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; |