3 |
* LinuxSampler - modular, streaming capable sampler * |
* LinuxSampler - modular, streaming capable sampler * |
4 |
* * |
* * |
5 |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
6 |
* Copyright (C) 2005 - 2010 Christian Schoenebeck * |
* Copyright (C) 2005 - 2017 Christian Schoenebeck * |
7 |
* * |
* * |
8 |
* This program is free software; you can redistribute it and/or modify * |
* This program is free software; you can redistribute it and/or modify * |
9 |
* it under the terms of the GNU General Public License as published by * |
* it under the terms of the GNU General Public License as published by * |
37 |
*/ |
*/ |
38 |
class EGADSR : public EG { |
class EGADSR : public EG { |
39 |
public: |
public: |
40 |
|
EGADSR(); |
41 |
|
|
42 |
/** |
/** |
43 |
* Will be called by the voice when the key / voice was triggered. |
* Will be called by the voice when the key / voice was triggered. |
67 |
*/ |
*/ |
68 |
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 |
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 |
69 |
|
|
70 |
|
void setStateOptions(bool AttackCancel, bool AttackHoldCancel, bool Decay1Cancel, bool Decay2Cancel, bool ReleaseCancel); |
71 |
|
|
72 |
/** |
/** |
73 |
* Should be called to inform the EG about an external event and |
* Should be called to inform the EG about an external event and |
74 |
* also whenever an envelope stage is completed. This will handle |
* also whenever an envelope stage is completed. This will handle |
94 |
}; |
}; |
95 |
|
|
96 |
stage_t Stage; |
stage_t Stage; |
97 |
|
event_t PostponedEvent; ///< Only if *Cancel variable below is set to to false in the respective EG stage: holds the transition event type for processing after that current stage completed its full duration. |
98 |
bool HoldAttack; |
bool HoldAttack; |
99 |
bool InfiniteSustain; |
bool InfiniteSustain; |
100 |
|
bool AttackCancel; ///< Whether the "attack" stage is cancelled when receiving a note-off. |
101 |
|
bool AttackHoldCancel; ///< Whether the "attack hold" stage is cancelled when receiving a note-off. |
102 |
|
bool Decay1Cancel; ///< Whether the "decay 1" stage is cancelled when receiving a note-off. |
103 |
|
bool Decay2Cancel; ///< Whether the "decay 2" stage is cancelled when receiving a note-off. |
104 |
|
bool ReleaseCancel; ///< Whether the "release" stage is cancelled when receiving a note-on. |
105 |
float Decay1Time; |
float Decay1Time; |
106 |
float Decay1Level2; |
float Decay1Level2; |
107 |
float Decay1Slope; |
float Decay1Slope; |
115 |
float invVolume; |
float invVolume; |
116 |
float ExpOffset; |
float ExpOffset; |
117 |
|
|
118 |
|
void enterNextStageForReleaseEvent(uint SampleRate); |
119 |
void enterAttackStage(const uint PreAttack, const float AttackTime, const uint SampleRate); |
void enterAttackStage(const uint PreAttack, const float AttackTime, const uint SampleRate); |
120 |
void enterAttackHoldStage(); |
void enterAttackHoldStage(); |
121 |
void enterDecay1Part1Stage(const uint SampleRate); |
void enterDecay1Part1Stage(const uint SampleRate); |