diff options
author | Chris Robinson <[email protected]> | 2011-07-30 05:43:47 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2011-07-30 05:43:47 -0700 |
commit | 81d401eab55792ece0c664db96f0390d9d0cbded (patch) | |
tree | bc9f36d421a3f5276b41921063719bb17362f9dc | |
parent | f986f7dfad389efbef97dbed44bf0d99b18dddba (diff) |
Use specialized click removal loops for mono and stereo output
-rw-r--r-- | Alc/ALu.c | 44 |
1 files changed, 37 insertions, 7 deletions
@@ -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) |