Browse Source

Added a AudioSampleBuffer gain ramp function.

tags/2021-05-28
jules 13 years ago
parent
commit
d35e1fd814
2 changed files with 23 additions and 0 deletions
  1. +9
    -0
      modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.cpp
  2. +14
    -0
      modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h

+ 9
- 0
modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.cpp 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,


+ 14
- 0
modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h 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


Loading…
Cancel
Save