From 9242e615ce7ba43154d4a35633a8f7d6daaf6b94 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 30 Jun 2023 04:35:35 +0200 Subject: [PATCH] Plugin: track only events for current cycle --- libs/ardour/plugin.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libs/ardour/plugin.cc b/libs/ardour/plugin.cc index 7952aca376..3f5b92347b 100644 --- a/libs/ardour/plugin.cc +++ b/libs/ardour/plugin.cc @@ -410,7 +410,7 @@ int Plugin::connect_and_run (BufferSet& bufs, samplepos_t /*start*/, samplepos_t /*end*/, double /*speed*/, ChanMapping const& /*in_map*/, ChanMapping const& /*out_map*/, - pframes_t nframes, samplecnt_t /*offset*/) + pframes_t nframes, samplecnt_t offset) { if (bufs.count().n_midi() > 0) { @@ -421,7 +421,11 @@ Plugin::connect_and_run (BufferSet& bufs, /* Track notes that we are sending to the plugin */ const MidiBuffer& b = bufs.get_midi (0); - _tracker.track (b.begin(), b.end()); + for (auto const ev : b) { + if (ev.time () >= offset && ev.time () < nframes + offset) { + _tracker.track (ev); + } + } if (_have_pending_stop_events) { /* Transmit note-offs that are pending from the last transport stop */