Create Freesound working directory a little more lazily so
[ardour.git] / libs / ardour / plugin.cc
index bf22de6c6c9d30af8721102215f563c526910030..bac014df38ddfb03ee57e223be295458b129089f 100644 (file)
@@ -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
@@ -133,9 +133,9 @@ ARDOUR::find_plugin(Session& session, string identifier, PluginType type)
                break;
 #endif
 
-#ifdef VST_SUPPORT
-       case ARDOUR::VST:
-               plugs = mgr.vst_plugin_info();
+#ifdef WINDOWS_VST_SUPPORT
+       case ARDOUR::Windows_VST:
+               plugs = mgr.windows_vst_plugin_info();
                break;
 #endif
 
@@ -163,7 +163,7 @@ ARDOUR::find_plugin(Session& session, string identifier, PluginType type)
                }
        }
 
-#ifdef VST_SUPPORT
+#ifdef WINDOWS_VST_SUPPORT
        /* hmm, we didn't find it. could be because in older versions of Ardour.
           we used to store the name of a VST plugin, not its unique ID. so try
           again.
@@ -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;
 }
+
+