From 991aba286f32e8760811bc061b15c5102c66b3e1 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 13 Mar 2013 21:53:42 -0700 Subject: Move the effect-specific get/set methods to where the effect is implemented --- Alc/alcDedicated.c | 51 +++ Alc/alcEcho.c | 95 +++++ Alc/alcModulator.c | 97 ++++++ Alc/alcReverb.c | 533 ++++++++++++++++++++++++++++ OpenAL32/Include/alEffect.h | 54 +++ OpenAL32/alAuxEffectSlot.c | 18 + OpenAL32/alEffect.c | 834 -------------------------------------------- 7 files changed, 848 insertions(+), 834 deletions(-) diff --git a/Alc/alcDedicated.c b/Alc/alcDedicated.c index 1d2cbc42..d73d8959 100644 --- a/Alc/alcDedicated.c +++ b/Alc/alcDedicated.c @@ -98,3 +98,54 @@ ALeffectState *DedicatedCreate(void) return &state->state; } + +void ded_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) +{ (void)effect;(void)param;(void)val; alSetError(context, AL_INVALID_ENUM); } +void ded_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) +{ + ded_SetParami(effect, context, param, vals[0]); +} +void ded_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) +{ + switch(param) + { + case AL_DEDICATED_GAIN: + if(val >= 0.0f && isfinite(val)) + effect->Dedicated.Gain = val; + else + alSetError(context, AL_INVALID_VALUE); + break; + + default: + alSetError(context, AL_INVALID_ENUM); + break; + } +} +void ded_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) +{ + ded_SetParamf(effect, context, param, vals[0]); +} + +void ded_GetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) +{ (void)effect;(void)param;(void)val; alSetError(context, AL_INVALID_ENUM); } +void ded_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) +{ + ded_GetParami(effect, context, param, vals); +} +void ded_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) +{ + switch(param) + { + case AL_DEDICATED_GAIN: + *val = effect->Dedicated.Gain; + break; + + default: + alSetError(context, AL_INVALID_ENUM); + break; + } +} +void ded_GetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) +{ + ded_GetParamf(effect, context, param, vals); +} diff --git a/Alc/alcEcho.c b/Alc/alcEcho.c index 9ca91747..55a5b599 100644 --- a/Alc/alcEcho.c +++ b/Alc/alcEcho.c @@ -182,3 +182,98 @@ ALeffectState *EchoCreate(void) return &state->state; } + +void echo_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) +{ (void)effect;(void)param;(void)val; alSetError(context, AL_INVALID_ENUM); } +void echo_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) +{ + echo_SetParami(effect, context, param, vals[0]); +} +void echo_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) +{ + switch(param) + { + case AL_ECHO_DELAY: + if(val >= AL_ECHO_MIN_DELAY && val <= AL_ECHO_MAX_DELAY) + effect->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; + 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; + 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; + 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; + else + alSetError(context, AL_INVALID_VALUE); + break; + + default: + alSetError(context, AL_INVALID_ENUM); + break; + } +} +void echo_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) +{ + echo_SetParamf(effect, context, param, vals[0]); +} + +void echo_GetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) +{ (void)effect;(void)param;(void)val; alSetError(context, AL_INVALID_ENUM); } +void echo_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) +{ + echo_GetParami(effect, context, param, vals); +} +void echo_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) +{ + switch(param) + { + case AL_ECHO_DELAY: + *val = effect->Echo.Delay; + break; + + case AL_ECHO_LRDELAY: + *val = effect->Echo.LRDelay; + break; + + case AL_ECHO_DAMPING: + *val = effect->Echo.Damping; + break; + + case AL_ECHO_FEEDBACK: + *val = effect->Echo.Feedback; + break; + + case AL_ECHO_SPREAD: + *val = effect->Echo.Spread; + break; + + default: + alSetError(context, AL_INVALID_ENUM); + break; + } +} +void echo_GetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) +{ + echo_GetParamf(effect, context, param, vals); +} diff --git a/Alc/alcModulator.c b/Alc/alcModulator.c index de062151..05b2fb00 100644 --- a/Alc/alcModulator.c +++ b/Alc/alcModulator.c @@ -202,3 +202,100 @@ ALeffectState *ModulatorCreate(void) return &state->state; } + +void mod_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) +{ + switch(param) + { + case AL_RING_MODULATOR_FREQUENCY: + if(val >= AL_RING_MODULATOR_MIN_FREQUENCY && val <= AL_RING_MODULATOR_MAX_FREQUENCY) + effect->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; + else + alSetError(context, AL_INVALID_VALUE); + break; + + default: + alSetError(context, AL_INVALID_ENUM); + break; + } +} +void mod_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) +{ + mod_SetParamf(effect, context, param, vals[0]); +} +void mod_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) +{ + switch(param) + { + case AL_RING_MODULATOR_FREQUENCY: + case AL_RING_MODULATOR_HIGHPASS_CUTOFF: + mod_SetParamf(effect, context, param, (ALfloat)val); + break; + + case AL_RING_MODULATOR_WAVEFORM: + if(val >= AL_RING_MODULATOR_MIN_WAVEFORM && val <= AL_RING_MODULATOR_MAX_WAVEFORM) + effect->Modulator.Waveform = val; + else + alSetError(context, AL_INVALID_VALUE); + break; + + default: + alSetError(context, AL_INVALID_ENUM); + break; + } +} +void mod_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) +{ + mod_SetParami(effect, context, param, vals[0]); +} + +void mod_GetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) +{ + switch(param) + { + case AL_RING_MODULATOR_FREQUENCY: + *val = (ALint)effect->Modulator.Frequency; + break; + case AL_RING_MODULATOR_HIGHPASS_CUTOFF: + *val = (ALint)effect->Modulator.HighPassCutoff; + break; + case AL_RING_MODULATOR_WAVEFORM: + *val = effect->Modulator.Waveform; + break; + + default: + alSetError(context, AL_INVALID_ENUM); + break; + } +} +void mod_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) +{ + mod_GetParami(effect, context, param, vals); +} +void mod_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) +{ + switch(param) + { + case AL_RING_MODULATOR_FREQUENCY: + *val = effect->Modulator.Frequency; + break; + case AL_RING_MODULATOR_HIGHPASS_CUTOFF: + *val = effect->Modulator.HighPassCutoff; + break; + + default: + alSetError(context, AL_INVALID_ENUM); + break; + } +} +void mod_GetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) +{ + mod_GetParamf(effect, context, param, vals); +} diff --git a/Alc/alcReverb.c b/Alc/alcReverb.c index b7dcdab9..ab52ae77 100644 --- a/Alc/alcReverb.c +++ b/Alc/alcReverb.c @@ -1281,3 +1281,536 @@ ALeffectState *ReverbCreate(void) return &State->state; } + +void eaxreverb_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) +{ + switch(param) + { + case AL_EAXREVERB_DECAY_HFLIMIT: + if(val >= AL_EAXREVERB_MIN_DECAY_HFLIMIT && val <= AL_EAXREVERB_MAX_DECAY_HFLIMIT) + effect->Reverb.DecayHFLimit = val; + else + alSetError(context, AL_INVALID_VALUE); + break; + + default: + alSetError(context, AL_INVALID_ENUM); + break; + } +} +void eaxreverb_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) +{ + eaxreverb_SetParami(effect, context, param, vals[0]); +} +void eaxreverb_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) +{ + switch(param) + { + case AL_EAXREVERB_DENSITY: + if(val >= AL_EAXREVERB_MIN_DENSITY && val <= AL_EAXREVERB_MAX_DENSITY) + effect->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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + else + alSetError(context, AL_INVALID_VALUE); + break; + + default: + alSetError(context, AL_INVALID_ENUM); + break; + } +} +void eaxreverb_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) +{ + 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]; + UnlockContext(context); + } + else + alSetError(context, AL_INVALID_VALUE); + break; + case AL_EAXREVERB_LATE_REVERB_PAN: + 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]; + UnlockContext(context); + } + else + alSetError(context, AL_INVALID_VALUE); + break; + + default: + eaxreverb_SetParamf(effect, context, param, vals[0]); + break; + } +} + +void eaxreverb_GetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) +{ + switch(param) + { + case AL_EAXREVERB_DECAY_HFLIMIT: + *val = effect->Reverb.DecayHFLimit; + break; + + default: + alSetError(context, AL_INVALID_ENUM); + break; + } +} +void eaxreverb_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) +{ + eaxreverb_GetParami(effect, context, param, vals); +} +void eaxreverb_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) +{ + switch(param) + { + case AL_EAXREVERB_DENSITY: + *val = effect->Reverb.Density; + break; + + case AL_EAXREVERB_DIFFUSION: + *val = effect->Reverb.Diffusion; + break; + + case AL_EAXREVERB_GAIN: + *val = effect->Reverb.Gain; + break; + + case AL_EAXREVERB_GAINHF: + *val = effect->Reverb.GainHF; + break; + + case AL_EAXREVERB_GAINLF: + *val = effect->Reverb.GainLF; + break; + + case AL_EAXREVERB_DECAY_TIME: + *val = effect->Reverb.DecayTime; + break; + + case AL_EAXREVERB_DECAY_HFRATIO: + *val = effect->Reverb.DecayHFRatio; + break; + + case AL_EAXREVERB_DECAY_LFRATIO: + *val = effect->Reverb.DecayLFRatio; + break; + + case AL_EAXREVERB_REFLECTIONS_GAIN: + *val = effect->Reverb.ReflectionsGain; + break; + + case AL_EAXREVERB_REFLECTIONS_DELAY: + *val = effect->Reverb.ReflectionsDelay; + break; + + case AL_EAXREVERB_LATE_REVERB_GAIN: + *val = effect->Reverb.LateReverbGain; + break; + + case AL_EAXREVERB_LATE_REVERB_DELAY: + *val = effect->Reverb.LateReverbDelay; + break; + + case AL_EAXREVERB_AIR_ABSORPTION_GAINHF: + *val = effect->Reverb.AirAbsorptionGainHF; + break; + + case AL_EAXREVERB_ECHO_TIME: + *val = effect->Reverb.EchoTime; + break; + + case AL_EAXREVERB_ECHO_DEPTH: + *val = effect->Reverb.EchoDepth; + break; + + case AL_EAXREVERB_MODULATION_TIME: + *val = effect->Reverb.ModulationTime; + break; + + case AL_EAXREVERB_MODULATION_DEPTH: + *val = effect->Reverb.ModulationDepth; + break; + + case AL_EAXREVERB_HFREFERENCE: + *val = effect->Reverb.HFReference; + break; + + case AL_EAXREVERB_LFREFERENCE: + *val = effect->Reverb.LFReference; + break; + + case AL_EAXREVERB_ROOM_ROLLOFF_FACTOR: + *val = effect->Reverb.RoomRolloffFactor; + break; + + default: + alSetError(context, AL_INVALID_ENUM); + break; + } +} +void eaxreverb_GetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) +{ + 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]; + 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]; + UnlockContext(context); + break; + + default: + eaxreverb_GetParamf(effect, context, param, vals); + break; + } +} + + +void reverb_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) +{ + switch(param) + { + case AL_REVERB_DECAY_HFLIMIT: + if(val >= AL_REVERB_MIN_DECAY_HFLIMIT && val <= AL_REVERB_MAX_DECAY_HFLIMIT) + effect->Reverb.DecayHFLimit = val; + else + alSetError(context, AL_INVALID_VALUE); + break; + + default: + alSetError(context, AL_INVALID_ENUM); + break; + } +} +void reverb_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) +{ + reverb_SetParami(effect, context, param, vals[0]); +} +void reverb_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) +{ + switch(param) + { + case AL_REVERB_DENSITY: + if(val >= AL_REVERB_MIN_DENSITY && val <= AL_REVERB_MAX_DENSITY) + effect->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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + else + alSetError(context, AL_INVALID_VALUE); + break; + + default: + alSetError(context, AL_INVALID_ENUM); + break; + } +} +void reverb_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) +{ + reverb_SetParamf(effect, context, param, vals[0]); +} + +void reverb_GetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) +{ + switch(param) + { + case AL_REVERB_DECAY_HFLIMIT: + *val = effect->Reverb.DecayHFLimit; + break; + + default: + alSetError(context, AL_INVALID_ENUM); + break; + } +} +void reverb_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) +{ + reverb_GetParami(effect, context, param, vals); +} +void reverb_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) +{ + switch(param) + { + case AL_REVERB_DENSITY: + *val = effect->Reverb.Density; + break; + + case AL_REVERB_DIFFUSION: + *val = effect->Reverb.Diffusion; + break; + + case AL_REVERB_GAIN: + *val = effect->Reverb.Gain; + break; + + case AL_REVERB_GAINHF: + *val = effect->Reverb.GainHF; + break; + + case AL_REVERB_DECAY_TIME: + *val = effect->Reverb.DecayTime; + break; + + case AL_REVERB_DECAY_HFRATIO: + *val = effect->Reverb.DecayHFRatio; + break; + + case AL_REVERB_REFLECTIONS_GAIN: + *val = effect->Reverb.ReflectionsGain; + break; + + case AL_REVERB_REFLECTIONS_DELAY: + *val = effect->Reverb.ReflectionsDelay; + break; + + case AL_REVERB_LATE_REVERB_GAIN: + *val = effect->Reverb.LateReverbGain; + break; + + case AL_REVERB_LATE_REVERB_DELAY: + *val = effect->Reverb.LateReverbDelay; + break; + + case AL_REVERB_AIR_ABSORPTION_GAINHF: + *val = effect->Reverb.AirAbsorptionGainHF; + break; + + case AL_REVERB_ROOM_ROLLOFF_FACTOR: + *val = effect->Reverb.RoomRolloffFactor; + break; + + default: + alSetError(context, AL_INVALID_ENUM); + break; + } +} +void reverb_GetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) +{ + reverb_GetParamf(effect, context, param, vals); +} diff --git a/OpenAL32/Include/alEffect.h b/OpenAL32/Include/alEffect.h index ba894c8b..77ff97a8 100644 --- a/OpenAL32/Include/alEffect.h +++ b/OpenAL32/Include/alEffect.h @@ -102,6 +102,60 @@ typedef struct ALeffect static __inline ALboolean IsReverbEffect(ALenum type) { return type == AL_EFFECT_REVERB || type == AL_EFFECT_EAXREVERB; } +void eaxreverb_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val); +void eaxreverb_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals); +void eaxreverb_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val); +void eaxreverb_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals); +void eaxreverb_GetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint *val); +void eaxreverb_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals); +void eaxreverb_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val); +void eaxreverb_GetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals); + +void reverb_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val); +void reverb_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals); +void reverb_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val); +void reverb_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals); +void reverb_GetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint *val); +void reverb_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals); +void reverb_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val); +void reverb_GetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals); + +void echo_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val); +void echo_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals); +void echo_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val); +void echo_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals); +void echo_GetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint *val); +void echo_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals); +void echo_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val); +void echo_GetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals); + +void mod_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val); +void mod_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals); +void mod_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val); +void mod_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals); +void mod_GetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint *val); +void mod_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals); +void mod_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val); +void mod_GetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals); + +void ded_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val); +void ded_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals); +void ded_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val); +void ded_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals); +void ded_GetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint *val); +void ded_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals); +void ded_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val); +void ded_GetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals); + +void null_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val); +void null_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals); +void null_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val); +void null_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals); +void null_GetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint *val); +void null_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals); +void null_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val); +void null_GetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals); + ALenum InitEffect(ALeffect *effect); ALvoid ReleaseALEffects(ALCdevice *device); diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c index 230fe5fc..23cfa4ac 100644 --- a/OpenAL32/alAuxEffectSlot.c +++ b/OpenAL32/alAuxEffectSlot.c @@ -428,6 +428,24 @@ ALeffectState *NoneCreate(void) return state; } +void null_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) +{ (void)effect;(void)param;(void)val; alSetError(context, AL_INVALID_ENUM); } +void null_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) +{ (void)effect;(void)param;(void)vals; alSetError(context, AL_INVALID_ENUM); } +void null_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) +{ (void)effect;(void)param;(void)val; alSetError(context, AL_INVALID_ENUM); } +void null_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) +{ (void)effect;(void)param;(void)vals; alSetError(context, AL_INVALID_ENUM); } + +void null_GetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) +{ (void)effect;(void)param;(void)val; alSetError(context, AL_INVALID_ENUM); } +void null_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) +{ (void)effect;(void)param;(void)vals; alSetError(context, AL_INVALID_ENUM); } +void null_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) +{ (void)effect;(void)param;(void)val; alSetError(context, AL_INVALID_ENUM); } +void null_GetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) +{ (void)effect;(void)param;(void)vals; alSetError(context, AL_INVALID_ENUM); } + static ALvoid RemoveEffectSlotArray(ALCcontext *Context, ALeffectslot *slot) { diff --git a/OpenAL32/alEffect.c b/OpenAL32/alEffect.c index 4d257641..2c684626 100644 --- a/OpenAL32/alEffect.c +++ b/OpenAL32/alEffect.c @@ -344,840 +344,6 @@ AL_API ALvoid AL_APIENTRY alGetEffectfv(ALuint effect, ALenum param, ALfloat *va } -static void eaxreverb_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) -{ - switch(param) - { - case AL_EAXREVERB_DECAY_HFLIMIT: - if(val >= AL_EAXREVERB_MIN_DECAY_HFLIMIT && val <= AL_EAXREVERB_MAX_DECAY_HFLIMIT) - effect->Reverb.DecayHFLimit = val; - else - alSetError(context, AL_INVALID_VALUE); - break; - - default: - alSetError(context, AL_INVALID_ENUM); - break; - } -} -static void eaxreverb_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) -{ - eaxreverb_SetParami(effect, context, param, vals[0]); -} -static void eaxreverb_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) -{ - switch(param) - { - case AL_EAXREVERB_DENSITY: - if(val >= AL_EAXREVERB_MIN_DENSITY && - val <= AL_EAXREVERB_MAX_DENSITY) - effect->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; - 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; - 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; - 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; - 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; - 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; - 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; - 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; - 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; - 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; - 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; - 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; - 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; - 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; - 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; - 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; - 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; - 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; - else - alSetError(context, AL_INVALID_VALUE); - break; - - case AL_EAXREVERB_ROOM_ROLLOFF_FACTOR: - if(val >= 0.0f && val <= 10.0f) - effect->Reverb.RoomRolloffFactor = val; - else - alSetError(context, AL_INVALID_VALUE); - break; - - default: - alSetError(context, AL_INVALID_ENUM); - break; - } -} -static void eaxreverb_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) -{ - 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]; - UnlockContext(context); - } - else - alSetError(context, AL_INVALID_VALUE); - break; - case AL_EAXREVERB_LATE_REVERB_PAN: - 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]; - UnlockContext(context); - } - else - alSetError(context, AL_INVALID_VALUE); - break; - - default: - eaxreverb_SetParamf(effect, context, param, vals[0]); - break; - } -} - -static void eaxreverb_GetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) -{ - switch(param) - { - case AL_EAXREVERB_DECAY_HFLIMIT: - *val = effect->Reverb.DecayHFLimit; - break; - - default: - alSetError(context, AL_INVALID_ENUM); - break; - } -} -static void eaxreverb_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) -{ - eaxreverb_GetParami(effect, context, param, vals); -} -static void eaxreverb_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) -{ - switch(param) - { - case AL_EAXREVERB_DENSITY: - *val = effect->Reverb.Density; - break; - - case AL_EAXREVERB_DIFFUSION: - *val = effect->Reverb.Diffusion; - break; - - case AL_EAXREVERB_GAIN: - *val = effect->Reverb.Gain; - break; - - case AL_EAXREVERB_GAINHF: - *val = effect->Reverb.GainHF; - break; - - case AL_EAXREVERB_GAINLF: - *val = effect->Reverb.GainLF; - break; - - case AL_EAXREVERB_DECAY_TIME: - *val = effect->Reverb.DecayTime; - break; - - case AL_EAXREVERB_DECAY_HFRATIO: - *val = effect->Reverb.DecayHFRatio; - break; - - case AL_EAXREVERB_DECAY_LFRATIO: - *val = effect->Reverb.DecayLFRatio; - break; - - case AL_EAXREVERB_REFLECTIONS_GAIN: - *val = effect->Reverb.ReflectionsGain; - break; - - case AL_EAXREVERB_REFLECTIONS_DELAY: - *val = effect->Reverb.ReflectionsDelay; - break; - - case AL_EAXREVERB_LATE_REVERB_GAIN: - *val = effect->Reverb.LateReverbGain; - break; - - case AL_EAXREVERB_LATE_REVERB_DELAY: - *val = effect->Reverb.LateReverbDelay; - break; - - case AL_EAXREVERB_AIR_ABSORPTION_GAINHF: - *val = effect->Reverb.AirAbsorptionGainHF; - break; - - case AL_EAXREVERB_ECHO_TIME: - *val = effect->Reverb.EchoTime; - break; - - case AL_EAXREVERB_ECHO_DEPTH: - *val = effect->Reverb.EchoDepth; - break; - - case AL_EAXREVERB_MODULATION_TIME: - *val = effect->Reverb.ModulationTime; - break; - - case AL_EAXREVERB_MODULATION_DEPTH: - *val = effect->Reverb.ModulationDepth; - break; - - case AL_EAXREVERB_HFREFERENCE: - *val = effect->Reverb.HFReference; - break; - - case AL_EAXREVERB_LFREFERENCE: - *val = effect->Reverb.LFReference; - break; - - case AL_EAXREVERB_ROOM_ROLLOFF_FACTOR: - *val = effect->Reverb.RoomRolloffFactor; - break; - - default: - alSetError(context, AL_INVALID_ENUM); - break; - } -} -static void eaxreverb_GetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) -{ - 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]; - 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]; - UnlockContext(context); - break; - - default: - eaxreverb_GetParamf(effect, context, param, vals); - break; - } -} - - -static void reverb_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) -{ - switch(param) - { - case AL_REVERB_DECAY_HFLIMIT: - if(val >= AL_REVERB_MIN_DECAY_HFLIMIT && - val <= AL_REVERB_MAX_DECAY_HFLIMIT) - effect->Reverb.DecayHFLimit = val; - else - alSetError(context, AL_INVALID_VALUE); - break; - - default: - alSetError(context, AL_INVALID_ENUM); - break; - } -} -static void reverb_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) -{ - reverb_SetParami(effect, context, param, vals[0]); -} -static void reverb_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) -{ - switch(param) - { - case AL_REVERB_DENSITY: - if(val >= AL_REVERB_MIN_DENSITY && - val <= AL_REVERB_MAX_DENSITY) - effect->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; - 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; - 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; - 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; - 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; - 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; - 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; - 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; - 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; - 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; - 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; - else - alSetError(context, AL_INVALID_VALUE); - break; - - default: - alSetError(context, AL_INVALID_ENUM); - break; - } -} -static void reverb_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) -{ - reverb_SetParamf(effect, context, param, vals[0]); -} - -static void reverb_GetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) -{ - switch(param) - { - case AL_REVERB_DECAY_HFLIMIT: - *val = effect->Reverb.DecayHFLimit; - break; - - default: - alSetError(context, AL_INVALID_ENUM); - break; - } -} -static void reverb_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) -{ - reverb_GetParami(effect, context, param, vals); -} -static void reverb_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) -{ - switch(param) - { - case AL_REVERB_DENSITY: - *val = effect->Reverb.Density; - break; - - case AL_REVERB_DIFFUSION: - *val = effect->Reverb.Diffusion; - break; - - case AL_REVERB_GAIN: - *val = effect->Reverb.Gain; - break; - - case AL_REVERB_GAINHF: - *val = effect->Reverb.GainHF; - break; - - case AL_REVERB_DECAY_TIME: - *val = effect->Reverb.DecayTime; - break; - - case AL_REVERB_DECAY_HFRATIO: - *val = effect->Reverb.DecayHFRatio; - break; - - case AL_REVERB_REFLECTIONS_GAIN: - *val = effect->Reverb.ReflectionsGain; - break; - - case AL_REVERB_REFLECTIONS_DELAY: - *val = effect->Reverb.ReflectionsDelay; - break; - - case AL_REVERB_LATE_REVERB_GAIN: - *val = effect->Reverb.LateReverbGain; - break; - - case AL_REVERB_LATE_REVERB_DELAY: - *val = effect->Reverb.LateReverbDelay; - break; - - case AL_REVERB_AIR_ABSORPTION_GAINHF: - *val = effect->Reverb.AirAbsorptionGainHF; - break; - - case AL_REVERB_ROOM_ROLLOFF_FACTOR: - *val = effect->Reverb.RoomRolloffFactor; - break; - - default: - alSetError(context, AL_INVALID_ENUM); - break; - } -} -static void reverb_GetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) -{ - reverb_GetParamf(effect, context, param, vals); -} - - -static void echo_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) -{ (void)effect;(void)param;(void)val; alSetError(context, AL_INVALID_ENUM); } -static void echo_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) -{ - echo_SetParami(effect, context, param, vals[0]); -} -static void echo_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) -{ - switch(param) - { - case AL_ECHO_DELAY: - if(val >= AL_ECHO_MIN_DELAY && val <= AL_ECHO_MAX_DELAY) - effect->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; - 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; - 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; - 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; - else - alSetError(context, AL_INVALID_VALUE); - break; - - default: - alSetError(context, AL_INVALID_ENUM); - break; - } -} -static void echo_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) -{ - echo_SetParamf(effect, context, param, vals[0]); -} - -static void echo_GetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) -{ (void)effect;(void)param;(void)val; alSetError(context, AL_INVALID_ENUM); } -static void echo_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) -{ - echo_GetParami(effect, context, param, vals); -} -static void echo_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) -{ - switch(param) - { - case AL_ECHO_DELAY: - *val = effect->Echo.Delay; - break; - - case AL_ECHO_LRDELAY: - *val = effect->Echo.LRDelay; - break; - - case AL_ECHO_DAMPING: - *val = effect->Echo.Damping; - break; - - case AL_ECHO_FEEDBACK: - *val = effect->Echo.Feedback; - break; - - case AL_ECHO_SPREAD: - *val = effect->Echo.Spread; - break; - - default: - alSetError(context, AL_INVALID_ENUM); - break; - } -} -static void echo_GetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) -{ - echo_GetParamf(effect, context, param, vals); -} - - -static void mod_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) -{ - switch(param) - { - case AL_RING_MODULATOR_FREQUENCY: - if(val >= AL_RING_MODULATOR_MIN_FREQUENCY && - val <= AL_RING_MODULATOR_MAX_FREQUENCY) - effect->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; - else - alSetError(context, AL_INVALID_VALUE); - break; - - default: - alSetError(context, AL_INVALID_ENUM); - break; - } -} -static void mod_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) -{ - mod_SetParamf(effect, context, param, vals[0]); -} -static void mod_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) -{ - switch(param) - { - case AL_RING_MODULATOR_FREQUENCY: - case AL_RING_MODULATOR_HIGHPASS_CUTOFF: - mod_SetParamf(effect, context, param, (ALfloat)val); - break; - - case AL_RING_MODULATOR_WAVEFORM: - if(val >= AL_RING_MODULATOR_MIN_WAVEFORM && - val <= AL_RING_MODULATOR_MAX_WAVEFORM) - effect->Modulator.Waveform = val; - else - alSetError(context, AL_INVALID_VALUE); - break; - - default: - alSetError(context, AL_INVALID_ENUM); - break; - } -} -static void mod_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) -{ - mod_SetParami(effect, context, param, vals[0]); -} - -static void mod_GetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) -{ - switch(param) - { - case AL_RING_MODULATOR_FREQUENCY: - *val = (ALint)effect->Modulator.Frequency; - break; - case AL_RING_MODULATOR_HIGHPASS_CUTOFF: - *val = (ALint)effect->Modulator.HighPassCutoff; - break; - case AL_RING_MODULATOR_WAVEFORM: - *val = effect->Modulator.Waveform; - break; - - default: - alSetError(context, AL_INVALID_ENUM); - break; - } -} -static void mod_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) -{ - mod_GetParami(effect, context, param, vals); -} -static void mod_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) -{ - switch(param) - { - case AL_RING_MODULATOR_FREQUENCY: - *val = effect->Modulator.Frequency; - break; - case AL_RING_MODULATOR_HIGHPASS_CUTOFF: - *val = effect->Modulator.HighPassCutoff; - break; - - default: - alSetError(context, AL_INVALID_ENUM); - break; - } -} -static void mod_GetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) -{ - mod_GetParamf(effect, context, param, vals); -} - - -static void ded_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) -{ (void)effect;(void)param;(void)val; alSetError(context, AL_INVALID_ENUM); } -static void ded_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) -{ - ded_SetParami(effect, context, param, vals[0]); -} -static void ded_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) -{ - switch(param) - { - case AL_DEDICATED_GAIN: - if(val >= 0.0f && isfinite(val)) - effect->Dedicated.Gain = val; - else - alSetError(context, AL_INVALID_VALUE); - break; - - default: - alSetError(context, AL_INVALID_ENUM); - break; - } -} -static void ded_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) -{ - ded_SetParamf(effect, context, param, vals[0]); -} - -static void ded_GetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) -{ (void)effect;(void)param;(void)val; alSetError(context, AL_INVALID_ENUM); } -static void ded_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) -{ - ded_GetParami(effect, context, param, vals); -} -static void ded_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) -{ - switch(param) - { - case AL_DEDICATED_GAIN: - *val = effect->Dedicated.Gain; - break; - - default: - alSetError(context, AL_INVALID_ENUM); - break; - } -} -static void ded_GetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) -{ - ded_GetParamf(effect, context, param, vals); -} - - -static void null_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) -{ (void)effect;(void)param;(void)val; alSetError(context, AL_INVALID_ENUM); } -static void null_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) -{ (void)effect;(void)param;(void)vals; alSetError(context, AL_INVALID_ENUM); } -static void null_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) -{ (void)effect;(void)param;(void)val; alSetError(context, AL_INVALID_ENUM); } -static void null_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) -{ (void)effect;(void)param;(void)vals; alSetError(context, AL_INVALID_ENUM); } - -static void null_GetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) -{ (void)effect;(void)param;(void)val; alSetError(context, AL_INVALID_ENUM); } -static void null_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) -{ (void)effect;(void)param;(void)vals; alSetError(context, AL_INVALID_ENUM); } -static void null_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) -{ (void)effect;(void)param;(void)val; alSetError(context, AL_INVALID_ENUM); } -static void null_GetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) -{ (void)effect;(void)param;(void)vals; alSetError(context, AL_INVALID_ENUM); } - - ALenum InitEffect(ALeffect *effect) { InitEffectParams(effect, AL_EFFECT_NULL); -- cgit v1.2.3