Go to the documentation of this file.
27 #ifndef ASYNC_AUDIO_COMPRESSOR_INCLUDED
28 #define ASYNC_AUDIO_COMPRESSOR_INCLUDED
106 class EnvelopeDetector
109 EnvelopeDetector(
double ms = 1.0,
double sampleRate = INTERNAL_SAMPLE_RATE )
110 : sampleRate_( sampleRate ), ms_( ms ), coef_( 0.0 )
118 virtual void setTc(
double ms )
124 virtual double getTc(
void ) {
return ms_; }
129 sampleRate_ = sampleRate;
136 inline void run(
double in,
double &state )
138 state = in + coef_ * ( state - in );
148 coef_ = exp( -1.0 / ( 0.001 * ms_ * sampleRate_ ) );
169 class AudioCompressor :
public AudioProcessor
195 void setRatio(
double ratio) { ratio_ = ratio; }
226 virtual void processSamples(
float *dest,
const float *src,
int count);
virtual void setTc(double ms)
void setRatio(double ratio)
Set the compression ratio.
EnvelopeDetector(double ms=1.0, double sampleRate=INTERNAL_SAMPLE_RATE)
A class to do audio compression/limiting.
virtual ~EnvelopeDetector()
void setAttack(double attack_ms)
Set the compressor attack time.
void setThreshold(double thresh_db)
Set the compression threshold.
virtual void processSamples(float *dest, const float *src, int count)
Process incoming samples and put them into the output buffer.
virtual double getTc(void)
AudioCompressor(void)
Default constuctor.
void run(double in, double &state)
The base class for an audio processor class.
void reset(void)
Reset the compressor.
Namespace for the asynchronous programming classes.
void setOutputGain(float gain)
Set the output gain.
~AudioCompressor(void)
Destructor.
void setDecay(double decay_ms)
Set the compressor decay time.
virtual void setSampleRate(double sampleRate)
virtual double getSampleRate(void)