Applying an envelope/gain ramp with AudioTransportSource?


I’m using the AudioTransportSource class to play and loop audio files - is there any way of applying some kind of gain ramp, envelope, or attack & decay with this class? I’ve noticed that the SamplerSound and AudioSampleBuffer classes implement this functionality but I can’t see any obvious way of doing it with AudioTransportSource.


Audio effects like the ones you mentioned don’t really belong in AudioTransportSource. It was nice of Jules to even include the gain ramps in the AudioSampleBuffer - in a super strict design environment they would have been in separate functions or classes:

[size=150]Single Responsibility Principle[/size]

If you want to apply a ramp, then call getNextAudioBlock() on the source to fill your buffer, then call applyGainRamp() on the buffer.