2017-04-27 04:31:01 +00:00
|
|
|
#ifndef B3_ADSR_H
|
|
|
|
#define B3_ADSR_H
|
|
|
|
|
|
|
|
class b3ADSR
|
|
|
|
{
|
|
|
|
int m_state;
|
|
|
|
double m_value;
|
|
|
|
double m_target;
|
|
|
|
double m_attackRate;
|
|
|
|
double m_decayRate;
|
|
|
|
double m_releaseRate;
|
|
|
|
double m_releaseTime;
|
|
|
|
double m_sustainLevel;
|
2017-05-01 18:14:09 +00:00
|
|
|
bool m_autoKeyOff;
|
2017-04-27 04:31:01 +00:00
|
|
|
public:
|
|
|
|
|
|
|
|
b3ADSR();
|
|
|
|
virtual ~b3ADSR();
|
|
|
|
|
|
|
|
double tick();
|
|
|
|
bool isIdle() const;
|
2017-05-01 18:14:09 +00:00
|
|
|
void keyOn(bool autoKeyOff);
|
2017-04-27 04:31:01 +00:00
|
|
|
void keyOff();
|
2017-04-28 19:39:51 +00:00
|
|
|
|
|
|
|
void setValues(double attack,double decay,double sustain,double release)
|
|
|
|
{
|
|
|
|
m_attackRate = attack;
|
|
|
|
m_decayRate = decay;
|
|
|
|
m_sustainLevel = sustain;
|
|
|
|
m_releaseRate = release;
|
|
|
|
}
|
|
|
|
|
2017-04-27 04:31:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif //B3_ADSR_H
|