aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-06-26 11:19:27 -0700
committerChris Robinson <[email protected]>2017-06-26 11:19:27 -0700
commit8f2bbc434c91b5d402de0e44b862a272928667a9 (patch)
treeccfbadbafa097489c8226ccca2a41e22e470bd79 /Alc
parentb13fead555c6dba54844a1e16e79d717eab8c965 (diff)
Use a macro to apply NFC filtered mixes instead of a loop
Diffstat (limited to 'Alc')
-rw-r--r--Alc/mixer.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/Alc/mixer.c b/Alc/mixer.c
index 56d65207..b5c4605b 100644
--- a/Alc/mixer.c
+++ b/Alc/mixer.c
@@ -471,13 +471,8 @@ ALboolean MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALsizei
);
else
{
- static void (*const NfcUpdate[MAX_AMBI_ORDER])(
- NfcFilter*,float*,const float*,const int
- ) = {
- NfcFilterUpdate1, NfcFilterUpdate2, NfcFilterUpdate3
- };
ALfloat *nfcsamples = Device->NFCtrlData;
- ALsizei ord, chanoffset = 0;
+ ALsizei chanoffset = 0;
MixSamples(samples,
voice->Direct.ChannelsPerOrder[0], voice->Direct.Buffer,
@@ -485,18 +480,21 @@ ALboolean MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALsizei
DstBufferSize
);
chanoffset += voice->Direct.ChannelsPerOrder[0];
- for(ord = 1;ord < MAX_AMBI_ORDER+1;ord++)
- {
- if(voice->Direct.ChannelsPerOrder[ord] <= 0)
- break;
- NfcUpdate[ord-1](&parms->NFCtrlFilter[ord-1], nfcsamples, samples,
- DstBufferSize);
- MixSamples(nfcsamples, voice->Direct.ChannelsPerOrder[ord],
- voice->Direct.Buffer+chanoffset, parms->Gains.Current+chanoffset,
- parms->Gains.Target+chanoffset, Counter, OutPos, DstBufferSize
- );
- chanoffset += voice->Direct.ChannelsPerOrder[ord];
- }
+#define APPLY_NFC_MIX(order) \
+ if(voice->Direct.ChannelsPerOrder[order] > 0) \
+ { \
+ NfcFilterUpdate##order(&parms->NFCtrlFilter[order-1], nfcsamples, \
+ samples, DstBufferSize); \
+ MixSamples(nfcsamples, voice->Direct.ChannelsPerOrder[order], \
+ voice->Direct.Buffer+chanoffset, parms->Gains.Current+chanoffset, \
+ parms->Gains.Target+chanoffset, Counter, OutPos, DstBufferSize \
+ ); \
+ chanoffset += voice->Direct.ChannelsPerOrder[order]; \
+ }
+ APPLY_NFC_MIX(1)
+ APPLY_NFC_MIX(2)
+ APPLY_NFC_MIX(3)
+#undef APPLY_NFC_MIX
}
}
else