mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-07 02:35:33 +08:00
Doxygen
This commit is contained in:
committed by
Mat Sutcliffe
parent
2c89275ea6
commit
11ee2413b5
@@ -1,109 +1,114 @@
|
||||
/*
|
||||
* Simple Compressor (header)
|
||||
* Simple Compressor (header)
|
||||
*
|
||||
* File : SimpleComp.h
|
||||
* Library : SimpleSource
|
||||
* Version : 1.12
|
||||
* Class : SimpleComp, SimpleCompRms
|
||||
* File : SimpleComp.h
|
||||
* Library : SimpleSource
|
||||
* Version : 1.12
|
||||
* Class : 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.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __SIMPLE_COMP_H__
|
||||
#define __SIMPLE_COMP_H__
|
||||
|
||||
#include "SimpleHeader.h" // common header
|
||||
#include "SimpleEnvelope.h" // for base class
|
||||
#include "SimpleGain.h" // for gain functions
|
||||
#include "SimpleHeader.h" // common header
|
||||
#include "SimpleEnvelope.h" // for base class
|
||||
#include "SimpleGain.h" // for gain functions
|
||||
|
||||
namespace chunkware_simple
|
||||
{
|
||||
//-------------------------------------------------------------
|
||||
// simple compressor
|
||||
//-------------------------------------------------------------
|
||||
class SimpleComp : public AttRelEnvelope
|
||||
{
|
||||
public:
|
||||
SimpleComp();
|
||||
virtual ~SimpleComp() {}
|
||||
//! simple compressor
|
||||
class SimpleComp : public AttRelEnvelope
|
||||
{
|
||||
public:
|
||||
SimpleComp();
|
||||
virtual ~SimpleComp() {}
|
||||
|
||||
// parameters
|
||||
virtual void setThresh( double dB );
|
||||
virtual void setRatio( double dB );
|
||||
void setMakeUpGain( double gain );
|
||||
//! @{ set parameters
|
||||
virtual void setThresh(double dB);
|
||||
virtual void setRatio(double dB);
|
||||
void setMakeUpGain(double gain);
|
||||
//! @}
|
||||
|
||||
virtual double getThresh( void ) const { return threshdB_; }
|
||||
virtual double getRatio( void ) const { return ratio_; }
|
||||
double getMakeUpGain( void ) const { return makeUpGain_; }
|
||||
//! @{ get parameters
|
||||
virtual double getThresh(void) const { return threshdB_; }
|
||||
virtual double getRatio(void) const { return ratio_; }
|
||||
double getMakeUpGain(void) const { return makeUpGain_; }
|
||||
//! @}
|
||||
|
||||
//! init runtime
|
||||
//! call before runtime (in resume())
|
||||
virtual void initRuntime(void);
|
||||
|
||||
// runtime
|
||||
virtual void initRuntime( void ); // call before runtime (in resume())
|
||||
void process( double &in1, double &in2 ); // compressor runtime process
|
||||
void process( double &in1, double &in2, double keyLinked ); // with stereo-linked key in
|
||||
//! compressor runtime process
|
||||
void process(double &in1, double &in2);
|
||||
|
||||
private:
|
||||
//! process sample with stereo-linked key in
|
||||
void process(double &in1, double &in2, double keyLinked);
|
||||
|
||||
// transfer function
|
||||
double threshdB_; // threshold (dB)
|
||||
double ratio_; // ratio (compression: < 1 ; expansion: > 1)
|
||||
private:
|
||||
|
||||
// runtime variables
|
||||
double envdB_; // over-threshold envelope (dB)
|
||||
// transfer function
|
||||
double threshdB_; // threshold (dB)
|
||||
double ratio_; // ratio (compression: < 1 ; expansion: > 1)
|
||||
|
||||
// runtime variables
|
||||
double envdB_; // over-threshold envelope (dB)
|
||||
|
||||
double makeUpGain_;
|
||||
|
||||
}; // end SimpleComp class
|
||||
}; // end SimpleComp class
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// simple compressor with RMS detection
|
||||
//-------------------------------------------------------------
|
||||
class SimpleCompRms : public SimpleComp
|
||||
{
|
||||
public:
|
||||
SimpleCompRms();
|
||||
virtual ~SimpleCompRms() {}
|
||||
//-------------------------------------------------------------
|
||||
// simple compressor with RMS detection
|
||||
//-------------------------------------------------------------
|
||||
class SimpleCompRms : public SimpleComp
|
||||
{
|
||||
public:
|
||||
SimpleCompRms();
|
||||
virtual ~SimpleCompRms() {}
|
||||
|
||||
// sample rate
|
||||
virtual void setSampleRate( double sampleRate ) override;
|
||||
// sample rate
|
||||
virtual void setSampleRate(double sampleRate) override;
|
||||
|
||||
// RMS window
|
||||
virtual void setWindow( double ms );
|
||||
virtual double getWindow( void ) const { return ave_.getTc(); }
|
||||
// RMS window
|
||||
virtual void setWindow(double ms);
|
||||
virtual double getWindow(void) const { return ave_.getTc(); }
|
||||
|
||||
// runtime process
|
||||
virtual void initRuntime( void ) override; // call before runtime (in resume())
|
||||
void process( double &in1, double &in2 ); // compressor runtime process
|
||||
// runtime process
|
||||
virtual void initRuntime(void) override; // call before runtime (in resume())
|
||||
void process(double &in1, double &in2); // compressor runtime process
|
||||
|
||||
private:
|
||||
private:
|
||||
|
||||
EnvelopeDetector ave_; // averager
|
||||
double aveOfSqrs_; // average of squares
|
||||
EnvelopeDetector ave_; // averager
|
||||
double aveOfSqrs_; // average of squares
|
||||
|
||||
}; // end SimpleCompRms class
|
||||
}; // end SimpleCompRms class
|
||||
|
||||
} // end namespace chunkware_simple
|
||||
} // end namespace chunkware_simple
|
||||
|
||||
// include inlined process function
|
||||
#include "SimpleCompProcess.inl"
|
||||
|
||||
#endif // end __SIMPLE_COMP_H__
|
||||
#endif // end __SIMPLE_COMP_H__
|
||||
|
||||
@@ -1,130 +1,125 @@
|
||||
/*
|
||||
* Simple Envelope Detectors (header)
|
||||
* Simple Envelope Detectors (header)
|
||||
*
|
||||
* File : SimpleEnvelope.h
|
||||
* Library : SimpleSource
|
||||
* Version : 1.12
|
||||
* Class : EnvelopeDetector, AttRelEnvelope
|
||||
* File : SimpleEnvelope.h
|
||||
* Library : SimpleSource
|
||||
* Version : 1.12
|
||||
* Class : 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.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __SIMPLE_ENVELOPE_H__
|
||||
#define __SIMPLE_ENVELOPE_H__
|
||||
|
||||
#include "SimpleHeader.h" // common header
|
||||
#include "SimpleHeader.h" // common header
|
||||
|
||||
namespace chunkware_simple
|
||||
{
|
||||
//-------------------------------------------------------------
|
||||
// DC offset (to prevent denormal)
|
||||
//-------------------------------------------------------------
|
||||
//-------------------------------------------------------------
|
||||
// DC offset (to prevent denormal)
|
||||
//-------------------------------------------------------------
|
||||
|
||||
// USE:
|
||||
// 1. init envelope state to DC_OFFSET before processing
|
||||
// 2. add to input before envelope runtime function
|
||||
static const double DC_OFFSET = 1.0E-25;
|
||||
// USE:
|
||||
// 1. init envelope state to DC_OFFSET before processing
|
||||
// 2. add to input before envelope runtime function
|
||||
static const double DC_OFFSET = 1.0E-25;
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// envelope detector
|
||||
//-------------------------------------------------------------
|
||||
class EnvelopeDetector
|
||||
{
|
||||
public:
|
||||
EnvelopeDetector(
|
||||
double ms = 1.0
|
||||
, double sampleRate = 44100.0
|
||||
);
|
||||
virtual ~EnvelopeDetector() {}
|
||||
//! envelope detector
|
||||
class EnvelopeDetector
|
||||
{
|
||||
public:
|
||||
EnvelopeDetector(double ms = 1.0, double sampleRate = 44100.0);
|
||||
virtual ~EnvelopeDetector() {}
|
||||
|
||||
// time constant
|
||||
virtual void setTc( double ms );
|
||||
virtual double getTc( void ) const { return ms_; }
|
||||
//! set time constant
|
||||
virtual void setTc(double ms);
|
||||
|
||||
// sample rate
|
||||
virtual void setSampleRate( double sampleRate );
|
||||
virtual double getSampleRate( void ) const { return sampleRate_; }
|
||||
//! get time constant
|
||||
virtual double getTc(void) const { return ms_; }
|
||||
|
||||
// runtime function
|
||||
INLINE void run( double in, double &state ) {
|
||||
state = in + coef_ * ( state - in );
|
||||
}
|
||||
//! set sample rate
|
||||
virtual void setSampleRate(double sampleRate);
|
||||
|
||||
protected:
|
||||
|
||||
double sampleRate_; // sample rate
|
||||
double ms_; // time constant in ms
|
||||
double coef_; // runtime coefficient
|
||||
virtual void setCoef( void ); // coef calculation
|
||||
//! get sample rate
|
||||
virtual double getSampleRate(void) const { return sampleRate_; }
|
||||
|
||||
}; // end SimpleComp class
|
||||
//! runtime function
|
||||
INLINE void run(double in, double &state)
|
||||
{
|
||||
state = in + coef_ * (state - in);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// attack/release envelope
|
||||
//-------------------------------------------------------------
|
||||
class AttRelEnvelope
|
||||
{
|
||||
public:
|
||||
AttRelEnvelope(
|
||||
double att_ms = 10.0
|
||||
, double rel_ms = 100.0
|
||||
, double sampleRate = 44100.0
|
||||
);
|
||||
virtual ~AttRelEnvelope() {}
|
||||
protected:
|
||||
|
||||
// attack time constant
|
||||
virtual void setAttack( double ms );
|
||||
virtual double getAttack( void ) const { return att_.getTc(); }
|
||||
double sampleRate_; //!< sample rate
|
||||
double ms_; //!< time constant in ms
|
||||
double coef_; //!< runtime coefficient
|
||||
virtual void setCoef(void); //!< coef calculation
|
||||
|
||||
// release time constant
|
||||
virtual void setRelease( double ms );
|
||||
virtual double getRelease( void ) const { return rel_.getTc(); }
|
||||
}; // end SimpleComp class
|
||||
|
||||
// sample rate dependencies
|
||||
virtual void setSampleRate( double sampleRate );
|
||||
virtual double getSampleRate( void ) const { return att_.getSampleRate(); }
|
||||
//! attack/release envelope
|
||||
class AttRelEnvelope
|
||||
{
|
||||
public:
|
||||
AttRelEnvelope(double att_ms = 10.0, double rel_ms = 100.0, double sampleRate = 44100.0);
|
||||
virtual ~AttRelEnvelope() {}
|
||||
|
||||
// runtime function
|
||||
INLINE void run( double in, double &state ) {
|
||||
// attack time constant
|
||||
virtual void setAttack(double ms);
|
||||
virtual double getAttack(void) const { return att_.getTc(); }
|
||||
|
||||
/* assumes that:
|
||||
* positive delta = attack
|
||||
* negative delta = release
|
||||
* good for linear & log values
|
||||
*/
|
||||
// release time constant
|
||||
virtual void setRelease(double ms);
|
||||
virtual double getRelease(void) const { return rel_.getTc(); }
|
||||
|
||||
if ( in > state )
|
||||
att_.run( in, state ); // attack
|
||||
else
|
||||
rel_.run( in, state ); // release
|
||||
}
|
||||
// sample rate dependencies
|
||||
virtual void setSampleRate(double sampleRate);
|
||||
virtual double getSampleRate(void) const { return att_.getSampleRate(); }
|
||||
|
||||
private:
|
||||
|
||||
EnvelopeDetector att_;
|
||||
EnvelopeDetector rel_;
|
||||
|
||||
}; // end AttRelEnvelope class
|
||||
// runtime function
|
||||
INLINE void run(double in, double &state)
|
||||
{
|
||||
|
||||
} // end namespace chunkware_simple
|
||||
/* assumes that:
|
||||
* positive delta = attack
|
||||
* negative delta = release
|
||||
* good for linear & log values
|
||||
*/
|
||||
|
||||
#endif // end __SIMPLE_ENVELOPE_H__
|
||||
if (in > state)
|
||||
att_.run(in, state); // attack
|
||||
else
|
||||
rel_.run(in, state); // release
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
EnvelopeDetector att_;
|
||||
EnvelopeDetector rel_;
|
||||
|
||||
}; // end AttRelEnvelope class
|
||||
|
||||
} // end namespace chunkware_simple
|
||||
|
||||
#endif // end __SIMPLE_ENVELOPE_H__
|
||||
|
||||
@@ -90,11 +90,11 @@ namespace chunkware_simple
|
||||
//! get RMS window
|
||||
virtual double getWindow(void) const { return ave_.getTc(); }
|
||||
|
||||
//! \copydoc SimpleGate::initRuntime
|
||||
virtual void initRuntime(void); // call before runtime (in resume())
|
||||
//! call before runtime (in resume())
|
||||
virtual void initRuntime(void);
|
||||
|
||||
//! \copydoc SimpleGate::process
|
||||
void process(double &in1, double &in2); // gate runtime process
|
||||
//! gate runtime process
|
||||
void process(double &in1, double &in2);
|
||||
|
||||
private:
|
||||
EnvelopeDetector ave_; //!< averager
|
||||
|
||||
@@ -1,117 +1,121 @@
|
||||
/*
|
||||
* Simple Limiter (header)
|
||||
* Simple Limiter (header)
|
||||
*
|
||||
* File : SimpleLimit.h
|
||||
* Library : SimpleSource
|
||||
* Version : 1.12
|
||||
* Class : SimpleLimit
|
||||
* File : SimpleLimit.h
|
||||
* Library : SimpleSource
|
||||
* Version : 1.12
|
||||
* Class : 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.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __SIMPLE_LIMIT_H__
|
||||
#define __SIMPLE_LIMIT_H__
|
||||
|
||||
#include "SimpleHeader.h" // common header
|
||||
#include "SimpleEnvelope.h" // for base class of FastEnvelope
|
||||
#include "SimpleGain.h" // for gain functions
|
||||
#include "SimpleHeader.h" // common header
|
||||
#include "SimpleEnvelope.h" // for base class of FastEnvelope
|
||||
#include "SimpleGain.h" // for gain functions
|
||||
#include <vector>
|
||||
|
||||
namespace chunkware_simple
|
||||
{
|
||||
//-------------------------------------------------------------
|
||||
// simple limiter
|
||||
//-------------------------------------------------------------
|
||||
class SimpleLimit
|
||||
{
|
||||
public:
|
||||
SimpleLimit();
|
||||
virtual ~SimpleLimit() {}
|
||||
//! Simple limiter
|
||||
class SimpleLimit
|
||||
{
|
||||
public:
|
||||
SimpleLimit();
|
||||
virtual ~SimpleLimit() {}
|
||||
|
||||
// parameters
|
||||
virtual void setThresh( double dB );
|
||||
virtual void setAttack( double ms );
|
||||
virtual void setRelease( double ms );
|
||||
//! @{ set parameters
|
||||
virtual void setThresh(double dB);
|
||||
virtual void setAttack(double ms);
|
||||
virtual void setRelease(double ms);
|
||||
//! @}
|
||||
|
||||
virtual double getThresh( void ) const { return threshdB_; }
|
||||
virtual double getAttack( void ) const { return att_.getTc(); }
|
||||
virtual double getRelease( void ) const { return rel_.getTc(); }
|
||||
//! @{ get parameters
|
||||
virtual double getThresh(void) const { return threshdB_; }
|
||||
virtual double getAttack(void) const { return att_.getTc(); }
|
||||
virtual double getRelease(void) const { return rel_.getTc(); }
|
||||
//! @}
|
||||
|
||||
// latency
|
||||
virtual const unsigned int getLatency( void ) const { return peakHold_; }
|
||||
//! get latency
|
||||
virtual const unsigned int getLatency(void) const { return peakHold_; }
|
||||
|
||||
// sample rate dependencies
|
||||
virtual void setSampleRate( double sampleRate );
|
||||
virtual double getSampleRate( void ) { return att_.getSampleRate(); }
|
||||
|
||||
// runtime
|
||||
virtual void initRuntime( void ); // call before runtime (in resume())
|
||||
void process( double &in1, double &in2 ); // limiter runtime process
|
||||
//! @{ sample rate
|
||||
virtual void setSampleRate(double sampleRate);
|
||||
virtual double getSampleRate(void) { return att_.getSampleRate(); }
|
||||
//! @}
|
||||
|
||||
protected:
|
||||
//! call before runtime (in resume())
|
||||
virtual void initRuntime(void);
|
||||
|
||||
// class for faster attack/release
|
||||
class FastEnvelope : public EnvelopeDetector
|
||||
{
|
||||
public:
|
||||
FastEnvelope( double ms = 1.0, double sampleRate = 44100.0 )
|
||||
: EnvelopeDetector( ms, sampleRate )
|
||||
{}
|
||||
virtual ~FastEnvelope() {}
|
||||
//! limiter runtime process
|
||||
void process(double &in1, double &in2);
|
||||
|
||||
protected:
|
||||
// override setCoef() - coefficient calculation
|
||||
virtual void setCoef( void );
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
// transfer function
|
||||
double threshdB_; // threshold (dB)
|
||||
double thresh_; // threshold (linear)
|
||||
protected:
|
||||
|
||||
// max peak
|
||||
unsigned int peakHold_; // peak hold (samples)
|
||||
unsigned int peakTimer_; // peak hold timer
|
||||
double maxPeak_; // max peak
|
||||
//! class for faster attack/release
|
||||
class FastEnvelope : public EnvelopeDetector
|
||||
{
|
||||
public:
|
||||
FastEnvelope(double ms = 1.0, double sampleRate = 44100.0)
|
||||
: EnvelopeDetector(ms, sampleRate)
|
||||
{}
|
||||
virtual ~FastEnvelope() {}
|
||||
|
||||
// attack/release envelope
|
||||
FastEnvelope att_; // attack
|
||||
FastEnvelope rel_; // release
|
||||
double env_; // over-threshold envelope (linear)
|
||||
protected:
|
||||
// override setCoef() - coefficient calculation
|
||||
virtual void setCoef(void);
|
||||
};
|
||||
|
||||
// buffer
|
||||
// BUFFER_SIZE default can handle up to ~10ms at 96kHz
|
||||
// change this if you require more
|
||||
static const int BUFFER_SIZE = 1024; // buffer size (always a power of 2!)
|
||||
unsigned int mask_; // buffer mask
|
||||
unsigned int cur_; // cursor
|
||||
std::vector< double > outBuffer_[ 2 ]; // output buffer
|
||||
|
||||
}; // end SimpleLimit class
|
||||
private:
|
||||
|
||||
} // end namespace chunkware_simple
|
||||
// transfer function
|
||||
double threshdB_; // threshold (dB)
|
||||
double thresh_; // threshold (linear)
|
||||
|
||||
// max peak
|
||||
unsigned int peakHold_; // peak hold (samples)
|
||||
unsigned int peakTimer_; // peak hold timer
|
||||
double maxPeak_; // max peak
|
||||
|
||||
// attack/release envelope
|
||||
FastEnvelope att_; // attack
|
||||
FastEnvelope rel_; // release
|
||||
double env_; // over-threshold envelope (linear)
|
||||
|
||||
// buffer
|
||||
// BUFFER_SIZE default can handle up to ~10ms at 96kHz
|
||||
// change this if you require more
|
||||
static const int BUFFER_SIZE = 1024; // buffer size (always a power of 2!)
|
||||
unsigned int mask_; // buffer mask
|
||||
unsigned int cur_; // cursor
|
||||
std::vector< double > outBuffer_[ 2 ]; // output buffer
|
||||
|
||||
}; // end SimpleLimit class
|
||||
|
||||
} // end namespace chunkware_simple
|
||||
|
||||
// include inlined process function
|
||||
#include "SimpleLimitProcess.inl"
|
||||
|
||||
#endif // end __SIMPLE_LIMIT_H__
|
||||
#endif // end __SIMPLE_LIMIT_H__
|
||||
|
||||
Reference in New Issue
Block a user