projects
/
dcpomatic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
b30d848
)
Zero 'lost' frames when audio buffer frame counts are dropped.
author
Carl Hetherington
<cth@carlh.net>
Thu, 25 Jul 2013 12:23:07 +0000
(13:23 +0100)
committer
Carl Hetherington
<cth@carlh.net>
Thu, 25 Jul 2013 12:23:07 +0000
(13:23 +0100)
src/lib/audio_buffers.cc
patch
|
blob
|
history
diff --git
a/src/lib/audio_buffers.cc
b/src/lib/audio_buffers.cc
index 090c0108134d3d17a49af6332f551092f1b43b0f..a15288a3b86c64b66f5567a3f93e7321e6e48279 100644
(file)
--- 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
}
/** 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);
* @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;
}
_frames = f;
}