aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/effects/modulator.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-03-22 17:47:19 -0700
committerChris Robinson <[email protected]>2019-03-22 17:47:19 -0700
commitedc32b40a53c67971e6f62cf067a7e0b6ab5cee6 (patch)
tree9b39b8ce47c6df4b39fa1f45ce1cbe5a4a35f169 /Alc/effects/modulator.cpp
parentea8b02dead8f7b35f0fe2c2fa3b0aa0f8d258828 (diff)
Slightly improve casting in the modulator effect
Diffstat (limited to 'Alc/effects/modulator.cpp')
-rw-r--r--Alc/effects/modulator.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/Alc/effects/modulator.cpp b/Alc/effects/modulator.cpp
index 7e452792..46fe32a3 100644
--- a/Alc/effects/modulator.cpp
+++ b/Alc/effects/modulator.cpp
@@ -45,7 +45,8 @@ namespace {
inline ALfloat Sin(ALsizei index)
{
- return std::sin(static_cast<ALfloat>(index) * (al::MathDefs<float>::Tau() / static_cast<ALfloat>WAVEFORM_FRACONE));
+ return std::sin(static_cast<ALfloat>(index) *
+ (al::MathDefs<float>::Tau() / ALfloat{WAVEFORM_FRACONE}));
}
inline ALfloat Saw(ALsizei index)
@@ -111,8 +112,8 @@ void ModulatorState::update(const ALCcontext *context, const ALeffectslot *slot,
{
const ALCdevice *device{context->Device};
- mStep = fastf2i(props->Modulator.Frequency / static_cast<ALfloat>(device->Frequency) * WAVEFORM_FRACONE);
- mStep = clampi(mStep, 0, WAVEFORM_FRACONE-1);
+ const float step{props->Modulator.Frequency / static_cast<ALfloat>(device->Frequency)};
+ mStep = fastf2i(clampf(step*WAVEFORM_FRACONE, 0.0f, ALfloat{WAVEFORM_FRACONE-1}));
if(mStep == 0)
mGetSamples = Modulate<One>;