Could we add a duration to getNextValue in samples? (it could be defaulted so that it uses a single sample by default)
That would make LinearSmoothedValue more useful in block-processing contexts such as AudioBuffer::applyGainRamp. This would allow you to do the following:
buf.applyGainRamp(chan, 0, blockSize, vol.getNextValue(), vol.getNextValue(blockSize-1));
That’s a use-case where it seems like you’re over-complicating things - surely a simpler way would just be to write a loop that actually uses the LinearSmoothedValue to get each multiplier? Same performance, and less edge-cases to deal with.
Hi Jules, thanks for replying. No question that a loop is a simple way to write it, but was looking to use block processes for reasons of conciseness. Now that I think on this a little further, there is a problem with what I’m suggesting, as it would always tie the final endpoint to the last sample in the buffer regardless of whether it hits earlier in the buffer. I still might investigate this for some control-signal type applications, though am suspecting this may be more trouble than its worth with non power of two buffer sizes.