From 505c50ebe14cf7ec350ff516d27db71e120942d0 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Tue, 17 Feb 2015 12:07:32 -0800 Subject: [PATCH] correct gain variance in linearFade() --- libraries/audio/src/AudioEditBuffer.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libraries/audio/src/AudioEditBuffer.h b/libraries/audio/src/AudioEditBuffer.h index b773fedfb8..66639f20bb 100644 --- a/libraries/audio/src/AudioEditBuffer.h +++ b/libraries/audio/src/AudioEditBuffer.h @@ -23,8 +23,8 @@ public: bool getZeroCrossing(uint32_t start, bool direction, float32_t epsilon, uint32_t& zero); - void linearFade(uint32_t start, uint32_t stop, bool slope); - void exponentialFade(uint32_t start, uint32_t stop, bool slope); + void linearFade(uint32_t start, uint32_t stop, bool increasing); + void exponentialFade(uint32_t start, uint32_t stop, bool increasing); }; template< typename T > @@ -74,7 +74,7 @@ inline bool AudioEditBuffer::getZeroCrossing(uint32_t start, bool direction, } template< typename T > -inline void AudioEditBuffer::linearFade(uint32_t start, uint32_t stop, bool slope) { +inline void AudioEditBuffer::linearFade(uint32_t start, uint32_t stop, bool increasing) { if (start >= stop || start > this->_frameCount || stop > this->_frameCount ) { return; @@ -84,7 +84,7 @@ inline void AudioEditBuffer::linearFade(uint32_t start, uint32_t stop, bool s float32_t delta; float32_t gain; - if (slope) { // 0.0 to 1.0f in delta increments + if (increasing) { // 0.0 to 1.0f in delta increments delta = 1.0f / (float32_t)count; gain = 0.0f; } else { // 1.0f to 0.0f in delta increments @@ -95,13 +95,13 @@ inline void AudioEditBuffer::linearFade(uint32_t start, uint32_t stop, bool s for (uint32_t i = start; i < stop; ++i) { for (uint32_t j = 0; j < this->_channelCount; ++j) { this->_frameBuffer[j][i] *= gain; - gain += delta; } + gain += delta; } } template< typename T > -inline void AudioEditBuffer::exponentialFade(uint32_t start, uint32_t stop, bool slope) { +inline void AudioEditBuffer::exponentialFade(uint32_t start, uint32_t stop, bool increasing) { // TBD }