aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/mixer.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-05-17 07:17:48 -0700
committerChris Robinson <[email protected]>2014-05-17 07:17:48 -0700
commit0b5b39d5e60b250a41a6f306f3167a553d5dad58 (patch)
tree22141ce0bc2e5e009d217b3beedaa3f59eec48cd /Alc/mixer.c
parent70f1e54068f2ccfce30f9e5db8ea61b01283f59b (diff)
Add a flag to specify when the low-pass filter needs to apply
Diffstat (limited to 'Alc/mixer.c')
-rw-r--r--Alc/mixer.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/Alc/mixer.c b/Alc/mixer.c
index fc3fecbd..ac433e35 100644
--- a/Alc/mixer.c
+++ b/Alc/mixer.c
@@ -84,12 +84,21 @@ static void SilenceData(ALfloat *dst, ALuint samples)
}
-static void DoFilter(ALfilterState *filter, ALfloat *restrict dst, const ALfloat *restrict src,
- ALuint numsamples)
+static void DoFilters(ALfilterState *lpfilter, ALfloat *restrict dst, const ALfloat *restrict src,
+ ALuint numsamples, enum ActiveFilters type)
{
ALuint i;
- for(i = 0;i < numsamples;i++)
- dst[i] = ALfilterState_processSingle(filter, src[i]);
+ switch(type)
+ {
+ case AF_None:
+ memcpy(dst, src, numsamples * sizeof(ALfloat));
+ break;
+
+ case AF_LowPass:
+ for(i = 0;i < numsamples;i++)
+ dst[i] = ALfilterState_processSingle(lpfilter, src[i]);
+ break;
+ }
}
@@ -323,8 +332,8 @@ ALvoid MixSource(ALactivesource *src, ALCdevice *Device, ALuint SamplesToDo)
{
DirectParams *directparms = &src->Direct;
- DoFilter(&directparms->LpFilter[chan], SrcData, ResampledData,
- DstBufferSize);
+ DoFilters(&directparms->LpFilter[chan], SrcData, ResampledData,
+ DstBufferSize, directparms->Filters[chan]);
src->DryMix(directparms, SrcData, chan, OutPos, DstBufferSize);
}
@@ -334,8 +343,8 @@ ALvoid MixSource(ALactivesource *src, ALCdevice *Device, ALuint SamplesToDo)
if(!sendparms->OutBuffer)
continue;
- DoFilter(&sendparms->LpFilter[chan], SrcData, ResampledData,
- DstBufferSize);
+ DoFilters(&sendparms->LpFilter[chan], SrcData, ResampledData,
+ DstBufferSize, sendparms->Filters[chan]);
src->WetMix(sendparms, SrcData, OutPos, DstBufferSize);
}
}