diff options
author | Chris Robinson <[email protected]> | 2013-05-25 22:07:31 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2013-05-25 22:07:31 -0700 |
commit | d1c5599c8ead4905d46e5d86f3f0547d3a925d44 (patch) | |
tree | 28ae38a4b174dd3d96d9046901bee0408c76857a | |
parent | 6571d805400f018b51835a8e37752409af9b1c4d (diff) |
Use an ALeffectProps union to store the effect properties
-rw-r--r-- | Alc/ALu.c | 12 | ||||
-rw-r--r-- | Alc/effects/chorus.c | 40 | ||||
-rw-r--r-- | Alc/effects/dedicated.c | 12 | ||||
-rw-r--r-- | Alc/effects/distortion.c | 44 | ||||
-rw-r--r-- | Alc/effects/echo.c | 32 | ||||
-rw-r--r-- | Alc/effects/equalizer.c | 74 | ||||
-rw-r--r-- | Alc/effects/flanger.c | 40 | ||||
-rw-r--r-- | Alc/effects/modulator.c | 30 | ||||
-rw-r--r-- | Alc/effects/reverb.c | 222 | ||||
-rw-r--r-- | OpenAL32/Include/alAuxEffectSlot.h | 3 | ||||
-rw-r--r-- | OpenAL32/Include/alEffect.h | 14 | ||||
-rw-r--r-- | OpenAL32/alAuxEffectSlot.c | 32 | ||||
-rw-r--r-- | OpenAL32/alEffect.c | 206 |
13 files changed, 400 insertions, 361 deletions
@@ -447,7 +447,7 @@ ALvoid CalcNonAttnSourceParams(ALsource *ALSource, const ALCcontext *ALContext) if(!Slot && i == 0) Slot = Device->DefaultSlot; - if(Slot && Slot->effect.type == AL_EFFECT_NULL) + if(Slot && Slot->EffectType == AL_EFFECT_NULL) Slot = NULL; ALSource->Params.Send[i].Slot = Slot; ALSource->Params.Send[i].Gain = WetGain[i]; @@ -551,7 +551,7 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext) if(!Slot && i == 0) Slot = Device->DefaultSlot; - if(!Slot || Slot->effect.type == AL_EFFECT_NULL) + if(!Slot || Slot->EffectType == AL_EFFECT_NULL) { Slot = NULL; RoomRolloff[i] = 0.0f; @@ -561,12 +561,12 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext) else if(Slot->AuxSendAuto) { RoomRolloff[i] = RoomRolloffBase; - if(IsReverbEffect(Slot->effect.type)) + if(IsReverbEffect(Slot->EffectType)) { - RoomRolloff[i] += Slot->effect.Reverb.RoomRolloffFactor; - DecayDistance[i] = Slot->effect.Reverb.DecayTime * + RoomRolloff[i] += Slot->EffectProps.Reverb.RoomRolloffFactor; + DecayDistance[i] = Slot->EffectProps.Reverb.DecayTime * SPEEDOFSOUNDMETRESPERSEC; - RoomAirAbsorption[i] = Slot->effect.Reverb.AirAbsorptionGainHF; + RoomAirAbsorption[i] = Slot->EffectProps.Reverb.AirAbsorptionGainHF; } else { diff --git a/Alc/effects/chorus.c b/Alc/effects/chorus.c index 22241af5..4dc6cd98 100644 --- a/Alc/effects/chorus.c +++ b/Alc/effects/chorus.c @@ -111,17 +111,17 @@ static ALvoid ALchorusState_Update(ALchorusState *state, ALCdevice *Device, cons state->Gain[1][it] = 0.0f; } - state->waveform = Slot->effect.Chorus.Waveform; - state->depth = Slot->effect.Chorus.Depth; - state->feedback = Slot->effect.Chorus.Feedback; - state->delay = fastf2i(Slot->effect.Chorus.Delay * frequency); + state->waveform = Slot->EffectProps.Chorus.Waveform; + state->depth = Slot->EffectProps.Chorus.Depth; + state->feedback = Slot->EffectProps.Chorus.Feedback; + state->delay = fastf2i(Slot->EffectProps.Chorus.Delay * frequency); /* Gains for left and right sides */ ComputeAngleGains(Device, atan2f(-1.0f, 0.0f), 0.0f, Slot->Gain, state->Gain[0]); ComputeAngleGains(Device, atan2f(+1.0f, 0.0f), 0.0f, Slot->Gain, state->Gain[1]); - phase = Slot->effect.Chorus.Phase; - rate = Slot->effect.Chorus.Rate; + phase = Slot->EffectProps.Chorus.Phase; + rate = Slot->EffectProps.Chorus.Rate; /* Calculate LFO coefficient */ switch (state->waveform) @@ -285,18 +285,19 @@ ALeffectStateFactory *ALchorusStateFactory_getFactory(void) void ALchorus_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) { + ALeffectProps *props = &effect->Props; switch(param) { case AL_CHORUS_WAVEFORM: if(val >= AL_CHORUS_MIN_WAVEFORM && val <= AL_CHORUS_MAX_WAVEFORM) - effect->Chorus.Waveform = val; + props->Chorus.Waveform = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_CHORUS_PHASE: if(val >= AL_CHORUS_MIN_PHASE && val <= AL_CHORUS_MAX_PHASE) - effect->Chorus.Phase = val; + props->Chorus.Phase = val; else alSetError(context, AL_INVALID_VALUE); break; @@ -312,32 +313,33 @@ void ALchorus_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, co } void ALchorus_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) { + ALeffectProps *props = &effect->Props; switch(param) { case AL_CHORUS_RATE: if(val >= AL_CHORUS_MIN_RATE && val <= AL_CHORUS_MAX_RATE) - effect->Chorus.Rate = val; + props->Chorus.Rate = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_CHORUS_DEPTH: if(val >= AL_CHORUS_MIN_DEPTH && val <= AL_CHORUS_MAX_DEPTH) - effect->Chorus.Depth = val; + props->Chorus.Depth = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_CHORUS_FEEDBACK: if(val >= AL_CHORUS_MIN_FEEDBACK && val <= AL_CHORUS_MAX_FEEDBACK) - effect->Chorus.Feedback = val; + props->Chorus.Feedback = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_CHORUS_DELAY: if(val >= AL_CHORUS_MIN_DELAY && val <= AL_CHORUS_MAX_DELAY) - effect->Chorus.Delay = val; + props->Chorus.Delay = val; else alSetError(context, AL_INVALID_VALUE); break; @@ -354,14 +356,15 @@ void ALchorus_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, co void ALchorus_GetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) { + const ALeffectProps *props = &effect->Props; switch(param) { case AL_CHORUS_WAVEFORM: - *val = effect->Chorus.Waveform; + *val = props->Chorus.Waveform; break; case AL_CHORUS_PHASE: - *val = effect->Chorus.Phase; + *val = props->Chorus.Phase; break; default: @@ -375,22 +378,23 @@ void ALchorus_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, AL } void ALchorus_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) { + const ALeffectProps *props = &effect->Props; switch(param) { case AL_CHORUS_RATE: - *val = effect->Chorus.Rate; + *val = props->Chorus.Rate; break; case AL_CHORUS_DEPTH: - *val = effect->Chorus.Depth; + *val = props->Chorus.Depth; break; case AL_CHORUS_FEEDBACK: - *val = effect->Chorus.Feedback; + *val = props->Chorus.Feedback; break; case AL_CHORUS_DELAY: - *val = effect->Chorus.Delay; + *val = props->Chorus.Delay; break; default: diff --git a/Alc/effects/dedicated.c b/Alc/effects/dedicated.c index 184fe292..35d26cc0 100644 --- a/Alc/effects/dedicated.c +++ b/Alc/effects/dedicated.c @@ -60,13 +60,13 @@ static ALvoid ALdedicatedState_Update(ALdedicatedState *state, ALCdevice *device ALfloat Gain; ALsizei s; - Gain = Slot->Gain * Slot->effect.Dedicated.Gain; + Gain = Slot->Gain * Slot->EffectProps.Dedicated.Gain; for(s = 0;s < MaxChannels;s++) state->gains[s] = 0.0f; - if(Slot->effect.type == AL_EFFECT_DEDICATED_DIALOGUE) + if(Slot->EffectType == AL_EFFECT_DEDICATED_DIALOGUE) ComputeAngleGains(device, atan2f(0.0f, 1.0f), 0.0f, Gain, state->gains); - else if(Slot->effect.type == AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT) + else if(Slot->EffectType == AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT) state->gains[LFE] = Gain; } @@ -132,11 +132,12 @@ void ALdedicated_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, } void ALdedicated_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) { + ALeffectProps *props = &effect->Props; switch(param) { case AL_DEDICATED_GAIN: if(val >= 0.0f && isfinite(val)) - effect->Dedicated.Gain = val; + props->Dedicated.Gain = val; else alSetError(context, AL_INVALID_VALUE); break; @@ -159,10 +160,11 @@ void ALdedicated_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, } void ALdedicated_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) { + const ALeffectProps *props = &effect->Props; switch(param) { case AL_DEDICATED_GAIN: - *val = effect->Dedicated.Gain; + *val = props->Dedicated.Gain; break; default: diff --git a/Alc/effects/distortion.c b/Alc/effects/distortion.c index cc6669af..5be2215e 100644 --- a/Alc/effects/distortion.c +++ b/Alc/effects/distortion.c @@ -99,14 +99,14 @@ static ALvoid ALdistortionState_Update(ALdistortionState *state, ALCdevice *Devi } /* Store distorted signal attenuation settings */ - state->attenuation = Slot->effect.Distortion.Gain; + state->attenuation = Slot->EffectProps.Distortion.Gain; /* Store waveshaper edge settings */ - edge = sinf(Slot->effect.Distortion.Edge * (F_PI/2.0f)); + edge = sinf(Slot->EffectProps.Distortion.Edge * (F_PI/2.0f)); state->edge_coeff = 2.0f * edge / (1.0f-edge); /* Lowpass filter */ - cutoff = Slot->effect.Distortion.LowpassCutoff; + cutoff = Slot->EffectProps.Distortion.LowpassCutoff; /* Bandwidth value is constant in octaves */ bandwidth = (cutoff / 2.0f) / (cutoff * 0.67f); w0 = 2.0f*F_PI * cutoff / (frequency*4.0f); @@ -119,9 +119,9 @@ static ALvoid ALdistortionState_Update(ALdistortionState *state, ALCdevice *Devi state->lowpass.a[2] = 1.0f - alpha; /* Bandpass filter */ - cutoff = Slot->effect.Distortion.EQCenter; + cutoff = Slot->EffectProps.Distortion.EQCenter; /* Convert bandwidth in Hz to octaves */ - bandwidth = Slot->effect.Distortion.EQBandwidth / (cutoff * 0.67f); + bandwidth = Slot->EffectProps.Distortion.EQBandwidth / (cutoff * 0.67f); w0 = 2.0f*F_PI * cutoff / (frequency*4.0f); alpha = sinf(w0) * sinhf(logf(2.0f) / 2.0f * bandwidth * w0 / sinf(w0)); state->bandpass.b[0] = alpha; @@ -281,15 +281,15 @@ ALeffectStateFactory *ALdistortionStateFactory_getFactory(void) void ALdistortion_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) { - effect=effect; - val=val; - + const ALeffectProps *props = &effect->Props; switch(param) { default: alSetError(context, AL_INVALID_ENUM); break; } + (void)props; + (void)val; } void ALdistortion_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) { @@ -297,39 +297,40 @@ void ALdistortion_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param } void ALdistortion_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) { + ALeffectProps *props = &effect->Props; switch(param) { case AL_DISTORTION_EDGE: if(val >= AL_DISTORTION_MIN_EDGE && val <= AL_DISTORTION_MAX_EDGE) - effect->Distortion.Edge = val; + props->Distortion.Edge = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_DISTORTION_GAIN: if(val >= AL_DISTORTION_MIN_GAIN && val <= AL_DISTORTION_MAX_GAIN) - effect->Distortion.Gain = val; + props->Distortion.Gain = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_DISTORTION_LOWPASS_CUTOFF: if(val >= AL_DISTORTION_MIN_LOWPASS_CUTOFF && val <= AL_DISTORTION_MAX_LOWPASS_CUTOFF) - effect->Distortion.LowpassCutoff = val; + props->Distortion.LowpassCutoff = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_DISTORTION_EQCENTER: if(val >= AL_DISTORTION_MIN_EQCENTER && val <= AL_DISTORTION_MAX_EQCENTER) - effect->Distortion.EQCenter = val; + props->Distortion.EQCenter = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_DISTORTION_EQBANDWIDTH: if(val >= AL_DISTORTION_MIN_EQBANDWIDTH && val <= AL_DISTORTION_MAX_EQBANDWIDTH) - effect->Distortion.EQBandwidth = val; + props->Distortion.EQBandwidth = val; else alSetError(context, AL_INVALID_VALUE); break; @@ -346,15 +347,15 @@ void ALdistortion_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param void ALdistortion_GetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) { - effect=effect; - val=val; - + const ALeffectProps *props = &effect->Props; switch(param) { default: alSetError(context, AL_INVALID_ENUM); break; } + (void)props; + (void)val; } void ALdistortion_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) { @@ -362,26 +363,27 @@ void ALdistortion_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param } void ALdistortion_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) { + const ALeffectProps *props = &effect->Props; switch(param) { case AL_DISTORTION_EDGE: - *val = effect->Distortion.Edge; + *val = props->Distortion.Edge; break; case AL_DISTORTION_GAIN: - *val = effect->Distortion.Gain; + *val = props->Distortion.Gain; break; case AL_DISTORTION_LOWPASS_CUTOFF: - *val = effect->Distortion.LowpassCutoff; + *val = props->Distortion.LowpassCutoff; break; case AL_DISTORTION_EQCENTER: - *val = effect->Distortion.EQCenter; + *val = props->Distortion.EQCenter; break; case AL_DISTORTION_EQBANDWIDTH: - *val = effect->Distortion.EQBandwidth; + *val = props->Distortion.EQBandwidth; break; default: diff --git a/Alc/effects/echo.c b/Alc/effects/echo.c index 533461ac..d1f734bf 100644 --- a/Alc/effects/echo.c +++ b/Alc/effects/echo.c @@ -96,16 +96,16 @@ static ALvoid ALechoState_Update(ALechoState *state, ALCdevice *Device, const AL ALfloat dirGain; ALuint i; - state->Tap[0].delay = fastf2u(Slot->effect.Echo.Delay * frequency) + 1; - state->Tap[1].delay = fastf2u(Slot->effect.Echo.LRDelay * frequency); + state->Tap[0].delay = fastf2u(Slot->EffectProps.Echo.Delay * frequency) + 1; + state->Tap[1].delay = fastf2u(Slot->EffectProps.Echo.LRDelay * frequency); state->Tap[1].delay += state->Tap[0].delay; - lrpan = Slot->effect.Echo.Spread; + lrpan = Slot->EffectProps.Echo.Spread; - state->FeedGain = Slot->effect.Echo.Feedback; + state->FeedGain = Slot->EffectProps.Echo.Feedback; cw = cosf(F_PI*2.0f * LOWPASSFREQREF / frequency); - g = 1.0f - Slot->effect.Echo.Damping; + g = 1.0f - Slot->EffectProps.Echo.Damping; state->iirFilter.coeff = lpCoeffCalc(g, cw); gain = Slot->Gain; @@ -229,39 +229,40 @@ void ALecho_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, cons } void ALecho_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) { + ALeffectProps *props = &effect->Props; switch(param) { case AL_ECHO_DELAY: if(val >= AL_ECHO_MIN_DELAY && val <= AL_ECHO_MAX_DELAY) - effect->Echo.Delay = val; + props->Echo.Delay = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_ECHO_LRDELAY: if(val >= AL_ECHO_MIN_LRDELAY && val <= AL_ECHO_MAX_LRDELAY) - effect->Echo.LRDelay = val; + props->Echo.LRDelay = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_ECHO_DAMPING: if(val >= AL_ECHO_MIN_DAMPING && val <= AL_ECHO_MAX_DAMPING) - effect->Echo.Damping = val; + props->Echo.Damping = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_ECHO_FEEDBACK: if(val >= AL_ECHO_MIN_FEEDBACK && val <= AL_ECHO_MAX_FEEDBACK) - effect->Echo.Feedback = val; + props->Echo.Feedback = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_ECHO_SPREAD: if(val >= AL_ECHO_MIN_SPREAD && val <= AL_ECHO_MAX_SPREAD) - effect->Echo.Spread = val; + props->Echo.Spread = val; else alSetError(context, AL_INVALID_VALUE); break; @@ -284,26 +285,27 @@ void ALecho_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, ALin } void ALecho_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) { + const ALeffectProps *props = &effect->Props; switch(param) { case AL_ECHO_DELAY: - *val = effect->Echo.Delay; + *val = props->Echo.Delay; break; case AL_ECHO_LRDELAY: - *val = effect->Echo.LRDelay; + *val = props->Echo.LRDelay; break; case AL_ECHO_DAMPING: - *val = effect->Echo.Damping; + *val = props->Echo.Damping; break; case AL_ECHO_FEEDBACK: - *val = effect->Echo.Feedback; + *val = props->Echo.Feedback; break; case AL_ECHO_SPREAD: - *val = effect->Echo.Spread; + *val = props->Echo.Spread; break; default: diff --git a/Alc/effects/equalizer.c b/Alc/effects/equalizer.c index 3d5f35d5..df95716f 100644 --- a/Alc/effects/equalizer.c +++ b/Alc/effects/equalizer.c @@ -141,22 +141,22 @@ static ALvoid ALequalizerState_Update(ALequalizerState *state, ALCdevice *device switch (it) { case 0: /* Low Shelf */ - gain = powf(10.0f, (20.0f * log10f(slot->effect.Equalizer.LowGain)) / 40.0f); - filter_frequency = slot->effect.Equalizer.LowCutoff; + gain = powf(10.0f, (20.0f * log10f(slot->EffectProps.Equalizer.LowGain)) / 40.0f); + filter_frequency = slot->EffectProps.Equalizer.LowCutoff; break; case 1: /* Peaking */ - gain = powf(10.0f, (20.0f * log10f(slot->effect.Equalizer.Mid1Gain)) / 40.0f); - filter_frequency = slot->effect.Equalizer.Mid1Center; - bandwidth = slot->effect.Equalizer.Mid1Width; + gain = powf(10.0f, (20.0f * log10f(slot->EffectProps.Equalizer.Mid1Gain)) / 40.0f); + filter_frequency = slot->EffectProps.Equalizer.Mid1Center; + bandwidth = slot->EffectProps.Equalizer.Mid1Width; break; case 2: /* Peaking */ - gain = powf(10.0f, (20.0f * log10f(slot->effect.Equalizer.Mid2Gain)) / 40.0f); - filter_frequency = slot->effect.Equalizer.Mid2Center; - bandwidth = slot->effect.Equalizer.Mid2Width; + gain = powf(10.0f, (20.0f * log10f(slot->EffectProps.Equalizer.Mid2Gain)) / 40.0f); + filter_frequency = slot->EffectProps.Equalizer.Mid2Center; + bandwidth = slot->EffectProps.Equalizer.Mid2Width; break; case 3: /* High Shelf */ - gain = powf(10.0f, (20.0f * log10f(slot->effect.Equalizer.HighGain)) / 40.0f); - filter_frequency = slot->effect.Equalizer.HighCutoff; + gain = powf(10.0f, (20.0f * log10f(slot->EffectProps.Equalizer.HighGain)) / 40.0f); + filter_frequency = slot->EffectProps.Equalizer.HighCutoff; break; } @@ -323,15 +323,15 @@ ALeffectStateFactory *ALequalizerStateFactory_getFactory(void) void ALequalizer_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) { - effect=effect; - val=val; - + ALeffectProps *props = &effect->Props; switch(param) { default: alSetError(context, AL_INVALID_ENUM); break; } + (void)props; + (void)val; } void ALequalizer_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) { @@ -339,74 +339,75 @@ void ALequalizer_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, } void ALequalizer_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) { + ALeffectProps *props = &effect->Props; switch(param) { case AL_EQUALIZER_LOW_GAIN: if(val >= AL_EQUALIZER_MIN_LOW_GAIN && val <= AL_EQUALIZER_MAX_LOW_GAIN) - effect->Equalizer.LowGain = val; + props->Equalizer.LowGain = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_EQUALIZER_LOW_CUTOFF: if(val >= AL_EQUALIZER_MIN_LOW_CUTOFF && val <= AL_EQUALIZER_MAX_LOW_CUTOFF) - effect->Equalizer.LowCutoff = val; + props->Equalizer.LowCutoff = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_EQUALIZER_MID1_GAIN: if(val >= AL_EQUALIZER_MIN_MID1_GAIN && val <= AL_EQUALIZER_MAX_MID1_GAIN) - effect->Equalizer.Mid1Gain = val; + props->Equalizer.Mid1Gain = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_EQUALIZER_MID1_CENTER: if(val >= AL_EQUALIZER_MIN_MID1_CENTER && val <= AL_EQUALIZER_MAX_MID1_CENTER) - effect->Equalizer.Mid1Center = val; + props->Equalizer.Mid1Center = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_EQUALIZER_MID1_WIDTH: if(val >= AL_EQUALIZER_MIN_MID1_WIDTH && val <= AL_EQUALIZER_MAX_MID1_WIDTH) - effect->Equalizer.Mid1Width = val; + props->Equalizer.Mid1Width = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_EQUALIZER_MID2_GAIN: if(val >= AL_EQUALIZER_MIN_MID2_GAIN && val <= AL_EQUALIZER_MAX_MID2_GAIN) - effect->Equalizer.Mid2Gain = val; + props->Equalizer.Mid2Gain = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_EQUALIZER_MID2_CENTER: if(val >= AL_EQUALIZER_MIN_MID2_CENTER && val <= AL_EQUALIZER_MAX_MID2_CENTER) - effect->Equalizer.Mid2Center = val; + props->Equalizer.Mid2Center = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_EQUALIZER_MID2_WIDTH: if(val >= AL_EQUALIZER_MIN_MID2_WIDTH && val <= AL_EQUALIZER_MAX_MID2_WIDTH) - effect->Equalizer.Mid2Width = val; + props->Equalizer.Mid2Width = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_EQUALIZER_HIGH_GAIN: if(val >= AL_EQUALIZER_MIN_HIGH_GAIN && val <= AL_EQUALIZER_MAX_HIGH_GAIN) - effect->Equalizer.HighGain = val; + props->Equalizer.HighGain = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_EQUALIZER_HIGH_CUTOFF: if(val >= AL_EQUALIZER_MIN_HIGH_CUTOFF && val <= AL_EQUALIZER_MAX_HIGH_CUTOFF) - effect->Equalizer.HighCutoff = val; + props->Equalizer.HighCutoff = val; else alSetError(context, AL_INVALID_VALUE); break; @@ -423,15 +424,15 @@ void ALequalizer_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, void ALequalizer_GetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) { - effect=effect; - val=val; - + ALeffectProps *props = &effect->Props; switch(param) { default: alSetError(context, AL_INVALID_ENUM); break; } + (void)props; + (void)val; } void ALequalizer_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) { @@ -439,46 +440,47 @@ void ALequalizer_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, } void ALequalizer_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) { + const ALeffectProps *props = &effect->Props; switch(param) { case AL_EQUALIZER_LOW_GAIN: - *val = effect->Equalizer.LowGain; + *val = props->Equalizer.LowGain; break; case AL_EQUALIZER_LOW_CUTOFF: - *val = effect->Equalizer.LowCutoff; + *val = props->Equalizer.LowCutoff; break; case AL_EQUALIZER_MID1_GAIN: - *val = effect->Equalizer.Mid1Gain; + *val = props->Equalizer.Mid1Gain; break; case AL_EQUALIZER_MID1_CENTER: - *val = effect->Equalizer.Mid1Center; + *val = props->Equalizer.Mid1Center; break; case AL_EQUALIZER_MID1_WIDTH: - *val = effect->Equalizer.Mid1Width; + *val = props->Equalizer.Mid1Width; break; case AL_EQUALIZER_MID2_GAIN: - *val = effect->Equalizer.Mid2Gain; + *val = props->Equalizer.Mid2Gain; break; case AL_EQUALIZER_MID2_CENTER: - *val = effect->Equalizer.Mid2Center; + *val = props->Equalizer.Mid2Center; break; case AL_EQUALIZER_MID2_WIDTH: - *val = effect->Equalizer.Mid2Width; + *val = props->Equalizer.Mid2Width; break; case AL_EQUALIZER_HIGH_GAIN: - *val = effect->Equalizer.HighGain; + *val = props->Equalizer.HighGain; break; case AL_EQUALIZER_HIGH_CUTOFF: - *val = effect->Equalizer.HighCutoff; + *val = props->Equalizer.HighCutoff; break; default: diff --git a/Alc/effects/flanger.c b/Alc/effects/flanger.c index 12e16de2..1983c5e0 100644 --- a/Alc/effects/flanger.c +++ b/Alc/effects/flanger.c @@ -111,17 +111,17 @@ static ALvoid ALflangerState_Update(ALflangerState *state, ALCdevice *Device, co state->Gain[1][it] = 0.0f; } - state->waveform = Slot->effect.Flanger.Waveform; - state->depth = Slot->effect.Flanger.Depth; - state->feedback = Slot->effect.Flanger.Feedback; - state->delay = fastf2i(Slot->effect.Flanger.Delay * frequency); + state->waveform = Slot->EffectProps.Flanger.Waveform; + state->depth = Slot->EffectProps.Flanger.Depth; + state->feedback = Slot->EffectProps.Flanger.Feedback; + state->delay = fastf2i(Slot->EffectProps.Flanger.Delay * frequency); /* Gains for left and right sides */ ComputeAngleGains(Device, atan2f(-1.0f, 0.0f), 0.0f, Slot->Gain, state->Gain[0]); ComputeAngleGains(Device, atan2f(+1.0f, 0.0f), 0.0f, Slot->Gain, state->Gain[1]); - phase = Slot->effect.Flanger.Phase; - rate = Slot->effect.Flanger.Rate; + phase = Slot->EffectProps.Flanger.Phase; + rate = Slot->EffectProps.Flanger.Rate; /* Calculate LFO coefficient */ switch(state->waveform) @@ -285,18 +285,19 @@ ALeffectStateFactory *ALflangerStateFactory_getFactory(void) void ALflanger_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) { + ALeffectProps *props = &effect->Props; switch(param) { case AL_FLANGER_WAVEFORM: if(val >= AL_FLANGER_MIN_WAVEFORM && val <= AL_FLANGER_MAX_WAVEFORM) - effect->Flanger.Waveform = val; + props->Flanger.Waveform = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_FLANGER_PHASE: if(val >= AL_FLANGER_MIN_PHASE && val <= AL_FLANGER_MAX_PHASE) - effect->Flanger.Phase = val; + props->Flanger.Phase = val; else alSetError(context, AL_INVALID_VALUE); break; @@ -312,32 +313,33 @@ void ALflanger_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, c } void ALflanger_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) { + ALeffectProps *props = &effect->Props; switch(param) { case AL_FLANGER_RATE: if(val >= AL_FLANGER_MIN_RATE && val <= AL_FLANGER_MAX_RATE) - effect->Flanger.Rate = val; + props->Flanger.Rate = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_FLANGER_DEPTH: if(val >= AL_FLANGER_MIN_DEPTH && val <= AL_FLANGER_MAX_DEPTH) - effect->Flanger.Depth = val; + props->Flanger.Depth = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_FLANGER_FEEDBACK: if(val >= AL_FLANGER_MIN_FEEDBACK && val <= AL_FLANGER_MAX_FEEDBACK) - effect->Flanger.Feedback = val; + props->Flanger.Feedback = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_FLANGER_DELAY: if(val >= AL_FLANGER_MIN_DELAY && val <= AL_FLANGER_MAX_DELAY) - effect->Flanger.Delay = val; + props->Flanger.Delay = val; else alSetError(context, AL_INVALID_VALUE); break; @@ -354,14 +356,15 @@ void ALflanger_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, c void ALflanger_GetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) { + const ALeffectProps *props = &effect->Props; switch(param) { case AL_FLANGER_WAVEFORM: - *val = effect->Flanger.Waveform; + *val = props->Flanger.Waveform; break; case AL_FLANGER_PHASE: - *val = effect->Flanger.Phase; + *val = props->Flanger.Phase; break; default: @@ -375,22 +378,23 @@ void ALflanger_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, A } void ALflanger_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) { + const ALeffectProps *props = &effect->Props; switch(param) { case AL_FLANGER_RATE: - *val = effect->Flanger.Rate; + *val = props->Flanger.Rate; break; case AL_FLANGER_DEPTH: - *val = effect->Flanger.Depth; + *val = props->Flanger.Depth; break; case AL_FLANGER_FEEDBACK: - *val = effect->Flanger.Feedback; + *val = props->Flanger.Feedback; break; case AL_FLANGER_DELAY: - *val = effect->Flanger.Delay; + *val = props->Flanger.Delay; break; default: diff --git a/Alc/effects/modulator.c b/Alc/effects/modulator.c index 3f9ff8a5..bd994adb 100644 --- a/Alc/effects/modulator.c +++ b/Alc/effects/modulator.c @@ -152,18 +152,18 @@ static ALvoid ALmodulatorState_Update(ALmodulatorState *state, ALCdevice *Device ALfloat gain, cw, a = 0.0f; ALuint index; - if(Slot->effect.Modulator.Waveform == AL_RING_MODULATOR_SINUSOID) + if(Slot->EffectProps.Modulator.Waveform == AL_RING_MODULATOR_SINUSOID) state->Waveform = SINUSOID; - else if(Slot->effect.Modulator.Waveform == AL_RING_MODULATOR_SAWTOOTH) + else if(Slot->EffectProps.Modulator.Waveform == AL_RING_MODULATOR_SAWTOOTH) state->Waveform = SAWTOOTH; - else if(Slot->effect.Modulator.Waveform == AL_RING_MODULATOR_SQUARE) + else if(Slot->EffectProps.Modulator.Waveform == AL_RING_MODULATOR_SQUARE) state->Waveform = SQUARE; - state->step = fastf2u(Slot->effect.Modulator.Frequency*WAVEFORM_FRACONE / + state->step = fastf2u(Slot->EffectProps.Modulator.Frequency*WAVEFORM_FRACONE / Device->Frequency); if(state->step == 0) state->step = 1; - cw = cosf(F_PI*2.0f * Slot->effect.Modulator.HighPassCutoff / + cw = cosf(F_PI*2.0f * Slot->EffectProps.Modulator.HighPassCutoff / Device->Frequency); a = (2.0f-cw) - sqrtf(powf(2.0f-cw, 2.0f) - 1.0f); state->iirFilter.coeff = a; @@ -240,18 +240,19 @@ ALeffectStateFactory *ALmodulatorStateFactory_getFactory(void) void ALmodulator_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) { + ALeffectProps *props = &effect->Props; switch(param) { case AL_RING_MODULATOR_FREQUENCY: if(val >= AL_RING_MODULATOR_MIN_FREQUENCY && val <= AL_RING_MODULATOR_MAX_FREQUENCY) - effect->Modulator.Frequency = val; + props->Modulator.Frequency = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_RING_MODULATOR_HIGHPASS_CUTOFF: if(val >= AL_RING_MODULATOR_MIN_HIGHPASS_CUTOFF && val <= AL_RING_MODULATOR_MAX_HIGHPASS_CUTOFF) - effect->Modulator.HighPassCutoff = val; + props->Modulator.HighPassCutoff = val; else alSetError(context, AL_INVALID_VALUE); break; @@ -267,6 +268,7 @@ void ALmodulator_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, } void ALmodulator_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) { + ALeffectProps *props = &effect->Props; switch(param) { case AL_RING_MODULATOR_FREQUENCY: @@ -276,7 +278,7 @@ void ALmodulator_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, case AL_RING_MODULATOR_WAVEFORM: if(val >= AL_RING_MODULATOR_MIN_WAVEFORM && val <= AL_RING_MODULATOR_MAX_WAVEFORM) - effect->Modulator.Waveform = val; + props->Modulator.Waveform = val; else alSetError(context, AL_INVALID_VALUE); break; @@ -293,16 +295,17 @@ void ALmodulator_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, void ALmodulator_GetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) { + const ALeffectProps *props = &effect->Props; switch(param) { case AL_RING_MODULATOR_FREQUENCY: - *val = (ALint)effect->Modulator.Frequency; + *val = (ALint)props->Modulator.Frequency; break; case AL_RING_MODULATOR_HIGHPASS_CUTOFF: - *val = (ALint)effect->Modulator.HighPassCutoff; + *val = (ALint)props->Modulator.HighPassCutoff; break; case AL_RING_MODULATOR_WAVEFORM: - *val = effect->Modulator.Waveform; + *val = props->Modulator.Waveform; break; default: @@ -316,13 +319,14 @@ void ALmodulator_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, } void ALmodulator_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) { + ALeffectProps *props = &effect->Props; switch(param) { case AL_RING_MODULATOR_FREQUENCY: - *val = effect->Modulator.Frequency; + *val = props->Modulator.Frequency; break; case AL_RING_MODULATOR_HIGHPASS_CUTOFF: - *val = effect->Modulator.HighPassCutoff; + *val = props->Modulator.HighPassCutoff; break; default: diff --git a/Alc/effects/reverb.c b/Alc/effects/reverb.c index 2421225d..b283b67f 100644 --- a/Alc/effects/reverb.c +++ b/Alc/effects/reverb.c @@ -1085,70 +1085,70 @@ static ALvoid ALreverbState_Update(ALreverbState *State, ALCdevice *Device, cons ALuint frequency = Device->Frequency; ALfloat cw, x, y, hfRatio; - if(Slot->effect.type == AL_EFFECT_EAXREVERB && !EmulateEAXReverb) + if(Slot->EffectType == AL_EFFECT_EAXREVERB && !EmulateEAXReverb) State->IsEax = AL_TRUE; - else if(Slot->effect.type == AL_EFFECT_REVERB || EmulateEAXReverb) + else if(Slot->EffectType == AL_EFFECT_REVERB || EmulateEAXReverb) State->IsEax = AL_FALSE; // Calculate the master low-pass filter (from the master effect HF gain). if(State->IsEax) - cw = CalcI3DL2HFreq(Slot->effect.Reverb.HFReference, frequency); + cw = CalcI3DL2HFreq(Slot->EffectProps.Reverb.HFReference, frequency); else cw = CalcI3DL2HFreq(LOWPASSFREQREF, frequency); // This is done with 2 chained 1-pole filters, so no need to square g. - State->LpFilter.coeff = lpCoeffCalc(Slot->effect.Reverb.GainHF, cw); + State->LpFilter.coeff = lpCoeffCalc(Slot->EffectProps.Reverb.GainHF, cw); if(State->IsEax) { // Update the modulator line. - UpdateModulator(Slot->effect.Reverb.ModulationTime, - Slot->effect.Reverb.ModulationDepth, + UpdateModulator(Slot->EffectProps.Reverb.ModulationTime, + Slot->EffectProps.Reverb.ModulationDepth, frequency, State); } // Update the initial effect delay. - UpdateDelayLine(Slot->effect.Reverb.ReflectionsDelay, - Slot->effect.Reverb.LateReverbDelay, + UpdateDelayLine(Slot->EffectProps.Reverb.ReflectionsDelay, + Slot->EffectProps.Reverb.LateReverbDelay, frequency, State); // Update the early lines. - UpdateEarlyLines(Slot->effect.Reverb.Gain, - Slot->effect.Reverb.ReflectionsGain, - Slot->effect.Reverb.LateReverbDelay, State); + UpdateEarlyLines(Slot->EffectProps.Reverb.Gain, + Slot->EffectProps.Reverb.ReflectionsGain, + Slot->EffectProps.Reverb.LateReverbDelay, State); // Update the decorrelator. - UpdateDecorrelator(Slot->effect.Reverb.Density, frequency, State); + UpdateDecorrelator(Slot->EffectProps.Reverb.Density, frequency, State); // Get the mixing matrix coefficients (x and y). - CalcMatrixCoeffs(Slot->effect.Reverb.Diffusion, &x, &y); + CalcMatrixCoeffs(Slot->EffectProps.Reverb.Diffusion, &x, &y); // Then divide x into y to simplify the matrix calculation. State->Late.MixCoeff = y / x; // If the HF limit parameter is flagged, calculate an appropriate limit // based on the air absorption parameter. - hfRatio = Slot->effect.Reverb.DecayHFRatio; - if(Slot->effect.Reverb.DecayHFLimit && - Slot->effect.Reverb.AirAbsorptionGainHF < 1.0f) + hfRatio = Slot->EffectProps.Reverb.DecayHFRatio; + if(Slot->EffectProps.Reverb.DecayHFLimit && + Slot->EffectProps.Reverb.AirAbsorptionGainHF < 1.0f) hfRatio = CalcLimitedHfRatio(hfRatio, - Slot->effect.Reverb.AirAbsorptionGainHF, - Slot->effect.Reverb.DecayTime); + Slot->EffectProps.Reverb.AirAbsorptionGainHF, + Slot->EffectProps.Reverb.DecayTime); // Update the late lines. - UpdateLateLines(Slot->effect.Reverb.Gain, Slot->effect.Reverb.LateReverbGain, - x, Slot->effect.Reverb.Density, Slot->effect.Reverb.DecayTime, - Slot->effect.Reverb.Diffusion, hfRatio, cw, frequency, State); + UpdateLateLines(Slot->EffectProps.Reverb.Gain, Slot->EffectProps.Reverb.LateReverbGain, + x, Slot->EffectProps.Reverb.Density, Slot->EffectProps.Reverb.DecayTime, + Slot->EffectProps.Reverb.Diffusion, hfRatio, cw, frequency, State); if(State->IsEax) { // Update the echo line. - UpdateEchoLine(Slot->effect.Reverb.Gain, Slot->effect.Reverb.LateReverbGain, - Slot->effect.Reverb.EchoTime, Slot->effect.Reverb.DecayTime, - Slot->effect.Reverb.Diffusion, Slot->effect.Reverb.EchoDepth, + UpdateEchoLine(Slot->EffectProps.Reverb.Gain, Slot->EffectProps.Reverb.LateReverbGain, + Slot->EffectProps.Reverb.EchoTime, Slot->EffectProps.Reverb.DecayTime, + Slot->EffectProps.Reverb.Diffusion, Slot->EffectProps.Reverb.EchoDepth, hfRatio, cw, frequency, State); // Update early and late 3D panning. - Update3DPanning(Device, Slot->effect.Reverb.ReflectionsPan, - Slot->effect.Reverb.LateReverbPan, Slot->Gain, State); + Update3DPanning(Device, Slot->EffectProps.Reverb.ReflectionsPan, + Slot->EffectProps.Reverb.LateReverbPan, Slot->Gain, State); } else { @@ -1292,11 +1292,12 @@ ALeffectStateFactory *ALreverbStateFactory_getFactory(void) void ALeaxreverb_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) { + ALeffectProps *props = &effect->Props; switch(param) { case AL_EAXREVERB_DECAY_HFLIMIT: if(val >= AL_EAXREVERB_MIN_DECAY_HFLIMIT && val <= AL_EAXREVERB_MAX_DECAY_HFLIMIT) - effect->Reverb.DecayHFLimit = val; + props->Reverb.DecayHFLimit = val; else alSetError(context, AL_INVALID_VALUE); break; @@ -1312,144 +1313,145 @@ void ALeaxreverb_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, } void ALeaxreverb_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) { + ALeffectProps *props = &effect->Props; switch(param) { case AL_EAXREVERB_DENSITY: if(val >= AL_EAXREVERB_MIN_DENSITY && val <= AL_EAXREVERB_MAX_DENSITY) - effect->Reverb.Density = val; + props->Reverb.Density = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_EAXREVERB_DIFFUSION: if(val >= AL_EAXREVERB_MIN_DIFFUSION && val <= AL_EAXREVERB_MAX_DIFFUSION) - effect->Reverb.Diffusion = val; + props->Reverb.Diffusion = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_EAXREVERB_GAIN: if(val >= AL_EAXREVERB_MIN_GAIN && val <= AL_EAXREVERB_MAX_GAIN) - effect->Reverb.Gain = val; + props->Reverb.Gain = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_EAXREVERB_GAINHF: if(val >= AL_EAXREVERB_MIN_GAINHF && val <= AL_EAXREVERB_MAX_GAINHF) - effect->Reverb.GainHF = val; + props->Reverb.GainHF = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_EAXREVERB_GAINLF: if(val >= AL_EAXREVERB_MIN_GAINLF && val <= AL_EAXREVERB_MAX_GAINLF) - effect->Reverb.GainLF = val; + props->Reverb.GainLF = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_EAXREVERB_DECAY_TIME: if(val >= AL_EAXREVERB_MIN_DECAY_TIME && val <= AL_EAXREVERB_MAX_DECAY_TIME) - effect->Reverb.DecayTime = val; + props->Reverb.DecayTime = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_EAXREVERB_DECAY_HFRATIO: if(val >= AL_EAXREVERB_MIN_DECAY_HFRATIO && val <= AL_EAXREVERB_MAX_DECAY_HFRATIO) - effect->Reverb.DecayHFRatio = val; + props->Reverb.DecayHFRatio = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_EAXREVERB_DECAY_LFRATIO: if(val >= AL_EAXREVERB_MIN_DECAY_LFRATIO && val <= AL_EAXREVERB_MAX_DECAY_LFRATIO) - effect->Reverb.DecayLFRatio = val; + props->Reverb.DecayLFRatio = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_EAXREVERB_REFLECTIONS_GAIN: if(val >= AL_EAXREVERB_MIN_REFLECTIONS_GAIN && val <= AL_EAXREVERB_MAX_REFLECTIONS_GAIN) - effect->Reverb.ReflectionsGain = val; + props->Reverb.ReflectionsGain = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_EAXREVERB_REFLECTIONS_DELAY: if(val >= AL_EAXREVERB_MIN_REFLECTIONS_DELAY && val <= AL_EAXREVERB_MAX_REFLECTIONS_DELAY) - effect->Reverb.ReflectionsDelay = val; + props->Reverb.ReflectionsDelay = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_EAXREVERB_LATE_REVERB_GAIN: if(val >= AL_EAXREVERB_MIN_LATE_REVERB_GAIN && val <= AL_EAXREVERB_MAX_LATE_REVERB_GAIN) - effect->Reverb.LateReverbGain = val; + props->Reverb.LateReverbGain = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_EAXREVERB_LATE_REVERB_DELAY: if(val >= AL_EAXREVERB_MIN_LATE_REVERB_DELAY && val <= AL_EAXREVERB_MAX_LATE_REVERB_DELAY) - effect->Reverb.LateReverbDelay = val; + props->Reverb.LateReverbDelay = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_EAXREVERB_AIR_ABSORPTION_GAINHF: if(val >= AL_EAXREVERB_MIN_AIR_ABSORPTION_GAINHF && val <= AL_EAXREVERB_MAX_AIR_ABSORPTION_GAINHF) - effect->Reverb.AirAbsorptionGainHF = val; + props->Reverb.AirAbsorptionGainHF = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_EAXREVERB_ECHO_TIME: if(val >= AL_EAXREVERB_MIN_ECHO_TIME && val <= AL_EAXREVERB_MAX_ECHO_TIME) - effect->Reverb.EchoTime = val; + props->Reverb.EchoTime = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_EAXREVERB_ECHO_DEPTH: if(val >= AL_EAXREVERB_MIN_ECHO_DEPTH && val <= AL_EAXREVERB_MAX_ECHO_DEPTH) - effect->Reverb.EchoDepth = val; + props->Reverb.EchoDepth = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_EAXREVERB_MODULATION_TIME: if(val >= AL_EAXREVERB_MIN_MODULATION_TIME && val <= AL_EAXREVERB_MAX_MODULATION_TIME) - effect->Reverb.ModulationTime = val; + props->Reverb.ModulationTime = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_EAXREVERB_MODULATION_DEPTH: if(val >= AL_EAXREVERB_MIN_MODULATION_DEPTH && val <= AL_EAXREVERB_MAX_MODULATION_DEPTH) - effect->Reverb.ModulationDepth = val; + props->Reverb.ModulationDepth = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_EAXREVERB_HFREFERENCE: if(val >= AL_EAXREVERB_MIN_HFREFERENCE && val <= AL_EAXREVERB_MAX_HFREFERENCE) - effect->Reverb.HFReference = val; + props->Reverb.HFReference = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_EAXREVERB_LFREFERENCE: if(val >= AL_EAXREVERB_MIN_LFREFERENCE && val <= AL_EAXREVERB_MAX_LFREFERENCE) - effect->Reverb.LFReference = val; + props->Reverb.LFReference = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_EAXREVERB_ROOM_ROLLOFF_FACTOR: if(val >= AL_EAXREVERB_MIN_ROOM_ROLLOFF_FACTOR && val <= AL_EAXREVERB_MAX_ROOM_ROLLOFF_FACTOR) - effect->Reverb.RoomRolloffFactor = val; + props->Reverb.RoomRolloffFactor = val; else alSetError(context, AL_INVALID_VALUE); break; @@ -1461,15 +1463,16 @@ void ALeaxreverb_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, } void ALeaxreverb_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) { + ALeffectProps *props = &effect->Props; switch(param) { case AL_EAXREVERB_REFLECTIONS_PAN: if(isfinite(vals[0]) && isfinite(vals[1]) && isfinite(vals[2])) { LockContext(context); - effect->Reverb.ReflectionsPan[0] = vals[0]; - effect->Reverb.ReflectionsPan[1] = vals[1]; - effect->Reverb.ReflectionsPan[2] = vals[2]; + props->Reverb.ReflectionsPan[0] = vals[0]; + props->Reverb.ReflectionsPan[1] = vals[1]; + props->Reverb.ReflectionsPan[2] = vals[2]; UnlockContext(context); } else @@ -1479,9 +1482,9 @@ void ALeaxreverb_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, if(isfinite(vals[0]) && isfinite(vals[1]) && isfinite(vals[2])) { LockContext(context); - effect->Reverb.LateReverbPan[0] = vals[0]; - effect->Reverb.LateReverbPan[1] = vals[1]; - effect->Reverb.LateReverbPan[2] = vals[2]; + props->Reverb.LateReverbPan[0] = vals[0]; + props->Reverb.LateReverbPan[1] = vals[1]; + props->Reverb.LateReverbPan[2] = vals[2]; UnlockContext(context); } else @@ -1496,10 +1499,11 @@ void ALeaxreverb_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, void ALeaxreverb_GetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) { + const ALeffectProps *props = &effect->Props; switch(param) { case AL_EAXREVERB_DECAY_HFLIMIT: - *val = effect->Reverb.DecayHFLimit; + *val = props->Reverb.DecayHFLimit; break; default: @@ -1513,86 +1517,87 @@ void ALeaxreverb_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, } void ALeaxreverb_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) { + const ALeffectProps *props = &effect->Props; switch(param) { case AL_EAXREVERB_DENSITY: - *val = effect->Reverb.Density; + *val = props->Reverb.Density; break; case AL_EAXREVERB_DIFFUSION: - *val = effect->Reverb.Diffusion; + *val = props->Reverb.Diffusion; break; case AL_EAXREVERB_GAIN: - *val = effect->Reverb.Gain; + *val = props->Reverb.Gain; break; case AL_EAXREVERB_GAINHF: - *val = effect->Reverb.GainHF; + *val = props->Reverb.GainHF; break; case AL_EAXREVERB_GAINLF: - *val = effect->Reverb.GainLF; + *val = props->Reverb.GainLF; break; case AL_EAXREVERB_DECAY_TIME: - *val = effect->Reverb.DecayTime; + *val = props->Reverb.DecayTime; break; case AL_EAXREVERB_DECAY_HFRATIO: - *val = effect->Reverb.DecayHFRatio; + *val = props->Reverb.DecayHFRatio; break; case AL_EAXREVERB_DECAY_LFRATIO: - *val = effect->Reverb.DecayLFRatio; + *val = props->Reverb.DecayLFRatio; break; case AL_EAXREVERB_REFLECTIONS_GAIN: - *val = effect->Reverb.ReflectionsGain; + *val = props->Reverb.ReflectionsGain; break; case AL_EAXREVERB_REFLECTIONS_DELAY: - *val = effect->Reverb.ReflectionsDelay; + *val = props->Reverb.ReflectionsDelay; break; case AL_EAXREVERB_LATE_REVERB_GAIN: - *val = effect->Reverb.LateReverbGain; + *val = props->Reverb.LateReverbGain; break; case AL_EAXREVERB_LATE_REVERB_DELAY: - *val = effect->Reverb.LateReverbDelay; + *val = props->Reverb.LateReverbDelay; break; case AL_EAXREVERB_AIR_ABSORPTION_GAINHF: - *val = effect->Reverb.AirAbsorptionGainHF; + *val = props->Reverb.AirAbsorptionGainHF; break; case AL_EAXREVERB_ECHO_TIME: - *val = effect->Reverb.EchoTime; + *val = props->Reverb.EchoTime; break; case AL_EAXREVERB_ECHO_DEPTH: - *val = effect->Reverb.EchoDepth; + *val = props->Reverb.EchoDepth; break; case AL_EAXREVERB_MODULATION_TIME: - *val = effect->Reverb.ModulationTime; + *val = props->Reverb.ModulationTime; break; case AL_EAXREVERB_MODULATION_DEPTH: - *val = effect->Reverb.ModulationDepth; + *val = props->Reverb.ModulationDepth; break; case AL_EAXREVERB_HFREFERENCE: - *val = effect->Reverb.HFReference; + *val = props->Reverb.HFReference; break; case AL_EAXREVERB_LFREFERENCE: - *val = effect->Reverb.LFReference; + *val = props->Reverb.LFReference; break; case AL_EAXREVERB_ROOM_ROLLOFF_FACTOR: - *val = effect->Reverb.RoomRolloffFactor; + *val = props->Reverb.RoomRolloffFactor; break; default: @@ -1602,20 +1607,21 @@ void ALeaxreverb_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param, } void ALeaxreverb_GetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) { + const ALeffectProps *props = &effect->Props; switch(param) { case AL_EAXREVERB_REFLECTIONS_PAN: LockContext(context); - vals[0] = effect->Reverb.ReflectionsPan[0]; - vals[1] = effect->Reverb.ReflectionsPan[1]; - vals[2] = effect->Reverb.ReflectionsPan[2]; + vals[0] = props->Reverb.ReflectionsPan[0]; + vals[1] = props->Reverb.ReflectionsPan[1]; + vals[2] = props->Reverb.ReflectionsPan[2]; UnlockContext(context); break; case AL_EAXREVERB_LATE_REVERB_PAN: LockContext(context); - vals[0] = effect->Reverb.LateReverbPan[0]; - vals[1] = effect->Reverb.LateReverbPan[1]; - vals[2] = effect->Reverb.LateReverbPan[2]; + vals[0] = props->Reverb.LateReverbPan[0]; + vals[1] = props->Reverb.LateReverbPan[1]; + vals[2] = props->Reverb.LateReverbPan[2]; UnlockContext(context); break; @@ -1629,11 +1635,12 @@ DEFINE_ALEFFECT_VTABLE(ALeaxreverb); void ALreverb_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) { + ALeffectProps *props = &effect->Props; switch(param) { case AL_REVERB_DECAY_HFLIMIT: if(val >= AL_REVERB_MIN_DECAY_HFLIMIT && val <= AL_REVERB_MAX_DECAY_HFLIMIT) - effect->Reverb.DecayHFLimit = val; + props->Reverb.DecayHFLimit = val; else alSetError(context, AL_INVALID_VALUE); break; @@ -1649,88 +1656,89 @@ void ALreverb_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, co } void ALreverb_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) { + ALeffectProps *props = &effect->Props; switch(param) { case AL_REVERB_DENSITY: if(val >= AL_REVERB_MIN_DENSITY && val <= AL_REVERB_MAX_DENSITY) - effect->Reverb.Density = val; + props->Reverb.Density = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_REVERB_DIFFUSION: if(val >= AL_REVERB_MIN_DIFFUSION && val <= AL_REVERB_MAX_DIFFUSION) - effect->Reverb.Diffusion = val; + props->Reverb.Diffusion = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_REVERB_GAIN: if(val >= AL_REVERB_MIN_GAIN && val <= AL_REVERB_MAX_GAIN) - effect->Reverb.Gain = val; + props->Reverb.Gain = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_REVERB_GAINHF: if(val >= AL_REVERB_MIN_GAINHF && val <= AL_REVERB_MAX_GAINHF) - effect->Reverb.GainHF = val; + props->Reverb.GainHF = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_REVERB_DECAY_TIME: if(val >= AL_REVERB_MIN_DECAY_TIME && val <= AL_REVERB_MAX_DECAY_TIME) - effect->Reverb.DecayTime = val; + props->Reverb.DecayTime = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_REVERB_DECAY_HFRATIO: if(val >= AL_REVERB_MIN_DECAY_HFRATIO && val <= AL_REVERB_MAX_DECAY_HFRATIO) - effect->Reverb.DecayHFRatio = val; + props->Reverb.DecayHFRatio = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_REVERB_REFLECTIONS_GAIN: if(val >= AL_REVERB_MIN_REFLECTIONS_GAIN && val <= AL_REVERB_MAX_REFLECTIONS_GAIN) - effect->Reverb.ReflectionsGain = val; + props->Reverb.ReflectionsGain = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_REVERB_REFLECTIONS_DELAY: if(val >= AL_REVERB_MIN_REFLECTIONS_DELAY && val <= AL_REVERB_MAX_REFLECTIONS_DELAY) - effect->Reverb.ReflectionsDelay = val; + props->Reverb.ReflectionsDelay = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_REVERB_LATE_REVERB_GAIN: if(val >= AL_REVERB_MIN_LATE_REVERB_GAIN && val <= AL_REVERB_MAX_LATE_REVERB_GAIN) - effect->Reverb.LateReverbGain = val; + props->Reverb.LateReverbGain = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_REVERB_LATE_REVERB_DELAY: if(val >= AL_REVERB_MIN_LATE_REVERB_DELAY && val <= AL_REVERB_MAX_LATE_REVERB_DELAY) - effect->Reverb.LateReverbDelay = val; + props->Reverb.LateReverbDelay = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_REVERB_AIR_ABSORPTION_GAINHF: if(val >= AL_REVERB_MIN_AIR_ABSORPTION_GAINHF && val <= AL_REVERB_MAX_AIR_ABSORPTION_GAINHF) - effect->Reverb.AirAbsorptionGainHF = val; + props->Reverb.AirAbsorptionGainHF = val; else alSetError(context, AL_INVALID_VALUE); break; case AL_REVERB_ROOM_ROLLOFF_FACTOR: if(val >= AL_REVERB_MIN_ROOM_ROLLOFF_FACTOR && val <= AL_REVERB_MAX_ROOM_ROLLOFF_FACTOR) - effect->Reverb.RoomRolloffFactor = val; + props->Reverb.RoomRolloffFactor = val; else alSetError(context, AL_INVALID_VALUE); break; @@ -1747,10 +1755,11 @@ void ALreverb_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, co void ALreverb_GetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) { + const ALeffectProps *props = &effect->Props; switch(param) { case AL_REVERB_DECAY_HFLIMIT: - *val = effect->Reverb.DecayHFLimit; + *val = props->Reverb.DecayHFLimit; break; default: @@ -1764,54 +1773,55 @@ void ALreverb_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, AL } void ALreverb_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) { + const ALeffectProps *props = &effect->Props; switch(param) { case AL_REVERB_DENSITY: - *val = effect->Reverb.Density; + *val = props->Reverb.Density; break; case AL_REVERB_DIFFUSION: - *val = effect->Reverb.Diffusion; + *val = props->Reverb.Diffusion; break; case AL_REVERB_GAIN: - *val = effect->Reverb.Gain; + *val = props->Reverb.Gain; break; case AL_REVERB_GAINHF: - *val = effect->Reverb.GainHF; + *val = props->Reverb.GainHF; break; case AL_REVERB_DECAY_TIME: - *val = effect->Reverb.DecayTime; + *val = props->Reverb.DecayTime; break; case AL_REVERB_DECAY_HFRATIO: - *val = effect->Reverb.DecayHFRatio; + *val = props->Reverb.DecayHFRatio; break; case AL_REVERB_REFLECTIONS_GAIN: - *val = effect->Reverb.ReflectionsGain; + *val = props->Reverb.ReflectionsGain; break; case AL_REVERB_REFLECTIONS_DELAY: - *val = effect->Reverb.ReflectionsDelay; + *val = props->Reverb.ReflectionsDelay; break; case AL_REVERB_LATE_REVERB_GAIN: - *val = effect->Reverb.LateReverbGain; + *val = props->Reverb.LateReverbGain; break; case AL_REVERB_LATE_REVERB_DELAY: - *val = effect->Reverb.LateReverbDelay; + *val = props->Reverb.LateReverbDelay; break; case AL_REVERB_AIR_ABSORPTION_GAINHF: - *val = effect->Reverb.AirAbsorptionGainHF; + *val = props->Reverb.AirAbsorptionGainHF; break; case AL_REVERB_ROOM_ROLLOFF_FACTOR: - *val = effect->Reverb.RoomRolloffFactor; + *val = props->Reverb.RoomRolloffFactor; break; default: diff --git a/OpenAL32/Include/alAuxEffectSlot.h b/OpenAL32/Include/alAuxEffectSlot.h index d7062ff7..24614fa4 100644 --- a/OpenAL32/Include/alAuxEffectSlot.h +++ b/OpenAL32/Include/alAuxEffectSlot.h @@ -73,7 +73,8 @@ static const struct ALeffectStateFactoryVtable T##_ALeffectStateFactory_vtable = struct ALeffectslot { - ALeffect effect; + ALenum EffectType; + ALeffectProps EffectProps; volatile ALfloat Gain; volatile ALboolean AuxSendAuto; diff --git a/OpenAL32/Include/alEffect.h b/OpenAL32/Include/alEffect.h index cea785dc..c0bbb40a 100644 --- a/OpenAL32/Include/alEffect.h +++ b/OpenAL32/Include/alEffect.h @@ -59,11 +59,7 @@ extern const struct ALeffectVtable ALnull_vtable; extern const struct ALeffectVtable ALdedicated_vtable; -struct ALeffect -{ - // Effect type (AL_EFFECT_NULL, ...) - ALenum type; - +typedef union ALeffectProps { struct { // Shared Reverb Properties ALfloat Density; @@ -152,6 +148,14 @@ struct ALeffect ALfloat EQCenter; ALfloat EQBandwidth; } Distortion; +} ALeffectProps; + +struct ALeffect +{ + // Effect type (AL_EFFECT_NULL, ...) + ALenum type; + + ALeffectProps Props; const struct ALeffectVtable *vtbl; diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c index 0b2cce21..e2d9b42d 100644 --- a/OpenAL32/alAuxEffectSlot.c +++ b/OpenAL32/alAuxEffectSlot.c @@ -294,10 +294,6 @@ AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSloti(ALuint effectslot, ALenum pa al_throwerr(Context, AL_INVALID_NAME); switch(param) { - case AL_EFFECTSLOT_EFFECT: - *value = Slot->effect.id; - break; - case AL_EFFECTSLOT_AUXILIARY_SEND_AUTO: *value = Slot->AuxSendAuto; break; @@ -479,7 +475,7 @@ ALenum InitializeEffect(ALCdevice *Device, ALeffectslot *EffectSlot, ALeffect *e ALenum newtype = (effect ? effect->type : AL_EFFECT_NULL); ALeffectStateFactory *factory; - if(newtype != EffectSlot->effect.type) + if(newtype != EffectSlot->EffectType) { ALeffectState *State; FPUCtl oldMode; @@ -507,9 +503,15 @@ ALenum InitializeEffect(ALCdevice *Device, ALeffectslot *EffectSlot, ALeffect *e State = ExchangePtr((XchgPtr*)&EffectSlot->EffectState, State); if(!effect) - memset(&EffectSlot->effect, 0, sizeof(EffectSlot->effect)); + { + memset(&EffectSlot->EffectProps, 0, sizeof(EffectSlot->EffectProps)); + EffectSlot->EffectType = AL_EFFECT_NULL; + } else - memcpy(&EffectSlot->effect, effect, sizeof(*effect)); + { + memcpy(&EffectSlot->EffectProps, &effect->Props, sizeof(effect->Props)); + EffectSlot->EffectType = effect->type; + } /* FIXME: This should be done asynchronously, but since the EffectState * object was changed, it needs an update before its Process method can @@ -525,13 +527,13 @@ ALenum InitializeEffect(ALCdevice *Device, ALeffectslot *EffectSlot, ALeffect *e } else { - ALCdevice_Lock(Device); - if(!effect) - memset(&EffectSlot->effect, 0, sizeof(EffectSlot->effect)); - else - memcpy(&EffectSlot->effect, effect, sizeof(*effect)); - ALCdevice_Unlock(Device); - EffectSlot->NeedsUpdate = AL_TRUE; + if(effect) + { + ALCdevice_Lock(Device); + memcpy(&EffectSlot->EffectProps, &effect->Props, sizeof(effect->Props)); + ALCdevice_Unlock(Device); + EffectSlot->NeedsUpdate = AL_TRUE; + } } return AL_NO_ERROR; @@ -543,6 +545,8 @@ ALenum InitEffectSlot(ALeffectslot *slot) ALeffectStateFactory *factory; ALint i, c; + slot->EffectType = AL_EFFECT_NULL; + factory = getFactoryByType(AL_EFFECT_NULL); if(!(slot->EffectState=ALeffectStateFactory_create(factory))) return AL_OUT_OF_MEMORY; diff --git a/OpenAL32/alEffect.c b/OpenAL32/alEffect.c index dded17b1..827a2439 100644 --- a/OpenAL32/alEffect.c +++ b/OpenAL32/alEffect.c @@ -368,107 +368,107 @@ static void InitEffectParams(ALeffect *effect, ALenum type) switch(type) { case AL_EFFECT_EAXREVERB: - effect->Reverb.Density = AL_EAXREVERB_DEFAULT_DENSITY; - effect->Reverb.Diffusion = AL_EAXREVERB_DEFAULT_DIFFUSION; - effect->Reverb.Gain = AL_EAXREVERB_DEFAULT_GAIN; - effect->Reverb.GainHF = AL_EAXREVERB_DEFAULT_GAINHF; - effect->Reverb.GainLF = AL_EAXREVERB_DEFAULT_GAINLF; - effect->Reverb.DecayTime = AL_EAXREVERB_DEFAULT_DECAY_TIME; - effect->Reverb.DecayHFRatio = AL_EAXREVERB_DEFAULT_DECAY_HFRATIO; - effect->Reverb.DecayLFRatio = AL_EAXREVERB_DEFAULT_DECAY_LFRATIO; - effect->Reverb.ReflectionsGain = AL_EAXREVERB_DEFAULT_REFLECTIONS_GAIN; - effect->Reverb.ReflectionsDelay = AL_EAXREVERB_DEFAULT_REFLECTIONS_DELAY; - effect->Reverb.ReflectionsPan[0] = AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN_XYZ; - effect->Reverb.ReflectionsPan[1] = AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN_XYZ; - effect->Reverb.ReflectionsPan[2] = AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN_XYZ; - effect->Reverb.LateReverbGain = AL_EAXREVERB_DEFAULT_LATE_REVERB_GAIN; - effect->Reverb.LateReverbDelay = AL_EAXREVERB_DEFAULT_LATE_REVERB_DELAY; - effect->Reverb.LateReverbPan[0] = AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN_XYZ; - effect->Reverb.LateReverbPan[1] = AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN_XYZ; - effect->Reverb.LateReverbPan[2] = AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN_XYZ; - effect->Reverb.EchoTime = AL_EAXREVERB_DEFAULT_ECHO_TIME; - effect->Reverb.EchoDepth = AL_EAXREVERB_DEFAULT_ECHO_DEPTH; - effect->Reverb.ModulationTime = AL_EAXREVERB_DEFAULT_MODULATION_TIME; - effect->Reverb.ModulationDepth = AL_EAXREVERB_DEFAULT_MODULATION_DEPTH; - effect->Reverb.AirAbsorptionGainHF = AL_EAXREVERB_DEFAULT_AIR_ABSORPTION_GAINHF; - effect->Reverb.HFReference = AL_EAXREVERB_DEFAULT_HFREFERENCE; - effect->Reverb.LFReference = AL_EAXREVERB_DEFAULT_LFREFERENCE; - effect->Reverb.RoomRolloffFactor = AL_EAXREVERB_DEFAULT_ROOM_ROLLOFF_FACTOR; - effect->Reverb.DecayHFLimit = AL_EAXREVERB_DEFAULT_DECAY_HFLIMIT; + effect->Props.Reverb.Density = AL_EAXREVERB_DEFAULT_DENSITY; + effect->Props.Reverb.Diffusion = AL_EAXREVERB_DEFAULT_DIFFUSION; + effect->Props.Reverb.Gain = AL_EAXREVERB_DEFAULT_GAIN; + effect->Props.Reverb.GainHF = AL_EAXREVERB_DEFAULT_GAINHF; + effect->Props.Reverb.GainLF = AL_EAXREVERB_DEFAULT_GAINLF; + effect->Props.Reverb.DecayTime = AL_EAXREVERB_DEFAULT_DECAY_TIME; + effect->Props.Reverb.DecayHFRatio = AL_EAXREVERB_DEFAULT_DECAY_HFRATIO; + effect->Props.Reverb.DecayLFRatio = AL_EAXREVERB_DEFAULT_DECAY_LFRATIO; + effect->Props.Reverb.ReflectionsGain = AL_EAXREVERB_DEFAULT_REFLECTIONS_GAIN; + effect->Props.Reverb.ReflectionsDelay = AL_EAXREVERB_DEFAULT_REFLECTIONS_DELAY; + effect->Props.Reverb.ReflectionsPan[0] = AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN_XYZ; + effect->Props.Reverb.ReflectionsPan[1] = AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN_XYZ; + effect->Props.Reverb.ReflectionsPan[2] = AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN_XYZ; + effect->Props.Reverb.LateReverbGain = AL_EAXREVERB_DEFAULT_LATE_REVERB_GAIN; + effect->Props.Reverb.LateReverbDelay = AL_EAXREVERB_DEFAULT_LATE_REVERB_DELAY; + effect->Props.Reverb.LateReverbPan[0] = AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN_XYZ; + effect->Props.Reverb.LateReverbPan[1] = AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN_XYZ; + effect->Props.Reverb.LateReverbPan[2] = AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN_XYZ; + effect->Props.Reverb.EchoTime = AL_EAXREVERB_DEFAULT_ECHO_TIME; + effect->Props.Reverb.EchoDepth = AL_EAXREVERB_DEFAULT_ECHO_DEPTH; + effect->Props.Reverb.ModulationTime = AL_EAXREVERB_DEFAULT_MODULATION_TIME; + effect->Props.Reverb.ModulationDepth = AL_EAXREVERB_DEFAULT_MODULATION_DEPTH; + effect->Props.Reverb.AirAbsorptionGainHF = AL_EAXREVERB_DEFAULT_AIR_ABSORPTION_GAINHF; + effect->Props.Reverb.HFReference = AL_EAXREVERB_DEFAULT_HFREFERENCE; + effect->Props.Reverb.LFReference = AL_EAXREVERB_DEFAULT_LFREFERENCE; + effect->Props.Reverb.RoomRolloffFactor = AL_EAXREVERB_DEFAULT_ROOM_ROLLOFF_FACTOR; + effect->Props.Reverb.DecayHFLimit = AL_EAXREVERB_DEFAULT_DECAY_HFLIMIT; effect->vtbl = &ALeaxreverb_vtable; break; case AL_EFFECT_REVERB: - effect->Reverb.Density = AL_REVERB_DEFAULT_DENSITY; - effect->Reverb.Diffusion = AL_REVERB_DEFAULT_DIFFUSION; - effect->Reverb.Gain = AL_REVERB_DEFAULT_GAIN; - effect->Reverb.GainHF = AL_REVERB_DEFAULT_GAINHF; - effect->Reverb.DecayTime = AL_REVERB_DEFAULT_DECAY_TIME; - effect->Reverb.DecayHFRatio = AL_REVERB_DEFAULT_DECAY_HFRATIO; - effect->Reverb.ReflectionsGain = AL_REVERB_DEFAULT_REFLECTIONS_GAIN; - effect->Reverb.ReflectionsDelay = AL_REVERB_DEFAULT_REFLECTIONS_DELAY; - effect->Reverb.LateReverbGain = AL_REVERB_DEFAULT_LATE_REVERB_GAIN; - effect->Reverb.LateReverbDelay = AL_REVERB_DEFAULT_LATE_REVERB_DELAY; - effect->Reverb.AirAbsorptionGainHF = AL_REVERB_DEFAULT_AIR_ABSORPTION_GAINHF; - effect->Reverb.RoomRolloffFactor = AL_REVERB_DEFAULT_ROOM_ROLLOFF_FACTOR; - effect->Reverb.DecayHFLimit = AL_REVERB_DEFAULT_DECAY_HFLIMIT; + effect->Props.Reverb.Density = AL_REVERB_DEFAULT_DENSITY; + effect->Props.Reverb.Diffusion = AL_REVERB_DEFAULT_DIFFUSION; + effect->Props.Reverb.Gain = AL_REVERB_DEFAULT_GAIN; + effect->Props.Reverb.GainHF = AL_REVERB_DEFAULT_GAINHF; + effect->Props.Reverb.DecayTime = AL_REVERB_DEFAULT_DECAY_TIME; + effect->Props.Reverb.DecayHFRatio = AL_REVERB_DEFAULT_DECAY_HFRATIO; + effect->Props.Reverb.ReflectionsGain = AL_REVERB_DEFAULT_REFLECTIONS_GAIN; + effect->Props.Reverb.ReflectionsDelay = AL_REVERB_DEFAULT_REFLECTIONS_DELAY; + effect->Props.Reverb.LateReverbGain = AL_REVERB_DEFAULT_LATE_REVERB_GAIN; + effect->Props.Reverb.LateReverbDelay = AL_REVERB_DEFAULT_LATE_REVERB_DELAY; + effect->Props.Reverb.AirAbsorptionGainHF = AL_REVERB_DEFAULT_AIR_ABSORPTION_GAINHF; + effect->Props.Reverb.RoomRolloffFactor = AL_REVERB_DEFAULT_ROOM_ROLLOFF_FACTOR; + effect->Props.Reverb.DecayHFLimit = AL_REVERB_DEFAULT_DECAY_HFLIMIT; effect->vtbl = &ALreverb_vtable; break; case AL_EFFECT_CHORUS: - effect->Chorus.Waveform = AL_CHORUS_DEFAULT_WAVEFORM; - effect->Chorus.Phase = AL_CHORUS_DEFAULT_PHASE; - effect->Chorus.Rate = AL_CHORUS_DEFAULT_RATE; - effect->Chorus.Depth = AL_CHORUS_DEFAULT_DEPTH; - effect->Chorus.Feedback = AL_CHORUS_DEFAULT_FEEDBACK; - effect->Chorus.Delay = AL_CHORUS_DEFAULT_DELAY; + effect->Props.Chorus.Waveform = AL_CHORUS_DEFAULT_WAVEFORM; + effect->Props.Chorus.Phase = AL_CHORUS_DEFAULT_PHASE; + effect->Props.Chorus.Rate = AL_CHORUS_DEFAULT_RATE; + effect->Props.Chorus.Depth = AL_CHORUS_DEFAULT_DEPTH; + effect->Props.Chorus.Feedback = AL_CHORUS_DEFAULT_FEEDBACK; + effect->Props.Chorus.Delay = AL_CHORUS_DEFAULT_DELAY; effect->vtbl = &ALchorus_vtable; break; case AL_EFFECT_DISTORTION: - effect->Distortion.Edge = AL_DISTORTION_DEFAULT_EDGE; - effect->Distortion.Gain = AL_DISTORTION_DEFAULT_GAIN; - effect->Distortion.LowpassCutoff = AL_DISTORTION_DEFAULT_LOWPASS_CUTOFF; - effect->Distortion.EQCenter = AL_DISTORTION_DEFAULT_EQCENTER; - effect->Distortion.EQBandwidth = AL_DISTORTION_DEFAULT_EQBANDWIDTH; + effect->Props.Distortion.Edge = AL_DISTORTION_DEFAULT_EDGE; + effect->Props.Distortion.Gain = AL_DISTORTION_DEFAULT_GAIN; + effect->Props.Distortion.LowpassCutoff = AL_DISTORTION_DEFAULT_LOWPASS_CUTOFF; + effect->Props.Distortion.EQCenter = AL_DISTORTION_DEFAULT_EQCENTER; + effect->Props.Distortion.EQBandwidth = AL_DISTORTION_DEFAULT_EQBANDWIDTH; effect->vtbl = &ALdistortion_vtable; break; case AL_EFFECT_ECHO: - effect->Echo.Delay = AL_ECHO_DEFAULT_DELAY; - effect->Echo.LRDelay = AL_ECHO_DEFAULT_LRDELAY; - effect->Echo.Damping = AL_ECHO_DEFAULT_DAMPING; - effect->Echo.Feedback = AL_ECHO_DEFAULT_FEEDBACK; - effect->Echo.Spread = AL_ECHO_DEFAULT_SPREAD; + effect->Props.Echo.Delay = AL_ECHO_DEFAULT_DELAY; + effect->Props.Echo.LRDelay = AL_ECHO_DEFAULT_LRDELAY; + effect->Props.Echo.Damping = AL_ECHO_DEFAULT_DAMPING; + effect->Props.Echo.Feedback = AL_ECHO_DEFAULT_FEEDBACK; + effect->Props.Echo.Spread = AL_ECHO_DEFAULT_SPREAD; effect->vtbl = &ALecho_vtable; break; case AL_EFFECT_EQUALIZER: - effect->Equalizer.LowCutoff = AL_EQUALIZER_DEFAULT_LOW_CUTOFF; - effect->Equalizer.LowGain = AL_EQUALIZER_DEFAULT_LOW_GAIN; - effect->Equalizer.Mid1Center = AL_EQUALIZER_DEFAULT_MID1_CENTER; - effect->Equalizer.Mid1Gain = AL_EQUALIZER_DEFAULT_MID1_GAIN; - effect->Equalizer.Mid1Width = AL_EQUALIZER_DEFAULT_MID1_WIDTH; - effect->Equalizer.Mid2Center = AL_EQUALIZER_DEFAULT_MID2_CENTER; - effect->Equalizer.Mid2Gain = AL_EQUALIZER_DEFAULT_MID2_GAIN; - effect->Equalizer.Mid2Width = AL_EQUALIZER_DEFAULT_MID2_WIDTH; - effect->Equalizer.HighCutoff = AL_EQUALIZER_DEFAULT_HIGH_CUTOFF; - effect->Equalizer.HighGain = AL_EQUALIZER_DEFAULT_HIGH_GAIN; + effect->Props.Equalizer.LowCutoff = AL_EQUALIZER_DEFAULT_LOW_CUTOFF; + effect->Props.Equalizer.LowGain = AL_EQUALIZER_DEFAULT_LOW_GAIN; + effect->Props.Equalizer.Mid1Center = AL_EQUALIZER_DEFAULT_MID1_CENTER; + effect->Props.Equalizer.Mid1Gain = AL_EQUALIZER_DEFAULT_MID1_GAIN; + effect->Props.Equalizer.Mid1Width = AL_EQUALIZER_DEFAULT_MID1_WIDTH; + effect->Props.Equalizer.Mid2Center = AL_EQUALIZER_DEFAULT_MID2_CENTER; + effect->Props.Equalizer.Mid2Gain = AL_EQUALIZER_DEFAULT_MID2_GAIN; + effect->Props.Equalizer.Mid2Width = AL_EQUALIZER_DEFAULT_MID2_WIDTH; + effect->Props.Equalizer.HighCutoff = AL_EQUALIZER_DEFAULT_HIGH_CUTOFF; + effect->Props.Equalizer.HighGain = AL_EQUALIZER_DEFAULT_HIGH_GAIN; effect->vtbl = &ALequalizer_vtable; break; case AL_EFFECT_FLANGER: - effect->Flanger.Waveform = AL_FLANGER_DEFAULT_WAVEFORM; - effect->Flanger.Phase = AL_FLANGER_DEFAULT_PHASE; - effect->Flanger.Rate = AL_FLANGER_DEFAULT_RATE; - effect->Flanger.Depth = AL_FLANGER_DEFAULT_DEPTH; - effect->Flanger.Feedback = AL_FLANGER_DEFAULT_FEEDBACK; - effect->Flanger.Delay = AL_FLANGER_DEFAULT_DELAY; + effect->Props.Flanger.Waveform = AL_FLANGER_DEFAULT_WAVEFORM; + effect->Props.Flanger.Phase = AL_FLANGER_DEFAULT_PHASE; + effect->Props.Flanger.Rate = AL_FLANGER_DEFAULT_RATE; + effect->Props.Flanger.Depth = AL_FLANGER_DEFAULT_DEPTH; + effect->Props.Flanger.Feedback = AL_FLANGER_DEFAULT_FEEDBACK; + effect->Props.Flanger.Delay = AL_FLANGER_DEFAULT_DELAY; effect->vtbl = &ALflanger_vtable; break; case AL_EFFECT_RING_MODULATOR: - effect->Modulator.Frequency = AL_RING_MODULATOR_DEFAULT_FREQUENCY; - effect->Modulator.HighPassCutoff = AL_RING_MODULATOR_DEFAULT_HIGHPASS_CUTOFF; - effect->Modulator.Waveform = AL_RING_MODULATOR_DEFAULT_WAVEFORM; + effect->Props.Modulator.Frequency = AL_RING_MODULATOR_DEFAULT_FREQUENCY; + effect->Props.Modulator.HighPassCutoff = AL_RING_MODULATOR_DEFAULT_HIGHPASS_CUTOFF; + effect->Props.Modulator.Waveform = AL_RING_MODULATOR_DEFAULT_WAVEFORM; effect->vtbl = &ALmodulator_vtable; break; case AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT: case AL_EFFECT_DEDICATED_DIALOGUE: - effect->Dedicated.Gain = 1.0f; + effect->Props.Dedicated.Gain = 1.0f; effect->vtbl = &ALdedicated_vtable; break; default: @@ -641,33 +641,33 @@ ALvoid LoadReverbPreset(const char *name, ALeffect *effect) TRACE("Loading reverb '%s'\n", reverblist[i].name); props = &reverblist[i].props; - effect->Reverb.Density = props->flDensity; - effect->Reverb.Diffusion = props->flDiffusion; - effect->Reverb.Gain = props->flGain; - effect->Reverb.GainHF = props->flGainHF; - effect->Reverb.GainLF = props->flGainLF; - effect->Reverb.DecayTime = props->flDecayTime; - effect->Reverb.DecayHFRatio = props->flDecayHFRatio; - effect->Reverb.DecayLFRatio = props->flDecayLFRatio; - effect->Reverb.ReflectionsGain = props->flReflectionsGain; - effect->Reverb.ReflectionsDelay = props->flReflectionsDelay; - effect->Reverb.ReflectionsPan[0] = props->flReflectionsPan[0]; - effect->Reverb.ReflectionsPan[1] = props->flReflectionsPan[1]; - effect->Reverb.ReflectionsPan[2] = props->flReflectionsPan[2]; - effect->Reverb.LateReverbGain = props->flLateReverbGain; - effect->Reverb.LateReverbDelay = props->flLateReverbDelay; - effect->Reverb.LateReverbPan[0] = props->flLateReverbPan[0]; - effect->Reverb.LateReverbPan[1] = props->flLateReverbPan[1]; - effect->Reverb.LateReverbPan[2] = props->flLateReverbPan[2]; - effect->Reverb.EchoTime = props->flEchoTime; - effect->Reverb.EchoDepth = props->flEchoDepth; - effect->Reverb.ModulationTime = props->flModulationTime; - effect->Reverb.ModulationDepth = props->flModulationDepth; - effect->Reverb.AirAbsorptionGainHF = props->flAirAbsorptionGainHF; - effect->Reverb.HFReference = props->flHFReference; - effect->Reverb.LFReference = props->flLFReference; - effect->Reverb.RoomRolloffFactor = props->flRoomRolloffFactor; - effect->Reverb.DecayHFLimit = props->iDecayHFLimit; + effect->Props.Reverb.Density = props->flDensity; + effect->Props.Reverb.Diffusion = props->flDiffusion; + effect->Props.Reverb.Gain = props->flGain; + effect->Props.Reverb.GainHF = props->flGainHF; + effect->Props.Reverb.GainLF = props->flGainLF; + effect->Props.Reverb.DecayTime = props->flDecayTime; + effect->Props.Reverb.DecayHFRatio = props->flDecayHFRatio; + effect->Props.Reverb.DecayLFRatio = props->flDecayLFRatio; + effect->Props.Reverb.ReflectionsGain = props->flReflectionsGain; + effect->Props.Reverb.ReflectionsDelay = props->flReflectionsDelay; + effect->Props.Reverb.ReflectionsPan[0] = props->flReflectionsPan[0]; + effect->Props.Reverb.ReflectionsPan[1] = props->flReflectionsPan[1]; + effect->Props.Reverb.ReflectionsPan[2] = props->flReflectionsPan[2]; + effect->Props.Reverb.LateReverbGain = props->flLateReverbGain; + effect->Props.Reverb.LateReverbDelay = props->flLateReverbDelay; + effect->Props.Reverb.LateReverbPan[0] = props->flLateReverbPan[0]; + effect->Props.Reverb.LateReverbPan[1] = props->flLateReverbPan[1]; + effect->Props.Reverb.LateReverbPan[2] = props->flLateReverbPan[2]; + effect->Props.Reverb.EchoTime = props->flEchoTime; + effect->Props.Reverb.EchoDepth = props->flEchoDepth; + effect->Props.Reverb.ModulationTime = props->flModulationTime; + effect->Props.Reverb.ModulationDepth = props->flModulationDepth; + effect->Props.Reverb.AirAbsorptionGainHF = props->flAirAbsorptionGainHF; + effect->Props.Reverb.HFReference = props->flHFReference; + effect->Props.Reverb.LFReference = props->flLFReference; + effect->Props.Reverb.RoomRolloffFactor = props->flRoomRolloffFactor; + effect->Props.Reverb.DecayHFLimit = props->iDecayHFLimit; return; } |