34 |
uint CurrentStep; // The current time step |
uint CurrentStep; // The current time step |
35 |
|
|
36 |
public: |
public: |
37 |
|
ArrayList<SignalUnit*> Units; // A list of all signal units in this rack |
38 |
|
|
39 |
SignalUnitRack(): CurrentStep(0) { } |
SignalUnitRack(): CurrentStep(0) { } |
40 |
uint GetCurrentStep() { return CurrentStep; } |
uint GetCurrentStep() { return CurrentStep; } |
41 |
|
|
|
/** |
|
|
* Will be called to increment the time with one sample point. |
|
|
* Each unit should recalculate its current level on every call of this function. |
|
|
*/ |
|
|
virtual void Increment() = 0; |
|
|
|
|
|
virtual void ProcessCCEvent(RTList<Event>::Iterator& itEvent) = 0; |
|
|
|
|
|
/** Initializes and triggers the rack. */ |
|
|
virtual void Trigger() = 0; |
|
|
|
|
|
/** |
|
|
* When the rack belongs to a voice, this method is |
|
|
* called when the voice enter the release stage. |
|
|
*/ |
|
|
virtual void EnterReleaseStage() = 0; |
|
|
|
|
|
/** |
|
|
* When the rack belongs to a voice, this method is |
|
|
* called when the voice is of type which ignore note off. |
|
|
*/ |
|
|
virtual void CancelRelease() = 0; |
|
|
|
|
42 |
virtual EndpointSignalUnit* GetEndpointUnit() = 0; |
virtual EndpointSignalUnit* GetEndpointUnit() = 0; |
|
}; |
|
|
|
|
|
template <class O /* The signal unit rack's owner */> |
|
|
class SignalUnitRackBase: public SignalUnitRack { |
|
|
protected: |
|
|
O* pOwner; // The owner to which this rack belongs. |
|
|
|
|
|
public: |
|
|
ArrayList<SignalUnitBase<O>*> Units; // A list of all signal units in this rack |
|
|
|
|
|
SignalUnitRackBase(O* Owner) { |
|
|
pOwner = Owner; |
|
|
} |
|
43 |
|
|
44 |
/** |
/** |
45 |
* Will be called to increment the time with one sample point. |
* Will be called to increment the time with one sample point. |
64 |
virtual void Trigger() { |
virtual void Trigger() { |
65 |
CurrentStep = 0; |
CurrentStep = 0; |
66 |
for (int i = 0; i < Units.size(); i++) { |
for (int i = 0; i < Units.size(); i++) { |
|
Units[i]->SetOwner(pOwner); |
|
67 |
Units[i]->Trigger(); |
Units[i]->Trigger(); |
68 |
} |
} |
69 |
} |
} |
70 |
|
|
71 |
|
/** |
72 |
|
* When the rack belongs to a voice, this method is |
73 |
|
* called when the voice enter the release stage. |
74 |
|
*/ |
75 |
virtual void EnterReleaseStage() { |
virtual void EnterReleaseStage() { |
76 |
for (int i = 0; i < Units.size(); i++) { |
for (int i = 0; i < Units.size(); i++) { |
77 |
Units[i]->EnterReleaseStage(); |
Units[i]->EnterReleaseStage(); |
78 |
} |
} |
79 |
} |
} |
80 |
|
|
81 |
|
/** |
82 |
|
* When the rack belongs to a voice, this method is |
83 |
|
* called when the voice is of type which ignore note off. |
84 |
|
*/ |
85 |
virtual void CancelRelease() { |
virtual void CancelRelease() { |
86 |
for (int i = 0; i < Units.size(); i++) { |
for (int i = 0; i < Units.size(); i++) { |
87 |
Units[i]->CancelRelease(); |
Units[i]->CancelRelease(); |