diff options
author | Chris Robinson <[email protected]> | 2012-09-24 19:07:07 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2012-09-24 19:07:07 -0700 |
commit | d4e82d441ea0f4e093a98719b3275338b250cf26 (patch) | |
tree | 3a1e552892d936bdbe20b9145fe242ac65c09da8 /Alc/mixer_c.c | |
parent | 2ceea21f763f4d5639dea202900603ad49a2d6e4 (diff) |
Combine multiple loops into one
Diffstat (limited to 'Alc/mixer_c.c')
-rw-r--r-- | Alc/mixer_c.c | 40 |
1 files changed, 11 insertions, 29 deletions
diff --git a/Alc/mixer_c.c b/Alc/mixer_c.c index 44ef5ded..efa51b75 100644 --- a/Alc/mixer_c.c +++ b/Alc/mixer_c.c @@ -84,33 +84,23 @@ void MixDirect_C(ALsource *Source, ALCdevice *Device, DirectParams *params, ALfloat (*RESTRICT DryBuffer)[BUFFERSIZE] = Device->DryBuffer; ALfloat *RESTRICT ClickRemoval = Device->ClickRemoval; ALfloat *RESTRICT PendingClicks = Device->PendingClicks; - ALfloat DrySend[MaxChannels]; + ALfloat DrySend; ALuint pos; ALuint c; (void)Source; for(c = 0;c < MaxChannels;c++) - DrySend[c] = params->Gains[srcchan][c]; - - pos = 0; - if(OutPos == 0) - { - for(c = 0;c < MaxChannels;c++) - ClickRemoval[c] -= data[pos]*DrySend[c]; - } - for(c = 0;c < MaxChannels;c++) { - if(DrySend[c] < 0.00001f) + DrySend = params->Gains[srcchan][c]; + if(DrySend < 0.00001f) continue; + if(OutPos == 0) + ClickRemoval[c] -= data[0]*DrySend; for(pos = 0;pos < BufferSize;pos++) - DryBuffer[c][OutPos+pos] += data[pos]*DrySend[c]; - } - pos = BufferSize; - if(OutPos+pos == SamplesToDo) - { - for(c = 0;c < MaxChannels;c++) - PendingClicks[c] += data[pos]*DrySend[c]; + DryBuffer[c][OutPos+pos] += data[pos]*DrySend; + if(OutPos+pos == SamplesToDo) + PendingClicks[c] += data[pos]*DrySend; } } @@ -125,18 +115,10 @@ void MixSend_C(SendParams *params, const ALfloat *RESTRICT data, ALfloat WetSend = params->Gain; ALuint pos; - pos = 0; if(OutPos == 0) - { - WetClickRemoval[0] -= data[pos] * WetSend; - } + WetClickRemoval[0] -= data[0] * WetSend; for(pos = 0;pos < BufferSize;pos++) - { - WetBuffer[0][OutPos] += data[pos] * WetSend; - OutPos++; - } - if(OutPos == SamplesToDo) - { + WetBuffer[0][OutPos+pos] += data[pos] * WetSend; + if(OutPos+pos == SamplesToDo) WetPendingClicks[0] += data[pos] * WetSend; - } } |