aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALu.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2011-07-30 05:43:47 -0700
committerChris Robinson <[email protected]>2011-07-30 05:43:47 -0700
commit81d401eab55792ece0c664db96f0390d9d0cbded (patch)
treebc9f36d421a3f5276b41921063719bb17362f9dc /Alc/ALu.c
parentf986f7dfad389efbef97dbed44bf0d99b18dddba (diff)
Use specialized click removal loops for mono and stereo output
Diffstat (limited to 'Alc/ALu.c')
-rw-r--r--Alc/ALu.c44
1 files changed, 37 insertions, 7 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index ecf2c687..1ba71129 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -1057,18 +1057,48 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
UnlockDevice(device);
//Post processing loop
- for(i = 0;i < SamplesToDo;i++)
+ if(device->FmtChans == DevFmtMono)
{
- for(c = 0;c < MAXCHANNELS;c++)
+ for(i = 0;i < SamplesToDo;i++)
{
- device->DryBuffer[i][c] += device->ClickRemoval[c];
- device->ClickRemoval[c] -= device->ClickRemoval[c] / 256.0f;
+ device->DryBuffer[i][FRONT_CENTER] += device->ClickRemoval[FRONT_CENTER];
+ device->ClickRemoval[FRONT_CENTER] -= device->ClickRemoval[FRONT_CENTER] / 256.0f;
}
+ device->ClickRemoval[FRONT_CENTER] += device->PendingClicks[FRONT_CENTER];
+ device->PendingClicks[FRONT_CENTER] = 0.0f;
}
- for(i = 0;i < MAXCHANNELS;i++)
+ else if(device->FmtChans == DevFmtStereo)
{
- device->ClickRemoval[i] += device->PendingClicks[i];
- device->PendingClicks[i] = 0.0f;
+ /* Assumes the first two channels are FRONT_LEFT and FRONT_RIGHT */
+ for(i = 0;i < SamplesToDo;i++)
+ {
+ for(c = 0;c < 2;c++)
+ {
+ device->DryBuffer[i][c] += device->ClickRemoval[c];
+ device->ClickRemoval[c] -= device->ClickRemoval[c] / 256.0f;
+ }
+ }
+ for(c = 0;c < 2;c++)
+ {
+ device->ClickRemoval[c] += device->PendingClicks[c];
+ device->PendingClicks[c] = 0.0f;
+ }
+ }
+ else
+ {
+ for(i = 0;i < SamplesToDo;i++)
+ {
+ for(c = 0;c < MAXCHANNELS;c++)
+ {
+ device->DryBuffer[i][c] += device->ClickRemoval[c];
+ device->ClickRemoval[c] -= device->ClickRemoval[c] / 256.0f;
+ }
+ }
+ for(c = 0;c < MAXCHANNELS;c++)
+ {
+ device->ClickRemoval[c] += device->PendingClicks[c];
+ device->PendingClicks[c] = 0.0f;
+ }
}
switch(device->FmtType)