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

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

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

revision 720 by senkov, Sun Jul 24 18:22:56 2005 UTC revision 2225 by iliev, Tue Aug 2 13:44:57 2011 UTC
# Line 112  namespace LinuxSampler { Line 112  namespace LinuxSampler {
112                          break;                          break;
113                  }                  }
114              }              }
115                
116                /**
117                 * Should be invoked after the LFO is triggered.
118                 * @param phase From 0 to 360 degrees.
119                 */
120                void setPhase(float phase) {
121                    if (phase < 0) phase = 0;
122                    if (phase > 360) phase = 360;
123                    phase /= 360.0f;
124                    const unsigned int intLimit = (unsigned int) -1; // all 0xFFFF...
125                    unsigned int uiPhase = intLimit * phase + iLevel;
126                    if (uiPhase > intLimit / 2) iLevel = uiPhase - intLimit;
127                    else iLevel = uiPhase;
128                }
129    
130          protected:          protected:
131              int   iLevel;              int   iLevel;

Legend:
Removed from v.720  
changed lines
  Added in v.2225

  ViewVC Help
Powered by ViewVC