diff options
Diffstat (limited to 'OpenAL32/alEffect.c')
-rw-r--r-- | OpenAL32/alEffect.c | 422 |
1 files changed, 418 insertions, 4 deletions
diff --git a/OpenAL32/alEffect.c b/OpenAL32/alEffect.c index 4455a230..4d0e7f34 100644 --- a/OpenAL32/alEffect.c +++ b/OpenAL32/alEffect.c @@ -170,6 +170,7 @@ ALvoid AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint iValue) if(param == AL_EFFECT_TYPE) { ALboolean isOk = (iValue == AL_EFFECT_NULL || + (iValue == AL_EFFECT_EAXREVERB && !DisabledEffects[EAXREVERB]) || (iValue == AL_EFFECT_REVERB && !DisabledEffects[REVERB]) || (iValue == AL_EFFECT_ECHO && !DisabledEffects[ECHO])); @@ -178,6 +179,22 @@ ALvoid AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint iValue) else alSetError(AL_INVALID_VALUE); } + else if(ALEffect->type == AL_EFFECT_EAXREVERB) + { + switch(param) + { + case AL_EAXREVERB_DECAY_HFLIMIT: + if(iValue == AL_TRUE || iValue == AL_FALSE) + ALEffect->Reverb.DecayHFLimit = iValue; + else + alSetError(AL_INVALID_VALUE); + break; + + default: + alSetError(AL_INVALID_ENUM); + break; + } + } else if(ALEffect->type == AL_EFFECT_REVERB) { switch(param) @@ -227,6 +244,19 @@ ALvoid AL_APIENTRY alEffectiv(ALuint effect, ALenum param, ALint *piValues) { alEffecti(effect, param, piValues[0]); } + else if(ALEffect->type == AL_EFFECT_EAXREVERB) + { + switch(param) + { + case AL_EAXREVERB_DECAY_HFLIMIT: + alEffecti(effect, param, piValues[0]); + break; + + default: + alSetError(AL_INVALID_ENUM); + break; + } + } else if(ALEffect->type == AL_EFFECT_REVERB) { switch(param) @@ -269,7 +299,175 @@ ALvoid AL_APIENTRY alEffectf(ALuint effect, ALenum param, ALfloat flValue) { ALeffect *ALEffect = (ALeffect*)ALTHUNK_LOOKUPENTRY(effect); - if(ALEffect->type == AL_EFFECT_REVERB) + if(ALEffect->type == AL_EFFECT_EAXREVERB) + { + switch(param) + { + case AL_EAXREVERB_DENSITY: + if(flValue >= AL_EAXREVERB_MIN_DENSITY && + flValue <= AL_EAXREVERB_MAX_DENSITY) + ALEffect->Reverb.Density = flValue; + else + alSetError(AL_INVALID_VALUE); + break; + + case AL_EAXREVERB_DIFFUSION: + if(flValue >= AL_EAXREVERB_MIN_DIFFUSION && + flValue <= AL_EAXREVERB_MAX_DIFFUSION) + ALEffect->Reverb.Diffusion = flValue; + else + alSetError(AL_INVALID_VALUE); + break; + + case AL_EAXREVERB_GAIN: + if(flValue >= AL_EAXREVERB_MIN_GAIN && + flValue <= AL_EAXREVERB_MAX_GAIN) + ALEffect->Reverb.Gain = flValue; + else + alSetError(AL_INVALID_VALUE); + break; + + case AL_EAXREVERB_GAINHF: + if(flValue >= AL_EAXREVERB_MIN_GAINHF && + flValue <= AL_EAXREVERB_MAX_GAIN) + ALEffect->Reverb.GainHF = flValue; + else + alSetError(AL_INVALID_VALUE); + break; + + case AL_EAXREVERB_GAINLF: + if(flValue >= AL_EAXREVERB_MIN_GAINLF && + flValue <= AL_EAXREVERB_MAX_GAINLF) + ALEffect->Reverb.GainLF = flValue; + else + alSetError(AL_INVALID_VALUE); + break; + + case AL_EAXREVERB_DECAY_TIME: + if(flValue >= AL_EAXREVERB_MIN_DECAY_TIME && + flValue <= AL_EAXREVERB_MAX_DECAY_TIME) + ALEffect->Reverb.DecayTime = flValue; + else + alSetError(AL_INVALID_VALUE); + break; + + case AL_EAXREVERB_DECAY_HFRATIO: + if(flValue >= AL_EAXREVERB_MIN_DECAY_HFRATIO && + flValue <= AL_EAXREVERB_MAX_DECAY_HFRATIO) + ALEffect->Reverb.DecayHFRatio = flValue; + else + alSetError(AL_INVALID_VALUE); + break; + + case AL_EAXREVERB_DECAY_LFRATIO: + if(flValue >= AL_EAXREVERB_MIN_DECAY_LFRATIO && + flValue <= AL_EAXREVERB_MAX_DECAY_LFRATIO) + ALEffect->Reverb.DecayLFRatio = flValue; + else + alSetError(AL_INVALID_VALUE); + break; + + case AL_EAXREVERB_REFLECTIONS_GAIN: + if(flValue >= AL_EAXREVERB_MIN_REFLECTIONS_GAIN && + flValue <= AL_EAXREVERB_MAX_REFLECTIONS_GAIN) + ALEffect->Reverb.ReflectionsGain = flValue; + else + alSetError(AL_INVALID_VALUE); + break; + + case AL_EAXREVERB_REFLECTIONS_DELAY: + if(flValue >= AL_EAXREVERB_MIN_REFLECTIONS_DELAY && + flValue <= AL_EAXREVERB_MAX_REFLECTIONS_DELAY) + ALEffect->Reverb.ReflectionsDelay = flValue; + else + alSetError(AL_INVALID_VALUE); + break; + + case AL_EAXREVERB_LATE_REVERB_GAIN: + if(flValue >= AL_EAXREVERB_MIN_LATE_REVERB_GAIN && + flValue <= AL_EAXREVERB_MAX_LATE_REVERB_GAIN) + ALEffect->Reverb.LateReverbGain = flValue; + else + alSetError(AL_INVALID_VALUE); + break; + + case AL_EAXREVERB_LATE_REVERB_DELAY: + if(flValue >= AL_EAXREVERB_MIN_LATE_REVERB_DELAY && + flValue <= AL_EAXREVERB_MAX_LATE_REVERB_DELAY) + ALEffect->Reverb.LateReverbDelay = flValue; + else + alSetError(AL_INVALID_VALUE); + break; + + case AL_EAXREVERB_AIR_ABSORPTION_GAINHF: + if(flValue >= AL_EAXREVERB_MIN_AIR_ABSORPTION_GAINHF && + flValue <= AL_EAXREVERB_MAX_AIR_ABSORPTION_GAINHF) + ALEffect->Reverb.AirAbsorptionGainHF = flValue; + else + alSetError(AL_INVALID_VALUE); + break; + + case AL_EAXREVERB_ECHO_TIME: + if(flValue >= AL_EAXREVERB_MIN_ECHO_TIME && + flValue <= AL_EAXREVERB_MAX_ECHO_TIME) + ALEffect->Reverb.EchoTime = flValue; + else + alSetError(AL_INVALID_VALUE); + break; + + case AL_EAXREVERB_ECHO_DEPTH: + if(flValue >= AL_EAXREVERB_MIN_ECHO_DEPTH && + flValue <= AL_EAXREVERB_MAX_ECHO_DEPTH) + ALEffect->Reverb.EchoDepth = flValue; + else + alSetError(AL_INVALID_VALUE); + break; + + case AL_EAXREVERB_MODULATION_TIME: + if(flValue >= AL_EAXREVERB_MIN_MODULATION_TIME && + flValue <= AL_EAXREVERB_MAX_MODULATION_TIME) + ALEffect->Reverb.ModulationTime = flValue; + else + alSetError(AL_INVALID_VALUE); + break; + + case AL_EAXREVERB_MODULATION_DEPTH: + if(flValue >= AL_EAXREVERB_MIN_MODULATION_DEPTH && + flValue <= AL_EAXREVERB_MAX_MODULATION_DEPTH) + ALEffect->Reverb.ModulationDepth = flValue; + else + alSetError(AL_INVALID_VALUE); + break; + + case AL_EAXREVERB_HFREFERENCE: + if(flValue >= AL_EAXREVERB_MIN_HFREFERENCE && + flValue <= AL_EAXREVERB_MAX_HFREFERENCE) + ALEffect->Reverb.HFReference = flValue; + else + alSetError(AL_INVALID_VALUE); + break; + + case AL_EAXREVERB_LFREFERENCE: + if(flValue >= AL_EAXREVERB_MIN_LFREFERENCE && + flValue <= AL_EAXREVERB_MAX_LFREFERENCE) + ALEffect->Reverb.LFReference = flValue; + else + alSetError(AL_INVALID_VALUE); + break; + + case AL_EAXREVERB_ROOM_ROLLOFF_FACTOR: + if(flValue >= 0.0f && flValue <= 10.0f) + ALEffect->Reverb.RoomRolloffFactor = flValue; + else + alSetError(AL_INVALID_VALUE); + break; + + default: + alSetError(AL_INVALID_ENUM); + break; + } + } + else if(ALEffect->type == AL_EFFECT_REVERB) { switch(param) { @@ -426,7 +624,50 @@ ALvoid AL_APIENTRY alEffectfv(ALuint effect, ALenum param, ALfloat *pflValues) { ALeffect *ALEffect = (ALeffect*)ALTHUNK_LOOKUPENTRY(effect); - if(ALEffect->type == AL_EFFECT_REVERB) + if(ALEffect->type == AL_EFFECT_EAXREVERB) + { + switch(param) + { + case AL_EAXREVERB_DENSITY: + case AL_EAXREVERB_DIFFUSION: + case AL_EAXREVERB_GAIN: + case AL_EAXREVERB_GAINHF: + case AL_EAXREVERB_GAINLF: + case AL_EAXREVERB_DECAY_TIME: + case AL_EAXREVERB_DECAY_HFRATIO: + case AL_EAXREVERB_DECAY_LFRATIO: + case AL_EAXREVERB_REFLECTIONS_GAIN: + case AL_EAXREVERB_REFLECTIONS_DELAY: + case AL_EAXREVERB_LATE_REVERB_GAIN: + case AL_EAXREVERB_LATE_REVERB_DELAY: + case AL_EAXREVERB_AIR_ABSORPTION_GAINHF: + case AL_EAXREVERB_ECHO_TIME: + case AL_EAXREVERB_ECHO_DEPTH: + case AL_EAXREVERB_MODULATION_TIME: + case AL_EAXREVERB_MODULATION_DEPTH: + case AL_EAXREVERB_HFREFERENCE: + case AL_EAXREVERB_LFREFERENCE: + case AL_EAXREVERB_ROOM_ROLLOFF_FACTOR: + alEffectf(effect, param, pflValues[0]); + break; + + case AL_EAXREVERB_REFLECTIONS_PAN: + ALEffect->Reverb.ReflectionsPan[0] = pflValues[0]; + ALEffect->Reverb.ReflectionsPan[1] = pflValues[1]; + ALEffect->Reverb.ReflectionsPan[2] = pflValues[2]; + break; + case AL_EAXREVERB_LATE_REVERB_PAN: + ALEffect->Reverb.LateReverbPan[0] = pflValues[0]; + ALEffect->Reverb.LateReverbPan[1] = pflValues[1]; + ALEffect->Reverb.LateReverbPan[2] = pflValues[2]; + break; + + default: + alSetError(AL_INVALID_ENUM); + break; + } + } + else if(ALEffect->type == AL_EFFECT_REVERB) { switch(param) { @@ -491,6 +732,19 @@ ALvoid AL_APIENTRY alGetEffecti(ALuint effect, ALenum param, ALint *piValue) { *piValue = ALEffect->type; } + else if(ALEffect->type == AL_EFFECT_EAXREVERB) + { + switch(param) + { + case AL_EAXREVERB_DECAY_HFLIMIT: + *piValue = ALEffect->Reverb.DecayHFLimit; + break; + + default: + alSetError(AL_INVALID_ENUM); + break; + } + } else if(ALEffect->type == AL_EFFECT_REVERB) { switch(param) @@ -537,6 +791,19 @@ ALvoid AL_APIENTRY alGetEffectiv(ALuint effect, ALenum param, ALint *piValues) { alGetEffecti(effect, param, piValues); } + else if(ALEffect->type == AL_EFFECT_EAXREVERB) + { + switch(param) + { + case AL_EAXREVERB_DECAY_HFLIMIT: + alGetEffecti(effect, param, piValues); + break; + + default: + alSetError(AL_INVALID_ENUM); + break; + } + } else if(ALEffect->type == AL_EFFECT_REVERB) { switch(param) @@ -579,7 +846,96 @@ ALvoid AL_APIENTRY alGetEffectf(ALuint effect, ALenum param, ALfloat *pflValue) { ALeffect *ALEffect = (ALeffect*)ALTHUNK_LOOKUPENTRY(effect); - if(ALEffect->type == AL_EFFECT_REVERB) + if(ALEffect->type == AL_EFFECT_EAXREVERB) + { + switch(param) + { + case AL_EAXREVERB_DENSITY: + *pflValue = ALEffect->Reverb.Density; + break; + + case AL_EAXREVERB_DIFFUSION: + *pflValue = ALEffect->Reverb.Diffusion; + break; + + case AL_EAXREVERB_GAIN: + *pflValue = ALEffect->Reverb.Gain; + break; + + case AL_EAXREVERB_GAINHF: + *pflValue = ALEffect->Reverb.GainHF; + break; + + case AL_EAXREVERB_GAINLF: + *pflValue = ALEffect->Reverb.GainLF; + break; + + case AL_EAXREVERB_DECAY_TIME: + *pflValue = ALEffect->Reverb.DecayTime; + break; + + case AL_EAXREVERB_DECAY_HFRATIO: + *pflValue = ALEffect->Reverb.DecayHFRatio; + break; + + case AL_EAXREVERB_DECAY_LFRATIO: + *pflValue = ALEffect->Reverb.DecayLFRatio; + break; + + case AL_EAXREVERB_REFLECTIONS_GAIN: + *pflValue = ALEffect->Reverb.ReflectionsGain; + break; + + case AL_EAXREVERB_REFLECTIONS_DELAY: + *pflValue = ALEffect->Reverb.ReflectionsDelay; + break; + + case AL_EAXREVERB_LATE_REVERB_GAIN: + *pflValue = ALEffect->Reverb.LateReverbGain; + break; + + case AL_EAXREVERB_LATE_REVERB_DELAY: + *pflValue = ALEffect->Reverb.LateReverbDelay; + break; + + case AL_EAXREVERB_AIR_ABSORPTION_GAINHF: + *pflValue = ALEffect->Reverb.AirAbsorptionGainHF; + break; + + case AL_EAXREVERB_ECHO_TIME: + *pflValue = ALEffect->Reverb.EchoTime; + break; + + case AL_EAXREVERB_ECHO_DEPTH: + *pflValue = ALEffect->Reverb.EchoDepth; + break; + + case AL_EAXREVERB_MODULATION_TIME: + *pflValue = ALEffect->Reverb.ModulationTime; + break; + + case AL_EAXREVERB_MODULATION_DEPTH: + *pflValue = ALEffect->Reverb.ModulationDepth; + break; + + case AL_EAXREVERB_HFREFERENCE: + *pflValue = ALEffect->Reverb.HFReference; + break; + + case AL_EAXREVERB_LFREFERENCE: + *pflValue = ALEffect->Reverb.LFReference; + break; + + case AL_EAXREVERB_ROOM_ROLLOFF_FACTOR: + *pflValue = ALEffect->Reverb.RoomRolloffFactor; + break; + + default: + alSetError(AL_INVALID_ENUM); + break; + } + } + else if(ALEffect->type == AL_EFFECT_REVERB) { switch(param) { @@ -685,7 +1041,50 @@ ALvoid AL_APIENTRY alGetEffectfv(ALuint effect, ALenum param, ALfloat *pflValues { ALeffect *ALEffect = (ALeffect*)ALTHUNK_LOOKUPENTRY(effect); - if(ALEffect->type == AL_EFFECT_REVERB) + if(ALEffect->type == AL_EFFECT_EAXREVERB) + { + switch(param) + { + case AL_EAXREVERB_DENSITY: + case AL_EAXREVERB_DIFFUSION: + case AL_EAXREVERB_GAIN: + case AL_EAXREVERB_GAINHF: + case AL_EAXREVERB_GAINLF: + case AL_EAXREVERB_DECAY_TIME: + case AL_EAXREVERB_DECAY_HFRATIO: + case AL_EAXREVERB_DECAY_LFRATIO: + case AL_EAXREVERB_REFLECTIONS_GAIN: + case AL_EAXREVERB_REFLECTIONS_DELAY: + case AL_EAXREVERB_LATE_REVERB_GAIN: + case AL_EAXREVERB_LATE_REVERB_DELAY: + case AL_EAXREVERB_AIR_ABSORPTION_GAINHF: + case AL_EAXREVERB_ECHO_TIME: + case AL_EAXREVERB_ECHO_DEPTH: + case AL_EAXREVERB_MODULATION_TIME: + case AL_EAXREVERB_MODULATION_DEPTH: + case AL_EAXREVERB_HFREFERENCE: + case AL_EAXREVERB_LFREFERENCE: + case AL_EAXREVERB_ROOM_ROLLOFF_FACTOR: + alGetEffectf(effect, param, pflValues); + break; + + case AL_EAXREVERB_REFLECTIONS_PAN: + pflValues[0] = ALEffect->Reverb.ReflectionsPan[0]; + pflValues[1] = ALEffect->Reverb.ReflectionsPan[1]; + pflValues[2] = ALEffect->Reverb.ReflectionsPan[2]; + break; + case AL_EAXREVERB_LATE_REVERB_PAN: + pflValues[0] = ALEffect->Reverb.LateReverbPan[0]; + pflValues[1] = ALEffect->Reverb.LateReverbPan[1]; + pflValues[2] = ALEffect->Reverb.LateReverbPan[2]; + break; + + default: + alSetError(AL_INVALID_ENUM); + break; + } + } + else if(ALEffect->type == AL_EFFECT_REVERB) { switch(param) { @@ -761,18 +1160,33 @@ static void InitEffectParams(ALeffect *effect, ALenum type) effect->type = type; switch(type) { + case AL_EFFECT_EAXREVERB: case AL_EFFECT_REVERB: effect->Reverb.Density = 1.0f; effect->Reverb.Diffusion = 1.0f; effect->Reverb.Gain = 0.32f; effect->Reverb.GainHF = 0.89f; + effect->Reverb.GainLF = 1.0f; effect->Reverb.DecayTime = 1.49f; effect->Reverb.DecayHFRatio = 0.83f; + effect->Reverb.DecayLFRatio = 1.0f; effect->Reverb.ReflectionsGain = 0.05f; effect->Reverb.ReflectionsDelay = 0.007f; + effect->Reverb.ReflectionsPan[0] = 0.0f; + effect->Reverb.ReflectionsPan[1] = 0.0f; + effect->Reverb.ReflectionsPan[2] = 0.0f; effect->Reverb.LateReverbGain = 1.26f; effect->Reverb.LateReverbDelay = 0.011f; + effect->Reverb.LateReverbPan[0] = 0.0f; + effect->Reverb.LateReverbPan[1] = 0.0f; + effect->Reverb.LateReverbPan[2] = 0.0f; + effect->Reverb.EchoTime = 0.25f; + effect->Reverb.EchoDepth = 0.0f; + effect->Reverb.ModulationTime = 0.25f; + effect->Reverb.ModulationDepth = 0.0f; effect->Reverb.AirAbsorptionGainHF = 0.994f; + effect->Reverb.HFReference = 5000.0f; + effect->Reverb.LFReference = 250.0f; effect->Reverb.RoomRolloffFactor = 0.0f; effect->Reverb.DecayHFLimit = AL_TRUE; break; |