void deactivate ();
void flush ();
+ void enable (bool yn);
+ bool enabled () const;
+ bool bypassable () const;
+
bool reset_parameters_to_default ();
bool can_reset_all_parameters ();
void set_parameter_state_2X (const XMLNode& node, int version);
void set_control_ids (const XMLNode&, int version);
+ void enable_changed ();
+ void bypassable_changed ();
+
boost::shared_ptr<Plugin> plugin_factory (boost::shared_ptr<Plugin>);
void add_plugin (boost::shared_ptr<Plugin>);
void latency_changed (framecnt_t, framecnt_t);
bool _latency_changed;
+ uint32_t _bypass_port;
};
} // namespace ARDOUR
virtual bool display_to_user() const { return _display_to_user; }
virtual void set_display_to_user (bool);
- bool active () const { return _pending_active; }
+ bool active () const { return _pending_active; } ///< ardour hard bypass
+ virtual bool enabled () const { return _pending_active; } ///< processor enabled/bypass
+ virtual bool bypassable () const { return true; } ///< enable is not automated or locked
virtual bool does_routing() const { return false; }
virtual void deactivate () { _pending_active = false; ActiveChanged(); }
virtual void flush() {}
+ virtual void enable (bool yn) { if (yn) { activate (); } else { deactivate (); } }
+
virtual bool configure_io (ChanCount in, ChanCount out);
/* Derived classes should override these, or processor appears as an in-place pass-through */
virtual void set_pre_fader (bool);
PBD::Signal0<void> ActiveChanged;
+ PBD::Signal0<void> BypassableChanged;
PBD::Signal2<void,ChanCount,ChanCount> ConfigurationChanged;
void set_ui (void*);
, _strict_io (false)
, _custom_cfg (false)
, _maps_from_state (false)
+ , _bypass_port (UINT32_MAX)
{
/* the first is the master */
plugin->set_automation_control (i, c);
}
+
const Plugin::PropertyDescriptors& pdl (plugin->get_supported_properties ());
for (Plugin::PropertyDescriptors::const_iterator p = pdl.begin(); p != pdl.end(); ++p) {
Evoral::Parameter param (PluginPropertyAutomation, 0, p->first);
add_control (boost::shared_ptr<AutomationControl> (new PluginPropertyControl(this, param, desc, list)));
}
}
+
+ _bypass_port = plugin->designated_bypass_port ();
+
+ if (_bypass_port != UINT32_MAX) {
+ boost::shared_ptr<AutomationControl> ac = automation_control (Evoral::Parameter (PluginAutomation, 0, _bypass_port));
+ if (0 == (ac->flags () & Controllable::NotAutomatable)) {
+ ac->alist()->automation_state_changed.connect_same_thread (*this, boost::bind (&PluginInsert::bypassable_changed, this));
+ ac->Changed.connect_same_thread (*this, boost::bind (&PluginInsert::enable_changed, this));
+ }
+ }
}
/** Called when something outside of this host has modified a plugin
* parameter. Responsible for propagating the change to two places:
}
}
+void
+PluginInsert::enable (bool yn)
+{
+ if (_bypass_port == UINT32_MAX) {
+ if (yn) {
+ activate ();
+ } else {
+ deactivate ();
+ }
+ } else {
+ if (!_pending_active) {
+ activate ();
+ }
+ boost::shared_ptr<AutomationControl> ac = automation_control (Evoral::Parameter (PluginAutomation, 0, _bypass_port));
+ ac->set_value (yn ? 1.0 : 0.0, Controllable::NoGroup);
+ ActiveChanged ();
+ }
+}
+
+bool
+PluginInsert::enabled () const
+{
+ if (_bypass_port == UINT32_MAX) {
+ return Processor::enabled ();
+ } else {
+ boost::shared_ptr<const AutomationControl> ac = boost::const_pointer_cast<AutomationControl> (automation_control (Evoral::Parameter (PluginAutomation, 0, _bypass_port)));
+ return (ac->get_value () > 0 && _pending_active);
+ }
+}
+
+bool
+PluginInsert::bypassable () const
+{
+ if (_bypass_port == UINT32_MAX) {
+ return true;
+ } else {
+ boost::shared_ptr<const AutomationControl> ac = boost::const_pointer_cast<AutomationControl> (automation_control (Evoral::Parameter (PluginAutomation, 0, _bypass_port)));
+
+ return !ac->automation_playback ();
+ }
+}
+
+void
+PluginInsert::enable_changed ()
+{
+ ActiveChanged ();
+}
+
+void
+PluginInsert::bypassable_changed ()
+{
+ BypassableChanged ();
+}
+
void
PluginInsert::inplace_silence_unconnected (BufferSet& bufs, const PinMappings& out_map, framecnt_t nframes, framecnt_t offset) const
{
vst->set_insert (this, _plugins.size ());
}
#endif
+
_plugins.push_back (plugin);
}