: Processor (s, (plug ? plug->name() : string ("toBeRenamed")))
, _sc_playback_latency (0)
, _sc_capture_latency (0)
+ , _plugin_signal_latency (0)
, _signal_analysis_collected_nframes(0)
, _signal_analysis_collect_nframes_max(0)
, _configured (false)
, _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:
}
Processor::activate ();
+ if (_plugin_signal_latency != signal_latency ()) {
+ _plugin_signal_latency = signal_latency ();
+ latency_changed ();
+ }
}
void
for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) {
(*i)->deactivate ();
}
+ if (_plugin_signal_latency != signal_latency ()) {
+ _plugin_signal_latency = signal_latency ();
+ latency_changed ();
+ }
}
void
}
}
+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
{
&_signal_analysis_outputs);
}
}
+
+ if (_plugin_signal_latency != signal_latency ()) {
+ _plugin_signal_latency = signal_latency ();
+ latency_changed ();
+ }
}
void
ARDOUR::framecnt_t
PluginInsert::signal_latency() const
{
+ if (!_pending_active) {
+ return 0;
+ }
if (_user_latency) {
return _user_latency;
}
plugin->ParameterChangedExternally.connect_same_thread (*this, boost::bind (&PluginInsert::parameter_changed_externally, this, _1, _2));
plugin->StartTouch.connect_same_thread (*this, boost::bind (&PluginInsert::start_touch, this, _1));
plugin->EndTouch.connect_same_thread (*this, boost::bind (&PluginInsert::end_touch, this, _1));
- plugin->LatencyChanged.connect_same_thread (*this, boost::bind (&PluginInsert::latency_changed, this, _1, _2));
_custom_sinks = plugin->get_info()->n_inputs;
// cache sidechain port count
_cached_sidechain_pins.reset ();
vst->set_insert (this, _plugins.size ());
}
#endif
+
_plugins.push_back (plugin);
}
}
void
-PluginInsert::latency_changed (framecnt_t, framecnt_t)
+PluginInsert::latency_changed ()
{
// this is called in RT context, LatencyChanged is emitted after run()
_latency_changed = true;
+#if 1 // TODO check possible deadlock in RT-context (esp. with jack) latency-callback.
+ // XXX This also needs a proper API not an owner() hack.
+ static_cast<Route*>(owner ())->processors_changed (RouteProcessorChange ()); /* EMIT SIGNAL */
+#endif
}
void