diff options
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/ALu.c | 32 | ||||
-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 | ||||
-rw-r--r-- | Alc/filters/defs.h | 32 | ||||
-rw-r--r-- | Alc/filters/filter.c | 22 | ||||
-rw-r--r-- | Alc/mixvoice.c | 18 |
9 files changed, 95 insertions, 95 deletions
@@ -1070,20 +1070,20 @@ static void CalcPanningAndFilters(ALvoice *voice, const ALfloat Distance, const voice->Direct.FilterType = AF_None; if(gainHF != 1.0f) voice->Direct.FilterType |= AF_LowPass; if(gainLF != 1.0f) voice->Direct.FilterType |= AF_HighPass; - ALfilterState_setParams( - &voice->Direct.Params[0].LowPass, ALfilterType_HighShelf, + BiquadState_setParams( + &voice->Direct.Params[0].LowPass, BiquadType_HighShelf, gainHF, hfScale, calc_rcpQ_from_slope(gainHF, 1.0f) ); - ALfilterState_setParams( - &voice->Direct.Params[0].HighPass, ALfilterType_LowShelf, + BiquadState_setParams( + &voice->Direct.Params[0].HighPass, BiquadType_LowShelf, gainLF, lfScale, calc_rcpQ_from_slope(gainLF, 1.0f) ); for(c = 1;c < num_channels;c++) { - ALfilterState_copyParams(&voice->Direct.Params[c].LowPass, - &voice->Direct.Params[0].LowPass); - ALfilterState_copyParams(&voice->Direct.Params[c].HighPass, - &voice->Direct.Params[0].HighPass); + BiquadState_copyParams(&voice->Direct.Params[c].LowPass, + &voice->Direct.Params[0].LowPass); + BiquadState_copyParams(&voice->Direct.Params[c].HighPass, + &voice->Direct.Params[0].HighPass); } } for(i = 0;i < NumSends;i++) @@ -1096,20 +1096,20 @@ static void CalcPanningAndFilters(ALvoice *voice, const ALfloat Distance, const voice->Send[i].FilterType = AF_None; if(gainHF != 1.0f) voice->Send[i].FilterType |= AF_LowPass; if(gainLF != 1.0f) voice->Send[i].FilterType |= AF_HighPass; - ALfilterState_setParams( - &voice->Send[i].Params[0].LowPass, ALfilterType_HighShelf, + BiquadState_setParams( + &voice->Send[i].Params[0].LowPass, BiquadType_HighShelf, gainHF, hfScale, calc_rcpQ_from_slope(gainHF, 1.0f) ); - ALfilterState_setParams( - &voice->Send[i].Params[0].HighPass, ALfilterType_LowShelf, + BiquadState_setParams( + &voice->Send[i].Params[0].HighPass, BiquadType_LowShelf, gainLF, lfScale, calc_rcpQ_from_slope(gainLF, 1.0f) ); for(c = 1;c < num_channels;c++) { - ALfilterState_copyParams(&voice->Send[i].Params[c].LowPass, - &voice->Send[i].Params[0].LowPass); - ALfilterState_copyParams(&voice->Send[i].Params[c].HighPass, - &voice->Send[i].Params[0].HighPass); + BiquadState_copyParams(&voice->Send[i].Params[c].LowPass, + &voice->Send[i].Params[0].LowPass); + BiquadState_copyParams(&voice->Send[i].Params[c].HighPass, + &voice->Send[i].Params[0].HighPass); } } } 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); diff --git a/Alc/filters/defs.h b/Alc/filters/defs.h index f4e1e62c..c26427fb 100644 --- a/Alc/filters/defs.h +++ b/Alc/filters/defs.h @@ -14,30 +14,30 @@ * the square root of the desired linear gain (or halve the dB gain). */ -typedef enum ALfilterType { +typedef enum BiquadType { /** EFX-style low-pass filter, specifying a gain and reference frequency. */ - ALfilterType_HighShelf, + BiquadType_HighShelf, /** EFX-style high-pass filter, specifying a gain and reference frequency. */ - ALfilterType_LowShelf, + BiquadType_LowShelf, /** Peaking filter, specifying a gain and reference frequency. */ - ALfilterType_Peaking, + BiquadType_Peaking, /** Low-pass cut-off filter, specifying a cut-off frequency. */ - ALfilterType_LowPass, + BiquadType_LowPass, /** High-pass cut-off filter, specifying a cut-off frequency. */ - ALfilterType_HighPass, + BiquadType_HighPass, /** Band-pass filter, specifying a center frequency. */ - ALfilterType_BandPass, -} ALfilterType; + BiquadType_BandPass, +} BiquadType; -typedef struct ALfilterState { +typedef struct BiquadState { ALfloat x[2]; /* History of two last input samples */ ALfloat y[2]; /* History of two last output samples */ ALfloat b0, b1, b2; /* Transfer function coefficients "b" */ ALfloat a1, a2; /* Transfer function coefficients "a" (a0 is pre-applied) */ -} ALfilterState; +} BiquadState; /* Currently only a C-based filter process method is implemented. */ -#define ALfilterState_process ALfilterState_processC +#define BiquadState_process BiquadState_processC /** * Calculates the rcpQ (i.e. 1/Q) coefficient for shelving filters, using the @@ -61,7 +61,7 @@ inline ALfloat calc_rcpQ_from_bandwidth(ALfloat f0norm, ALfloat bandwidth) return 2.0f*sinhf(logf(2.0f)/2.0f*bandwidth*w0/sinf(w0)); } -inline void ALfilterState_clear(ALfilterState *filter) +inline void BiquadState_clear(BiquadState *filter) { filter->x[0] = 0.0f; filter->x[1] = 0.0f; @@ -84,9 +84,9 @@ inline void ALfilterState_clear(ALfilterState *filter) * band. Can be generated from calc_rcpQ_from_slope or * calc_rcpQ_from_bandwidth depending on the available data. */ -void ALfilterState_setParams(ALfilterState *filter, ALfilterType type, ALfloat gain, ALfloat f0norm, ALfloat rcpQ); +void BiquadState_setParams(BiquadState *filter, BiquadType type, ALfloat gain, ALfloat f0norm, ALfloat rcpQ); -inline void ALfilterState_copyParams(ALfilterState *restrict dst, const ALfilterState *restrict src) +inline void BiquadState_copyParams(BiquadState *restrict dst, const BiquadState *restrict src) { dst->b0 = src->b0; dst->b1 = src->b1; @@ -95,9 +95,9 @@ inline void ALfilterState_copyParams(ALfilterState *restrict dst, const ALfilter dst->a2 = src->a2; } -void ALfilterState_processC(ALfilterState *filter, ALfloat *restrict dst, const ALfloat *restrict src, ALsizei numsamples); +void BiquadState_processC(BiquadState *filter, ALfloat *restrict dst, const ALfloat *restrict src, ALsizei numsamples); -inline void ALfilterState_processPassthru(ALfilterState *filter, const ALfloat *restrict src, ALsizei numsamples) +inline void BiquadState_processPassthru(BiquadState *filter, const ALfloat *restrict src, ALsizei numsamples) { if(numsamples >= 2) { diff --git a/Alc/filters/filter.c b/Alc/filters/filter.c index 1cf18f08..4d757be7 100644 --- a/Alc/filters/filter.c +++ b/Alc/filters/filter.c @@ -7,14 +7,14 @@ #include "alMain.h" #include "defs.h" -extern inline void ALfilterState_clear(ALfilterState *filter); -extern inline void ALfilterState_copyParams(ALfilterState *restrict dst, const ALfilterState *restrict src); -extern inline void ALfilterState_processPassthru(ALfilterState *filter, const ALfloat *restrict src, ALsizei numsamples); +extern inline void BiquadState_clear(BiquadState *filter); +extern inline void BiquadState_copyParams(BiquadState *restrict dst, const BiquadState *restrict src); +extern inline void BiquadState_processPassthru(BiquadState *filter, const ALfloat *restrict src, ALsizei numsamples); extern inline ALfloat calc_rcpQ_from_slope(ALfloat gain, ALfloat slope); extern inline ALfloat calc_rcpQ_from_bandwidth(ALfloat f0norm, ALfloat bandwidth); -void ALfilterState_setParams(ALfilterState *filter, ALfilterType type, ALfloat gain, ALfloat f0norm, ALfloat rcpQ) +void BiquadState_setParams(BiquadState *filter, BiquadType type, ALfloat gain, ALfloat f0norm, ALfloat rcpQ) { ALfloat alpha, sqrtgain_alpha_2; ALfloat w0, sin_w0, cos_w0; @@ -32,7 +32,7 @@ void ALfilterState_setParams(ALfilterState *filter, ALfilterType type, ALfloat g /* Calculate filter coefficients depending on filter type */ switch(type) { - case ALfilterType_HighShelf: + case BiquadType_HighShelf: sqrtgain_alpha_2 = 2.0f * sqrtf(gain) * alpha; b[0] = gain*((gain+1.0f) + (gain-1.0f)*cos_w0 + sqrtgain_alpha_2); b[1] = -2.0f*gain*((gain-1.0f) + (gain+1.0f)*cos_w0 ); @@ -41,7 +41,7 @@ void ALfilterState_setParams(ALfilterState *filter, ALfilterType type, ALfloat g a[1] = 2.0f* ((gain-1.0f) - (gain+1.0f)*cos_w0 ); a[2] = (gain+1.0f) - (gain-1.0f)*cos_w0 - sqrtgain_alpha_2; break; - case ALfilterType_LowShelf: + case BiquadType_LowShelf: sqrtgain_alpha_2 = 2.0f * sqrtf(gain) * alpha; b[0] = gain*((gain+1.0f) - (gain-1.0f)*cos_w0 + sqrtgain_alpha_2); b[1] = 2.0f*gain*((gain-1.0f) - (gain+1.0f)*cos_w0 ); @@ -50,7 +50,7 @@ void ALfilterState_setParams(ALfilterState *filter, ALfilterType type, ALfloat g a[1] = -2.0f* ((gain-1.0f) + (gain+1.0f)*cos_w0 ); a[2] = (gain+1.0f) + (gain-1.0f)*cos_w0 - sqrtgain_alpha_2; break; - case ALfilterType_Peaking: + case BiquadType_Peaking: gain = sqrtf(gain); b[0] = 1.0f + alpha * gain; b[1] = -2.0f * cos_w0; @@ -60,7 +60,7 @@ void ALfilterState_setParams(ALfilterState *filter, ALfilterType type, ALfloat g a[2] = 1.0f - alpha / gain; break; - case ALfilterType_LowPass: + case BiquadType_LowPass: b[0] = (1.0f - cos_w0) / 2.0f; b[1] = 1.0f - cos_w0; b[2] = (1.0f - cos_w0) / 2.0f; @@ -68,7 +68,7 @@ void ALfilterState_setParams(ALfilterState *filter, ALfilterType type, ALfloat g a[1] = -2.0f * cos_w0; a[2] = 1.0f - alpha; break; - case ALfilterType_HighPass: + case BiquadType_HighPass: b[0] = (1.0f + cos_w0) / 2.0f; b[1] = -(1.0f + cos_w0); b[2] = (1.0f + cos_w0) / 2.0f; @@ -76,7 +76,7 @@ void ALfilterState_setParams(ALfilterState *filter, ALfilterType type, ALfloat g a[1] = -2.0f * cos_w0; a[2] = 1.0f - alpha; break; - case ALfilterType_BandPass: + case BiquadType_BandPass: b[0] = alpha; b[1] = 0; b[2] = -alpha; @@ -94,7 +94,7 @@ void ALfilterState_setParams(ALfilterState *filter, ALfilterType type, ALfloat g } -void ALfilterState_processC(ALfilterState *filter, ALfloat *restrict dst, const ALfloat *restrict src, ALsizei numsamples) +void BiquadState_processC(BiquadState *filter, ALfloat *restrict dst, const ALfloat *restrict src, ALsizei numsamples) { ALsizei i; if(LIKELY(numsamples > 1)) diff --git a/Alc/mixvoice.c b/Alc/mixvoice.c index 0e039115..a9d12821 100644 --- a/Alc/mixvoice.c +++ b/Alc/mixvoice.c @@ -263,7 +263,7 @@ static void LoadSamples(ALfloat *restrict dst, const ALvoid *restrict src, ALint } -static const ALfloat *DoFilters(ALfilterState *lpfilter, ALfilterState *hpfilter, +static const ALfloat *DoFilters(BiquadState *lpfilter, BiquadState *hpfilter, ALfloat *restrict dst, const ALfloat *restrict src, ALsizei numsamples, enum ActiveFilters type) { @@ -271,17 +271,17 @@ static const ALfloat *DoFilters(ALfilterState *lpfilter, ALfilterState *hpfilter switch(type) { case AF_None: - ALfilterState_processPassthru(lpfilter, src, numsamples); - ALfilterState_processPassthru(hpfilter, src, numsamples); + BiquadState_processPassthru(lpfilter, src, numsamples); + BiquadState_processPassthru(hpfilter, src, numsamples); break; case AF_LowPass: - ALfilterState_process(lpfilter, dst, src, numsamples); - ALfilterState_processPassthru(hpfilter, dst, numsamples); + BiquadState_process(lpfilter, dst, src, numsamples); + BiquadState_processPassthru(hpfilter, dst, numsamples); return dst; case AF_HighPass: - ALfilterState_processPassthru(lpfilter, src, numsamples); - ALfilterState_process(hpfilter, dst, src, numsamples); + BiquadState_processPassthru(lpfilter, src, numsamples); + BiquadState_process(hpfilter, dst, src, numsamples); return dst; case AF_BandPass: @@ -290,8 +290,8 @@ static const ALfloat *DoFilters(ALfilterState *lpfilter, ALfilterState *hpfilter ALfloat temp[256]; ALsizei todo = mini(256, numsamples-i); - ALfilterState_process(lpfilter, temp, src+i, todo); - ALfilterState_process(hpfilter, dst+i, temp, todo); + BiquadState_process(lpfilter, temp, src+i, todo); + BiquadState_process(hpfilter, dst+i, temp, todo); i += todo; } return dst; |