rework name/canonical-name stuff for MIDI port info
[ardour.git] / libs / ardour / session_vst.cc
index 1b25659cc9a787c4e120e4fc67538a217fc1bf05..bdad186598ed15e5474ff20961c5bff42f361cee 100644 (file)
@@ -28,7 +28,7 @@
 #include "ardour/tempo.h"
 #include "ardour/plugin_insert.h"
 #include "ardour/windows_vst_plugin.h"
-#include "ardour/vestige/aeffectx.h"
+#include "ardour/vestige/vestige.h"
 #include "ardour/vst_types.h"
 #ifdef WINDOWS_VST_SUPPORT
 #include <fst.h>
@@ -50,7 +50,8 @@ const char* Session::vst_can_do_strings[] = {
        X_("receiveVstMidiEvent"),
        X_("supportShell"),
        X_("shellCategory"),
-       X_("shellCategorycurID")
+       X_("shellCategorycurID"),
+       X_("sizeWindow")
 };
 const int Session::vst_can_do_string_count = sizeof (vst_can_do_strings) / sizeof (char*);
 
@@ -68,6 +69,7 @@ intptr_t Session::vst_callback (
        static VstTimeInfo _timeinfo; // only uses as fallback
        VstTimeInfo* timeinfo;
        int32_t newflags = 0;
+       bool used_for_impulse_analysis = false;
 
        if (effect && effect->ptr1) {
                plug = (VSTPlugin *) (effect->ptr1);
@@ -76,6 +78,9 @@ intptr_t Session::vst_callback (
                DEBUG_TRACE (PBD::DEBUG::VSTCallbacks, string_compose ("am callback 0x%1%2, opcode = %3%4, plugin = \"%5\"\n",
                                        std::hex, (void*) DEBUG_THREAD_SELF,
                                        std::dec, opcode, plug->name()));
+               if (plug->_for_impulse_analysis) {
+                       plug = 0;
+               }
        } else {
                plug = 0;
                session = 0;
@@ -298,6 +303,7 @@ intptr_t Session::vst_callback (
        case audioMasterSetTime:
                SHOW_CALLBACK ("audioMasterSetTime");
                // VstTimenfo* in <ptr>, filter in <value>, not supported
+               return 0;
 
        case audioMasterTempoAt:
                SHOW_CALLBACK ("audioMasterTempoAt");
@@ -346,7 +352,7 @@ intptr_t Session::vst_callback (
                                plug->VSTSizeWindow (); /* EMIT SIGNAL */
                        }
                }
-               return 0;
+               return 1;
 
        case audioMasterGetSampleRate:
                SHOW_CALLBACK ("audioMasterGetSampleRate");
@@ -378,6 +384,7 @@ intptr_t Session::vst_callback (
        case audioMasterGetNextPlug:
                SHOW_CALLBACK ("audioMasterGetNextPlug");
                // output pin in <value> (-1: first to come), returns cEffect*
+               return 0;
 
        case audioMasterWillReplaceOrAccumulate:
                SHOW_CALLBACK ("audioMasterWillReplaceOrAccumulate");
@@ -436,7 +443,7 @@ intptr_t Session::vst_callback (
                SHOW_CALLBACK ("audioMasterGetVendorString");
                // fills <ptr> with a string identifying the vendor (max 64 char)
                strcpy ((char*) ptr, "Linux Audio Systems");
-               return 0;
+               return 1;
 
        case audioMasterGetProductString:
                SHOW_CALLBACK ("audioMasterGetProductString");
@@ -492,19 +499,32 @@ intptr_t Session::vst_callback (
        case audioMasterUpdateDisplay:
                SHOW_CALLBACK ("audioMasterUpdateDisplay");
                // something has changed, update 'multi-fx' display
-               if (effect) {
-                       effect->dispatcher(effect, effEditIdle, 0, 0, NULL, 0.0f);
+               /* TODO: consider emitting  ParameterChangedExternally() for each ctrl input */
+               if (session) {
+                       session->set_dirty ();
                }
                return 0;
 
        case audioMasterBeginEdit:
                SHOW_CALLBACK ("audioMasterBeginEdit");
                // begin of automation session (when mouse down), parameter index in <index>
+               if (plug && plug->plugin_insert ()) {
+                       boost::shared_ptr<AutomationControl> ac = plug->plugin_insert ()->automation_control (Evoral::Parameter (PluginAutomation, 0, index));
+                       if (ac) {
+                               ac->start_touch (ac->session().transport_sample());
+                       }
+               }
                return 0;
 
        case audioMasterEndEdit:
                SHOW_CALLBACK ("audioMasterEndEdit");
                // end of automation session (when mouse up),     parameter index in <index>
+               if (plug && plug->plugin_insert ()) {
+                       boost::shared_ptr<AutomationControl> ac = plug->plugin_insert ()->automation_control (Evoral::Parameter (PluginAutomation, 0, index));
+                       if (ac) {
+                               ac->stop_touch (ac->session().transport_sample());
+                       }
+               }
                return 0;
 
        case audioMasterOpenFileSelector: