Don't use VST ->user points, prefer host-reserved ptr

Apparently "user" is for plugins (not hosts) to use.
This commit is contained in:
Robin Gareus 2017-07-08 18:13:42 +02:00
parent 9a0ab26fbf
commit fd8053da9e
8 changed files with 10 additions and 10 deletions

View file

@ -207,7 +207,7 @@ dispatch_x_events (XEvent* event, VSTState* vstfx)
if (width != vstfx->width || height != vstfx->height) { if (width != vstfx->width || height != vstfx->height) {
vstfx->width = width; vstfx->width = width;
vstfx->height = height; vstfx->height = height;
ARDOUR::VSTPlugin* plug = (ARDOUR::VSTPlugin *)(vstfx->plugin->user); ARDOUR::VSTPlugin* plug = (ARDOUR::VSTPlugin *)(vstfx->plugin->ptr1);
plug->VSTSizeWindow (); /* EMIT SIGNAL */ plug->VSTSizeWindow (); /* EMIT SIGNAL */
} }

View file

@ -297,7 +297,7 @@ vstfx_instantiate (VSTHandle* fhandle, audioMasterCallback amc, void* userptr)
} }
vstfx->handle = fhandle; vstfx->handle = fhandle;
vstfx->plugin->user = userptr; vstfx->plugin->ptr1 = userptr;
if (vstfx->plugin->magic != kEffectMagic) if (vstfx->plugin->magic != kEffectMagic)
{ {

View file

@ -119,7 +119,7 @@ LXVSTPluginInfo::get_presets (bool user_only) const
Session::vst_current_loading_id = atoi (unique_id); Session::vst_current_loading_id = atoi (unique_id);
AEffect* plugin = handle->main_entry (Session::vst_callback); AEffect* plugin = handle->main_entry (Session::vst_callback);
Session::vst_current_loading_id = 0; Session::vst_current_loading_id = 0;
plugin->user = NULL; plugin->ptr1 = NULL;
plugin->dispatcher (plugin, effOpen, 0, 0, 0, 0); // :( plugin->dispatcher (plugin, effOpen, 0, 0, 0, 0); // :(
int const vst_version = plugin->dispatcher (plugin, effGetVstVersion, 0, 0, NULL, 0); int const vst_version = plugin->dispatcher (plugin, effGetVstVersion, 0, 0, NULL, 0);

View file

@ -126,7 +126,7 @@ MacVSTPluginInfo::get_presets (bool user_only) const
Session::vst_current_loading_id = atoi (unique_id); Session::vst_current_loading_id = atoi (unique_id);
AEffect* plugin = handle->main_entry (Session::vst_callback); AEffect* plugin = handle->main_entry (Session::vst_callback);
Session::vst_current_loading_id = 0; Session::vst_current_loading_id = 0;
plugin->user = NULL; plugin->ptr1 = NULL;
plugin->dispatcher (plugin, effOpen, 0, 0, 0, 0); // :( plugin->dispatcher (plugin, effOpen, 0, 0, 0, 0); // :(
int const vst_version = plugin->dispatcher (plugin, effGetVstVersion, 0, 0, NULL, 0); int const vst_version = plugin->dispatcher (plugin, effGetVstVersion, 0, 0, NULL, 0);

View file

@ -194,7 +194,7 @@ mac_vst_instantiate (VSTHandle* fhandle, audioMasterCallback amc, void* userptr)
} }
mac_vst->handle = fhandle; mac_vst->handle = fhandle;
mac_vst->plugin->user = userptr; mac_vst->plugin->ptr1 = userptr;
if (mac_vst->plugin->magic != kEffectMagic) if (mac_vst->plugin->magic != kEffectMagic)
{ {

View file

@ -69,8 +69,8 @@ intptr_t Session::vst_callback (
VstTimeInfo* timeinfo; VstTimeInfo* timeinfo;
int32_t newflags = 0; int32_t newflags = 0;
if (effect && effect->user) { if (effect && effect->ptr1) {
plug = (VSTPlugin *) (effect->user); plug = (VSTPlugin *) (effect->ptr1);
session = &plug->session(); session = &plug->session();
timeinfo = plug->timeinfo (); timeinfo = plug->timeinfo ();
DEBUG_TRACE (PBD::DEBUG::VSTCallbacks, string_compose ("am callback 0x%1%2, opcode = %3%4, plugin = \"%5\"\n", DEBUG_TRACE (PBD::DEBUG::VSTCallbacks, string_compose ("am callback 0x%1%2, opcode = %3%4, plugin = \"%5\"\n",

View file

@ -79,8 +79,8 @@ void
VSTPlugin::open_plugin () VSTPlugin::open_plugin ()
{ {
_plugin = _state->plugin; _plugin = _state->plugin;
assert (_plugin->user == this); // should have been set by {mac_vst|fst|lxvst}_instantiate assert (_plugin->ptr1 == this); // should have been set by {mac_vst|fst|lxvst}_instantiate
_plugin->user = this; _plugin->ptr1 = this;
_state->plugin->dispatcher (_plugin, effOpen, 0, 0, 0, 0); _state->plugin->dispatcher (_plugin, effOpen, 0, 0, 0, 0);
_state->vst_version = _plugin->dispatcher (_plugin, effGetVstVersion, 0, 0, 0, 0); _state->vst_version = _plugin->dispatcher (_plugin, effGetVstVersion, 0, 0, 0, 0);
} }

View file

@ -569,7 +569,7 @@ fst_instantiate (VSTHandle* fhandle, audioMasterCallback amc, void* userptr)
} }
fst->handle = fhandle; fst->handle = fhandle;
fst->plugin->user = userptr; fst->plugin->ptr1 = userptr;
if (fst->plugin->magic != kEffectMagic) { if (fst->plugin->magic != kEffectMagic) {
fst_error ("fst_instantiate: %s is not a vst plugin\n", fhandle->name); fst_error ("fst_instantiate: %s is not a vst plugin\n", fhandle->name);