diff options
Diffstat (limited to 'Alc/effects')
-rw-r--r-- | Alc/effects/autowah.c | 10 | ||||
-rw-r--r-- | Alc/effects/chorus.c | 14 | ||||
-rw-r--r-- | Alc/effects/compressor.c | 4 | ||||
-rw-r--r-- | Alc/effects/dedicated.c | 4 | ||||
-rw-r--r-- | Alc/effects/distortion.c | 12 | ||||
-rw-r--r-- | Alc/effects/echo.c | 12 | ||||
-rw-r--r-- | Alc/effects/equalizer.c | 22 | ||||
-rw-r--r-- | Alc/effects/flanger.c | 14 | ||||
-rw-r--r-- | Alc/effects/modulator.c | 10 | ||||
-rw-r--r-- | Alc/effects/null.c | 2 | ||||
-rw-r--r-- | Alc/effects/reverb.c | 5 |
11 files changed, 54 insertions, 55 deletions
diff --git a/Alc/effects/autowah.c b/Alc/effects/autowah.c index 1e7a8e29..648afc83 100644 --- a/Alc/effects/autowah.c +++ b/Alc/effects/autowah.c @@ -64,17 +64,17 @@ static ALboolean ALautowahState_deviceUpdate(ALautowahState *state, ALCdevice *d return AL_TRUE; } -static ALvoid ALautowahState_update(ALautowahState *state, const ALCdevice *device, const ALeffectslot *slot) +static ALvoid ALautowahState_update(ALautowahState *state, const ALCdevice *device, const ALeffectslot *slot, const ALeffectProps *props) { ALfloat attackTime, releaseTime; - attackTime = slot->Params.EffectProps.Autowah.AttackTime * state->Frequency; - releaseTime = slot->Params.EffectProps.Autowah.ReleaseTime * state->Frequency; + attackTime = props->Autowah.AttackTime * state->Frequency; + releaseTime = props->Autowah.ReleaseTime * state->Frequency; state->AttackRate = powf(1.0f/GAIN_SILENCE_THRESHOLD, 1.0f/attackTime); state->ReleaseRate = powf(GAIN_SILENCE_THRESHOLD/1.0f, 1.0f/releaseTime); - state->PeakGain = slot->Params.EffectProps.Autowah.PeakGain; - state->Resonance = slot->Params.EffectProps.Autowah.Resonance; + state->PeakGain = props->Autowah.PeakGain; + state->Resonance = props->Autowah.Resonance; ComputeAmbientGains(device->Dry, slot->Params.Gain, state->Gain); } diff --git a/Alc/effects/chorus.c b/Alc/effects/chorus.c index 3eff95a4..e1cbba2d 100644 --- a/Alc/effects/chorus.c +++ b/Alc/effects/chorus.c @@ -92,14 +92,14 @@ static ALboolean ALchorusState_deviceUpdate(ALchorusState *state, ALCdevice *Dev return AL_TRUE; } -static ALvoid ALchorusState_update(ALchorusState *state, const ALCdevice *Device, const ALeffectslot *Slot) +static ALvoid ALchorusState_update(ALchorusState *state, const ALCdevice *Device, const ALeffectslot *Slot, const ALeffectProps *props) { ALfloat frequency = (ALfloat)Device->Frequency; ALfloat coeffs[MAX_AMBI_COEFFS]; ALfloat rate; ALint phase; - switch(Slot->Params.EffectProps.Chorus.Waveform) + switch(props->Chorus.Waveform) { case AL_CHORUS_WAVEFORM_TRIANGLE: state->waveform = CWF_Triangle; @@ -108,9 +108,9 @@ static ALvoid ALchorusState_update(ALchorusState *state, const ALCdevice *Device state->waveform = CWF_Sinusoid; break; } - state->depth = Slot->Params.EffectProps.Chorus.Depth; - state->feedback = Slot->Params.EffectProps.Chorus.Feedback; - state->delay = fastf2i(Slot->Params.EffectProps.Chorus.Delay * frequency); + state->depth = props->Chorus.Depth; + state->feedback = props->Chorus.Feedback; + state->delay = fastf2i(props->Chorus.Delay * frequency); /* Gains for left and right sides */ CalcXYZCoeffs(-1.0f, 0.0f, 0.0f, 0.0f, coeffs); @@ -118,8 +118,8 @@ static ALvoid ALchorusState_update(ALchorusState *state, const ALCdevice *Device CalcXYZCoeffs( 1.0f, 0.0f, 0.0f, 0.0f, coeffs); ComputePanningGains(Device->Dry, coeffs, Slot->Params.Gain, state->Gain[1]); - phase = Slot->Params.EffectProps.Chorus.Phase; - rate = Slot->Params.EffectProps.Chorus.Rate; + phase = props->Chorus.Phase; + rate = props->Chorus.Rate; if(!(rate > 0.0f)) { state->lfo_scale = 0.0f; diff --git a/Alc/effects/compressor.c b/Alc/effects/compressor.c index c501b3ba..6329d3f1 100644 --- a/Alc/effects/compressor.c +++ b/Alc/effects/compressor.c @@ -56,12 +56,12 @@ static ALboolean ALcompressorState_deviceUpdate(ALcompressorState *state, ALCdev return AL_TRUE; } -static ALvoid ALcompressorState_update(ALcompressorState *state, const ALCdevice *device, const ALeffectslot *slot) +static ALvoid ALcompressorState_update(ALcompressorState *state, const ALCdevice *device, const ALeffectslot *slot, const ALeffectProps *props) { aluMatrixf matrix; ALuint i; - state->Enabled = slot->Params.EffectProps.Compressor.OnOff; + state->Enabled = props->Compressor.OnOff; aluMatrixfSet(&matrix, 1.0f, 0.0f, 0.0f, 0.0f, diff --git a/Alc/effects/dedicated.c b/Alc/effects/dedicated.c index 34e5ed80..98dd560b 100644 --- a/Alc/effects/dedicated.c +++ b/Alc/effects/dedicated.c @@ -46,7 +46,7 @@ static ALboolean ALdedicatedState_deviceUpdate(ALdedicatedState *UNUSED(state), return AL_TRUE; } -static ALvoid ALdedicatedState_update(ALdedicatedState *state, const ALCdevice *device, const ALeffectslot *Slot) +static ALvoid ALdedicatedState_update(ALdedicatedState *state, const ALCdevice *device, const ALeffectslot *Slot, const ALeffectProps *props) { ALfloat Gain; ALuint i; @@ -54,7 +54,7 @@ static ALvoid ALdedicatedState_update(ALdedicatedState *state, const ALCdevice * for(i = 0;i < MAX_OUTPUT_CHANNELS;i++) state->gains[i] = 0.0f; - Gain = Slot->Params.Gain * Slot->Params.EffectProps.Dedicated.Gain; + Gain = Slot->Params.Gain * props->Dedicated.Gain; if(Slot->Params.EffectType == AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT) { int idx; diff --git a/Alc/effects/distortion.c b/Alc/effects/distortion.c index 534a817c..deec6092 100644 --- a/Alc/effects/distortion.c +++ b/Alc/effects/distortion.c @@ -53,7 +53,7 @@ static ALboolean ALdistortionState_deviceUpdate(ALdistortionState *UNUSED(state) return AL_TRUE; } -static ALvoid ALdistortionState_update(ALdistortionState *state, const ALCdevice *Device, const ALeffectslot *Slot) +static ALvoid ALdistortionState_update(ALdistortionState *state, const ALCdevice *Device, const ALeffectslot *Slot, const ALeffectProps *props) { ALfloat frequency = (ALfloat)Device->Frequency; ALfloat bandwidth; @@ -61,15 +61,15 @@ static ALvoid ALdistortionState_update(ALdistortionState *state, const ALCdevice ALfloat edge; /* Store distorted signal attenuation settings */ - state->attenuation = Slot->Params.EffectProps.Distortion.Gain; + state->attenuation = props->Distortion.Gain; /* Store waveshaper edge settings */ - edge = sinf(Slot->Params.EffectProps.Distortion.Edge * (F_PI_2)); + edge = sinf(props->Distortion.Edge * (F_PI_2)); edge = minf(edge, 0.99f); state->edge_coeff = 2.0f * edge / (1.0f-edge); /* Lowpass filter */ - cutoff = Slot->Params.EffectProps.Distortion.LowpassCutoff; + cutoff = props->Distortion.LowpassCutoff; /* Bandwidth value is constant in octaves */ bandwidth = (cutoff / 2.0f) / (cutoff * 0.67f); ALfilterState_setParams(&state->lowpass, ALfilterType_LowPass, 1.0f, @@ -77,9 +77,9 @@ static ALvoid ALdistortionState_update(ALdistortionState *state, const ALCdevice ); /* Bandpass filter */ - cutoff = Slot->Params.EffectProps.Distortion.EQCenter; + cutoff = props->Distortion.EQCenter; /* Convert bandwidth in Hz to octaves */ - bandwidth = Slot->Params.EffectProps.Distortion.EQBandwidth / (cutoff * 0.67f); + bandwidth = props->Distortion.EQBandwidth / (cutoff * 0.67f); ALfilterState_setParams(&state->bandpass, ALfilterType_BandPass, 1.0f, cutoff / (frequency*4.0f), calc_rcpQ_from_bandwidth(cutoff / (frequency*4.0f), bandwidth) ); diff --git a/Alc/effects/echo.c b/Alc/effects/echo.c index eea86f15..0632a44d 100644 --- a/Alc/effects/echo.c +++ b/Alc/effects/echo.c @@ -82,17 +82,17 @@ static ALboolean ALechoState_deviceUpdate(ALechoState *state, ALCdevice *Device) return AL_TRUE; } -static ALvoid ALechoState_update(ALechoState *state, const ALCdevice *Device, const ALeffectslot *Slot) +static ALvoid ALechoState_update(ALechoState *state, const ALCdevice *Device, const ALeffectslot *Slot, const ALeffectProps *props) { ALuint frequency = Device->Frequency; ALfloat coeffs[MAX_AMBI_COEFFS]; ALfloat gain, lrpan, spread; - state->Tap[0].delay = fastf2u(Slot->Params.EffectProps.Echo.Delay * frequency) + 1; - state->Tap[1].delay = fastf2u(Slot->Params.EffectProps.Echo.LRDelay * frequency); + state->Tap[0].delay = fastf2u(props->Echo.Delay * frequency) + 1; + state->Tap[1].delay = fastf2u(props->Echo.LRDelay * frequency); state->Tap[1].delay += state->Tap[0].delay; - spread = Slot->Params.EffectProps.Echo.Spread; + spread = props->Echo.Spread; if(spread < 0.0f) lrpan = -1.0f; else lrpan = 1.0f; /* Convert echo spread (where 0 = omni, +/-1 = directional) to coverage @@ -100,9 +100,9 @@ static ALvoid ALechoState_update(ALechoState *state, const ALCdevice *Device, co */ spread = asinf(1.0f - fabsf(spread))*4.0f; - state->FeedGain = Slot->Params.EffectProps.Echo.Feedback; + state->FeedGain = props->Echo.Feedback; - gain = minf(1.0f - Slot->Params.EffectProps.Echo.Damping, 0.01f); + gain = minf(1.0f - props->Echo.Damping, 0.01f); ALfilterState_setParams(&state->Filter, ALfilterType_HighShelf, gain, LOWPASSFREQREF/frequency, calc_rcpQ_from_slope(gain, 0.75f)); diff --git a/Alc/effects/equalizer.c b/Alc/effects/equalizer.c index 94ee1853..25e36724 100644 --- a/Alc/effects/equalizer.c +++ b/Alc/effects/equalizer.c @@ -97,7 +97,7 @@ static ALboolean ALequalizerState_deviceUpdate(ALequalizerState *UNUSED(state), return AL_TRUE; } -static ALvoid ALequalizerState_update(ALequalizerState *state, const ALCdevice *device, const ALeffectslot *slot) +static ALvoid ALequalizerState_update(ALequalizerState *state, const ALCdevice *device, const ALeffectslot *slot, const ALeffectProps *props) { ALfloat frequency = (ALfloat)device->Frequency; ALfloat gain, freq_mult; @@ -121,8 +121,8 @@ static ALvoid ALequalizerState_update(ALequalizerState *state, const ALCdevice * * filters' gain is for the reference frequency, which is the centerpoint * of the transition band. */ - gain = sqrtf(slot->Params.EffectProps.Equalizer.LowGain); - freq_mult = slot->Params.EffectProps.Equalizer.LowCutoff/frequency; + gain = sqrtf(props->Equalizer.LowGain); + freq_mult = props->Equalizer.LowCutoff/frequency; ALfilterState_setParams(&state->filter[0][0], ALfilterType_LowShelf, gain, freq_mult, calc_rcpQ_from_slope(gain, 0.75f) ); @@ -137,11 +137,11 @@ static ALvoid ALequalizerState_update(ALequalizerState *state, const ALCdevice * state->filter[0][i].process = state->filter[0][0].process; } - gain = slot->Params.EffectProps.Equalizer.Mid1Gain; - freq_mult = slot->Params.EffectProps.Equalizer.Mid1Center/frequency; + gain = props->Equalizer.Mid1Gain; + freq_mult = props->Equalizer.Mid1Center/frequency; ALfilterState_setParams(&state->filter[1][0], ALfilterType_Peaking, gain, freq_mult, calc_rcpQ_from_bandwidth( - freq_mult, slot->Params.EffectProps.Equalizer.Mid1Width + freq_mult, props->Equalizer.Mid1Width ) ); for(i = 1;i < MAX_EFFECT_CHANNELS;i++) @@ -154,11 +154,11 @@ static ALvoid ALequalizerState_update(ALequalizerState *state, const ALCdevice * state->filter[1][i].process = state->filter[1][0].process; } - gain = slot->Params.EffectProps.Equalizer.Mid2Gain; - freq_mult = slot->Params.EffectProps.Equalizer.Mid2Center/frequency; + gain = props->Equalizer.Mid2Gain; + freq_mult = props->Equalizer.Mid2Center/frequency; ALfilterState_setParams(&state->filter[2][0], ALfilterType_Peaking, gain, freq_mult, calc_rcpQ_from_bandwidth( - freq_mult, slot->Params.EffectProps.Equalizer.Mid2Width + freq_mult, props->Equalizer.Mid2Width ) ); for(i = 1;i < MAX_EFFECT_CHANNELS;i++) @@ -171,8 +171,8 @@ static ALvoid ALequalizerState_update(ALequalizerState *state, const ALCdevice * state->filter[2][i].process = state->filter[2][0].process; } - gain = sqrtf(slot->Params.EffectProps.Equalizer.HighGain); - freq_mult = slot->Params.EffectProps.Equalizer.HighCutoff/frequency; + gain = sqrtf(props->Equalizer.HighGain); + freq_mult = props->Equalizer.HighCutoff/frequency; ALfilterState_setParams(&state->filter[3][0], ALfilterType_HighShelf, gain, freq_mult, calc_rcpQ_from_slope(gain, 0.75f) ); diff --git a/Alc/effects/flanger.c b/Alc/effects/flanger.c index 966622e6..7b55977e 100644 --- a/Alc/effects/flanger.c +++ b/Alc/effects/flanger.c @@ -92,14 +92,14 @@ static ALboolean ALflangerState_deviceUpdate(ALflangerState *state, ALCdevice *D return AL_TRUE; } -static ALvoid ALflangerState_update(ALflangerState *state, const ALCdevice *Device, const ALeffectslot *Slot) +static ALvoid ALflangerState_update(ALflangerState *state, const ALCdevice *Device, const ALeffectslot *Slot, const ALeffectProps *props) { ALfloat frequency = (ALfloat)Device->Frequency; ALfloat coeffs[MAX_AMBI_COEFFS]; ALfloat rate; ALint phase; - switch(Slot->Params.EffectProps.Flanger.Waveform) + switch(props->Flanger.Waveform) { case AL_FLANGER_WAVEFORM_TRIANGLE: state->waveform = FWF_Triangle; @@ -108,9 +108,9 @@ static ALvoid ALflangerState_update(ALflangerState *state, const ALCdevice *Devi state->waveform = FWF_Sinusoid; break; } - state->depth = Slot->Params.EffectProps.Flanger.Depth; - state->feedback = Slot->Params.EffectProps.Flanger.Feedback; - state->delay = fastf2i(Slot->Params.EffectProps.Flanger.Delay * frequency); + state->depth = props->Flanger.Depth; + state->feedback = props->Flanger.Feedback; + state->delay = fastf2i(props->Flanger.Delay * frequency); /* Gains for left and right sides */ CalcXYZCoeffs(-1.0f, 0.0f, 0.0f, 0.0f, coeffs); @@ -118,8 +118,8 @@ static ALvoid ALflangerState_update(ALflangerState *state, const ALCdevice *Devi CalcXYZCoeffs( 1.0f, 0.0f, 0.0f, 0.0f, coeffs); ComputePanningGains(Device->Dry, coeffs, Slot->Params.Gain, state->Gain[1]); - phase = Slot->Params.EffectProps.Flanger.Phase; - rate = Slot->Params.EffectProps.Flanger.Rate; + phase = props->Flanger.Phase; + rate = props->Flanger.Rate; if(!(rate > 0.0f)) { state->lfo_scale = 0.0f; diff --git a/Alc/effects/modulator.c b/Alc/effects/modulator.c index 5a96bb9d..0b0971b2 100644 --- a/Alc/effects/modulator.c +++ b/Alc/effects/modulator.c @@ -92,25 +92,25 @@ static ALboolean ALmodulatorState_deviceUpdate(ALmodulatorState *UNUSED(state), return AL_TRUE; } -static ALvoid ALmodulatorState_update(ALmodulatorState *state, const ALCdevice *Device, const ALeffectslot *Slot) +static ALvoid ALmodulatorState_update(ALmodulatorState *state, const ALCdevice *Device, const ALeffectslot *Slot, const ALeffectProps *props) { aluMatrixf matrix; ALfloat cw, a; ALuint i; - if(Slot->Params.EffectProps.Modulator.Waveform == AL_RING_MODULATOR_SINUSOID) + if(props->Modulator.Waveform == AL_RING_MODULATOR_SINUSOID) state->Process = ModulateSin; - else if(Slot->Params.EffectProps.Modulator.Waveform == AL_RING_MODULATOR_SAWTOOTH) + else if(props->Modulator.Waveform == AL_RING_MODULATOR_SAWTOOTH) state->Process = ModulateSaw; else /*if(Slot->Params.EffectProps.Modulator.Waveform == AL_RING_MODULATOR_SQUARE)*/ state->Process = ModulateSquare; - state->step = fastf2u(Slot->Params.EffectProps.Modulator.Frequency*WAVEFORM_FRACONE / + state->step = fastf2u(props->Modulator.Frequency*WAVEFORM_FRACONE / Device->Frequency); if(state->step == 0) state->step = 1; /* Custom filter coeffs, which match the old version instead of a low-shelf. */ - cw = cosf(F_TAU * Slot->Params.EffectProps.Modulator.HighPassCutoff / Device->Frequency); + cw = cosf(F_TAU * props->Modulator.HighPassCutoff / Device->Frequency); a = (2.0f-cw) - sqrtf(powf(2.0f-cw, 2.0f) - 1.0f); for(i = 0;i < MAX_EFFECT_CHANNELS;i++) diff --git a/Alc/effects/null.c b/Alc/effects/null.c index b90f75c9..a135b194 100644 --- a/Alc/effects/null.c +++ b/Alc/effects/null.c @@ -35,7 +35,7 @@ static ALboolean ALnullState_deviceUpdate(ALnullState* UNUSED(state), ALCdevice* /* This updates the effect state. This is called any time the effect is * (re)loaded into a slot. */ -static ALvoid ALnullState_update(ALnullState* UNUSED(state), const ALCdevice* UNUSED(device), const ALeffectslot* UNUSED(slot)) +static ALvoid ALnullState_update(ALnullState* UNUSED(state), const ALCdevice* UNUSED(device), const ALeffectslot* UNUSED(slot), const ALeffectProps* UNUSED(props)) { } diff --git a/Alc/effects/reverb.c b/Alc/effects/reverb.c index 0f851295..916469a8 100644 --- a/Alc/effects/reverb.c +++ b/Alc/effects/reverb.c @@ -173,7 +173,7 @@ static ALvoid ALreverbState_Destruct(ALreverbState *State) } static ALboolean ALreverbState_deviceUpdate(ALreverbState *State, ALCdevice *Device); -static ALvoid ALreverbState_update(ALreverbState *State, const ALCdevice *Device, const ALeffectslot *Slot); +static ALvoid ALreverbState_update(ALreverbState *State, const ALCdevice *Device, const ALeffectslot *Slot, const ALeffectProps *props); static ALvoid ALreverbState_processStandard(ALreverbState *State, ALuint SamplesToDo, const ALfloat *restrict SamplesIn, ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels); static ALvoid ALreverbState_processEax(ALreverbState *State, ALuint SamplesToDo, const ALfloat *restrict SamplesIn, ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels); static ALvoid ALreverbState_process(ALreverbState *State, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels); @@ -893,9 +893,8 @@ static ALvoid Update3DPanning(const ALCdevice *Device, const ALfloat *Reflection } } -static ALvoid ALreverbState_update(ALreverbState *State, const ALCdevice *Device, const ALeffectslot *Slot) +static ALvoid ALreverbState_update(ALreverbState *State, const ALCdevice *Device, const ALeffectslot *Slot, const ALeffectProps *props) { - const ALeffectProps *props = &Slot->Params.EffectProps; ALuint frequency = Device->Frequency; ALfloat lfscale, hfscale, hfRatio; ALfloat gain, gainlf, gainhf; |