summaryrefslogtreecommitdiff
path: root/src/lib/audio_buffers.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-07-25 13:23:07 +0100
committerCarl Hetherington <cth@carlh.net>2013-07-25 13:23:07 +0100
commitfd970b185e9357522f5d12d62800df8769764729 (patch)
treec1e2b32b6760aa17381e703f487bf3a2c5a692aa /src/lib/audio_buffers.cc
parentb30d848861341d7f7c5a2f8571b469eb7b555250 (diff)
Zero 'lost' frames when audio buffer frame counts are dropped.
Diffstat (limited to 'src/lib/audio_buffers.cc')
-rw-r--r--src/lib/audio_buffers.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/lib/audio_buffers.cc b/src/lib/audio_buffers.cc
index 090c01081..a15288a3b 100644
--- a/src/lib/audio_buffers.cc
+++ b/src/lib/audio_buffers.cc
@@ -110,13 +110,21 @@ AudioBuffers::data (int c) const
}
/** Set the number of frames that these AudioBuffers will report themselves
- * as having.
+ * as having. If we reduce the number of frames, the `lost' frames will
+ * be silenced.
* @param f Frames; must be less than or equal to the number of allocated frames.
*/
void
AudioBuffers::set_frames (int f)
{
assert (f <= _allocated_frames);
+
+ for (int c = 0; c < _channels; ++c) {
+ for (int i = f; i < _frames; ++i) {
+ _data[c][i] = 0;
+ }
+ }
+
_frames = f;
}