mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 15:25:35 +08:00
[AFV} Ref T730, fixed CPPCheck issues and Artistic style applied
This commit is contained in:
@@ -1,30 +1,30 @@
|
||||
/*
|
||||
* Simple Compressor (source)
|
||||
* Simple Compressor (source)
|
||||
*
|
||||
* File : SimpleComp.cpp
|
||||
* Library : SimpleSource
|
||||
* Version : 1.12
|
||||
* Implements : SimpleComp, SimpleCompRms
|
||||
* File : SimpleComp.cpp
|
||||
* Library : SimpleSource
|
||||
* Version : 1.12
|
||||
* Implements : SimpleComp, SimpleCompRms
|
||||
*
|
||||
* © 2006, ChunkWare Music Software, OPEN-SOURCE
|
||||
* © 2006, ChunkWare Music Software, OPEN-SOURCE
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
@@ -32,29 +32,30 @@
|
||||
|
||||
namespace chunkware_simple
|
||||
{
|
||||
//-------------------------------------------------------------
|
||||
// simple compressor
|
||||
//-------------------------------------------------------------
|
||||
SimpleComp::SimpleComp()
|
||||
: AttRelEnvelope( 10.0, 100.0 )
|
||||
, threshdB_( 0.0 )
|
||||
, ratio_( 1.0 )
|
||||
, envdB_( DC_OFFSET )
|
||||
{
|
||||
}
|
||||
//-------------------------------------------------------------
|
||||
// simple compressor
|
||||
//-------------------------------------------------------------
|
||||
SimpleComp::SimpleComp()
|
||||
: AttRelEnvelope(10.0, 100.0)
|
||||
, threshdB_(0.0)
|
||||
, ratio_(1.0)
|
||||
, envdB_(DC_OFFSET)
|
||||
, makeUpGain_(1.0)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------
|
||||
void SimpleComp::setThresh( double dB )
|
||||
{
|
||||
threshdB_ = dB;
|
||||
}
|
||||
//-------------------------------------------------------------
|
||||
void SimpleComp::setThresh(double dB)
|
||||
{
|
||||
threshdB_ = dB;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------
|
||||
void SimpleComp::setRatio( double ratio )
|
||||
{
|
||||
assert( ratio > 0.0 );
|
||||
ratio_ = ratio;
|
||||
}
|
||||
//-------------------------------------------------------------
|
||||
void SimpleComp::setRatio(double ratio)
|
||||
{
|
||||
assert(ratio > 0.0);
|
||||
ratio_ = ratio;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------
|
||||
void SimpleComp::setMakeUpGain(double gain)
|
||||
@@ -62,39 +63,39 @@ namespace chunkware_simple
|
||||
makeUpGain_ = gain;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------
|
||||
void SimpleComp::initRuntime( void )
|
||||
{
|
||||
envdB_ = DC_OFFSET;
|
||||
}
|
||||
//-------------------------------------------------------------
|
||||
void SimpleComp::initRuntime(void)
|
||||
{
|
||||
envdB_ = DC_OFFSET;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// simple compressor with RMS detection
|
||||
//-------------------------------------------------------------
|
||||
SimpleCompRms::SimpleCompRms()
|
||||
: ave_( 5.0 )
|
||||
, aveOfSqrs_( DC_OFFSET )
|
||||
{
|
||||
}
|
||||
//-------------------------------------------------------------
|
||||
// simple compressor with RMS detection
|
||||
//-------------------------------------------------------------
|
||||
SimpleCompRms::SimpleCompRms()
|
||||
: ave_(5.0)
|
||||
, aveOfSqrs_(DC_OFFSET)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------
|
||||
void SimpleCompRms::setSampleRate( double sampleRate )
|
||||
{
|
||||
SimpleComp::setSampleRate( sampleRate );
|
||||
ave_.setSampleRate( sampleRate );
|
||||
}
|
||||
//-------------------------------------------------------------
|
||||
void SimpleCompRms::setSampleRate(double sampleRate)
|
||||
{
|
||||
SimpleComp::setSampleRate(sampleRate);
|
||||
ave_.setSampleRate(sampleRate);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------
|
||||
void SimpleCompRms::setWindow( double ms )
|
||||
{
|
||||
ave_.setTc( ms );
|
||||
}
|
||||
//-------------------------------------------------------------
|
||||
void SimpleCompRms::setWindow(double ms)
|
||||
{
|
||||
ave_.setTc(ms);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------
|
||||
void SimpleCompRms::initRuntime( void )
|
||||
{
|
||||
SimpleComp::initRuntime();
|
||||
aveOfSqrs_ = DC_OFFSET;
|
||||
}
|
||||
//-------------------------------------------------------------
|
||||
void SimpleCompRms::initRuntime(void)
|
||||
{
|
||||
SimpleComp::initRuntime();
|
||||
aveOfSqrs_ = DC_OFFSET;
|
||||
}
|
||||
|
||||
} // end namespace chunkware_simple
|
||||
} // end namespace chunkware_simple
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace chunkware_simple
|
||||
// runtime variables
|
||||
double envdB_; // over-threshold envelope (dB)
|
||||
|
||||
double makeUpGain_;
|
||||
double makeUpGain_ = 1.0;
|
||||
|
||||
}; // end SimpleComp class
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace chunkware_simple
|
||||
{
|
||||
public:
|
||||
SimpleCompRms();
|
||||
virtual ~SimpleCompRms() {}
|
||||
virtual ~SimpleCompRms() override {}
|
||||
|
||||
// sample rate
|
||||
virtual void setSampleRate(double sampleRate) override;
|
||||
|
||||
@@ -1,97 +1,99 @@
|
||||
/*
|
||||
* Simple Envelope Detectors (source)
|
||||
* Simple Envelope Detectors (source)
|
||||
*
|
||||
* File : SimpleEnvelope.cpp
|
||||
* Library : SimpleSource
|
||||
* Version : 1.12
|
||||
* Implements : EnvelopeDetector, AttRelEnvelope
|
||||
* File : SimpleEnvelope.cpp
|
||||
* Library : SimpleSource
|
||||
* Version : 1.12
|
||||
* Implements : EnvelopeDetector, AttRelEnvelope
|
||||
*
|
||||
* 2006, ChunkWare Music Software, OPEN-SOURCE
|
||||
* 2006, ChunkWare Music Software, OPEN-SOURCE
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include "SimpleEnvelope.h"
|
||||
|
||||
namespace chunkware_simple
|
||||
{
|
||||
//-------------------------------------------------------------
|
||||
// envelope detector
|
||||
//-------------------------------------------------------------
|
||||
EnvelopeDetector::EnvelopeDetector( double ms, double sampleRate )
|
||||
{
|
||||
assert( sampleRate > 0.0 );
|
||||
assert( ms > 0.0 );
|
||||
sampleRate_ = sampleRate;
|
||||
ms_ = ms;
|
||||
setCoef();
|
||||
}
|
||||
//-------------------------------------------------------------
|
||||
// envelope detector
|
||||
//-------------------------------------------------------------
|
||||
EnvelopeDetector::EnvelopeDetector(double ms, double sampleRate)
|
||||
{
|
||||
assert(sampleRate > 0.0);
|
||||
assert(ms > 0.0);
|
||||
sampleRate_ = sampleRate;
|
||||
ms_ = ms;
|
||||
|
||||
//-------------------------------------------------------------
|
||||
void EnvelopeDetector::setTc( double ms )
|
||||
{
|
||||
assert( ms > 0.0 );
|
||||
ms_ = ms;
|
||||
setCoef();
|
||||
}
|
||||
// setCoef();
|
||||
// TODO: KB avoid virtual function call in ctor
|
||||
coef_ = exp(-1000.0 / (ms_ * sampleRate_));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------
|
||||
void EnvelopeDetector::setSampleRate( double sampleRate )
|
||||
{
|
||||
assert( sampleRate > 0.0 );
|
||||
sampleRate_ = sampleRate;
|
||||
setCoef();
|
||||
}
|
||||
//-------------------------------------------------------------
|
||||
void EnvelopeDetector::setTc(double ms)
|
||||
{
|
||||
assert(ms > 0.0);
|
||||
ms_ = ms;
|
||||
setCoef();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------
|
||||
void EnvelopeDetector::setCoef( void )
|
||||
{
|
||||
coef_ = exp( -1000.0 / ( ms_ * sampleRate_ ) );
|
||||
}
|
||||
//-------------------------------------------------------------
|
||||
void EnvelopeDetector::setSampleRate(double sampleRate)
|
||||
{
|
||||
assert(sampleRate > 0.0);
|
||||
sampleRate_ = sampleRate;
|
||||
setCoef();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// attack/release envelope
|
||||
//-------------------------------------------------------------
|
||||
AttRelEnvelope::AttRelEnvelope( double att_ms, double rel_ms, double sampleRate )
|
||||
: att_( att_ms, sampleRate )
|
||||
, rel_( rel_ms, sampleRate )
|
||||
{
|
||||
}
|
||||
//-------------------------------------------------------------
|
||||
void EnvelopeDetector::setCoef(void)
|
||||
{
|
||||
coef_ = exp(-1000.0 / (ms_ * sampleRate_));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------
|
||||
void AttRelEnvelope::setAttack( double ms )
|
||||
{
|
||||
att_.setTc( ms );
|
||||
}
|
||||
//-------------------------------------------------------------
|
||||
// attack/release envelope
|
||||
//-------------------------------------------------------------
|
||||
AttRelEnvelope::AttRelEnvelope(double att_ms, double rel_ms, double sampleRate)
|
||||
: att_(att_ms, sampleRate)
|
||||
, rel_(rel_ms, sampleRate)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------
|
||||
void AttRelEnvelope::setRelease( double ms )
|
||||
{
|
||||
rel_.setTc( ms );
|
||||
}
|
||||
//-------------------------------------------------------------
|
||||
void AttRelEnvelope::setAttack(double ms)
|
||||
{
|
||||
att_.setTc(ms);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------
|
||||
void AttRelEnvelope::setSampleRate( double sampleRate )
|
||||
{
|
||||
att_.setSampleRate( sampleRate );
|
||||
rel_.setSampleRate( sampleRate );
|
||||
}
|
||||
//-------------------------------------------------------------
|
||||
void AttRelEnvelope::setRelease(double ms)
|
||||
{
|
||||
rel_.setTc(ms);
|
||||
}
|
||||
|
||||
} // end namespace chunkware_simple
|
||||
//-------------------------------------------------------------
|
||||
void AttRelEnvelope::setSampleRate(double sampleRate)
|
||||
{
|
||||
att_.setSampleRate(sampleRate);
|
||||
rel_.setSampleRate(sampleRate);
|
||||
}
|
||||
|
||||
} // end namespace chunkware_simple
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
/*
|
||||
* Simple Limiter (source)
|
||||
* Simple Limiter (source)
|
||||
*
|
||||
* File : SimpleLimit.cpp
|
||||
* Library : SimpleSource
|
||||
* Version : 1.12
|
||||
* Implements : SimpleLimit
|
||||
* File : SimpleLimit.cpp
|
||||
* Library : SimpleSource
|
||||
* Version : 1.12
|
||||
* Implements : SimpleLimit
|
||||
*
|
||||
* 2006, ChunkWare Music Software, OPEN-SOURCE
|
||||
* 2006, ChunkWare Music Software, OPEN-SOURCE
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
@@ -32,71 +32,71 @@
|
||||
|
||||
namespace chunkware_simple
|
||||
{
|
||||
//-------------------------------------------------------------
|
||||
SimpleLimit::SimpleLimit()
|
||||
: threshdB_( 0.0 )
|
||||
, thresh_( 1.0 )
|
||||
, peakHold_( 0 )
|
||||
, peakTimer_( 0 )
|
||||
, maxPeak_( 1.0 )
|
||||
, att_( 1.0 )
|
||||
, rel_( 10.0 )
|
||||
, env_( 1.0 )
|
||||
, mask_( BUFFER_SIZE - 1 )
|
||||
, cur_( 0 )
|
||||
{
|
||||
setAttack( 1.0 );
|
||||
outBuffer_[ 0 ].resize( BUFFER_SIZE, 0.0 );
|
||||
outBuffer_[ 1 ].resize( BUFFER_SIZE, 0.0 );
|
||||
}
|
||||
//-------------------------------------------------------------
|
||||
SimpleLimit::SimpleLimit()
|
||||
: threshdB_(0.0)
|
||||
, thresh_(1.0)
|
||||
, peakHold_(0)
|
||||
, peakTimer_(0)
|
||||
, maxPeak_(1.0)
|
||||
, att_(1.0)
|
||||
, rel_(10.0)
|
||||
, env_(1.0)
|
||||
, mask_(BUFFER_SIZE - 1)
|
||||
, cur_(0)
|
||||
{
|
||||
setAttack(1.0);
|
||||
outBuffer_[ 0 ].resize(BUFFER_SIZE, 0.0);
|
||||
outBuffer_[ 1 ].resize(BUFFER_SIZE, 0.0);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------
|
||||
void SimpleLimit::setThresh( double dB )
|
||||
{
|
||||
threshdB_ = dB;
|
||||
thresh_ = dB2lin( dB );
|
||||
}
|
||||
//-------------------------------------------------------------
|
||||
void SimpleLimit::setThresh(double dB)
|
||||
{
|
||||
threshdB_ = dB;
|
||||
thresh_ = dB2lin(dB);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------
|
||||
void SimpleLimit::setAttack( double ms )
|
||||
{
|
||||
unsigned int samp = int( 0.001 * ms * att_.getSampleRate() );
|
||||
//-------------------------------------------------------------
|
||||
void SimpleLimit::setAttack(double ms)
|
||||
{
|
||||
unsigned int samp = static_cast<unsigned>(0.001 * ms * att_.getSampleRate());
|
||||
|
||||
assert( samp < BUFFER_SIZE );
|
||||
assert(samp < BUFFER_SIZE);
|
||||
|
||||
peakHold_ = samp;
|
||||
att_.setTc( ms );
|
||||
}
|
||||
peakHold_ = samp;
|
||||
att_.setTc(ms);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------
|
||||
void SimpleLimit::setRelease( double ms )
|
||||
{
|
||||
rel_.setTc( ms );
|
||||
}
|
||||
//-------------------------------------------------------------
|
||||
void SimpleLimit::setRelease(double ms)
|
||||
{
|
||||
rel_.setTc(ms);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------
|
||||
void SimpleLimit::setSampleRate( double sampleRate )
|
||||
{
|
||||
att_.setSampleRate( sampleRate );
|
||||
rel_.setSampleRate( sampleRate );
|
||||
}
|
||||
//-------------------------------------------------------------
|
||||
void SimpleLimit::setSampleRate(double sampleRate)
|
||||
{
|
||||
att_.setSampleRate(sampleRate);
|
||||
rel_.setSampleRate(sampleRate);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------
|
||||
void SimpleLimit::initRuntime( void )
|
||||
{
|
||||
peakTimer_ = 0;
|
||||
maxPeak_ = thresh_;
|
||||
env_ = thresh_;
|
||||
cur_ = 0;
|
||||
outBuffer_[ 0 ].assign( BUFFER_SIZE, 0.0 );
|
||||
outBuffer_[ 1 ].assign( BUFFER_SIZE, 0.0 );
|
||||
}
|
||||
//-------------------------------------------------------------
|
||||
void SimpleLimit::initRuntime(void)
|
||||
{
|
||||
peakTimer_ = 0;
|
||||
maxPeak_ = thresh_;
|
||||
env_ = thresh_;
|
||||
cur_ = 0;
|
||||
outBuffer_[ 0 ].assign(BUFFER_SIZE, 0.0);
|
||||
outBuffer_[ 1 ].assign(BUFFER_SIZE, 0.0);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------
|
||||
void SimpleLimit::FastEnvelope::setCoef( void )
|
||||
{
|
||||
// rises to 99% of in value over duration of time constant
|
||||
coef_ = pow( 0.01, (1000.0 / (ms_ * sampleRate_) ) );
|
||||
}
|
||||
//-------------------------------------------------------------
|
||||
void SimpleLimit::FastEnvelope::setCoef(void)
|
||||
{
|
||||
// rises to 99% of in value over duration of time constant
|
||||
coef_ = pow(0.01, (1000.0 / (ms_ * sampleRate_)));
|
||||
}
|
||||
|
||||
} // end namespace chunkware_simple
|
||||
} // end namespace chunkware_simple
|
||||
|
||||
Reference in New Issue
Block a user