/[svn]/linuxsampler/trunk/src/engines/common/SignalUnitRack.h
ViewVC logotype

Diff of /linuxsampler/trunk/src/engines/common/SignalUnitRack.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2205 by iliev, Mon Jul 11 17:52:01 2011 UTC revision 2224 by iliev, Mon Aug 1 19:08:09 2011 UTC
# Line 29  Line 29 
29    
30    
31  namespace LinuxSampler {  namespace LinuxSampler {
32        
33      class SignalUnitRack {      class SignalUnitRack {
34          protected:          protected:
35              uint CurrentStep; // The current time step              uint CurrentStep; // The current time step
36    
37          public:          public:
38              SignalUnitRack(): CurrentStep(0) { }              FixedArray<SignalUnit*> Units; // A list of all signal units in this rack
             uint GetCurrentStep() { return CurrentStep; }  
39    
40              /**              /**
41               * Will be called to increment the time with one sample point.               * @param maxUnitCount We are using fixed size array because of the real-time safe requirements.
              * 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.  
42               */               */
43              virtual void CancelRelease() = 0;              SignalUnitRack(int maxUnitCount): CurrentStep(0), Units(maxUnitCount) { }
44                            
45              virtual EndpointSignalUnit* GetEndpointUnit() = 0;              uint GetCurrentStep() { return CurrentStep; }
     };  
       
     template <class O /* The signal unit rack's owner */>  
     class SignalUnitRackBase: public SignalUnitRack {  
         protected:  
             O* pOwner; // The owner to which this rack belongs.  
46    
47          public:              virtual EndpointSignalUnit* GetEndpointUnit() = 0;
             ArrayList<SignalUnitBase<O>*> Units; // A list of all signal units in this rack  
48                            
49              SignalUnitRackBase(O* Owner) {              virtual void EnterFadeOutStage() = 0;
                 pOwner = Owner;  
             }  
50                            
51              /**              /**
52               * Will be called to increment the time with one sample point.               * Will be called to increment the time with one sample point.
# Line 98  namespace LinuxSampler { Line 71  namespace LinuxSampler {
71              virtual void Trigger() {              virtual void Trigger() {
72                  CurrentStep = 0;                  CurrentStep = 0;
73                  for (int i = 0; i < Units.size(); i++) {                  for (int i = 0; i < Units.size(); i++) {
                     Units[i]->SetOwner(pOwner);  
74                      Units[i]->Trigger();                      Units[i]->Trigger();
75                  }                  }
76              }              }
77                            
78                /**
79                 * When the rack belongs to a voice, this method is
80                 * called when the voice enter the release stage.
81                 */
82              virtual void EnterReleaseStage() {              virtual void EnterReleaseStage() {
83                  for (int i = 0; i < Units.size(); i++) {                  for (int i = 0; i < Units.size(); i++) {
84                      Units[i]->EnterReleaseStage();                      Units[i]->EnterReleaseStage();
85                  }                  }
86              }              }
87                            
88                /**
89                 * When the rack belongs to a voice, this method is
90                 * called when the voice is of type which ignore note off.
91                 */
92              virtual void CancelRelease() {              virtual void CancelRelease() {
93                  for (int i = 0; i < Units.size(); i++) {                  for (int i = 0; i < Units.size(); i++) {
94                      Units[i]->CancelRelease();                      Units[i]->CancelRelease();

Legend:
Removed from v.2205  
changed lines
  Added in v.2224

  ViewVC Help
Powered by ViewVC