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

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

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

revision 318 by schoenebeck, Fri Oct 8 20:51:39 2004 UTC revision 319 by schoenebeck, Mon Dec 13 00:46:42 2004 UTC
# Line 104  namespace LinuxSampler { Line 104  namespace LinuxSampler {
104               *               *
105               * @param Samples - total number of sample points to be rendered in               * @param Samples - total number of sample points to be rendered in
106               *                  this audio fragment cycle by the audio engine               *                  this audio fragment cycle by the audio engine
107                 * @returns true if modulation is active (LFO depth <> 0.0)
108               */               */
109              void Process(uint Samples) {              bool Process(uint Samples) {
110                  RTList<Event>::Iterator itCtrlEvent = pEvents->first();                  RTList<Event>::Iterator itCtrlEvent = pEvents->first();
111                  int iSample = TriggerDelay;                  int iSample = TriggerDelay;
112                    bool result;
113                  while (iSample < Samples) {                  while (iSample < Samples) {
114                      int process_break = Samples;                      int process_break = Samples;
115                      if (itCtrlEvent && itCtrlEvent->FragmentPos() <= process_break) process_break = itCtrlEvent->FragmentPos();                      if (itCtrlEvent && itCtrlEvent->FragmentPos() <= process_break) process_break = itCtrlEvent->FragmentPos();
# Line 122  namespace LinuxSampler { Line 124  namespace LinuxSampler {
124                              Coeff = -Coeff; // invert direction                              Coeff = -Coeff; // invert direction
125                              Level += 2.0f * Coeff;                              Level += 2.0f * Coeff;
126                          }                          }
127                            result = true; // modulation active
128                      }                      }
129                      else if (Coeff < 0.0f) { // level going down                      else if (Coeff < 0.0f) { // level going down
130                          while (iSample < process_break && Level >= CurrentMin) {                          while (iSample < process_break && Level >= CurrentMin) {
# Line 133  namespace LinuxSampler { Line 136  namespace LinuxSampler {
136                              Coeff = -Coeff; // invert direction                              Coeff = -Coeff; // invert direction
137                              Level += 2.0f * Coeff;                              Level += 2.0f * Coeff;
138                          }                          }
139                            result = true; // modulation active
140                      }                      }
141                      else { // no modulation at all (Coeff = 0.0)                      else { // no modulation at all (Coeff = 0.0)
142                          switch (Propagation) {                          switch (Propagation) {
# Line 150  namespace LinuxSampler { Line 154  namespace LinuxSampler {
154                              pManipulator->ApplyLevel(Level, iSample);                              pManipulator->ApplyLevel(Level, iSample);
155                              iSample++;                              iSample++;
156                          }                          }
157                            result = false; // modulation inactive
158                      }                      }
159    
160                      if (itCtrlEvent) {                      if (itCtrlEvent) {
# Line 159  namespace LinuxSampler { Line 164  namespace LinuxSampler {
164                  }                  }
165                  TriggerDelay = 0;                  TriggerDelay = 0;
166                  pEvents->clear();                  pEvents->clear();
167                    return result;
168              }              }
169    
170              /**              /**

Legend:
Removed from v.318  
changed lines
  Added in v.319

  ViewVC Help
Powered by ViewVC