From bb62f7eaecebe078533eea2b53ec65ad509f74b2 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 7 Nov 2019 04:21:21 +0100 Subject: Plugin: bypass <> enabled mapping LV2 uses "enabled": -1: inactive, 0: bypassed, 1:enabled VST3 has "bypass: 0:active, 1: bypassed --- libs/ardour/ardour/plugin_insert.h | 1 + libs/ardour/plugin_insert.cc | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'libs') diff --git a/libs/ardour/ardour/plugin_insert.h b/libs/ardour/ardour/plugin_insert.h index 3beaef9a15..5c7f9b724e 100644 --- a/libs/ardour/ardour/plugin_insert.h +++ b/libs/ardour/ardour/plugin_insert.h @@ -426,6 +426,7 @@ private: void latency_changed (); bool _latency_changed; uint32_t _bypass_port; + bool _inverted_bypass_enable; typedef std::map >CtrlOutMap; CtrlOutMap _control_outputs; diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc index 430fc181aa..556a5f6cee 100644 --- a/libs/ardour/plugin_insert.cc +++ b/libs/ardour/plugin_insert.cc @@ -88,6 +88,7 @@ PluginInsert::PluginInsert (Session& s, boost::shared_ptr plug) , _maps_from_state (false) , _latency_changed (false) , _bypass_port (UINT32_MAX) + , _inverted_bypass_enable (false) , _stat_reset (0) { /* the first is the master */ @@ -716,7 +717,7 @@ PluginInsert::enable (bool yn) activate (); } boost::shared_ptr ac = automation_control (Evoral::Parameter (PluginAutomation, 0, _bypass_port)); - const double val = yn ? 1.0 : 0.0; + const double val = yn ^ _inverted_bypass_enable ? 1.0 : 0.0; ac->set_value (val, Controllable::NoGroup); #ifdef ALLOW_VST_BYPASS_TO_FAIL // yet unused, see also vst_plugin.cc @@ -748,7 +749,7 @@ PluginInsert::enabled () const return Processor::enabled (); } else { boost::shared_ptr ac = boost::const_pointer_cast (automation_control (Evoral::Parameter (PluginAutomation, 0, _bypass_port))); - return (ac->get_value () > 0 && _pending_active); + return ((ac->get_value () > 0) ^ _inverted_bypass_enable) && _pending_active; } } -- cgit v1.2.3