- /*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");*/
-
- ArdourCanvas::Group* const group = (ArdourCanvas::Group*)get_canvas_group();
-
- if (midi_view()->note_mode() == Sustained) {
- if ((ev.buffer()[0] & 0xF0) == MIDI_CMD_NOTE_ON) {
- const Byte& note = ev.buffer()[1];
- const double y1 = midi_stream_view()->note_to_y(note);
-
- CanvasNote* ev_rect = new CanvasNote(*this, *group);
- ev_rect->property_x1() = trackview.editor.frame_to_pixel (
- (nframes_t)ev.time());
- ev_rect->property_y1() = y1;
- ev_rect->property_x2() = trackview.editor.frame_to_pixel (
- _region->length());
- ev_rect->property_y2() = y1 + floor(midi_stream_view()->note_height());
- ev_rect->property_fill_color_rgba() = note_fill_color(ev.velocity());
- ev_rect->property_outline_color_rgba() = note_outline_color(ev.velocity());
- /* outline all but right edge */
- ev_rect->property_outline_what() = (guint32) (0x1 & 0x4 & 0x8);
-
- ev_rect->raise_to_top();
-
- _events.push_back(ev_rect);
- if (_active_notes)
- _active_notes[note] = ev_rect;
-
- } 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((nframes_t)ev.time());
- _active_notes[note]->property_outline_what() = (guint32) 0xF; // all edges
- _active_notes[note] = NULL;
- }
- }
-
- } else if (midi_view()->note_mode() == Percussive) {
- const Byte& note = ev.buffer()[1];
- const double diamond_size = midi_stream_view()->note_height() / 2.0;
- const double x = trackview.editor.frame_to_pixel((nframes_t)ev.time());
- const double y = midi_stream_view()->note_to_y(note) + ((diamond_size-2) / 4.0);