}
}
+void
+AudioBuffers::make_silent (int from, int frames)
+{
+ assert ((from + frames) <= _allocated_frames);
+
+ for (int c = 0; c < _channels; ++c) {
+ for (int i = from; i < (from + frames); ++i) {
+ _data[c][i] = 0;
+ }
+ }
+}
+
/** Copy data from another AudioBuffers to this one. All channels are copied.
* @param from AudioBuffers to copy from; must have the same number of channels as this.
* @param frames_to_copy Number of frames to copy.
}
}
+/** 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)
{
if (!_data[i]) {
throw bad_alloc ();
}
+ for (int j = _allocated_frames; j < frames; ++j) {
+ _data[i][j] = 0;
+ }
}
_allocated_frames = frames;