Revert "fix LXVST support for plugins that make audioMaster callbacks from
authorPaul Davis <paul@linuxaudiosystems.com>
Mon, 29 Apr 2013 00:31:25 +0000 (20:31 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 29 Apr 2013 00:31:25 +0000 (20:31 -0400)
within effOpen (e.g. glitch)"

This patch broke just about all other LVXST plugins. Glitch is doing something
wrong, or there is more magic about VST that we have yet to understand.

This reverts commit 56bc98f78bd3b1e5ba5c6ce902b2805d40a6cc53.

libs/ardour/ardour/vst_plugin.h
libs/ardour/linux_vst_support.cc
libs/ardour/lxvst_plugin.cc

index d9cfd87badece440e2517563e45692f6f4bc3c5c..7ca973cbb70d896fc729cff010ea877f2af9f8ee 100644 (file)
@@ -73,7 +73,6 @@ public:
        
        AEffect * plugin () const { return _plugin; }
        VSTState * state () const { return _state; }
-        void set_state (VSTState* s) { _state = s; }
 
        int set_state (XMLNode const &, int);
 
index 9106d69009450bc5870a2aa5fa8c43322e00d12e..99251f08e476234f7969f5d6c7489ad5dc558f2d 100644 (file)
@@ -34,8 +34,6 @@
 #include <glibmm/fileutils.h>
 
 #include "ardour/linux_vst_support.h"
-#include "ardour/vst_plugin.h"
-
 #include "pbd/basename.h"
 #include "pbd/error.h"
 
@@ -295,43 +293,36 @@ vstfx_unload (VSTHandle* fhandle)
        return 0;
 }
 
-/**
-   Instantiates a VST plugin and also set _state of its plugin argument 
- */
+/*This instantiates a plugin*/
 
-VSTState*
-vstfx_instantiate (VSTHandle* fhandle, audioMasterCallback amc, void *ptr)
+VSTState *
+vstfx_instantiate (VSTHandle* fhandle, audioMasterCallback amc, void* userptr)
 {
        VSTState* vstfx = vstfx_new ();
-       ARDOUR::VSTPlugin* plugin = reinterpret_cast<ARDOUR::VSTPlugin*> (ptr);
 
-       if (fhandle == 0) {
+       if(fhandle == 0)
+       {
            vstfx_error( "** ERROR ** VSTFX : The handle was 0\n" );
            return 0;
        }
 
-       if ((vstfx->plugin = fhandle->main_entry (amc)) == 0) {
+       if ((vstfx->plugin = fhandle->main_entry (amc)) == 0) 
+       {
                vstfx_error ("** ERROR ** VSTFX : %s could not be instantiated :(\n", fhandle->name);
                free (vstfx);
                return 0;
        }
        
        vstfx->handle = fhandle;
-       vstfx->plugin->user = plugin;
+       vstfx->plugin->user = userptr;
                
-       if (vstfx->plugin->magic != kEffectMagic) {
+       if (vstfx->plugin->magic != kEffectMagic)
+       {
                vstfx_error ("** ERROR ** VSTFX : %s is not a VST plugin\n", fhandle->name);
                free (vstfx);
                return 0;
        }
-
-       /* need to set this here because some plugins make audioMaster
-        * callbacks from within effOpen, and _state must be set for
-        * that to work.
-        */
        
-       plugin->set_state (vstfx);
-
        vstfx->plugin->dispatcher (vstfx->plugin, effOpen, 0, 0, 0, 0);
        
        /*May or May not need to 'switch the plugin on' here - unlikely
index 80e6b9c286dc4eb0851463e3d9145e2826c3240f..6e30e0c4436d8457ee0a939b089e762ebf0976a2 100755 (executable)
@@ -32,7 +32,7 @@ LXVSTPlugin::LXVSTPlugin (AudioEngine& e, Session& session, VSTHandle* h)
 {
        /* Instantiate the plugin and return a VSTState* */
 
-       if (vstfx_instantiate (_handle, Session::vst_callback, this) == 0) {
+       if ((_state = vstfx_instantiate (_handle, Session::vst_callback, this)) == 0) {
                throw failed_constructor();
        }
 
@@ -44,7 +44,7 @@ LXVSTPlugin::LXVSTPlugin (const LXVSTPlugin &other)
 {
        _handle = other._handle;
 
-       if (vstfx_instantiate (_handle, Session::vst_callback, this) == 0) {
+       if ((_state = vstfx_instantiate (_handle, Session::vst_callback, this)) == 0) {
                throw failed_constructor();
        }
        _plugin = _state->plugin;