From efb5c5eecd3b2fd1744f8ce965653fed3a76cf01 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 25 Nov 2014 02:08:48 -0800 Subject: Use linear gain stepping --- Alc/mixer_sse.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'Alc/mixer_sse.c') diff --git a/Alc/mixer_sse.c b/Alc/mixer_sse.c index 75f50f88..4dfc748d 100644 --- a/Alc/mixer_sse.c +++ b/Alc/mixer_sse.c @@ -167,23 +167,23 @@ void Mix_SSE(const ALfloat *data, ALuint OutChans, ALfloat (*restrict OutBuffer) ALuint pos = 0; gain = Gains[c].Current; step = Gains[c].Step; - if(step != 1.0f && Counter > 0) + if(step != 0.0f && Counter > 0) { /* Mix with applying gain steps in aligned multiples of 4. */ if(BufferSize-pos > 3 && Counter-pos > 3) { gain4 = _mm_setr_ps( gain, - gain * step, - gain * step * step, - gain * step * step * step + gain + step, + gain + step + step, + gain + step + step + step ); - step4 = _mm_set1_ps(step * step * step * step); + step4 = _mm_set1_ps(step + step + step + step); do { const __m128 val4 = _mm_load_ps(&data[pos]); __m128 dry4 = _mm_load_ps(&OutBuffer[c][OutPos+pos]); dry4 = _mm_add_ps(dry4, _mm_mul_ps(val4, gain4)); - gain4 = _mm_mul_ps(gain4, step4); + gain4 = _mm_add_ps(gain4, step4); _mm_store_ps(&OutBuffer[c][OutPos+pos], dry4); pos += 4; } while(BufferSize-pos > 3 && Counter-pos > 3); @@ -193,7 +193,7 @@ void Mix_SSE(const ALfloat *data, ALuint OutChans, ALfloat (*restrict OutBuffer) for(;pos < BufferSize && pos < Counter;pos++) { OutBuffer[c][OutPos+pos] += data[pos]*gain; - gain *= step; + gain += step; } if(pos == Counter) gain = Gains[c].Target; -- cgit v1.2.3