From 781a2adb1157eb9b323b1f7e2dd40ba4feafa470 Mon Sep 17 00:00:00 2001 From: s-ol Date: Thu, 22 Feb 2018 13:34:10 +0100 Subject: remove more deprecated math --- src/CircleVCO.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/CircleVCO.cpp') diff --git a/src/CircleVCO.cpp b/src/CircleVCO.cpp index 41ba4f0..bb96bea 100644 --- a/src/CircleVCO.cpp +++ b/src/CircleVCO.cpp @@ -27,22 +27,22 @@ struct CircleVCO : Module { void CircleVCO::step() { - float deltaTime = 1.0 / engineGetSampleRate(); + float deltaTime = 1.0f / engineGetSampleRate(); float pitch = params[PITCH_PARAM].value; pitch += inputs[PITCH_INPUT].value; pitch = clamp(pitch, -4.0f, 4.0f); - float freq = 200 * (powf(2.0, pitch) - powf(2.0, -4.0)); + float freq = 200.0f * (pow(2.0f, pitch) - powf(2.0f, -4.0f)); phase += freq * deltaTime; - while (phase >= 1.0) - phase -= 1.0; - - float sine = sinf(2 * M_PI * phase); - float cosn = cosf(2 * M_PI * phase); - outputs[SIN_OUTPUT].value = sine * 5; - outputs[COS_OUTPUT].value = cosn * 5; - outputs[PHS_OUTPUT].value = phase * 5; + while (phase >= 1.0f) + phase -= 1.0f; + + float sine = sin(2.0f * M_PI * phase); + float cosn = cos(2.0f * M_PI * phase); + outputs[SIN_OUTPUT].value = sine * 5.0f; + outputs[COS_OUTPUT].value = cosn * 5.0f; + outputs[PHS_OUTPUT].value = phase * 5.0f; } -- cgit v1.2.3