This commit is contained in:
Roland Rossgotterer
2019-10-10 13:23:44 +02:00
committed by Mat Sutcliffe
parent 8367559713
commit 30d764d72c

View File

@@ -37,59 +37,68 @@
namespace chunkware_simple
{
//-------------------------------------------------------------
// simple gate
//-------------------------------------------------------------
//! simple gate
class SimpleGate : public AttRelEnvelope
{
public:
//! Constructor
SimpleGate();
//! Destructor
virtual ~SimpleGate() {}
// parameters
//! set threshold
virtual void setThresh(double dB);
//! get threshold
virtual double getThresh(void) const { return threshdB_; }
// runtime
// init runtime
virtual void initRuntime(void); // call before runtime (in resume())
//! Process audio
void process(double &in1, double &in2); // gate runtime process
//! Process audio stereo-linked
void process(double &in1, double &in2, double keyLinked); // with stereo-linked key in
private:
// transfer function
double threshdB_; // threshold (dB)
double thresh_; // threshold (linear)
double threshdB_; //!< threshold (dB)
double thresh_; //!< threshold (linear)
// runtime variables
double env_; // over-threshold envelope (linear)
double env_; //!< over-threshold envelope (linear)
};
}; // end SimpleGate class
//-------------------------------------------------------------
// simple gate with RMS detection
//-------------------------------------------------------------
//! simple gate with RMS detection
class SimpleGateRms : public SimpleGate
{
public:
//! Constructor
SimpleGateRms();
//! Destructor
virtual ~SimpleGateRms() {}
// sample rate
//! set sample rate
virtual void setSampleRate(double sampleRate);
// RMS window
//! set RMS window
virtual void setWindow(double ms);
//! get RMS window
virtual double getWindow(void) const { return ave_.getTc(); }
// runtime process
//! \copydoc SimpleGate::initRuntime
virtual void initRuntime(void); // call before runtime (in resume())
//! \copydoc SimpleGate::process
void process(double &in1, double &in2); // gate runtime process
private:
EnvelopeDetector ave_; // averager
double aveOfSqrs_; // average of squares
EnvelopeDetector ave_; //!< averager
double aveOfSqrs_; //!< average of squares
}; // end SimpleGateRms class