From 82dd2d875e9b7549eaa63f9d1a3e08635aafa524 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sat, 17 May 2014 07:54:25 -0700 Subject: Apply high-pass source filters as needed --- Alc/mixer.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'Alc/mixer.c') diff --git a/Alc/mixer.c b/Alc/mixer.c index ac433e35..32d4d308 100644 --- a/Alc/mixer.c +++ b/Alc/mixer.c @@ -84,7 +84,8 @@ static void SilenceData(ALfloat *dst, ALuint samples) } -static void DoFilters(ALfilterState *lpfilter, ALfloat *restrict dst, const ALfloat *restrict src, +static void DoFilters(ALfilterState *lpfilter, ALfilterState *hpfilter, + ALfloat *restrict dst, const ALfloat *restrict src, ALuint numsamples, enum ActiveFilters type) { ALuint i; @@ -98,6 +99,18 @@ static void DoFilters(ALfilterState *lpfilter, ALfloat *restrict dst, const ALfl for(i = 0;i < numsamples;i++) dst[i] = ALfilterState_processSingle(lpfilter, src[i]); break; + + case AF_HighPass: + for(i = 0;i < numsamples;i++) + dst[i] = ALfilterState_processSingle(hpfilter, src[i]); + break; + + case AF_BandPass: + for(i = 0;i < numsamples;i++) + dst[i] = ALfilterState_processSingle(hpfilter, + ALfilterState_processSingle(lpfilter, src[i]) + ); + break; } } @@ -332,8 +345,9 @@ ALvoid MixSource(ALactivesource *src, ALCdevice *Device, ALuint SamplesToDo) { DirectParams *directparms = &src->Direct; - DoFilters(&directparms->LpFilter[chan], SrcData, ResampledData, - DstBufferSize, directparms->Filters[chan]); + DoFilters(&directparms->LpFilter[chan], &directparms->HpFilter[chan], + SrcData, ResampledData, DstBufferSize, + directparms->Filters[chan]); src->DryMix(directparms, SrcData, chan, OutPos, DstBufferSize); } @@ -343,8 +357,9 @@ ALvoid MixSource(ALactivesource *src, ALCdevice *Device, ALuint SamplesToDo) if(!sendparms->OutBuffer) continue; - DoFilters(&sendparms->LpFilter[chan], SrcData, ResampledData, - DstBufferSize, sendparms->Filters[chan]); + DoFilters(&sendparms->LpFilter[chan], &sendparms->HpFilter[chan], + SrcData, ResampledData, DstBufferSize, + sendparms->Filters[chan]); src->WetMix(sendparms, SrcData, OutPos, DstBufferSize); } } -- cgit v1.2.3