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