diff options
author | Robin Gareus <robin@gareus.org> | 2019-10-02 01:54:08 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2019-10-02 01:54:08 +0200 |
commit | e99fe6213787751ad9a647355d1f3fc69862d5a6 (patch) | |
tree | d394a928c2ce41b12055eb6dc85a477ab6f88122 /libs/ardour/delayline.cc | |
parent | ec2628f2ca1249d89b4049045a6ff05d39bf474b (diff) |
Optimize default case: no delay
Diffstat (limited to 'libs/ardour/delayline.cc')
-rw-r--r-- | libs/ardour/delayline.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/libs/ardour/delayline.cc b/libs/ardour/delayline.cc index cf7b3d4364..2ec56c3ae2 100644 --- a/libs/ardour/delayline.cc +++ b/libs/ardour/delayline.cc @@ -69,6 +69,11 @@ DelayLine::run (BufferSet& bufs, samplepos_t /* start_sample */, samplepos_t /* const sampleoffset_t pending_delay = _pending_delay; sampleoffset_t delay_diff = _delay - pending_delay; const bool pending_flush = _pending_flush; + + if (delay_diff == 0 && _delay == 0) { + return; + } + _pending_flush = false; // TODO handle pending_flush. @@ -322,6 +327,18 @@ void DelayLine::allocate_pending_buffers (samplecnt_t signal_delay, ChanCount const& cc) { assert (signal_delay >= 0); +#if 1 + /* If no buffers are required, don't allocate any. + * This may backfire later, allocating buffers on demand + * may take time and cause x-runs. + * + * The default buffersize is 4 * 16kB and - once allocated - + * usually sufficies for the lifetime of the delayline instance. + */ + if (signal_delay == _pending_delay && signal_delay == 0) { + return; + } +#endif samplecnt_t rbs = signal_delay + MAX_BUFFER_SIZE + 1; rbs = std::max (_bsiz, rbs); |