git.s-ol.nu vcvmods / 781a2ad
remove more deprecated math s-ol 4 years ago
1 changed file(s) with 9 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
2626
2727
2828 void CircleVCO::step() {
29 float deltaTime = 1.0 / engineGetSampleRate();
29 float deltaTime = 1.0f / engineGetSampleRate();
3030
3131 float pitch = params[PITCH_PARAM].value;
3232 pitch += inputs[PITCH_INPUT].value;
3333 pitch = clamp(pitch, -4.0f, 4.0f);
34 float freq = 200 * (powf(2.0, pitch) - powf(2.0, -4.0));
34 float freq = 200.0f * (pow(2.0f, pitch) - powf(2.0f, -4.0f));
3535
3636 phase += freq * deltaTime;
37 while (phase >= 1.0)
38 phase -= 1.0;
37 while (phase >= 1.0f)
38 phase -= 1.0f;
3939
40 float sine = sinf(2 * M_PI * phase);
41 float cosn = cosf(2 * M_PI * phase);
42 outputs[SIN_OUTPUT].value = sine * 5;
43 outputs[COS_OUTPUT].value = cosn * 5;
44 outputs[PHS_OUTPUT].value = phase * 5;
40 float sine = sin(2.0f * M_PI * phase);
41 float cosn = cos(2.0f * M_PI * phase);
42 outputs[SIN_OUTPUT].value = sine * 5.0f;
43 outputs[COS_OUTPUT].value = cosn * 5.0f;
44 outputs[PHS_OUTPUT].value = phase * 5.0f;
4545 }
4646
4747