AudioBuffer::setDataToReferTo() overload with startSample


#1

Hi,

Can you please add an overload of AudioBuffer::setDataToReferTo() which takes a startSample argument? (or amend the existing method to get another startSample argument with a default of 0).

Given an AudioBuffer, this would allow to easily use another AudioBuffer to reference slices of the original, with no extra allocations.

Thanks!
Dan


#2

I’ve added this to the develop branch.

It’s also possible to achieve something similar with one of the AudioBuffer’s constructors.


#3

Thanks!

Regarding the constructor, that’s true but it’s less flexible since you
can’t use the same AudioBuffer to go over slices over another, changing the
slice each time. Also I suspected that constructor might allocate memory
from the heap (not sure).