summaryrefslogtreecommitdiffstats
path: root/Alc/mixer.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2012-09-11 05:24:19 -0700
committerChris Robinson <[email protected]>2012-09-11 05:56:19 -0700
commit98ff6f990af1ad3159c5d9a2209b7b6de36d2130 (patch)
tree05a1c609d19ed26961057b6228696ad34c2cec4e /Alc/mixer.c
parentaaa81e00b75d0df6b83be5d3f6e54227110145ae (diff)
Do the filtering separately from the mixing
Diffstat (limited to 'Alc/mixer.c')
-rw-r--r--Alc/mixer.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/Alc/mixer.c b/Alc/mixer.c
index a7882c23..41eba4ae 100644
--- a/Alc/mixer.c
+++ b/Alc/mixer.c
@@ -191,6 +191,16 @@ static void Resample(enum Resampler Resampler, const ALfloat *data, ALuint frac,
}
+static void Filter2P(FILTER *filter, ALuint chan, ALfloat *RESTRICT dst,
+ const ALfloat *RESTRICT src, ALuint numsamples)
+{
+ ALuint i;
+ for(i = 0;i < numsamples;i++)
+ dst[i] = lpFilter2P(filter, chan, src[i]);
+ dst[i] = lpFilter2PC(filter, chan, src[i]);
+}
+
+
ALvoid MixSource(ALsource *Source, ALCdevice *Device, ALuint SamplesToDo)
{
ALbufferlistitem *BufferListItem;
@@ -432,20 +442,29 @@ ALvoid MixSource(ALsource *Source, ALCdevice *Device, ALuint SamplesToDo)
SrcData += BufferPrePadding*NumChannels;
for(i = 0;i < NumChannels;i++)
{
+ DirectParams *directparms = &Source->Params.Direct;
+ ALIGN(16) ALfloat FilteredData[BUFFERSIZE];
ALfloat ResampledData[BUFFERSIZE];
Resample(Resampler, SrcData+i, DataPosFrac, increment,
NumChannels, ResampledData, BufferSize);
- Source->Params.DryMix(Source, Device, &Source->Params.Direct,
- ResampledData, i, OutPos, SamplesToDo,
+ Filter2P(&directparms->iirFilter, i, FilteredData, ResampledData,
+ BufferSize);
+ Source->Params.DryMix(Source, Device, directparms,
+ FilteredData, i, OutPos, SamplesToDo,
BufferSize);
+
for(j = 0;j < Device->NumAuxSends;j++)
{
- if(!Source->Params.Send[j].Slot)
+ SendParams *sendparms = &Source->Params.Send[j];
+ if(!sendparms->Slot)
continue;
- Source->Params.WetMix(&Source->Params.Send[j], ResampledData, i,
- OutPos, SamplesToDo, BufferSize);
+
+ Filter2P(&sendparms->iirFilter, i, FilteredData, ResampledData,
+ BufferSize);
+ Source->Params.WetMix(sendparms, FilteredData, OutPos,
+ SamplesToDo, BufferSize);
}
}
for(i = 0;i < BufferSize;i++)