diff --git a/libs/ardour/audio_unit.cc b/libs/ardour/audio_unit.cc index 34095f5489..2c70852c33 100644 --- a/libs/ardour/audio_unit.cc +++ b/libs/ardour/audio_unit.cc @@ -1489,10 +1489,10 @@ AUPlugin::connect_and_run (BufferSet& bufs, MidiBuffer& m = bufs.get_midi (i); for (MidiBuffer::iterator i = m.begin(); i != m.end(); ++i) { Evoral::Event ev (*i); - if (ev.is_channel_event()) { + if (ev.is_channel_event () && ev.time() >= offset && ev.time() < offset + nframes) { const uint8_t* b = ev.buffer(); DEBUG_TRACE (DEBUG::AudioUnitProcess, string_compose ("%1: MIDI event %2\n", name(), ev)); - unit->MIDIEvent (b[0], b[1], b[2], ev.time()); + unit->MIDIEvent (b[0], b[1], b[2], ev.time() - offset); } /* XXX need to handle sysex and other message types */ }