From e1095310a8186bbd977534285df0ab29423d3aa3 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 6 Mar 2017 23:49:40 +0100 Subject: Rework VST initialization: Set the AEffect* plugin pointer before calling effOpen. effOpen may call back into the host (masterCallback) and invoke actions which depend on _plugin (eg. to call back into the plugin again) --- libs/ardour/vst_plugin.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'libs/ardour/vst_plugin.cc') diff --git a/libs/ardour/vst_plugin.cc b/libs/ardour/vst_plugin.cc index 8541e8eaf7..fe601d9505 100644 --- a/libs/ardour/vst_plugin.cc +++ b/libs/ardour/vst_plugin.cc @@ -76,13 +76,19 @@ VSTPlugin::~VSTPlugin () } void -VSTPlugin::set_plugin (AEffect* e) +VSTPlugin::open_plugin () { - _plugin = e; + _plugin = _state->plugin; + assert (_plugin->user == this); // should have been set by {mac_vst|fst|lxvst}_instantiate _plugin->user = this; + _state->plugin->dispatcher (_plugin, effOpen, 0, 0, 0, 0); + _state->vst_version = _plugin->dispatcher (_plugin, effGetVstVersion, 0, 0, 0, 0); +} +void +VSTPlugin::init_plugin () +{ /* set rate and blocksize */ - _plugin->dispatcher (_plugin, effSetSampleRate, 0, 0, NULL, (float) _session.frame_rate()); _plugin->dispatcher (_plugin, effSetBlockSize, 0, _session.get_block_size(), NULL, 0.0f); } -- cgit v1.2.3