diff options
author | Chris Robinson <[email protected]> | 2014-10-02 18:05:42 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2014-10-02 18:05:42 -0700 |
commit | 95ba18cf4e52c439b85ece2daf0b404fa69c7b70 (patch) | |
tree | 2367b5d69488633fb8d596cf3e3b328d81b2753f /Alc/effects/dedicated.c | |
parent | 9377d0f23730ff0d42a870627ea9a75059c481f4 (diff) |
Make ComputeAngleGains use ComputeDirectionalGains
Diffstat (limited to 'Alc/effects/dedicated.c')
-rw-r--r-- | Alc/effects/dedicated.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/Alc/effects/dedicated.c b/Alc/effects/dedicated.c index 0907d6b0..ea028046 100644 --- a/Alc/effects/dedicated.c +++ b/Alc/effects/dedicated.c @@ -48,16 +48,32 @@ static ALboolean ALdedicatedState_deviceUpdate(ALdedicatedState *UNUSED(state), static ALvoid ALdedicatedState_update(ALdedicatedState *state, ALCdevice *device, const ALeffectslot *Slot) { ALfloat Gain; - ALsizei s; + ALuint i; + + for(i = 0;i < MaxChannels;i++) + state->gains[i] = 0.0f; Gain = Slot->Gain * Slot->EffectProps.Dedicated.Gain; - if(Slot->EffectType == AL_EFFECT_DEDICATED_DIALOGUE) - ComputeAngleGains(device, atan2f(0.0f, 1.0f), 0.0f, Gain, state->gains); - else if(Slot->EffectType == AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT) - { - for(s = 0;s < MaxChannels;s++) - state->gains[s] = 0.0f; + if(Slot->EffectType == AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT) state->gains[LFE] = Gain; + else if(Slot->EffectType == AL_EFFECT_DEDICATED_DIALOGUE) + { + ALboolean done = AL_FALSE; + /* Dialog goes to the front-center speaker if it exists, otherwise it + * plays from the front-center location. */ + for(i = 0;i < device->NumSpeakers;i++) + { + if(device->Speaker[i].ChanName == FrontCenter) + { + state->gains[FrontCenter] = Gain; + done = AL_TRUE; + } + } + if(!done) + { + static const ALfloat front_dir[3] = { 0.0f, 0.0f, -1.0f }; + ComputeDirectionalGains(device, front_dir, Gain, state->gains); + } } } |