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

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

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

revision 1681 by schoenebeck, Wed Feb 13 15:10:13 2008 UTC revision 2225 by iliev, Tue Aug 2 13:44:57 2011 UTC
# Line 116  namespace LinuxSampler { Line 116  namespace LinuxSampler {
116                  real1 = real2 = cos(phi);                  real1 = real2 = cos(phi);
117                  imag1 = imag2 = sin(phi);                  imag1 = imag2 = sin(phi);
118              }              }
119                
120                /**
121                 * Should be invoked after the LFO is triggered with StartLevel
122                 * start_level_min.
123                 * @param phase From 0 to 360 degrees.
124                 */
125                void setPhase(float phase) {
126                    if (phase < 0) phase = 0;
127                    if (phase > 360) phase = 360;
128                    phase /= 360.0f;
129                    
130                    // FIXME: too heavy?
131                    float steps = 1.0f / (c1 / (2.0f * M_PI)); // number of steps for one cycle
132                    steps *= phase + 0.25f;
133                    for (int i = 0; i < steps; i++) render();
134                }
135    
136          private:          private:
137              float c1;              float c1;

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

  ViewVC Help
Powered by ViewVC