using namespace ARDOUR;
DelayLine::DelayLine (Session& s, const std::string& name)
- : Processor (s, string_compose ("latency-compensation-%1-%2", name, this))
+ : Processor (s, string_compose ("latcomp-%1-%2", name, this))
, _delay(0)
, _pending_delay(0)
, _bsiz(0)
{
}
+bool
+DelayLine::set_name (const string& name)
+{
+ return Processor::set_name (string_compose ("latcomp-%1-%2", name, this));
+}
+
#define FADE_LEN (16)
void
DelayLine::run (BufferSet& bufs, samplepos_t /* start_sample */, samplepos_t /* end_sample */, double /* speed */, pframes_t nsamples, bool)
_delay = pending_delay;
}
-void
+bool
DelayLine::set_delay(samplecnt_t signal_delay)
{
if (signal_delay < 0) {
cerr << "WARNING: latency compensation is not possible.\n";
}
+ if (signal_delay == _pending_delay) {
+ DEBUG_TRACE (DEBUG::LatencyCompensation,
+ string_compose ("%1 set_delay - no change: %2 samples for %3 channels\n",
+ name(), signal_delay, _configured_output.n_audio()));
+ return false;
+ }
+
DEBUG_TRACE (DEBUG::LatencyCompensation,
string_compose ("%1 set_delay to %2 samples for %3 channels\n",
name(), signal_delay, _configured_output.n_audio()));
if (signal_delay <= _bsiz) {
_pending_delay = signal_delay;
- return;
+ return true;
}
if (_pending_bsiz) {
} else {
_pending_delay = signal_delay;
}
- return;
+ return true;
}
allocate_pending_buffers (signal_delay);
DEBUG_TRACE (DEBUG::LatencyCompensation,
string_compose ("allocated buffer for %1 of size %2\n",
name(), signal_delay));
+
+ return true;
}
bool
}
XMLNode&
-DelayLine::state (bool full_state)
+DelayLine::state ()
{
- XMLNode& node (Processor::state (full_state));
+ XMLNode& node (Processor::state ());
node.set_property("type", "delay");
return node;
}