Rename BiquadState to BiquadFilter
This commit is contained in:
parent
b1fe405861
commit
9c5307a48a
24
Alc/ALu.c
24
Alc/ALu.c
@ -1017,20 +1017,20 @@ static void CalcPanningAndFilters(ALvoice *voice, const ALfloat Azi, const ALflo
|
||||
voice->Direct.FilterType = AF_None;
|
||||
if(gainHF != 1.0f) voice->Direct.FilterType |= AF_LowPass;
|
||||
if(gainLF != 1.0f) voice->Direct.FilterType |= AF_HighPass;
|
||||
BiquadState_setParams(
|
||||
BiquadFilter_setParams(
|
||||
&voice->Direct.Params[0].LowPass, BiquadType_HighShelf,
|
||||
gainHF, hfScale, calc_rcpQ_from_slope(gainHF, 1.0f)
|
||||
);
|
||||
BiquadState_setParams(
|
||||
BiquadFilter_setParams(
|
||||
&voice->Direct.Params[0].HighPass, BiquadType_LowShelf,
|
||||
gainLF, lfScale, calc_rcpQ_from_slope(gainLF, 1.0f)
|
||||
);
|
||||
for(c = 1;c < num_channels;c++)
|
||||
{
|
||||
BiquadState_copyParams(&voice->Direct.Params[c].LowPass,
|
||||
&voice->Direct.Params[0].LowPass);
|
||||
BiquadState_copyParams(&voice->Direct.Params[c].HighPass,
|
||||
&voice->Direct.Params[0].HighPass);
|
||||
BiquadFilter_copyParams(&voice->Direct.Params[c].LowPass,
|
||||
&voice->Direct.Params[0].LowPass);
|
||||
BiquadFilter_copyParams(&voice->Direct.Params[c].HighPass,
|
||||
&voice->Direct.Params[0].HighPass);
|
||||
}
|
||||
}
|
||||
for(i = 0;i < NumSends;i++)
|
||||
@ -1043,20 +1043,20 @@ static void CalcPanningAndFilters(ALvoice *voice, const ALfloat Azi, const ALflo
|
||||
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;
|
||||
BiquadState_setParams(
|
||||
BiquadFilter_setParams(
|
||||
&voice->Send[i].Params[0].LowPass, BiquadType_HighShelf,
|
||||
gainHF, hfScale, calc_rcpQ_from_slope(gainHF, 1.0f)
|
||||
);
|
||||
BiquadState_setParams(
|
||||
BiquadFilter_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++)
|
||||
{
|
||||
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);
|
||||
BiquadFilter_copyParams(&voice->Send[i].Params[c].LowPass,
|
||||
&voice->Send[i].Params[0].LowPass);
|
||||
BiquadFilter_copyParams(&voice->Send[i].Params[c].HighPass,
|
||||
&voice->Send[i].Params[0].HighPass);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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++)
|
||||
|
@ -52,7 +52,7 @@ typedef struct ALechoState {
|
||||
|
||||
ALfloat FeedGain;
|
||||
|
||||
BiquadState Filter;
|
||||
BiquadFilter 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;
|
||||
|
||||
BiquadState_clear(&state->Filter);
|
||||
BiquadFilter_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 */
|
||||
BiquadState_setParams(&state->Filter, BiquadType_HighShelf,
|
||||
gainhf, LOWPASSFREQREF/frequency,
|
||||
calc_rcpQ_from_slope(gainhf, 1.0f));
|
||||
BiquadFilter_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);
|
||||
|
@ -81,7 +81,7 @@ typedef struct ALequalizerState {
|
||||
ALfloat TargetGains[MAX_OUTPUT_CHANNELS];
|
||||
|
||||
/* Effect parameters */
|
||||
BiquadState filter[4];
|
||||
BiquadFilter 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++)
|
||||
BiquadState_clear(&state->Chans[i].filter[j]);
|
||||
BiquadFilter_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;
|
||||
BiquadState_setParams(&state->Chans[0].filter[0], BiquadType_LowShelf,
|
||||
BiquadFilter_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;
|
||||
BiquadState_setParams(&state->Chans[0].filter[1], BiquadType_Peaking,
|
||||
BiquadFilter_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;
|
||||
BiquadState_setParams(&state->Chans[0].filter[2], BiquadType_Peaking,
|
||||
BiquadFilter_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;
|
||||
BiquadState_setParams(&state->Chans[0].filter[3], BiquadType_HighShelf,
|
||||
BiquadFilter_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++)
|
||||
{
|
||||
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]);
|
||||
BiquadFilter_copyParams(&state->Chans[i].filter[0], &state->Chans[0].filter[0]);
|
||||
BiquadFilter_copyParams(&state->Chans[i].filter[1], &state->Chans[0].filter[1]);
|
||||
BiquadFilter_copyParams(&state->Chans[i].filter[2], &state->Chans[0].filter[2]);
|
||||
BiquadFilter_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++)
|
||||
{
|
||||
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);
|
||||
BiquadFilter_process(&state->Chans[c].filter[0], temps[0], SamplesIn[c], SamplesToDo);
|
||||
BiquadFilter_process(&state->Chans[c].filter[1], temps[1], temps[0], SamplesToDo);
|
||||
BiquadFilter_process(&state->Chans[c].filter[2], temps[2], temps[1], SamplesToDo);
|
||||
BiquadFilter_process(&state->Chans[c].filter[3], temps[3], temps[2], SamplesToDo);
|
||||
|
||||
MixSamples(temps[3], NumChannels, SamplesOut,
|
||||
state->Chans[c].CurrentGains, state->Chans[c].TargetGains,
|
||||
|
@ -43,7 +43,7 @@ typedef struct ALmodulatorState {
|
||||
alignas(16) ALfloat ModSamples[MAX_UPDATE_SAMPLES];
|
||||
|
||||
struct {
|
||||
BiquadState Filter;
|
||||
BiquadFilter 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++)
|
||||
{
|
||||
BiquadState_clear(&state->Chans[i].Filter);
|
||||
BiquadFilter_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++)
|
||||
BiquadState_copyParams(&state->Chans[i].Filter, &state->Chans[0].Filter);
|
||||
BiquadFilter_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++)
|
||||
{
|
||||
BiquadState_process(&state->Chans[c].Filter, temps[0], &SamplesIn[c][base], td);
|
||||
BiquadFilter_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];
|
||||
|
||||
|
@ -289,8 +289,8 @@ typedef struct ALreverbState {
|
||||
|
||||
/* Master effect filters */
|
||||
struct {
|
||||
BiquadState Lp;
|
||||
BiquadState Hp;
|
||||
BiquadFilter Lp;
|
||||
BiquadFilter Hp;
|
||||
} Filter[NUM_LINES];
|
||||
|
||||
/* Core delay line (early reflections and late reverb tap from this). */
|
||||
@ -347,8 +347,8 @@ static void ALreverbState_Construct(ALreverbState *state)
|
||||
|
||||
for(i = 0;i < NUM_LINES;i++)
|
||||
{
|
||||
BiquadState_clear(&state->Filter[i].Lp);
|
||||
BiquadState_clear(&state->Filter[i].Hp);
|
||||
BiquadFilter_clear(&state->Filter[i].Lp);
|
||||
BiquadFilter_clear(&state->Filter[i].Hp);
|
||||
}
|
||||
|
||||
state->Delay.Mask = 0;
|
||||
@ -1156,16 +1156,16 @@ static ALvoid ALreverbState_update(ALreverbState *State, const ALCcontext *Conte
|
||||
* killing most of the signal.
|
||||
*/
|
||||
gainhf = maxf(props->Reverb.GainHF, 0.001f);
|
||||
BiquadState_setParams(&State->Filter[0].Lp, BiquadType_HighShelf, gainhf, hf0norm,
|
||||
calc_rcpQ_from_slope(gainhf, 1.0f));
|
||||
BiquadFilter_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);
|
||||
BiquadState_setParams(&State->Filter[0].Hp, BiquadType_LowShelf, gainlf, lf0norm,
|
||||
calc_rcpQ_from_slope(gainlf, 1.0f));
|
||||
BiquadFilter_setParams(&State->Filter[0].Hp, BiquadType_LowShelf, gainlf, lf0norm,
|
||||
calc_rcpQ_from_slope(gainlf, 1.0f));
|
||||
for(i = 1;i < NUM_LINES;i++)
|
||||
{
|
||||
BiquadState_copyParams(&State->Filter[i].Lp, &State->Filter[0].Lp);
|
||||
BiquadState_copyParams(&State->Filter[i].Hp, &State->Filter[0].Hp);
|
||||
BiquadFilter_copyParams(&State->Filter[i].Lp, &State->Filter[0].Lp);
|
||||
BiquadFilter_copyParams(&State->Filter[i].Hp, &State->Filter[0].Hp);
|
||||
}
|
||||
|
||||
/* Update the main effect delay and associated taps. */
|
||||
@ -1547,8 +1547,8 @@ static ALvoid ALreverbState_process(ALreverbState *State, ALsizei SamplesToDo, c
|
||||
/* Band-pass the incoming samples. Use the early output lines for
|
||||
* temp storage.
|
||||
*/
|
||||
BiquadState_process(&State->Filter[c].Lp, early[0], afmt[c], todo);
|
||||
BiquadState_process(&State->Filter[c].Hp, early[1], early[0], todo);
|
||||
BiquadFilter_process(&State->Filter[c].Lp, early[0], afmt[c], todo);
|
||||
BiquadFilter_process(&State->Filter[c].Hp, early[1], early[0], todo);
|
||||
|
||||
/* Feed the initial delay line. */
|
||||
DelayLineIn(&State->Delay, State->Offset, c, early[1], todo);
|
||||
|
@ -30,14 +30,14 @@ typedef enum BiquadType {
|
||||
BiquadType_BandPass,
|
||||
} BiquadType;
|
||||
|
||||
typedef struct BiquadState {
|
||||
typedef struct BiquadFilter {
|
||||
ALfloat z1, z2; /* Last two delayed components for direct form II. */
|
||||
ALfloat b0, b1, b2; /* Transfer function coefficients "b" (numerator) */
|
||||
ALfloat a1, a2; /* Transfer function coefficients "a" (denominator; a0 is
|
||||
* pre-applied). */
|
||||
} BiquadState;
|
||||
} BiquadFilter;
|
||||
/* Currently only a C-based filter process method is implemented. */
|
||||
#define BiquadState_process BiquadState_processC
|
||||
#define BiquadFilter_process BiquadFilter_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 BiquadState_clear(BiquadState *filter)
|
||||
inline void BiquadFilter_clear(BiquadFilter *filter)
|
||||
{
|
||||
filter->z1 = 0.0f;
|
||||
filter->z2 = 0.0f;
|
||||
@ -82,9 +82,9 @@ inline void BiquadState_clear(BiquadState *filter)
|
||||
* band. Can be generated from calc_rcpQ_from_slope or
|
||||
* calc_rcpQ_from_bandwidth depending on the available data.
|
||||
*/
|
||||
void BiquadState_setParams(BiquadState *filter, BiquadType type, ALfloat gain, ALfloat f0norm, ALfloat rcpQ);
|
||||
void BiquadFilter_setParams(BiquadFilter *filter, BiquadType type, ALfloat gain, ALfloat f0norm, ALfloat rcpQ);
|
||||
|
||||
inline void BiquadState_copyParams(BiquadState *restrict dst, const BiquadState *restrict src)
|
||||
inline void BiquadFilter_copyParams(BiquadFilter *restrict dst, const BiquadFilter *restrict src)
|
||||
{
|
||||
dst->b0 = src->b0;
|
||||
dst->b1 = src->b1;
|
||||
@ -93,9 +93,9 @@ inline void BiquadState_copyParams(BiquadState *restrict dst, const BiquadState
|
||||
dst->a2 = src->a2;
|
||||
}
|
||||
|
||||
void BiquadState_processC(BiquadState *filter, ALfloat *restrict dst, const ALfloat *restrict src, ALsizei numsamples);
|
||||
void BiquadFilter_processC(BiquadFilter *filter, ALfloat *restrict dst, const ALfloat *restrict src, ALsizei numsamples);
|
||||
|
||||
inline void BiquadState_processPassthru(BiquadState *filter, ALsizei numsamples)
|
||||
inline void BiquadFilter_passthru(BiquadFilter *filter, ALsizei numsamples)
|
||||
{
|
||||
if(LIKELY(numsamples >= 2))
|
||||
{
|
||||
|
@ -7,14 +7,14 @@
|
||||
#include "alMain.h"
|
||||
#include "defs.h"
|
||||
|
||||
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, ALsizei numsamples);
|
||||
extern inline void BiquadFilter_clear(BiquadFilter *filter);
|
||||
extern inline void BiquadFilter_copyParams(BiquadFilter *restrict dst, const BiquadFilter *restrict src);
|
||||
extern inline void BiquadFilter_passthru(BiquadFilter *filter, 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 BiquadState_setParams(BiquadState *filter, BiquadType type, ALfloat gain, ALfloat f0norm, ALfloat rcpQ)
|
||||
void BiquadFilter_setParams(BiquadFilter *filter, BiquadType type, ALfloat gain, ALfloat f0norm, ALfloat rcpQ)
|
||||
{
|
||||
ALfloat alpha, sqrtgain_alpha_2;
|
||||
ALfloat w0, sin_w0, cos_w0;
|
||||
@ -94,7 +94,7 @@ void BiquadState_setParams(BiquadState *filter, BiquadType type, ALfloat gain, A
|
||||
}
|
||||
|
||||
|
||||
void BiquadState_processC(BiquadState *filter, ALfloat *restrict dst, const ALfloat *restrict src, ALsizei numsamples)
|
||||
void BiquadFilter_processC(BiquadFilter *filter, ALfloat *restrict dst, const ALfloat *restrict src, ALsizei numsamples)
|
||||
{
|
||||
if(LIKELY(numsamples > 1))
|
||||
{
|
||||
|
@ -263,7 +263,7 @@ static void LoadSamples(ALfloat *restrict dst, const ALvoid *restrict src, ALint
|
||||
}
|
||||
|
||||
|
||||
static const ALfloat *DoFilters(BiquadState *lpfilter, BiquadState *hpfilter,
|
||||
static const ALfloat *DoFilters(BiquadFilter *lpfilter, BiquadFilter *hpfilter,
|
||||
ALfloat *restrict dst, const ALfloat *restrict src,
|
||||
ALsizei numsamples, enum ActiveFilters type)
|
||||
{
|
||||
@ -271,17 +271,17 @@ static const ALfloat *DoFilters(BiquadState *lpfilter, BiquadState *hpfilter,
|
||||
switch(type)
|
||||
{
|
||||
case AF_None:
|
||||
BiquadState_processPassthru(lpfilter, numsamples);
|
||||
BiquadState_processPassthru(hpfilter, numsamples);
|
||||
BiquadFilter_passthru(lpfilter, numsamples);
|
||||
BiquadFilter_passthru(hpfilter, numsamples);
|
||||
break;
|
||||
|
||||
case AF_LowPass:
|
||||
BiquadState_process(lpfilter, dst, src, numsamples);
|
||||
BiquadState_processPassthru(hpfilter, numsamples);
|
||||
BiquadFilter_process(lpfilter, dst, src, numsamples);
|
||||
BiquadFilter_passthru(hpfilter, numsamples);
|
||||
return dst;
|
||||
case AF_HighPass:
|
||||
BiquadState_processPassthru(lpfilter, numsamples);
|
||||
BiquadState_process(hpfilter, dst, src, numsamples);
|
||||
BiquadFilter_passthru(lpfilter, numsamples);
|
||||
BiquadFilter_process(hpfilter, dst, src, numsamples);
|
||||
return dst;
|
||||
|
||||
case AF_BandPass:
|
||||
@ -290,8 +290,8 @@ static const ALfloat *DoFilters(BiquadState *lpfilter, BiquadState *hpfilter,
|
||||
ALfloat temp[256];
|
||||
ALsizei todo = mini(256, numsamples-i);
|
||||
|
||||
BiquadState_process(lpfilter, temp, src+i, todo);
|
||||
BiquadState_process(hpfilter, dst+i, temp, todo);
|
||||
BiquadFilter_process(lpfilter, temp, src+i, todo);
|
||||
BiquadFilter_process(hpfilter, dst+i, temp, todo);
|
||||
i += todo;
|
||||
}
|
||||
return dst;
|
||||
|
@ -153,8 +153,8 @@ typedef struct MixHrtfParams {
|
||||
|
||||
|
||||
typedef struct DirectParams {
|
||||
BiquadState LowPass;
|
||||
BiquadState HighPass;
|
||||
BiquadFilter LowPass;
|
||||
BiquadFilter HighPass;
|
||||
|
||||
NfcFilter NFCtrlFilter;
|
||||
|
||||
@ -171,8 +171,8 @@ typedef struct DirectParams {
|
||||
} DirectParams;
|
||||
|
||||
typedef struct SendParams {
|
||||
BiquadState LowPass;
|
||||
BiquadState HighPass;
|
||||
BiquadFilter LowPass;
|
||||
BiquadFilter HighPass;
|
||||
|
||||
struct {
|
||||
ALfloat Current[MAX_OUTPUT_CHANNELS];
|
||||
|
Loading…
x
Reference in New Issue
Block a user