mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-17 19:05:31 +08:00
Style
This commit is contained in:
committed by
Mat Sutcliffe
parent
8367559713
commit
30d764d72c
@@ -37,59 +37,68 @@
|
|||||||
|
|
||||||
namespace chunkware_simple
|
namespace chunkware_simple
|
||||||
{
|
{
|
||||||
//-------------------------------------------------------------
|
//! simple gate
|
||||||
// simple gate
|
|
||||||
//-------------------------------------------------------------
|
|
||||||
class SimpleGate : public AttRelEnvelope
|
class SimpleGate : public AttRelEnvelope
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
//! Constructor
|
||||||
SimpleGate();
|
SimpleGate();
|
||||||
|
|
||||||
|
//! Destructor
|
||||||
virtual ~SimpleGate() {}
|
virtual ~SimpleGate() {}
|
||||||
|
|
||||||
// parameters
|
//! set threshold
|
||||||
virtual void setThresh(double dB);
|
virtual void setThresh(double dB);
|
||||||
|
|
||||||
|
//! get threshold
|
||||||
virtual double getThresh(void) const { return threshdB_; }
|
virtual double getThresh(void) const { return threshdB_; }
|
||||||
|
|
||||||
// runtime
|
// init runtime
|
||||||
virtual void initRuntime(void); // call before runtime (in resume())
|
virtual void initRuntime(void); // call before runtime (in resume())
|
||||||
|
|
||||||
|
//! Process audio
|
||||||
void process(double &in1, double &in2); // gate runtime process
|
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
|
void process(double &in1, double &in2, double keyLinked); // with stereo-linked key in
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// transfer function
|
// transfer function
|
||||||
double threshdB_; // threshold (dB)
|
double threshdB_; //!< threshold (dB)
|
||||||
double thresh_; // threshold (linear)
|
double thresh_; //!< threshold (linear)
|
||||||
|
|
||||||
// runtime variables
|
// 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
|
class SimpleGateRms : public SimpleGate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
//! Constructor
|
||||||
SimpleGateRms();
|
SimpleGateRms();
|
||||||
|
|
||||||
|
//! Destructor
|
||||||
virtual ~SimpleGateRms() {}
|
virtual ~SimpleGateRms() {}
|
||||||
|
|
||||||
// sample rate
|
//! set sample rate
|
||||||
virtual void setSampleRate(double sampleRate);
|
virtual void setSampleRate(double sampleRate);
|
||||||
|
|
||||||
// RMS window
|
//! set RMS window
|
||||||
virtual void setWindow(double ms);
|
virtual void setWindow(double ms);
|
||||||
|
|
||||||
|
//! get RMS window
|
||||||
virtual double getWindow(void) const { return ave_.getTc(); }
|
virtual double getWindow(void) const { return ave_.getTc(); }
|
||||||
|
|
||||||
// runtime process
|
//! \copydoc SimpleGate::initRuntime
|
||||||
virtual void initRuntime(void); // call before runtime (in resume())
|
virtual void initRuntime(void); // call before runtime (in resume())
|
||||||
|
|
||||||
|
//! \copydoc SimpleGate::process
|
||||||
void process(double &in1, double &in2); // gate runtime process
|
void process(double &in1, double &in2); // gate runtime process
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
EnvelopeDetector ave_; //!< averager
|
||||||
EnvelopeDetector ave_; // averager
|
double aveOfSqrs_; //!< average of squares
|
||||||
double aveOfSqrs_; // average of squares
|
|
||||||
|
|
||||||
}; // end SimpleGateRms class
|
}; // end SimpleGateRms class
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user