diff options
author | David Robillard <d@drobilla.net> | 2007-06-09 02:07:59 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-06-09 02:07:59 +0000 |
commit | 7ff7f4013dfbbf18d08e397230ad2486fa7ff58f (patch) | |
tree | 4740e59efb0749e522c0ae55464e2a5140ebeaa7 /gtk2_ardour/midi_region_view.cc | |
parent | 0605f98fdce1ad456e3da6f6ae391ad394b3edfb (diff) |
Use double MIDI timestamps (towards tempo based time, and more-than-sample-accurate LV2 MIDI plugin application).
Eliminate double iteration over MIDIRingBuffer read to translate timestamps.
git-svn-id: svn://localhost/ardour2/trunk@1981 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/midi_region_view.cc')
-rw-r--r-- | gtk2_ardour/midi_region_view.cc | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index 918505b123..1750ece8a4 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -150,12 +150,11 @@ MidiRegionView::end_write() void MidiRegionView::add_event (const MidiEvent& ev) { - printf("Event, time = %u, size = %zu, data = ", - ev.time, ev.size); - for (size_t i=0; i < ev.size; ++i) { - printf("%X ", ev.buffer[i]); - } - printf("\n\n"); + printf("Event, time = %f, size = %zu, data = ", ev.time, ev.size); + for (size_t i=0; i < ev.size; ++i) { + printf("%X ", ev.buffer[i]); + } + printf("\n\n"); double y1 = trackview.height / 2.0; if ((ev.buffer[0] & 0xF0) == MIDI_CMD_NOTE_ON) { @@ -165,7 +164,7 @@ MidiRegionView::add_event (const MidiEvent& ev) ArdourCanvas::SimpleRect * ev_rect = new Gnome::Canvas::SimpleRect( *(ArdourCanvas::Group*)get_canvas_group()); ev_rect->property_x1() = trackview.editor.frame_to_pixel ( - ev.time); + (nframes_t)ev.time); ev_rect->property_y1() = y1; ev_rect->property_x2() = trackview.editor.frame_to_pixel ( _region->length()); @@ -182,7 +181,7 @@ MidiRegionView::add_event (const MidiEvent& ev) } else if ((ev.buffer[0] & 0xF0) == MIDI_CMD_NOTE_OFF) { const Byte& note = ev.buffer[1]; if (_active_notes && _active_notes[note]) { - _active_notes[note]->property_x2() = trackview.editor.frame_to_pixel(ev.time); + _active_notes[note]->property_x2() = trackview.editor.frame_to_pixel((nframes_t)ev.time); _active_notes[note]->property_outline_what() = (guint32) 0xF; // all edges _active_notes[note] = NULL; } |