diff options
author | Chris Robinson <[email protected]> | 2011-03-12 20:11:25 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2011-03-12 20:11:25 -0800 |
commit | 73123bc313fd0f700abc8569138081abca997b78 (patch) | |
tree | b438e53a2ed62f8b6391793aaf36297da0ad8b27 /OpenAL32 | |
parent | 947aa1342c82fe22b2030b04e43532af0a07d978 (diff) |
Add support for ALC_EXT_DEDICATED
Diffstat (limited to 'OpenAL32')
-rw-r--r-- | OpenAL32/Include/alAuxEffectSlot.h | 2 | ||||
-rw-r--r-- | OpenAL32/Include/alEffect.h | 5 | ||||
-rw-r--r-- | OpenAL32/alAuxEffectSlot.c | 4 | ||||
-rw-r--r-- | OpenAL32/alEffect.c | 67 | ||||
-rw-r--r-- | OpenAL32/alExtension.c | 5 |
5 files changed, 82 insertions, 1 deletions
diff --git a/OpenAL32/Include/alAuxEffectSlot.h b/OpenAL32/Include/alAuxEffectSlot.h index 43d2f719..09bc363e 100644 --- a/OpenAL32/Include/alAuxEffectSlot.h +++ b/OpenAL32/Include/alAuxEffectSlot.h @@ -49,6 +49,8 @@ ALeffectState *EAXVerbCreate(void); ALeffectState *VerbCreate(void); ALeffectState *EchoCreate(void); ALeffectState *ModulatorCreate(void); +ALeffectState *DedicatedDLGCreate(void); +ALeffectState *DedicatedLFECreate(void); #define ALEffect_Destroy(a) ((a)->Destroy((a))) #define ALEffect_DeviceUpdate(a,b) ((a)->DeviceUpdate((a),(b))) diff --git a/OpenAL32/Include/alEffect.h b/OpenAL32/Include/alEffect.h index 500b60a1..aa8e1200 100644 --- a/OpenAL32/Include/alEffect.h +++ b/OpenAL32/Include/alEffect.h @@ -14,6 +14,7 @@ enum { REVERB, ECHO, MODULATOR, + DEDICATED, MAX_EFFECTS }; @@ -69,6 +70,10 @@ typedef struct ALeffect ALint Waveform; } Modulator; + struct { + ALfloat Gain; + } Dedicated; + // Index to itself ALuint effect; } ALeffect; diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c index aab4f96b..9d25ce23 100644 --- a/OpenAL32/alAuxEffectSlot.c +++ b/OpenAL32/alAuxEffectSlot.c @@ -488,6 +488,10 @@ static ALvoid InitializeEffect(ALCcontext *Context, ALeffectslot *EffectSlot, AL NewState = EchoCreate(); else if(effect->type == AL_EFFECT_RING_MODULATOR) NewState = ModulatorCreate(); + else if(effect->type == AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT) + NewState = DedicatedLFECreate(); + else if(effect->type == AL_EFFECT_DEDICATED_DIALOGUE) + NewState = DedicatedDLGCreate(); /* No new state? An error occured.. */ if(NewState == NULL || ALEffect_DeviceUpdate(NewState, Context->Device) == AL_FALSE) diff --git a/OpenAL32/alEffect.c b/OpenAL32/alEffect.c index 0814cfe0..69a5b32d 100644 --- a/OpenAL32/alEffect.c +++ b/OpenAL32/alEffect.c @@ -171,7 +171,9 @@ AL_API ALvoid AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint iValue) (iValue == AL_EFFECT_EAXREVERB && !DisabledEffects[EAXREVERB]) || (iValue == AL_EFFECT_REVERB && !DisabledEffects[REVERB]) || (iValue == AL_EFFECT_ECHO && !DisabledEffects[ECHO]) || - (iValue == AL_EFFECT_RING_MODULATOR && !DisabledEffects[MODULATOR])); + (iValue == AL_EFFECT_RING_MODULATOR && !DisabledEffects[MODULATOR]) || + ((iValue == AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT || + iValue == AL_EFFECT_DEDICATED_DIALOGUE) && !DisabledEffects[DEDICATED])); if(isOk) InitEffectParams(ALEffect, iValue); @@ -681,6 +683,23 @@ AL_API ALvoid AL_APIENTRY alEffectf(ALuint effect, ALenum param, ALfloat flValue break; } } + else if(ALEffect->type == AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT || + ALEffect->type == AL_EFFECT_DEDICATED_DIALOGUE) + { + switch(param) + { + case AL_DEDICATED_GAIN: + if(flValue >= 0.0f) + ALEffect->Dedicated.Gain = flValue; + else + alSetError(Context, AL_INVALID_VALUE); + break; + + default: + alSetError(Context, AL_INVALID_ENUM); + break; + } + } else alSetError(Context, AL_INVALID_ENUM); } @@ -810,6 +829,20 @@ AL_API ALvoid AL_APIENTRY alEffectfv(ALuint effect, ALenum param, ALfloat *pflVa break; } } + else if(ALEffect->type == AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT || + ALEffect->type == AL_EFFECT_DEDICATED_DIALOGUE) + { + switch(param) + { + case AL_DEDICATED_GAIN: + alEffectf(effect, param, pflValues[0]); + break; + + default: + alSetError(Context, AL_INVALID_ENUM); + break; + } + } else alSetError(Context, AL_INVALID_ENUM); } @@ -1176,6 +1209,20 @@ AL_API ALvoid AL_APIENTRY alGetEffectf(ALuint effect, ALenum param, ALfloat *pfl break; } } + else if(ALEffect->type == AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT || + ALEffect->type == AL_EFFECT_DEDICATED_DIALOGUE) + { + switch(param) + { + case AL_DEDICATED_GAIN: + *pflValue = ALEffect->Dedicated.Gain; + break; + + default: + alSetError(Context, AL_INVALID_ENUM); + break; + } + } else alSetError(Context, AL_INVALID_ENUM); } @@ -1295,6 +1342,20 @@ AL_API ALvoid AL_APIENTRY alGetEffectfv(ALuint effect, ALenum param, ALfloat *pf break; } } + else if(ALEffect->type == AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT || + ALEffect->type == AL_EFFECT_DEDICATED_DIALOGUE) + { + switch(param) + { + case AL_DEDICATED_GAIN: + alGetEffectf(effect, param, pflValues); + break; + + default: + alSetError(Context, AL_INVALID_ENUM); + break; + } + } else alSetError(Context, AL_INVALID_ENUM); } @@ -1372,5 +1433,9 @@ static void InitEffectParams(ALeffect *effect, ALenum type) effect->Modulator.HighPassCutoff = AL_RING_MODULATOR_DEFAULT_HIGHPASS_CUTOFF; effect->Modulator.Waveform = AL_RING_MODULATOR_DEFAULT_WAVEFORM; break; + case AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT: + case AL_EFFECT_DEDICATED_DIALOGUE: + effect->Dedicated.Gain = 1.0f; + break; } } diff --git a/OpenAL32/alExtension.c b/OpenAL32/alExtension.c index 0febf225..59ca48aa 100644 --- a/OpenAL32/alExtension.c +++ b/OpenAL32/alExtension.c @@ -211,6 +211,8 @@ static const ALenums enumeration[] = { { "AL_EFFECT_COMPRESSOR", AL_EFFECT_COMPRESSOR }, { "AL_EFFECT_EQUALIZER", AL_EFFECT_EQUALIZER }, #endif + { "AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT",AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT}, + { "AL_EFFECT_DEDICATED_DIALOGUE", AL_EFFECT_DEDICATED_DIALOGUE }, // Reverb params { "AL_REVERB_DENSITY", AL_REVERB_DENSITY }, @@ -264,6 +266,9 @@ static const ALenums enumeration[] = { { "AL_RING_MODULATOR_HIGHPASS_CUTOFF", AL_RING_MODULATOR_HIGHPASS_CUTOFF }, { "AL_RING_MODULATOR_WAVEFORM", AL_RING_MODULATOR_WAVEFORM }, + // Dedicated Dialogue/LFE params + { "AL_DEDICATED_GAIN", AL_DEDICATED_GAIN }, + // Default { NULL, (ALenum)0 } |