diff options
author | Chris Robinson <[email protected]> | 2013-10-08 16:31:23 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2013-10-08 16:31:23 -0700 |
commit | a421e515befd1916d57e7668ee98c1a5dfe63dab (patch) | |
tree | 68d69e41030ccfec34ac89175edec66e99b7660b /Alc/effects | |
parent | 11365b42c7fedaef61d7123c390c429260eae52f (diff) |
Use a helper macro for pi*2
Diffstat (limited to 'Alc/effects')
-rw-r--r-- | Alc/effects/autowah.c | 2 | ||||
-rw-r--r-- | Alc/effects/chorus.c | 7 | ||||
-rw-r--r-- | Alc/effects/distortion.c | 2 | ||||
-rw-r--r-- | Alc/effects/flanger.c | 7 | ||||
-rw-r--r-- | Alc/effects/modulator.c | 5 | ||||
-rw-r--r-- | Alc/effects/reverb.c | 4 |
6 files changed, 12 insertions, 15 deletions
diff --git a/Alc/effects/autowah.c b/Alc/effects/autowah.c index 9a3f8b94..29ec02af 100644 --- a/Alc/effects/autowah.c +++ b/Alc/effects/autowah.c @@ -111,7 +111,7 @@ static ALvoid ALautowahState_process(ALautowahState *state, ALuint SamplesToDo, if((state->lfo++) % 30 == 0) { /* Using custom low-pass filter coefficients, to handle the resonance and peak-gain properties. */ - frequency = (1.0f + cosf(state->lfo * (1.0f / lerp(1.0f, 4.0f, state->AttackTime * state->ReleaseTime)) * 2.0f * F_PI / state->Frequency)) / OCTAVE; + frequency = (1.0f + cosf(state->lfo * (1.0f / lerp(1.0f, 4.0f, state->AttackTime * state->ReleaseTime)) * F_2PI / state->Frequency)) / OCTAVE; frequency = expf((frequency - 1.0f) * 6.0f); /* computing cutoff frequency and peak gain */ diff --git a/Alc/effects/chorus.c b/Alc/effects/chorus.c index 9e74f8c8..4dbfc93d 100644 --- a/Alc/effects/chorus.c +++ b/Alc/effects/chorus.c @@ -122,7 +122,7 @@ static ALvoid ALchorusState_update(ALchorusState *state, ALCdevice *Device, cons if(rate == 0.0f) state->lfo_coeff = 0.0f; else - state->lfo_coeff = F_PI*2.0f / (frequency / rate); + state->lfo_coeff = F_2PI / (frequency / rate); break; } @@ -152,12 +152,11 @@ static inline void Sinusoid(ALint *delay_left, ALint *delay_right, ALint offset, { ALfloat lfo_value; - lfo_value = 1.0f + sinf(fmodf(state->lfo_coeff*offset, 2.0f*F_PI)); + lfo_value = 1.0f + sinf(fmodf(state->lfo_coeff*offset, F_2PI)); lfo_value *= state->depth * state->delay; *delay_left = fastf2i(lfo_value) + state->delay; - lfo_value = 1.0f + sinf(fmodf(state->lfo_coeff*(offset+state->lfo_disp), - 2.0f*F_PI)); + lfo_value = 1.0f + sinf(fmodf(state->lfo_coeff*(offset+state->lfo_disp), F_2PI)); lfo_value *= state->depth * state->delay; *delay_right = fastf2i(lfo_value) + state->delay; } diff --git a/Alc/effects/distortion.c b/Alc/effects/distortion.c index 7402f0af..e39a8197 100644 --- a/Alc/effects/distortion.c +++ b/Alc/effects/distortion.c @@ -64,7 +64,7 @@ static ALvoid ALdistortionState_update(ALdistortionState *state, ALCdevice *Devi state->attenuation = Slot->EffectProps.Distortion.Gain; /* Store waveshaper edge settings */ - edge = sinf(Slot->EffectProps.Distortion.Edge * (F_PI/2.0f)); + edge = sinf(Slot->EffectProps.Distortion.Edge * (F_PI_2)); edge = minf(edge, 0.99f); state->edge_coeff = 2.0f * edge / (1.0f-edge); diff --git a/Alc/effects/flanger.c b/Alc/effects/flanger.c index d3cdd250..78be5e42 100644 --- a/Alc/effects/flanger.c +++ b/Alc/effects/flanger.c @@ -122,7 +122,7 @@ static ALvoid ALflangerState_update(ALflangerState *state, ALCdevice *Device, co if(rate == 0.0f) state->lfo_coeff = 0.0f; else - state->lfo_coeff = F_PI * 2.0f / (frequency / rate); + state->lfo_coeff = F_2PI / (frequency / rate); break; } @@ -152,12 +152,11 @@ static inline void Sinusoid(ALint *delay_left, ALint *delay_right, ALint offset, { ALfloat lfo_value; - lfo_value = 1.0f + sinf(fmodf(state->lfo_coeff * offset, 2.0f*F_PI)); + lfo_value = 1.0f + sinf(fmodf(state->lfo_coeff * offset, F_2PI)); lfo_value *= state->depth * state->delay; *delay_left = fastf2i(lfo_value) + state->delay; - lfo_value = 1.0f + sinf(fmodf(state->lfo_coeff * (offset+state->lfo_disp), - 2.0f*F_PI)); + lfo_value = 1.0f + sinf(fmodf(state->lfo_coeff * (offset+state->lfo_disp), F_2PI)); lfo_value *= state->depth * state->delay; *delay_right = fastf2i(lfo_value) + state->delay; } diff --git a/Alc/effects/modulator.c b/Alc/effects/modulator.c index 4fdd1261..17ca7e17 100644 --- a/Alc/effects/modulator.c +++ b/Alc/effects/modulator.c @@ -53,7 +53,7 @@ typedef struct ALmodulatorState { static inline ALfloat Sin(ALuint index) { - return sinf(index * (F_PI*2.0f / WAVEFORM_FRACONE) - F_PI)*0.5f + 0.5f; + return sinf(index*(F_2PI/WAVEFORM_FRACONE) - F_PI)*0.5f + 0.5f; } static inline ALfloat Saw(ALuint index) @@ -139,8 +139,7 @@ static ALvoid ALmodulatorState_update(ALmodulatorState *state, ALCdevice *Device if(state->step == 0) state->step = 1; /* Custom filter coeffs, which match the old version instead of a low-shelf. */ - cw = cosf(F_PI*2.0f * Slot->EffectProps.Modulator.HighPassCutoff / - Device->Frequency); + cw = cosf(F_2PI * Slot->EffectProps.Modulator.HighPassCutoff / Device->Frequency); a = (2.0f-cw) - sqrtf(powf(2.0f-cw, 2.0f) - 1.0f); state->Filter.b[0] = a; diff --git a/Alc/effects/reverb.c b/Alc/effects/reverb.c index 77bf4a16..75ec76e3 100644 --- a/Alc/effects/reverb.c +++ b/Alc/effects/reverb.c @@ -266,7 +266,7 @@ static inline ALfloat EAXModulation(ALreverbState *State, ALfloat in) // Calculate the sinus rythm (dependent on modulation time and the // sampling rate). The center of the sinus is moved to reduce the delay // of the effect when the time or depth are low. - sinus = 1.0f - cosf(F_PI*2.0f * State->Mod.Index / State->Mod.Range); + sinus = 1.0f - cosf(F_2PI * State->Mod.Index / State->Mod.Range); // The depth determines the range over which to read the input samples // from, so it must be filtered to reduce the distortion caused by even @@ -1137,7 +1137,7 @@ static ALvoid ALreverbState_update(ALreverbState *State, ALCdevice *Device, cons Slot->EffectProps.Reverb.AirAbsorptionGainHF, Slot->EffectProps.Reverb.DecayTime); - cw = cosf(F_PI*2.0f * hfscale); + cw = cosf(F_2PI * hfscale); // Update the late lines. UpdateLateLines(Slot->EffectProps.Reverb.Gain, Slot->EffectProps.Reverb.LateReverbGain, x, Slot->EffectProps.Reverb.Density, Slot->EffectProps.Reverb.DecayTime, |