diff options
Diffstat (limited to 'Alc/effects')
-rw-r--r-- | Alc/effects/distortion.c | 16 | ||||
-rw-r--r-- | Alc/effects/echo.c | 10 | ||||
-rw-r--r-- | Alc/effects/equalizer.c | 28 | ||||
-rw-r--r-- | Alc/effects/modulator.c | 8 | ||||
-rw-r--r-- | Alc/effects/reverb.c | 24 |
5 files changed, 43 insertions, 43 deletions
diff --git a/Alc/effects/distortion.c b/Alc/effects/distortion.c index 09289175..aa06a0a3 100644 --- a/Alc/effects/distortion.c +++ b/Alc/effects/distortion.c @@ -37,8 +37,8 @@ typedef struct ALdistortionState { ALfloat Gain[MAX_OUTPUT_CHANNELS]; /* Effect parameters */ - ALfilterState lowpass; - ALfilterState bandpass; + BiquadState lowpass; + BiquadState bandpass; ALfloat attenuation; ALfloat edge_coeff; @@ -59,8 +59,8 @@ static void ALdistortionState_Construct(ALdistortionState *state) ALeffectState_Construct(STATIC_CAST(ALeffectState, state)); SET_VTABLE2(ALdistortionState, ALeffectState, state); - ALfilterState_clear(&state->lowpass); - ALfilterState_clear(&state->bandpass); + BiquadState_clear(&state->lowpass); + BiquadState_clear(&state->bandpass); } static ALvoid ALdistortionState_Destruct(ALdistortionState *state) @@ -93,14 +93,14 @@ static ALvoid ALdistortionState_update(ALdistortionState *state, const ALCcontex /* Multiply sampling frequency by the amount of oversampling done during * processing. */ - ALfilterState_setParams(&state->lowpass, ALfilterType_LowPass, 1.0f, + BiquadState_setParams(&state->lowpass, BiquadType_LowPass, 1.0f, cutoff / (frequency*4.0f), calc_rcpQ_from_bandwidth(cutoff / (frequency*4.0f), bandwidth) ); cutoff = props->Distortion.EQCenter; /* Convert bandwidth in Hz to octaves. */ bandwidth = props->Distortion.EQBandwidth / (cutoff * 0.67f); - ALfilterState_setParams(&state->bandpass, ALfilterType_BandPass, 1.0f, + BiquadState_setParams(&state->bandpass, BiquadType_BandPass, 1.0f, cutoff / (frequency*4.0f), calc_rcpQ_from_bandwidth(cutoff / (frequency*4.0f), bandwidth) ); @@ -136,7 +136,7 @@ static ALvoid ALdistortionState_process(ALdistortionState *state, ALsizei Sample * (which is fortunately first step of distortion). So combine three * operations into the one. */ - ALfilterState_process(&state->lowpass, buffer[1], buffer[0], todo); + BiquadState_process(&state->lowpass, buffer[1], buffer[0], todo); /* Second step, do distortion using waveshaper function to emulate * signal processing during tube overdriving. Three steps of @@ -155,7 +155,7 @@ static ALvoid ALdistortionState_process(ALdistortionState *state, ALsizei Sample } /* Third step, do bandpass filtering of distorted signal. */ - ALfilterState_process(&state->bandpass, buffer[1], buffer[0], todo); + BiquadState_process(&state->bandpass, buffer[1], buffer[0], todo); todo >>= 2; for(k = 0;k < NumChannels;k++) diff --git a/Alc/effects/echo.c b/Alc/effects/echo.c index 10e00f39..7d549768 100644 --- a/Alc/effects/echo.c +++ b/Alc/effects/echo.c @@ -52,7 +52,7 @@ typedef struct ALechoState { ALfloat FeedGain; - ALfilterState Filter; + BiquadState Filter; } ALechoState; static ALvoid ALechoState_Destruct(ALechoState *state); @@ -76,7 +76,7 @@ static void ALechoState_Construct(ALechoState *state) state->Tap[1].delay = 0; state->Offset = 0; - ALfilterState_clear(&state->Filter); + BiquadState_clear(&state->Filter); } static ALvoid ALechoState_Destruct(ALechoState *state) @@ -135,9 +135,9 @@ static ALvoid ALechoState_update(ALechoState *state, const ALCcontext *context, state->FeedGain = props->Echo.Feedback; gainhf = maxf(1.0f - props->Echo.Damping, 0.0625f); /* Limit -24dB */ - ALfilterState_setParams(&state->Filter, ALfilterType_HighShelf, - gainhf, LOWPASSFREQREF/frequency, - calc_rcpQ_from_slope(gainhf, 1.0f)); + BiquadState_setParams(&state->Filter, BiquadType_HighShelf, + gainhf, LOWPASSFREQREF/frequency, + calc_rcpQ_from_slope(gainhf, 1.0f)); /* First tap panning */ CalcAngleCoeffs(-F_PI_2*lrpan, 0.0f, spread, coeffs); diff --git a/Alc/effects/equalizer.c b/Alc/effects/equalizer.c index a5c65cee..3174511a 100644 --- a/Alc/effects/equalizer.c +++ b/Alc/effects/equalizer.c @@ -81,7 +81,7 @@ typedef struct ALequalizerState { ALfloat TargetGains[MAX_OUTPUT_CHANNELS]; /* Effect parameters */ - ALfilterState filter[4]; + BiquadState filter[4]; } Chans[MAX_EFFECT_CHANNELS]; ALfloat SampleBuffer[MAX_EFFECT_CHANNELS][BUFFERSIZE]; @@ -114,7 +114,7 @@ static ALboolean ALequalizerState_deviceUpdate(ALequalizerState *state, ALCdevic for(i = 0; i < MAX_EFFECT_CHANNELS;i++) { for(j = 0;j < 4;j++) - ALfilterState_clear(&state->Chans[i].filter[j]); + BiquadState_clear(&state->Chans[i].filter[j]); for(j = 0;j < MAX_OUTPUT_CHANNELS;j++) state->Chans[i].CurrentGains[j] = 0.0f; } @@ -140,13 +140,13 @@ static ALvoid ALequalizerState_update(ALequalizerState *state, const ALCcontext */ gain = maxf(sqrtf(props->Equalizer.LowGain), 0.0625f); /* Limit -24dB */ f0norm = props->Equalizer.LowCutoff/frequency; - ALfilterState_setParams(&state->Chans[0].filter[0], ALfilterType_LowShelf, + BiquadState_setParams(&state->Chans[0].filter[0], BiquadType_LowShelf, gain, f0norm, calc_rcpQ_from_slope(gain, 0.75f) ); gain = maxf(props->Equalizer.Mid1Gain, 0.0625f); f0norm = props->Equalizer.Mid1Center/frequency; - ALfilterState_setParams(&state->Chans[0].filter[1], ALfilterType_Peaking, + BiquadState_setParams(&state->Chans[0].filter[1], BiquadType_Peaking, gain, f0norm, calc_rcpQ_from_bandwidth( f0norm, props->Equalizer.Mid1Width ) @@ -154,7 +154,7 @@ static ALvoid ALequalizerState_update(ALequalizerState *state, const ALCcontext gain = maxf(props->Equalizer.Mid2Gain, 0.0625f); f0norm = props->Equalizer.Mid2Center/frequency; - ALfilterState_setParams(&state->Chans[0].filter[2], ALfilterType_Peaking, + BiquadState_setParams(&state->Chans[0].filter[2], BiquadType_Peaking, gain, f0norm, calc_rcpQ_from_bandwidth( f0norm, props->Equalizer.Mid2Width ) @@ -162,17 +162,17 @@ static ALvoid ALequalizerState_update(ALequalizerState *state, const ALCcontext gain = maxf(sqrtf(props->Equalizer.HighGain), 0.0625f); f0norm = props->Equalizer.HighCutoff/frequency; - ALfilterState_setParams(&state->Chans[0].filter[3], ALfilterType_HighShelf, + BiquadState_setParams(&state->Chans[0].filter[3], BiquadType_HighShelf, gain, f0norm, calc_rcpQ_from_slope(gain, 0.75f) ); /* Copy the filter coefficients for the other input channels. */ for(i = 1;i < MAX_EFFECT_CHANNELS;i++) { - ALfilterState_copyParams(&state->Chans[i].filter[0], &state->Chans[0].filter[0]); - ALfilterState_copyParams(&state->Chans[i].filter[1], &state->Chans[0].filter[1]); - ALfilterState_copyParams(&state->Chans[i].filter[2], &state->Chans[0].filter[2]); - ALfilterState_copyParams(&state->Chans[i].filter[3], &state->Chans[0].filter[3]); + BiquadState_copyParams(&state->Chans[i].filter[0], &state->Chans[0].filter[0]); + BiquadState_copyParams(&state->Chans[i].filter[1], &state->Chans[0].filter[1]); + BiquadState_copyParams(&state->Chans[i].filter[2], &state->Chans[0].filter[2]); + BiquadState_copyParams(&state->Chans[i].filter[3], &state->Chans[0].filter[3]); } } @@ -183,10 +183,10 @@ static ALvoid ALequalizerState_process(ALequalizerState *state, ALsizei SamplesT for(c = 0;c < MAX_EFFECT_CHANNELS;c++) { - ALfilterState_process(&state->Chans[c].filter[0], temps[0], SamplesIn[c], SamplesToDo); - ALfilterState_process(&state->Chans[c].filter[1], temps[1], temps[0], SamplesToDo); - ALfilterState_process(&state->Chans[c].filter[2], temps[2], temps[1], SamplesToDo); - ALfilterState_process(&state->Chans[c].filter[3], temps[3], temps[2], SamplesToDo); + BiquadState_process(&state->Chans[c].filter[0], temps[0], SamplesIn[c], SamplesToDo); + BiquadState_process(&state->Chans[c].filter[1], temps[1], temps[0], SamplesToDo); + BiquadState_process(&state->Chans[c].filter[2], temps[2], temps[1], SamplesToDo); + BiquadState_process(&state->Chans[c].filter[3], temps[3], temps[2], SamplesToDo); MixSamples(temps[3], NumChannels, SamplesOut, state->Chans[c].CurrentGains, state->Chans[c].TargetGains, diff --git a/Alc/effects/modulator.c b/Alc/effects/modulator.c index bf8e8fd7..7deb648d 100644 --- a/Alc/effects/modulator.c +++ b/Alc/effects/modulator.c @@ -43,7 +43,7 @@ typedef struct ALmodulatorState { alignas(16) ALfloat ModSamples[MAX_UPDATE_SAMPLES]; struct { - ALfilterState Filter; + BiquadState Filter; ALfloat CurrentGains[MAX_OUTPUT_CHANNELS]; ALfloat TargetGains[MAX_OUTPUT_CHANNELS]; @@ -117,7 +117,7 @@ static ALboolean ALmodulatorState_deviceUpdate(ALmodulatorState *state, ALCdevic ALsizei i, j; for(i = 0;i < MAX_EFFECT_CHANNELS;i++) { - ALfilterState_clear(&state->Chans[i].Filter); + BiquadState_clear(&state->Chans[i].Filter); for(j = 0;j < MAX_OUTPUT_CHANNELS;j++) state->Chans[i].CurrentGains[j] = 0.0f; } @@ -151,7 +151,7 @@ static ALvoid ALmodulatorState_update(ALmodulatorState *state, const ALCcontext state->Chans[0].Filter.a1 = -a; state->Chans[0].Filter.a2 = 0.0f; for(i = 1;i < MAX_EFFECT_CHANNELS;i++) - ALfilterState_copyParams(&state->Chans[i].Filter, &state->Chans[0].Filter); + BiquadState_copyParams(&state->Chans[i].Filter, &state->Chans[0].Filter); STATIC_CAST(ALeffectState,state)->OutBuffer = device->FOAOut.Buffer; STATIC_CAST(ALeffectState,state)->OutChannels = device->FOAOut.NumChannels; @@ -178,7 +178,7 @@ static ALvoid ALmodulatorState_process(ALmodulatorState *state, ALsizei SamplesT for(c = 0;c < MAX_EFFECT_CHANNELS;c++) { - ALfilterState_process(&state->Chans[c].Filter, temps[0], &SamplesIn[c][base], td); + BiquadState_process(&state->Chans[c].Filter, temps[0], &SamplesIn[c][base], td); for(i = 0;i < td;i++) temps[1][i] = temps[0][i] * modsamples[i]; diff --git a/Alc/effects/reverb.c b/Alc/effects/reverb.c index cd38b492..3c5e5e96 100644 --- a/Alc/effects/reverb.c +++ b/Alc/effects/reverb.c @@ -291,8 +291,8 @@ typedef struct ALreverbState { /* Master effect filters */ struct { - ALfilterState Lp; - ALfilterState Hp; + BiquadState Lp; + BiquadState Hp; } Filter[NUM_LINES]; /* Core delay line (early reflections and late reverb tap from this). */ @@ -349,8 +349,8 @@ static void ALreverbState_Construct(ALreverbState *state) for(i = 0;i < NUM_LINES;i++) { - ALfilterState_clear(&state->Filter[i].Lp); - ALfilterState_clear(&state->Filter[i].Hp); + BiquadState_clear(&state->Filter[i].Lp); + BiquadState_clear(&state->Filter[i].Hp); } state->Delay.Mask = 0; @@ -1160,16 +1160,16 @@ static ALvoid ALreverbState_update(ALreverbState *State, const ALCcontext *Conte * killing most of the signal. */ gainhf = maxf(props->Reverb.GainHF, 0.001f); - ALfilterState_setParams(&State->Filter[0].Lp, ALfilterType_HighShelf, - gainhf, hf0norm, calc_rcpQ_from_slope(gainhf, 1.0f)); + BiquadState_setParams(&State->Filter[0].Lp, BiquadType_HighShelf, gainhf, hf0norm, + calc_rcpQ_from_slope(gainhf, 1.0f)); lf0norm = props->Reverb.LFReference / frequency; gainlf = maxf(props->Reverb.GainLF, 0.001f); - ALfilterState_setParams(&State->Filter[0].Hp, ALfilterType_LowShelf, - gainlf, lf0norm, calc_rcpQ_from_slope(gainlf, 1.0f)); + BiquadState_setParams(&State->Filter[0].Hp, BiquadType_LowShelf, gainlf, lf0norm, + calc_rcpQ_from_slope(gainlf, 1.0f)); for(i = 1;i < NUM_LINES;i++) { - ALfilterState_copyParams(&State->Filter[i].Lp, &State->Filter[0].Lp); - ALfilterState_copyParams(&State->Filter[i].Hp, &State->Filter[0].Hp); + BiquadState_copyParams(&State->Filter[i].Lp, &State->Filter[0].Lp); + BiquadState_copyParams(&State->Filter[i].Hp, &State->Filter[0].Hp); } /* Update the main effect delay and associated taps. */ @@ -1552,8 +1552,8 @@ static ALvoid ALreverbState_process(ALreverbState *State, ALsizei SamplesToDo, c /* Band-pass the incoming samples. Use the early output lines for * temp storage. */ - ALfilterState_process(&State->Filter[c].Lp, early[0], afmt[c], todo); - ALfilterState_process(&State->Filter[c].Hp, early[1], early[0], todo); + BiquadState_process(&State->Filter[c].Lp, early[0], afmt[c], todo); + BiquadState_process(&State->Filter[c].Hp, early[1], early[0], todo); /* Feed the initial delay line. */ DelayLineIn(&State->Delay, State->Offset, c, early[1], todo); |