From 5558b3cf06b98060438d1e68c8d5d2f4a9c2f8f6 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 26 Dec 2011 17:01:31 +0000 Subject: a grab bag of changes correcting and improving the way MIDI note on/off tracking is done. may/should fix a number of problem with spurious note-offs under a variety of circumstances git-svn-id: svn://localhost/ardour2/branches/3.0@11074 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/plugin.cc | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'libs/ardour/plugin.cc') diff --git a/libs/ardour/plugin.cc b/libs/ardour/plugin.cc index 8c8bf248e0..bac014df38 100644 --- a/libs/ardour/plugin.cc +++ b/libs/ardour/plugin.cc @@ -70,6 +70,7 @@ Plugin::Plugin (AudioEngine& e, Session& s) , _have_pending_stop_events (false) , _parameter_changed_since_last_preset (false) { + _pending_stop_events.ensure_buffers (DataType::MIDI, 1, 4096); } Plugin::Plugin (const Plugin& other) @@ -83,12 +84,11 @@ Plugin::Plugin (const Plugin& other) , _have_pending_stop_events (false) , _parameter_changed_since_last_preset (false) { - + _pending_stop_events.ensure_buffers (DataType::MIDI, 1, 4096); } Plugin::~Plugin () { - } void @@ -242,8 +242,10 @@ Plugin::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) { @@ -258,12 +260,29 @@ Plugin::connect_and_run (BufferSet& bufs, void Plugin::realtime_handle_transport_stopped () +{ + resolve_midi (); +} + +void +Plugin::realtime_locate () +{ + resolve_midi (); +} + +void +Plugin::monitoring_changed () +{ + resolve_midi (); +} + +void +Plugin::resolve_midi () { /* 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; @@ -345,3 +364,5 @@ Plugin::set_info (PluginInfoPtr info) { _info = info; } + + -- cgit v1.2.3