Copying data from AudioBuffer to AudioBlock


#1

Hi there,
I really like the clean interface and simplicity of the new AudioBlock so I decided to rewrite some of my code. I’m missing a function to copy values from an AudioBuffer to an AudioBlock that already manages memory. Actually it’s just a single line of code, I know, but still I think this could be useful for the AudioBlock class in general. Here is my approach:

void copyFromAudioBuffer(dsp::AudioBlock<float> dest, AudioBuffer<float>& src, const int destStart, const int srcStart, const int numSamples)
{
	dest.getSubBlock(destStart, numSamples).copy(dsp::AudioBlock<float>(src).getSubBlock(srcStart, numSamples));
}

What do you think? If there’s a better way to do it I’d be happy to know as well? :wink:


#2

OK. I’ve added this to the develop branch with commit 5faef29.