Send-delays - quick test

This commit is contained in:
Robin Gareus 2018-10-25 19:26:54 +02:00
parent b68b4d10a2
commit e46fe661c2
5 changed files with 37 additions and 2 deletions

View file

@ -48,6 +48,7 @@ public:
boost::shared_ptr<Amp> amp() const { return _amp; } boost::shared_ptr<Amp> amp() const { return _amp; }
boost::shared_ptr<PeakMeter> meter() const { return _meter; } boost::shared_ptr<PeakMeter> meter() const { return _meter; }
boost::shared_ptr<GainControl> gain_control() const { return _gain_control; } boost::shared_ptr<GainControl> gain_control() const { return _gain_control; }
boost::shared_ptr<AutomationControl> delay_control() const { return _delay_control; }
bool metering() const { return _metering; } bool metering() const { return _metering; }
void set_metering (bool yn) { _metering = yn; } void set_metering (bool yn) { _metering = yn; }
@ -72,6 +73,10 @@ public:
samplecnt_t get_delay_out () const { return _delay_out; } samplecnt_t get_delay_out () const { return _delay_out; }
samplecnt_t signal_latency () const; samplecnt_t signal_latency () const;
/* custom user-set delay */
samplecnt_t get_delay_extra () const { return _delay_extra; }
void set_delay_extra (samplecnt_t);
static PBD::Signal0<void> ChangedLatency; static PBD::Signal0<void> ChangedLatency;
void activate (); void activate ();
@ -87,6 +92,7 @@ protected:
bool _metering; bool _metering;
boost::shared_ptr<GainControl> _gain_control; boost::shared_ptr<GainControl> _gain_control;
boost::shared_ptr<AutomationControl> _delay_control;
boost::shared_ptr<Amp> _amp; boost::shared_ptr<Amp> _amp;
boost::shared_ptr<PeakMeter> _meter; boost::shared_ptr<PeakMeter> _meter;
boost::shared_ptr<DelayLine> _send_delay; boost::shared_ptr<DelayLine> _send_delay;
@ -107,6 +113,7 @@ private:
samplecnt_t _delay_in; samplecnt_t _delay_in;
samplecnt_t _delay_out; samplecnt_t _delay_out;
samplecnt_t _delay_extra;
bool _remove_on_disconnect; bool _remove_on_disconnect;
}; };

View file

@ -250,6 +250,8 @@ InternalSend::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sa
_amp->setup_gain_automation (start_sample, end_sample, nframes); _amp->setup_gain_automation (start_sample, end_sample, nframes);
_amp->run (mixbufs, start_sample, end_sample, speed, nframes, true); _amp->run (mixbufs, start_sample, end_sample, speed, nframes, true);
set_delay_extra (_delay_control->get_value ());
_send_delay->run (mixbufs, start_sample, end_sample, speed, nframes, true); _send_delay->run (mixbufs, start_sample, end_sample, speed, nframes, true);
/* consider metering */ /* consider metering */

View file

@ -1398,6 +1398,8 @@ LuaBindings::common (lua_State* L)
.deriveWSPtrClass <Send, Delivery> ("Send") .deriveWSPtrClass <Send, Delivery> ("Send")
.addFunction ("get_delay_in", &Send::get_delay_in) .addFunction ("get_delay_in", &Send::get_delay_in)
.addFunction ("get_delay_out", &Send::get_delay_out) .addFunction ("get_delay_out", &Send::get_delay_out)
.addFunction ("get_delay_extra", &Send::get_delay_extra)
.addFunction ("set_delay_extra", &Send::set_delay_extra)
.endClass () .endClass ()
.deriveWSPtrClass <InternalSend, Send> ("InternalSend") .deriveWSPtrClass <InternalSend, Send> ("InternalSend")

View file

@ -82,6 +82,7 @@ Send::Send (Session& s, boost::shared_ptr<Pannable> p, boost::shared_ptr<MuteMas
, _metering (false) , _metering (false)
, _delay_in (0) , _delay_in (0)
, _delay_out (0) , _delay_out (0)
, _delay_extra (0)
, _remove_on_disconnect (false) , _remove_on_disconnect (false)
{ {
if (_role == Listen) { if (_role == Listen) {
@ -97,6 +98,15 @@ Send::Send (Session& s, boost::shared_ptr<Pannable> p, boost::shared_ptr<MuteMas
_gain_control = boost::shared_ptr<GainControl> (new GainControl (_session, Evoral::Parameter(GainAutomation), gl)); _gain_control = boost::shared_ptr<GainControl> (new GainControl (_session, Evoral::Parameter(GainAutomation), gl));
add_control (_gain_control); add_control (_gain_control);
ParameterDescriptor dd;
dd.normal = 0;
dd.lower = 0;
dd.upper = _session.nominal_sample_rate () / 10; // max: 100ms
boost::shared_ptr<AutomationList> dl (new AutomationList (Evoral::Parameter (PluginAutomation)));
_delay_control = boost::shared_ptr<AutomationControl> (new AutomationControl (_session, Evoral::Parameter(PluginAutomation), dd, dl, "Delay"));
add_control (_delay_control);
_amp.reset (new Amp (_session, _("Fader"), _gain_control, true)); _amp.reset (new Amp (_session, _("Fader"), _gain_control, true));
_meter.reset (new PeakMeter (_session, name())); _meter.reset (new PeakMeter (_session, name()));
@ -168,10 +178,10 @@ Send::update_delaylines ()
bool changed; bool changed;
if (_delay_out > _delay_in) { if (_delay_out > _delay_in) {
changed = _thru_delay->set_delay(_delay_out - _delay_in); changed = _thru_delay->set_delay(_delay_out - _delay_in);
_send_delay->set_delay(0); _send_delay->set_delay(_delay_extra);
} else { } else {
changed = _thru_delay->set_delay(0); changed = _thru_delay->set_delay(0);
_send_delay->set_delay(_delay_in - _delay_out); _send_delay->set_delay(_delay_extra + _delay_in - _delay_out);
} }
if (changed) { if (changed) {
@ -211,6 +221,17 @@ Send::set_delay_out (samplecnt_t delay)
update_delaylines (); update_delaylines ();
} }
void
Send::set_delay_extra (samplecnt_t delay)
{
if (_delay_extra == delay) {
return;
}
_delay_extra = delay;
printf ("SET EXTRA DELAT %d\n", _delay_extra);
update_delaylines ();
}
void void
Send::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool) Send::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool)
{ {
@ -240,6 +261,8 @@ Send::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, do
_amp->setup_gain_automation (start_sample, end_sample, nframes); _amp->setup_gain_automation (start_sample, end_sample, nframes);
_amp->run (sendbufs, start_sample, end_sample, speed, nframes, true); _amp->run (sendbufs, start_sample, end_sample, speed, nframes, true);
set_delay_extra (_delay_control->get_value ());
_send_delay->run (sendbufs, start_sample, end_sample, speed, nframes, true); _send_delay->run (sendbufs, start_sample, end_sample, speed, nframes, true);
/* deliver to outputs */ /* deliver to outputs */

View file

@ -5639,6 +5639,7 @@ Session::graph_reordered ()
/* force all diskstreams to update their capture offset values to /* force all diskstreams to update their capture offset values to
* reflect any changes in latencies within the graph. * reflect any changes in latencies within the graph.
*/ */
Glib::Threads::Mutex::Lock lm (_engine.process_lock());
update_route_latency (false, true); update_route_latency (false, true);
} }