diff options
author | Robin Gareus <robin@gareus.org> | 2017-03-12 01:24:40 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2017-03-12 01:24:40 +0100 |
commit | 3e923470576d2867062d2b62291064cccc4dfe0f (patch) | |
tree | 1d15e86c385320ebb65cacbf8800e34e3b9bffec /libs/ardour | |
parent | 6386ebafcdadb2d45a7cf331c5bdeb2d0e37df87 (diff) |
Prepare for graceful case-by-case fallback of VST Bypass
VST's effSetBypass may fail even though a plugin CanDo "bypass",
and it can be case-by-case (depending on plugin-settings).
This codepath is not yet active, pending testing.
Diffstat (limited to 'libs/ardour')
-rw-r--r-- | libs/ardour/plugin_insert.cc | 22 | ||||
-rw-r--r-- | libs/ardour/vst_plugin.cc | 7 |
2 files changed, 28 insertions, 1 deletions
diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc index 8e3e138201..25b0e7e46a 100644 --- a/libs/ardour/plugin_insert.cc +++ b/libs/ardour/plugin_insert.cc @@ -633,7 +633,27 @@ PluginInsert::enable (bool yn) activate (); } boost::shared_ptr<AutomationControl> ac = automation_control (Evoral::Parameter (PluginAutomation, 0, _bypass_port)); - ac->set_value (yn ? 1.0 : 0.0, Controllable::NoGroup); + const double val = yn ? 1.0 : 0.0; + ac->set_value (val, Controllable::NoGroup); + +#ifdef ALLOW_VST_BYPASS_TO_FAIL // yet unused, see also vst_plugin.cc + /* special case VST.. bypass may fail */ + if (_bypass_port == UINT32_MAX - 1) { + /* check if bypass worked */ + if (ac->get_value () != val) { + warning << _("PluginInsert: VST Bypass failed, falling back to host bypass.") << endmsg; + // set plugin to enabled (not-byassed) + ac->set_value (1.0, Controllable::NoGroup); + // ..and use host-provided hard-bypass + if (yn) { + activate (); + } else { + deactivate (); + } + return; + } + } +#endif ActiveChanged (); } } diff --git a/libs/ardour/vst_plugin.cc b/libs/ardour/vst_plugin.cc index fe601d9505..95a661c40c 100644 --- a/libs/ardour/vst_plugin.cc +++ b/libs/ardour/vst_plugin.cc @@ -98,6 +98,9 @@ uint32_t VSTPlugin::designated_bypass_port () { if (_plugin->dispatcher (_plugin, effCanDo, 0, 0, const_cast<char*> ("bypass"), 0.0f) != 0) { +#ifdef ALLOW_VST_BYPASS_TO_FAIL // yet unused, see also plugin_insert.cc + return UINT32_MAX - 1; // emulate a port +#else /* check if plugin actually supports it, * e.g. u-he Presswerk CanDo "bypass" but calling effSetBypass is a NO-OP. * (presumably the plugin-author thinks hard-bypassing is a bad idea, @@ -110,6 +113,7 @@ VSTPlugin::designated_bypass_port () } else { cerr << "Do *not* Emulate VST Bypass Port for " << name() << endl; // XXX DEBUG } +#endif } return UINT32_MAX; } @@ -163,6 +167,9 @@ VSTPlugin::set_parameter (uint32_t which, float newval) _eff_bypassed = (value == 1); } else { cerr << "effSetBypass failed rv=" << rv << endl; // XXX DEBUG +#ifdef ALLOW_VST_BYPASS_TO_FAIL // yet unused, see also vst_plugin.cc + // emit signal.. hard un/bypass from here?! +#endif } return; } |