summaryrefslogtreecommitdiff
path: root/libs/ardour/audio_buffer.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2013-12-28 13:43:44 +0100
committerRobin Gareus <robin@gareus.org>2013-12-28 13:43:44 +0100
commit37264c85a509aca4a4ea71e8e2c5d32c81956879 (patch)
treec8079dd59194ff1ccaca9126ed0ac2a2fb804de6 /libs/ardour/audio_buffer.cc
parent8f69af4af3f5da403fceffbcdf5e7d61ddfcaaca (diff)
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.
Diffstat (limited to 'libs/ardour/audio_buffer.cc')
-rw-r--r--libs/ardour/audio_buffer.cc18
1 files changed, 16 insertions, 2 deletions
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;
+}