diff options
Diffstat (limited to 'Alc/effects/vmorpher.cpp')
-rw-r--r-- | Alc/effects/vmorpher.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/Alc/effects/vmorpher.cpp b/Alc/effects/vmorpher.cpp index dc402aaf..6f7e22ae 100644 --- a/Alc/effects/vmorpher.cpp +++ b/Alc/effects/vmorpher.cpp @@ -47,22 +47,21 @@ namespace { inline ALfloat Sin(ALsizei index) { - return (std::sin(static_cast<ALfloat>(index) * - (al::MathDefs<float>::Tau() / ALfloat{WAVEFORM_FRACONE})))*0.5f+0.5f; + constexpr ALfloat scale{al::MathDefs<float>::Tau() / ALfloat{WAVEFORM_FRACONE}}; + return std::sin(static_cast<ALfloat>(index) * scale)*0.5f + 0.5f; } inline ALfloat Saw(ALsizei index) { - return (static_cast<ALfloat>(index)*(2.0f/WAVEFORM_FRACONE) - 1.0f)*0.5f+0.5f; + return static_cast<ALfloat>(index) / ALfloat{WAVEFORM_FRACONE}; } inline ALfloat Triangle(ALsizei index) { - return (std::fabs(static_cast<ALfloat>(index) * (al::MathDefs<float>::Tau() / WAVEFORM_FRACONE) - - al::MathDefs<float>::Pi()) / al::MathDefs<float>::Pi())*0.5f+0.5f; + return std::fabs(static_cast<ALfloat>(index)*(2.0f/WAVEFORM_FRACONE) - 1.0f); } -inline ALfloat Half(ALsizei UNUSED(index)) +inline ALfloat Half(ALsizei) { return 0.5f; } |