mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-15 19:16:40 +01:00
move LatencyChanged detection from Plugin to Processor (plugin-insert)
* support all Plugin APIs (not implementation specific) * also check for latency changes when plugins are hard en/disabled
This commit is contained in:
parent
49c9569039
commit
56c4eebfdd
4 changed files with 24 additions and 23 deletions
|
|
@ -225,23 +225,6 @@ class LIBARDOUR_API Plugin : public PBD::StatefulDestructible, public Latent
|
|||
return 0;
|
||||
}
|
||||
|
||||
/** Emitted when a Latency Changes
|
||||
*
|
||||
* (this cannot be part of ARDOUR::Latent because
|
||||
* signals cannot be copy-constructed).
|
||||
*/
|
||||
PBD::Signal2<void,framecnt_t, framecnt_t> LatencyChanged;
|
||||
|
||||
/* overload Latent::set_user_latency w/signal emission */
|
||||
virtual void set_user_latency (framecnt_t val) {
|
||||
bool changed = val != _user_latency;
|
||||
framecnt_t old = effective_latency ();
|
||||
_user_latency = val;
|
||||
if (changed) {
|
||||
LatencyChanged (old, effective_latency ()); /* EMIT SIGNAL */
|
||||
}
|
||||
}
|
||||
|
||||
/** the max possible latency a plugin will have */
|
||||
virtual framecnt_t max_latency () const { return 0; } // TODO = 0, require implementation
|
||||
|
||||
|
|
|
|||
|
|
@ -310,6 +310,7 @@ class LIBARDOUR_API PluginInsert : public Processor
|
|||
boost::shared_ptr<SideChain> _sidechain;
|
||||
uint32_t _sc_playback_latency;
|
||||
uint32_t _sc_capture_latency;
|
||||
uint32_t _plugin_signal_latency;
|
||||
|
||||
boost::weak_ptr<Plugin> _impulseAnalysisPlugin;
|
||||
|
||||
|
|
@ -368,7 +369,7 @@ class LIBARDOUR_API PluginInsert : public Processor
|
|||
void start_touch (uint32_t param_id);
|
||||
void end_touch (uint32_t param_id);
|
||||
|
||||
void latency_changed (framecnt_t, framecnt_t);
|
||||
void latency_changed ();
|
||||
bool _latency_changed;
|
||||
uint32_t _bypass_port;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2707,9 +2707,6 @@ LV2Plugin::connect_and_run(BufferSet& bufs,
|
|||
|
||||
if (_latency_control_port) {
|
||||
framecnt_t new_latency = signal_latency ();
|
||||
if (_current_latency != new_latency) {
|
||||
LatencyChanged (_current_latency, new_latency); /* EMIT SIGNAL */
|
||||
}
|
||||
_current_latency = new_latency;
|
||||
}
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ PluginInsert::PluginInsert (Session& s, boost::shared_ptr<Plugin> plug)
|
|||
: 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)
|
||||
|
|
@ -551,6 +552,10 @@ PluginInsert::activate ()
|
|||
}
|
||||
|
||||
Processor::activate ();
|
||||
if (_plugin_signal_latency != signal_latency ()) {
|
||||
_plugin_signal_latency = signal_latency ();
|
||||
latency_changed ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -561,6 +566,10 @@ PluginInsert::deactivate ()
|
|||
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
|
||||
|
|
@ -914,6 +923,11 @@ PluginInsert::connect_and_run (BufferSet& bufs, framepos_t start, framepos_t end
|
|||
&_signal_analysis_outputs);
|
||||
}
|
||||
}
|
||||
|
||||
if (_plugin_signal_latency != signal_latency ()) {
|
||||
_plugin_signal_latency = signal_latency ();
|
||||
latency_changed ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -2699,6 +2713,9 @@ PluginInsert::describe_parameter (Evoral::Parameter param)
|
|||
ARDOUR::framecnt_t
|
||||
PluginInsert::signal_latency() const
|
||||
{
|
||||
if (!_pending_active) {
|
||||
return 0;
|
||||
}
|
||||
if (_user_latency) {
|
||||
return _user_latency;
|
||||
}
|
||||
|
|
@ -2878,7 +2895,6 @@ PluginInsert::add_plugin (boost::shared_ptr<Plugin> plugin)
|
|||
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 ();
|
||||
|
|
@ -2939,10 +2955,14 @@ PluginInsert::monitoring_changed ()
|
|||
}
|
||||
|
||||
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 0 // TODO check possible deadlock in RT-context
|
||||
// XXX This also needs a proper API not an owner() hack.
|
||||
static_cast<Route*>(owner ())->processors_changed (RouteProcessorChange ()); /* EMIT SIGNAL */
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue