From 867963906f35b676e100e5310c729ab342db1851 Mon Sep 17 00:00:00 2001 From: John Glover Date: Fri, 14 Jun 2013 10:25:54 +0200 Subject: Allow Frame audio to be specified as less than frame size (with the remainder automatically set to 0). --- src/simpl/base.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/simpl/base.cpp b/src/simpl/base.cpp index 83155c5..2cbb285 100644 --- a/src/simpl/base.cpp +++ b/src/simpl/base.cpp @@ -356,6 +356,12 @@ void Frame::audio(sample* new_audio, int size) { std::rotate(_audio, _audio + size, _audio + _size); std::copy(new_audio, new_audio + size, _audio + (_size - size)); } + else if(size < _size) { + std::copy(new_audio, new_audio + size, _audio); + for(int i = size; i < _size; i++) { + _audio[i] = 0.0; + } + } else if(size == _size) { std::copy(new_audio, new_audio + size, _audio); } -- cgit v1.2.3