diff options
author | Chris Robinson <[email protected]> | 2011-09-01 18:01:14 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2011-09-01 18:01:14 -0700 |
commit | 942c8bf8a7e3fb657bcaad339cf8029abdce0359 (patch) | |
tree | c0115312da4951f9506b8b1fe7ef3a5a4f1f5ddc /Alc | |
parent | b6b3e2f1cc6b38ae1d5ff69485c8a62bdd625dda (diff) |
Combine the dedicated (dialog/LFE) effects
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/alcDedicated.c | 51 |
1 files changed, 13 insertions, 38 deletions
diff --git a/Alc/alcDedicated.c b/Alc/alcDedicated.c index c812877a..cba97eae 100644 --- a/Alc/alcDedicated.c +++ b/Alc/alcDedicated.c @@ -50,7 +50,7 @@ static ALboolean DedicatedDeviceUpdate(ALeffectState *effect, ALCdevice *Device) return AL_TRUE; } -static ALvoid DedicatedDLGUpdate(ALeffectState *effect, ALCcontext *Context, const ALeffectslot *Slot) +static ALvoid DedicatedUpdate(ALeffectState *effect, ALCcontext *Context, const ALeffectslot *Slot) { ALdedicatedState *state = (ALdedicatedState*)effect; ALCdevice *device = Context->Device; @@ -59,25 +59,20 @@ static ALvoid DedicatedDLGUpdate(ALeffectState *effect, ALCcontext *Context, con ALint pos; ALsizei s; - pos = aluCart2LUTpos(1.0f, 0.0f); - SpeakerGain = device->PanningLUT[pos]; - Gain = Slot->Gain * Slot->effect.Params.Dedicated.Gain; for(s = 0;s < MAXCHANNELS;s++) - state->gains[s] = SpeakerGain[s] * Gain; -} + state->gains[s] = 0.0f; -static ALvoid DedicatedLFEUpdate(ALeffectState *effect, ALCcontext *Context, const ALeffectslot *Slot) -{ - ALdedicatedState *state = (ALdedicatedState*)effect; - ALfloat Gain; - ALsizei s; - (void)Context; + if(Slot->effect.type == AL_EFFECT_DEDICATED_DIALOGUE) + { + pos = aluCart2LUTpos(1.0f, 0.0f); + SpeakerGain = device->PanningLUT[pos]; - Gain = Slot->Gain * Slot->effect.Params.Dedicated.Gain; - for(s = 0;s < MAXCHANNELS;s++) - state->gains[s] = 0.0f; - state->gains[LFE] = Gain; + for(s = 0;s < MAXCHANNELS;s++) + state->gains[s] = SpeakerGain[s] * Gain; + } + else if(Slot->effect.type == AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT) + state->gains[LFE] = Gain; } static ALvoid DedicatedProcess(ALeffectState *effect, const ALeffectslot *Slot, ALuint SamplesToDo, const ALfloat *SamplesIn, ALfloat (*SamplesOut)[MAXCHANNELS]) @@ -97,27 +92,7 @@ static ALvoid DedicatedProcess(ALeffectState *effect, const ALeffectslot *Slot, } } -ALeffectState *DedicatedDLGCreate(void) -{ - ALdedicatedState *state; - ALsizei s; - - state = malloc(sizeof(*state)); - if(!state) - return NULL; - - state->state.Destroy = DedicatedDestroy; - state->state.DeviceUpdate = DedicatedDeviceUpdate; - state->state.Update = DedicatedDLGUpdate; - state->state.Process = DedicatedProcess; - - for(s = 0;s < MAXCHANNELS;s++) - state->gains[s] = 0.0f; - - return &state->state; -} - -ALeffectState *DedicatedLFECreate(void) +ALeffectState *DedicatedCreate(void) { ALdedicatedState *state; ALsizei s; @@ -128,7 +103,7 @@ ALeffectState *DedicatedLFECreate(void) state->state.Destroy = DedicatedDestroy; state->state.DeviceUpdate = DedicatedDeviceUpdate; - state->state.Update = DedicatedLFEUpdate; + state->state.Update = DedicatedUpdate; state->state.Process = DedicatedProcess; for(s = 0;s < MAXCHANNELS;s++) |