aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/mixer.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-03-25 23:48:57 -0700
committerChris Robinson <[email protected]>2017-03-25 23:55:44 -0700
commit56428cdb74a6ee8449cb9977a9575c22c1844d26 (patch)
tree709b23e4cbc284177fe480e4a370a16163e31209 /Alc/mixer.c
parent1d559ec703653386ca65175d884f7487b36032e5 (diff)
Use a loop to apply NFC filters
Diffstat (limited to 'Alc/mixer.c')
-rw-r--r--Alc/mixer.c45
1 files changed, 15 insertions, 30 deletions
diff --git a/Alc/mixer.c b/Alc/mixer.c
index bc9c715e..46de5cbe 100644
--- a/Alc/mixer.c
+++ b/Alc/mixer.c
@@ -557,46 +557,31 @@ 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 chanoffset = 0;
+ ALsizei ord, chanoffset = 0;
+
MixSamples(samples,
voice->Direct.ChannelsPerOrder[0], voice->Direct.Buffer,
parms->Gains.Current, parms->Gains.Target, Counter, OutPos,
DstBufferSize
);
chanoffset += voice->Direct.ChannelsPerOrder[0];
- if(voice->Direct.ChannelsPerOrder[1] > 0)
- {
- NfcFilterUpdate1(&parms->NFCtrlFilter[0], nfcsamples, samples,
- DstBufferSize);
- MixSamples(nfcsamples,
- voice->Direct.ChannelsPerOrder[1], voice->Direct.Buffer+chanoffset,
- parms->Gains.Current+chanoffset, parms->Gains.Target+chanoffset,
- Counter, OutPos, DstBufferSize
- );
- chanoffset += voice->Direct.ChannelsPerOrder[1];
- }
- if(voice->Direct.ChannelsPerOrder[2] > 0)
- {
- NfcFilterUpdate2(&parms->NFCtrlFilter[1], nfcsamples, samples,
- DstBufferSize);
- MixSamples(nfcsamples,
- voice->Direct.ChannelsPerOrder[2], voice->Direct.Buffer+chanoffset,
- parms->Gains.Current+chanoffset, parms->Gains.Target+chanoffset,
- Counter, OutPos, DstBufferSize
- );
- chanoffset += voice->Direct.ChannelsPerOrder[2];
- }
- if(voice->Direct.ChannelsPerOrder[3] > 0)
+ for(ord = 1;ord < MAX_AMBI_ORDER+1;ord++)
{
- NfcFilterUpdate3(&parms->NFCtrlFilter[2], nfcsamples, samples,
+ if(voice->Direct.ChannelsPerOrder[ord] <= 0)
+ break;
+ NfcUpdate[ord-1](&parms->NFCtrlFilter[ord-1], nfcsamples, samples,
DstBufferSize);
- MixSamples(nfcsamples,
- voice->Direct.ChannelsPerOrder[3], voice->Direct.Buffer+chanoffset,
- parms->Gains.Current+chanoffset, parms->Gains.Target+chanoffset,
- Counter, OutPos, 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[3];
+ chanoffset += voice->Direct.ChannelsPerOrder[ord];
}
}
}