54 |
enum event_t { |
enum event_t { |
55 |
event_stage_end, |
event_stage_end, |
56 |
event_release, |
event_release, |
57 |
event_cancel_release |
event_cancel_release, |
58 |
|
event_hold_end |
59 |
}; |
}; |
60 |
|
|
61 |
/** |
/** |
77 |
* (0.000 - 60.000s) |
* (0.000 - 60.000s) |
78 |
* @param HoldAttack - if true, Decay1 will be postponed until the |
* @param HoldAttack - if true, Decay1 will be postponed until the |
79 |
* sample reached the sample loop start. |
* sample reached the sample loop start. |
|
* @param LoopStart - sample position where sample loop starts |
|
|
* (if any) |
|
80 |
* @param Decay1Time - Decay1 time of the sample amplitude EG |
* @param Decay1Time - Decay1 time of the sample amplitude EG |
81 |
* (0.000 - 60.000s) |
* (0.000 - 60.000s) |
82 |
* @param Decay2Time - only if !InfiniteSustain: 2nd decay stage |
* @param Decay2Time - only if !InfiniteSustain: 2nd decay stage |
94 |
* exponential curve parameters. |
* exponential curve parameters. |
95 |
* @param SampleRate - sample rate of used audio output driver |
* @param SampleRate - sample rate of used audio output driver |
96 |
*/ |
*/ |
97 |
void trigger(uint PreAttack, float AttackTime, bool HoldAttack, long LoopStart, float Decay1Time, double Decay2Time, bool InfiniteSustain, uint SustainLevel, float ReleaseTime, float Volume, uint SampleRate); //FIXME: we should better use 'float' for SampleRate |
void trigger(uint PreAttack, float AttackTime, bool HoldAttack, float Decay1Time, double Decay2Time, bool InfiniteSustain, uint SustainLevel, float ReleaseTime, float Volume, uint SampleRate); //FIXME: we should better use 'float' for SampleRate |
98 |
|
|
99 |
/** |
/** |
100 |
* Returns true in case envelope hasn't reached its final end state yet. |
* Returns true in case envelope hasn't reached its final end state yet. |
130 |
* the envelope's transition to the respective next stage. |
* the envelope's transition to the respective next stage. |
131 |
* |
* |
132 |
* @param Event - what happened |
* @param Event - what happened |
|
* @param SamplePos - current sample playback position |
|
|
* @param CurrentPitch - current frequency alternation quotient |
|
133 |
*/ |
*/ |
134 |
void update(event_t Event, double SamplePos, float CurrentPitch, uint SampleRate); |
void update(event_t Event, uint SampleRate); |
135 |
|
|
136 |
/** |
/** |
137 |
* Calculates exactly one, the next sample point of EG |
* Calculates exactly one, the next sample point of EG |
186 |
int StepsLeft; |
int StepsLeft; |
187 |
segment_t Segment; |
segment_t Segment; |
188 |
stage_t Stage; |
stage_t Stage; |
|
event_t PostponedEvent; ///< only used in Attack stage to postpone transition events until attack time is reached |
|
189 |
bool HoldAttack; |
bool HoldAttack; |
190 |
bool InfiniteSustain; |
bool InfiniteSustain; |
|
long LoopStart; |
|
191 |
float Decay1Time; |
float Decay1Time; |
192 |
float Decay1Level2; |
float Decay1Level2; |
193 |
float Decay1Slope; |
float Decay1Slope; |
202 |
float ExpOffset; |
float ExpOffset; |
203 |
float FadeOutCoeff; ///< very fast ramp down for e.g. voice stealing |
float FadeOutCoeff; ///< very fast ramp down for e.g. voice stealing |
204 |
|
|
205 |
void enterAttackStage(const uint PreAttack, const float AttackTime, const uint SampleRate, const double SamplePos, const float CurrentPitch); |
void enterAttackStage(const uint PreAttack, const float AttackTime, const uint SampleRate); |
206 |
void enterAttackHoldStage(const double SamplePos, const float CurrentPitch); |
void enterAttackHoldStage(); |
207 |
void enterDecay1Part1Stage(const uint SampleRate); |
void enterDecay1Part1Stage(const uint SampleRate); |
208 |
void enterDecay1Part2Stage(const uint SampleRate); |
void enterDecay1Part2Stage(const uint SampleRate); |
209 |
void enterDecay2Stage(const uint SampleRate); |
void enterDecay2Stage(const uint SampleRate); |