From 37264c85a509aca4a4ea71e8e2c5d32c81956879 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 28 Dec 2013 13:43:44 +0100 Subject: centralize buffer silent-flag fixes possible x-talk 1 in, >= 2 out tracks: Previously, only the first route-buffer of the input buffers were marked as non-silent in Route::process_output_buffers(). Other buffers in the set (e.g. post-panner) would contain audio but not marked as non-silent. --- libs/ardour/audio_buffer.cc | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'libs/ardour/audio_buffer.cc') diff --git a/libs/ardour/audio_buffer.cc b/libs/ardour/audio_buffer.cc index a36ad81c2a..b4e2a55ac2 100644 --- a/libs/ardour/audio_buffer.cc +++ b/libs/ardour/audio_buffer.cc @@ -76,12 +76,26 @@ AudioBuffer::resize (size_t size) } bool -AudioBuffer::check_silence (pframes_t nframes, pframes_t& n) const +AudioBuffer::check_silence (pframes_t nframes, bool wholebuffer, pframes_t& n) const { - for (n = 0; n < _size && n < nframes; ++n) { + for (n = 0; (wholebuffer || n < _size) && n < nframes; ++n) { if (_data[n] != Sample (0)) { return false; } } return true; } + +void +AudioBuffer::silence (framecnt_t len, framecnt_t offset) { + pframes_t n = 0; + if (!_silent) { + assert(_capacity > 0); + assert(offset + len <= _capacity); + memset(_data + offset, 0, sizeof (Sample) * len); + if (len == _capacity) { + _silent = true; + } + } + _written = true; +} -- cgit v1.2.3