27 #ifndef ASYNC_AUDIO_COMPRESSOR_INCLUDED 28 #define ASYNC_AUDIO_COMPRESSOR_INCLUDED 110 : sampleRate_( sampleRate ), ms_( ms ), coef_( 0.0 )
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_ ) );
201 void setAttack(
double attack_ms) { att_.setTc(attack_ms);}
207 void setDecay(
double decay_ms) { rel_.setTc(decay_ms); }
217 void setOutputGain(
float gain);
226 virtual void processSamples(
float *dest,
const float *src,
int count);
virtual double getSampleRate(void)
void setRatio(double ratio)
Set the compression ratio.
The base class for an audio processor.
virtual ~EnvelopeDetector()
void setDecay(double decay_ms)
Set the compressor decay time.
void setAttack(double attack_ms)
Set the compressor attack time.
virtual void setTc(double ms)
virtual double getTc(void)
A class to do audio compression/limiting.
virtual void setSampleRate(double sampleRate)
Namespace for the asynchronous programming classes.
The base class for an audio processor class.
void setThreshold(double thresh_db)
Set the compression threshold.
void run(double in, double &state)
EnvelopeDetector(double ms=1.0, double sampleRate=INTERNAL_SAMPLE_RATE)