From 50cb31af16240b248700dab1484d7f07656c66df Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 20 Jun 2013 17:34:23 +0100 Subject: Various fixes to make audio analysis sort-of work. --- src/lib/audio_buffers.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/lib/audio_buffers.cc') 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; -- cgit v1.2.3