1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Added a AudioSampleBuffer gain ramp function.

This commit is contained in:
jules 2013-01-04 17:54:50 +00:00
parent 80289de56f
commit d35e1fd814
2 changed files with 23 additions and 0 deletions

View file

@ -292,6 +292,15 @@ void AudioSampleBuffer::applyGain (const int startSample,
applyGain (i, startSample, numSamples, gain);
}
void AudioSampleBuffer::applyGainRamp (const int startSample,
const int numSamples,
const float startGain,
const float endGain) noexcept
{
for (int i = 0; i < numChannels; ++i)
applyGainRamp (i, startSample, numSamples, startGain, endGain);
}
void AudioSampleBuffer::addFrom (const int destChannel,
const int destStartSample,
const AudioSampleBuffer& source,

View file

@ -256,6 +256,20 @@ public:
float startGain,
float endGain) noexcept;
/** Applies a range of gains to a region of all channels.
The gain that is applied to each sample will vary from
startGain on the first sample to endGain on the last Sample,
so it can be used to do basic fades.
For speed, this doesn't check whether the sample numbers
are in-range, so be careful!
*/
void applyGainRamp (int startSample,
int numSamples,
float startGain,
float endGain) noexcept;
/** Adds samples from another buffer to this one.
@param destChannel the channel within this buffer to add the samples to