From 70b23ab77f99c6e4baeca3cb74355a027cf6769d Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 2 Oct 2014 21:19:34 -0700 Subject: Add a helper to search for a channel index by name --- Alc/effects/dedicated.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'Alc/effects') diff --git a/Alc/effects/dedicated.c b/Alc/effects/dedicated.c index ea028046..e3014967 100644 --- a/Alc/effects/dedicated.c +++ b/Alc/effects/dedicated.c @@ -55,21 +55,17 @@ static ALvoid ALdedicatedState_update(ALdedicatedState *state, ALCdevice *device Gain = Slot->Gain * Slot->EffectProps.Dedicated.Gain; if(Slot->EffectType == AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT) - state->gains[LFE] = Gain; + { + if(GetChannelIdxByName(device, LFE) != -1) + 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) + if(GetChannelIdxByName(device, FrontCenter) != -1) + state->gains[FrontCenter] = Gain; + else { static const ALfloat front_dir[3] = { 0.0f, 0.0f, -1.0f }; ComputeDirectionalGains(device, front_dir, Gain, state->gains); -- cgit v1.2.3