diff options
Diffstat (limited to 'libs/ardour/vst_plugin.cc')
-rw-r--r-- | libs/ardour/vst_plugin.cc | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/libs/ardour/vst_plugin.cc b/libs/ardour/vst_plugin.cc index 333b7d893a..8f30ff98e9 100644 --- a/libs/ardour/vst_plugin.cc +++ b/libs/ardour/vst_plugin.cc @@ -63,6 +63,7 @@ using std::max; VSTPlugin::VSTPlugin (AudioEngine& e, Session& session, FSTHandle* h) : Plugin (e, session) + , _have_pending_stop_events (false) { handle = h; @@ -89,6 +90,7 @@ VSTPlugin::VSTPlugin (AudioEngine& e, Session& session, FSTHandle* h) VSTPlugin::VSTPlugin (const VSTPlugin &other) : Plugin (other) + , _have_pending_stop_events (false) { handle = other.handle; @@ -514,6 +516,18 @@ VSTPlugin::connect_and_run (BufferSet& bufs, if (bufs.count().n_midi() > 0) { + + /* Track notes that we are sending to the plugin */ + MidiBuffer& b = bufs.get_midi (0); + bool looped; + _tracker.track (b.begin(), b.end(), looped); + + if (_have_pending_stop_events) { + /* Transmit note-offs that are pending from the last transport stop */ + bufs.merge_from (_pending_stop_events, 0); + _have_pending_stop_events = false; + } + VstEvents* v = bufs.get_vst_midi (0); _plugin->dispatcher (_plugin, effProcessEvents, 0, 0, v, 0); } @@ -721,6 +735,19 @@ VSTPlugin::first_user_preset_index () const return _plugin->numPrograms; } +void +VSTPlugin::realtime_handle_transport_stopped () +{ + /* Create note-offs for any active notes and put them in _pending_stop_events, to be picked + up on the next call to connect_and_run (). + */ + + _pending_stop_events.ensure_buffers (DataType::MIDI, 1, 4096); + _pending_stop_events.get_midi(0).clear (); + _tracker.resolve_notes (_pending_stop_events.get_midi (0), 0); + _have_pending_stop_events = true; +} + VSTPluginInfo::VSTPluginInfo() { type = ARDOUR::VST; |