Could this function be added to the class ?
It just is a special version of addFrom + applyGainRamp, in one pass…
[code]void AudioSampleBuffer::addFrom (const int destChannel,
const int destStartSample,
const float* source,
int numSamples,
float startGain,
float endGain) throw()
{
jassert (destChannel >= 0 && destChannel < numChannels);
jassert (destStartSample >= 0 && destStartSample + numSamples <= size);
jassert (source != 0);
if (startGain == endGain)
{
addFrom (destChannel,
destStartSample,
source,
numSamples,
startGain);
}
else
{
if (startGain != 0.0f && endGain != 0.0f && numSamples > 0)
{
float* d = channels [destChannel] + destStartSample;
const float increment = (endGain - startGain) / numSamples;
while (--numSamples >= 0)
{
*d++ += startGain * *source++;
startGain += increment;
}
}
}
}[/code]