dsp::AudioBlock copyFrom/copyTo specific channel?

Hi all,

I think the AudioBlock lacks copyFrom and copyTo versions where you can specifiy the source and destination channel, similarly to the AudioBuffer class. If i want to do it right now i think i’d need to do some plumbing by creating temporary AudioBlocks pointing to what i want and call copyFrom/copyTo on those?

Would it be possible to add something like this in the future or am i missing something obvious ?


just use getSingleChannelBlock to access the single channel blocks, don’t worry about performance, because the methods are all visible to the compiler, it should be optimised very efficent.

BTW: I made a copyFrom-wrapper for some legacy code which uses now AudioBlocks instead of AudioBuffer

static void copyFrom (dsp::AudioBlock<FloatType> &dest,
					int destChannel,
                   int destStartSample,
                   const dsp::AudioBlock<const FloatType> source,
                   int sourceChannel,
                   int sourceStartSample,
                   int numSamples)
        dest.getSingleChannelBlock (destChannel).getSubBlock (destStartSample, numSamples).copyFrom (source.getSingleChannelBlock (sourceChannel).getSubBlock (sourceStartSample, numSamples));

ah yep, that does the trick, cheers.