diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-06-20 17:34:23 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-06-20 21:20:38 +0100 |
| commit | 50cb31af16240b248700dab1484d7f07656c66df (patch) | |
| tree | 393568f3c24506ac6b004346b9ef5101f9fdcf61 /src/lib/audio_buffers.cc | |
| parent | edfd92e5554e3389e6456f497f44ca6e866800bf (diff) | |
Various fixes to make audio analysis sort-of work.
Diffstat (limited to 'src/lib/audio_buffers.cc')
| -rw-r--r-- | src/lib/audio_buffers.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lib/audio_buffers.cc b/src/lib/audio_buffers.cc index c3e89f130..403babaf7 100644 --- a/src/lib/audio_buffers.cc +++ b/src/lib/audio_buffers.cc @@ -206,6 +206,9 @@ AudioBuffers::accumulate_channel (AudioBuffers const * from, int from_channel, i } } +/** Ensure we have space for at least a certain number of frames. If we extend + * the buffers, fill the new space with silence. + */ void AudioBuffers::ensure_size (int frames) { @@ -218,6 +221,9 @@ AudioBuffers::ensure_size (int frames) if (!_data[i]) { throw bad_alloc (); } + for (int j = _allocated_frames; j < frames; ++j) { + _data[i][j] = 0; + } } _allocated_frames = frames; |
