47 |
enum stage_t { |
enum stage_t { |
48 |
stage_attack, |
stage_attack, |
49 |
stage_attack_hold, |
stage_attack_hold, |
50 |
|
stage_decay1_init, |
51 |
stage_decay1, |
stage_decay1, |
52 |
|
stage_decay1_part2_init, |
53 |
|
stage_decay1_part2, |
54 |
|
stage_decay2_init, |
55 |
stage_decay2, |
stage_decay2, |
56 |
stage_sustain, |
stage_sustain, |
57 |
|
stage_release_init, |
58 |
stage_release, |
stage_release, |
59 |
|
stage_release_part2_init, |
60 |
|
stage_release_part2, |
61 |
stage_fadeout, |
stage_fadeout, |
62 |
stage_end |
stage_end |
63 |
}; |
}; |
64 |
|
|
65 |
EGADSR(gig::Engine* pEngine, Event::destination_t ModulationDestination); |
EGADSR(gig::Engine* pEngine, Event::destination_t ModulationDestination); |
66 |
void Process(uint TotalSamples, RTList<Event>* pEvents, RTList<Event>::Iterator itTriggerEvent, double SamplePos, double CurrentPitch, RTList<Event>::Iterator itKillEvent = RTList<Event>::Iterator()); |
void Process(uint TotalSamples, RTList<Event>* pEvents, RTList<Event>::Iterator itTriggerEvent, double SamplePos, double CurrentPitch, RTList<Event>::Iterator itKillEvent = RTList<Event>::Iterator()); |
67 |
void Trigger(uint PreAttack, double AttackTime, bool HoldAttack, long LoopStart, double Decay1Time, double Decay2Time, bool InfiniteSustain, uint SustainLevel, double ReleaseTime, uint Delay); |
void Trigger(uint PreAttack, double AttackTime, bool HoldAttack, long LoopStart, double Decay1Time, double Decay2Time, bool InfiniteSustain, uint SustainLevel, double ReleaseTime, uint Delay, float Volume); |
68 |
inline EGADSR::stage_t GetStage() { return Stage; } |
inline EGADSR::stage_t GetStage() { return Stage; } |
69 |
protected: |
protected: |
70 |
gig::Engine* pEngine; |
gig::Engine* pEngine; |
77 |
bool HoldAttack; |
bool HoldAttack; |
78 |
long LoopStart; |
long LoopStart; |
79 |
float Decay1Coeff; |
float Decay1Coeff; |
80 |
|
float Decay1Coeff2; |
81 |
|
float Decay1Coeff3; |
82 |
|
float Decay1Level2; |
83 |
|
float Decay1Slope; |
84 |
long Decay1StepsLeft; ///< number of sample points in Decay1 stage |
long Decay1StepsLeft; ///< number of sample points in Decay1 stage |
85 |
float Decay2Coeff; |
float Decay2Coeff; |
86 |
|
long Decay2StepsLeft; |
87 |
bool InfiniteSustain; |
bool InfiniteSustain; |
88 |
float SustainLevel; |
float SustainLevel; |
89 |
float ReleaseCoeff; |
float ReleaseCoeff; |
90 |
|
float ReleaseCoeff2; |
91 |
|
float ReleaseCoeff3; |
92 |
|
float ReleaseLevel2; |
93 |
|
float ReleaseSlope; |
94 |
long ReleaseStepsLeft; ///< number of sample points til end of release stage |
long ReleaseStepsLeft; ///< number of sample points til end of release stage |
95 |
bool ReleasePostponed; ///< If a "release" event occured in the previous audio fragment, but wasn't processed yet. |
bool ReleasePostponed; ///< If a "release" event occured in the previous audio fragment, but wasn't processed yet. |
96 |
|
float ExpOffset; |
97 |
const static float FadeOutCoeff; |
const static float FadeOutCoeff; |
98 |
private: |
private: |
99 |
static float CalculateFadeOutCoeff(); |
static float CalculateFadeOutCoeff(); |