Use PBD string conversion functions in PBD::ConfigurationVariable
[ardour.git] / libs / ardour / linux_vst_support.cc
index 92c3243fb8c56d4bd896e2a0c5b1cea2f8bff8f4..44d61f7a77bfcbd8ab05176ce84691130d8e3e61 100644 (file)
@@ -83,7 +83,7 @@ static VSTState *
 vstfx_new ()
 {
        VSTState* vstfx = (VSTState *) calloc (1, sizeof (VSTState));
-       vstfx->init ();
+       vststate_init (vstfx);
        return vstfx;
 }
 
@@ -219,12 +219,10 @@ vstfx_load (const char *path)
 
        /*Find the main entry point into the plugin*/
 
-       fhandle->main_entry = (main_entry_t) dlsym(fhandle->dll, "main");
+       fhandle->main_entry = (main_entry_t) dlsym(fhandle->dll, "VSTPluginMain");
 
        if (fhandle->main_entry == 0) {
-               if ((fhandle->main_entry = (main_entry_t) dlsym(fhandle->dll, "VSTPluginMain")) != 0) {
-                       PBD::warning << path << _(": is a VST >= 2.4 - this plugin may or may not function correctly with this version of Ardour.") << endmsg;
-               }
+               fhandle->main_entry = (main_entry_t) dlsym(fhandle->dll, "main");
        }
 
        if (fhandle->main_entry == 0)
@@ -308,14 +306,16 @@ vstfx_instantiate (VSTHandle* fhandle, audioMasterCallback amc, void* userptr)
                return 0;
        }
 
-       vstfx->plugin->dispatcher (vstfx->plugin, effOpen, 0, 0, 0, 0);
-
-       /*May or May not need to 'switch the plugin on' here - unlikely
-       since FST doesn't and most plugins start up 'On' by default - I think this is the least of our worries*/
-
-       //vstfx->plugin->dispatcher (vstfx->plugin, effMainsChanged, 0, 1, 0, 0);
-
-       vstfx->vst_version = vstfx->plugin->dispatcher (vstfx->plugin, effGetVstVersion, 0, 0, 0, 0);
+       if (!userptr) {
+               /* scanning.. or w/o master-callback userptr == 0, open now.
+                *
+                * Session::vst_callback needs a pointer to the AEffect
+                *     ((VSTPlugin*)userptr)->_plugin = vstfx->plugin
+                * before calling effOpen, because effOpen may call back
+                */
+               vstfx->plugin->dispatcher (vstfx->plugin, effOpen, 0, 0, 0, 0);
+               vstfx->vst_version = vstfx->plugin->dispatcher (vstfx->plugin, effGetVstVersion, 0, 0, 0, 0);
+       }
 
        vstfx->handle->plugincnt++;
        vstfx->wantIdle = 0;