Use a lambda to apply the NFC mixes
This commit is contained in:
parent
e1af866a3d
commit
607fb3e632
@ -537,30 +537,29 @@ ALboolean MixSource(ALvoice *voice, ALuint SourceID, ALCcontext *Context, ALsize
|
|||||||
);
|
);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ALfloat *nfcsamples = Device->TempBuffer[NFC_DATA_BUF];
|
|
||||||
ALsizei chanoffset = 0;
|
|
||||||
|
|
||||||
MixSamples(samples,
|
MixSamples(samples,
|
||||||
voice->Direct.ChannelsPerOrder[0], voice->Direct.Buffer,
|
voice->Direct.ChannelsPerOrder[0], voice->Direct.Buffer,
|
||||||
parms->Gains.Current, parms->Gains.Target, Counter, OutPos,
|
parms->Gains.Current, parms->Gains.Target, Counter, OutPos,
|
||||||
DstBufferSize
|
DstBufferSize
|
||||||
);
|
);
|
||||||
chanoffset += voice->Direct.ChannelsPerOrder[0];
|
|
||||||
#define APPLY_NFC_MIX(order) \
|
ALfloat *nfcsamples{Device->TempBuffer[NFC_DATA_BUF]};
|
||||||
if(voice->Direct.ChannelsPerOrder[order] > 0) \
|
ALsizei chanoffset{voice->Direct.ChannelsPerOrder[0]};
|
||||||
{ \
|
using FilterProc = void(NfcFilter*,ALfloat*,const ALfloat*,ALsizei);
|
||||||
NfcFilterProcess##order(&parms->NFCtrlFilter, nfcsamples, samples, \
|
auto apply_nfc = [voice,parms,samples,DstBufferSize,Counter,OutPos,&chanoffset,nfcsamples](FilterProc &process, ALsizei order) -> void
|
||||||
DstBufferSize); \
|
{
|
||||||
MixSamples(nfcsamples, voice->Direct.ChannelsPerOrder[order], \
|
if(voice->Direct.ChannelsPerOrder[order] < 1)
|
||||||
voice->Direct.Buffer+chanoffset, parms->Gains.Current+chanoffset, \
|
return;
|
||||||
parms->Gains.Target+chanoffset, Counter, OutPos, DstBufferSize \
|
process(&parms->NFCtrlFilter, nfcsamples, samples, DstBufferSize);
|
||||||
); \
|
MixSamples(nfcsamples, voice->Direct.ChannelsPerOrder[order],
|
||||||
chanoffset += voice->Direct.ChannelsPerOrder[order]; \
|
voice->Direct.Buffer+chanoffset, parms->Gains.Current+chanoffset,
|
||||||
}
|
parms->Gains.Target+chanoffset, Counter, OutPos, DstBufferSize
|
||||||
APPLY_NFC_MIX(1)
|
);
|
||||||
APPLY_NFC_MIX(2)
|
chanoffset += voice->Direct.ChannelsPerOrder[order];
|
||||||
APPLY_NFC_MIX(3)
|
};
|
||||||
#undef APPLY_NFC_MIX
|
apply_nfc(NfcFilterProcess1, 1);
|
||||||
|
apply_nfc(NfcFilterProcess2, 2);
|
||||||
|
apply_nfc(NfcFilterProcess3, 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user