diff options
author | Robin Gareus <robin@gareus.org> | 2017-03-06 23:49:40 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2017-03-07 00:13:56 +0100 |
commit | e1095310a8186bbd977534285df0ab29423d3aa3 (patch) | |
tree | eae28a2a01773762ae77bf7b12c1270df7d468cb /libs/ardour/vst_plugin.cc | |
parent | 589c13c0eb9f6003a7e8cf923110459c897ea4b0 (diff) |
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)
Diffstat (limited to 'libs/ardour/vst_plugin.cc')
-rw-r--r-- | libs/ardour/vst_plugin.cc | 12 |
1 files changed, 9 insertions, 3 deletions
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); } |