mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-11 00:56:33 +01:00
set latency of sidechain port
This commit is contained in:
parent
321615e8ea
commit
a9c09af816
3 changed files with 30 additions and 0 deletions
|
|
@ -153,6 +153,7 @@ class LIBARDOUR_API PluginInsert : public Processor
|
||||||
bool set_preset_out (const ChanCount&);
|
bool set_preset_out (const ChanCount&);
|
||||||
bool add_sidechain (uint32_t n_audio = 1);
|
bool add_sidechain (uint32_t n_audio = 1);
|
||||||
bool del_sidechain ();
|
bool del_sidechain ();
|
||||||
|
void set_sidechain_latency (uint32_t, uint32_t);
|
||||||
boost::shared_ptr<SideChain> sidechain () const { return _sidechain; }
|
boost::shared_ptr<SideChain> sidechain () const { return _sidechain; }
|
||||||
// end C++ class slavery!
|
// end C++ class slavery!
|
||||||
|
|
||||||
|
|
@ -302,6 +303,8 @@ class LIBARDOUR_API PluginInsert : public Processor
|
||||||
Plugins _plugins;
|
Plugins _plugins;
|
||||||
|
|
||||||
boost::shared_ptr<SideChain> _sidechain;
|
boost::shared_ptr<SideChain> _sidechain;
|
||||||
|
uint32_t _sc_playback_latency;
|
||||||
|
uint32_t _sc_capture_latency;
|
||||||
|
|
||||||
boost::weak_ptr<Plugin> _impulseAnalysisPlugin;
|
boost::weak_ptr<Plugin> _impulseAnalysisPlugin;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,8 @@ const string PluginInsert::port_automation_node_name = "PortAutomation";
|
||||||
|
|
||||||
PluginInsert::PluginInsert (Session& s, boost::shared_ptr<Plugin> plug)
|
PluginInsert::PluginInsert (Session& s, boost::shared_ptr<Plugin> plug)
|
||||||
: Processor (s, (plug ? plug->name() : string ("toBeRenamed")))
|
: Processor (s, (plug ? plug->name() : string ("toBeRenamed")))
|
||||||
|
, _sc_playback_latency (0)
|
||||||
|
, _sc_capture_latency (0)
|
||||||
, _signal_analysis_collected_nframes(0)
|
, _signal_analysis_collected_nframes(0)
|
||||||
, _signal_analysis_collect_nframes_max(0)
|
, _signal_analysis_collect_nframes_max(0)
|
||||||
, _configured (false)
|
, _configured (false)
|
||||||
|
|
@ -215,10 +217,30 @@ PluginInsert::del_sidechain ()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_sidechain.reset ();
|
_sidechain.reset ();
|
||||||
|
_sc_playback_latency = 0;
|
||||||
|
_sc_capture_latency = 0;
|
||||||
PluginConfigChanged (); /* EMIT SIGNAL */
|
PluginConfigChanged (); /* EMIT SIGNAL */
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PluginInsert::set_sidechain_latency (uint32_t capture, uint32_t playback)
|
||||||
|
{
|
||||||
|
if (_sidechain &&
|
||||||
|
(_sc_playback_latency != playback || _sc_capture_latency != capture)) {
|
||||||
|
_sc_capture_latency = capture;
|
||||||
|
_sc_playback_latency = playback;
|
||||||
|
LatencyRange pl; pl.min = pl.max = playback;
|
||||||
|
LatencyRange cl; cl.min = cl.max = capture;
|
||||||
|
DEBUG_TRACE (DEBUG::Latency, string_compose ("%1: capture %2 playback; %3\n", _sidechain->name (), capture, playback));
|
||||||
|
PortSet& ps (_sidechain->input ()->ports ());
|
||||||
|
for (PortSet::iterator p = ps.begin(); p != ps.end(); ++p) {
|
||||||
|
p->set_private_latency_range (pl, true);
|
||||||
|
p->set_private_latency_range (cl, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PluginInsert::control_list_automation_state_changed (Evoral::Parameter which, AutoState s)
|
PluginInsert::control_list_automation_state_changed (Evoral::Parameter which, AutoState s)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -444,6 +444,11 @@ Route::process_output_buffers (BufferSet& bufs,
|
||||||
if (boost::dynamic_pointer_cast<Send>(*i) != 0) {
|
if (boost::dynamic_pointer_cast<Send>(*i) != 0) {
|
||||||
boost::dynamic_pointer_cast<Send>(*i)->set_delay_in(_signal_latency - latency);
|
boost::dynamic_pointer_cast<Send>(*i)->set_delay_in(_signal_latency - latency);
|
||||||
}
|
}
|
||||||
|
if (boost::dynamic_pointer_cast<PluginInsert>(*i) != 0) {
|
||||||
|
const framecnt_t longest_session_latency = _initial_delay + _signal_latency;
|
||||||
|
boost::dynamic_pointer_cast<PluginInsert>(*i)->set_sidechain_latency (
|
||||||
|
_initial_delay + latency, longest_session_latency - latency);
|
||||||
|
}
|
||||||
|
|
||||||
(*i)->run (bufs, start_frame - latency, end_frame - latency, nframes, *i != _processors.back());
|
(*i)->run (bufs, start_frame - latency, end_frame - latency, nframes, *i != _processors.back());
|
||||||
bufs.set_count ((*i)->output_streams());
|
bufs.set_count ((*i)->output_streams());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue