aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/effects/distortion.c
diff options
context:
space:
mode:
Diffstat (limited to 'Alc/effects/distortion.c')
-rw-r--r--Alc/effects/distortion.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/Alc/effects/distortion.c b/Alc/effects/distortion.c
index aa06a0a3..f4e9969c 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 */
- BiquadState lowpass;
- BiquadState bandpass;
+ BiquadFilter lowpass;
+ BiquadFilter bandpass;
ALfloat attenuation;
ALfloat edge_coeff;
@@ -58,9 +58,6 @@ static void ALdistortionState_Construct(ALdistortionState *state)
{
ALeffectState_Construct(STATIC_CAST(ALeffectState, state));
SET_VTABLE2(ALdistortionState, ALeffectState, state);
-
- BiquadState_clear(&state->lowpass);
- BiquadState_clear(&state->bandpass);
}
static ALvoid ALdistortionState_Destruct(ALdistortionState *state)
@@ -68,8 +65,10 @@ static ALvoid ALdistortionState_Destruct(ALdistortionState *state)
ALeffectState_Destruct(STATIC_CAST(ALeffectState,state));
}
-static ALboolean ALdistortionState_deviceUpdate(ALdistortionState *UNUSED(state), ALCdevice *UNUSED(device))
+static ALboolean ALdistortionState_deviceUpdate(ALdistortionState *state, ALCdevice *UNUSED(device))
{
+ BiquadFilter_clear(&state->lowpass);
+ BiquadFilter_clear(&state->bandpass);
return AL_TRUE;
}
@@ -93,14 +92,14 @@ static ALvoid ALdistortionState_update(ALdistortionState *state, const ALCcontex
/* Multiply sampling frequency by the amount of oversampling done during
* processing.
*/
- BiquadState_setParams(&state->lowpass, BiquadType_LowPass, 1.0f,
+ BiquadFilter_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);
- BiquadState_setParams(&state->bandpass, BiquadType_BandPass, 1.0f,
+ BiquadFilter_setParams(&state->bandpass, BiquadType_BandPass, 1.0f,
cutoff / (frequency*4.0f), calc_rcpQ_from_bandwidth(cutoff / (frequency*4.0f), bandwidth)
);
@@ -136,7 +135,7 @@ static ALvoid ALdistortionState_process(ALdistortionState *state, ALsizei Sample
* (which is fortunately first step of distortion). So combine three
* operations into the one.
*/
- BiquadState_process(&state->lowpass, buffer[1], buffer[0], todo);
+ BiquadFilter_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 +154,7 @@ static ALvoid ALdistortionState_process(ALdistortionState *state, ALsizei Sample
}
/* Third step, do bandpass filtering of distorted signal. */
- BiquadState_process(&state->bandpass, buffer[1], buffer[0], todo);
+ BiquadFilter_process(&state->bandpass, buffer[1], buffer[0], todo);
todo >>= 2;
for(k = 0;k < NumChannels;k++)