AudioSampleBuffer additional function


#1

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]


#2

any possibility to have this merged ?


#3

Ok, seems useful. (I don’t think I noticed this when you posted it)


#4

no problem man, i know you’re a bit busy… thanx again


#5