+ DEBUG_TRACE (DEBUG::MidiSourceIO,
+ string_compose ("%1: reached end with event @ %2 vs. %3\n",
+ _name, time_samples, start+cnt));
+ break;
+
+ } else {
+
+ /* in range */
+
+ if (loop_range) {
+ time_samples = loop_range->squish (time_samples);
+ }
+
+ const uint8_t status = i->buffer()[0];
+ const bool is_channel_event = (0x80 <= (status & 0xF0)) && (status <= 0xE0);
+ if (filter && is_channel_event) {
+ /* Copy event so the filter can modify the channel. I'm not
+ sure if this is necessary here (channels are mapped later in
+ buffers anyway), but it preserves existing behaviour without
+ destroying events in the model during read. */
+ Evoral::Event<Temporal::Beats> ev(*i, true);
+ if (!filter->filter(ev.buffer(), ev.size())) {
+ dst.write(time_samples, ev.event_type(), ev.size(), ev.buffer());
+ } else {
+ DEBUG_TRACE (DEBUG::MidiSourceIO,
+ string_compose ("%1: filter event @ %2 type %3 size %4\n",
+ _name, time_samples, i->event_type(), i->size()));