aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALu.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-10-02 21:19:34 -0700
committerChris Robinson <[email protected]>2014-10-02 21:19:34 -0700
commit70b23ab77f99c6e4baeca3cb74355a027cf6769d (patch)
treebadc3fce317db7928dc2ddf06b870cf96c32413b /Alc/ALu.c
parent79fb86d8f79459b0144e4de750e9b6f07c4de473 (diff)
Add a helper to search for a channel index by name
Diffstat (limited to 'Alc/ALu.c')
-rw-r--r--Alc/ALu.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 564ab133..49ebd0c2 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -409,15 +409,8 @@ ALvoid CalcNonAttnSourceParams(ALvoice *voice, const ALsource *ALSource, const A
for(j = 0;j < MaxChannels;j++)
gains[j].Target = 0.0f;
- for(i = 0;i < (ALint)Device->NumSpeakers;i++)
- {
- enum Channel chan = Device->Speaker[i].ChanName;
- if(chan == chans[c].channel)
- {
- gains[chan].Target = DryGain;
- break;
- }
- }
+ if(GetChannelIdxByName(Device, chans[c].channel) != -1)
+ gains[chans[c].channel].Target = DryGain;
}
UpdateDryStepping(&voice->Direct, num_channels);
@@ -467,7 +460,8 @@ ALvoid CalcNonAttnSourceParams(ALvoice *voice, const ALsource *ALSource, const A
{
for(i = 0;i < MaxChannels;i++)
Target[i] = 0.0f;
- Target[chans[c].channel] = DryGain;
+ if(GetChannelIdxByName(Device, chans[c].channel) != -1)
+ Target[chans[c].channel] = DryGain;
ok = true;
}
else for(i = 0;i < (ALint)Device->NumSpeakers;i++)