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

Made LinearSmoothedValue::skip() return the new current value

This commit is contained in:
jules 2018-07-19 16:31:16 +01:00
parent d8dfabf422
commit 2c3339ca1b

View file

@ -164,16 +164,16 @@ public:
{
if (buffer.getNumChannels() == 1)
{
FloatType* samples = buffer.getWritePointer(0);
auto samples = buffer.getWritePointer(0);
for (int i = 0; i < numSamples; i++)
for (int i = 0; i < numSamples; ++i)
samples[i] *= getNextValue();
}
else
{
for (int i = 0; i < numSamples; i++)
for (int i = 0; i < numSamples; ++i)
{
const FloatType gain = getNextValue();
auto gain = getNextValue();
for (int channel = 0; channel < buffer.getNumChannels(); channel++)
buffer.setSample (channel, i, buffer.getSample (channel, i) * gain);
@ -188,22 +188,22 @@ public:
//==============================================================================
/** Skip the next numSamples samples.
This is identical to calling getNextValue numSamples times.
This is identical to calling getNextValue numSamples times. It returns
the new current value.
@see getNextValue
*/
void skip (int numSamples) noexcept
FloatType skip (int numSamples) noexcept
{
if (numSamples >= countdown)
{
currentValue = target;
countdown = 0;
return target;
}
else
{
currentValue += (step * static_cast<FloatType> (numSamples));
countdown -= numSamples;
}
currentValue += (step * static_cast<FloatType> (numSamples));
countdown -= numSamples;
return currentValue;
}
private: