summaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2012-09-24 15:33:44 -0700
committerChris Robinson <[email protected]>2012-09-24 15:33:44 -0700
commit2ceea21f763f4d5639dea202900603ad49a2d6e4 (patch)
tree8d2b8a2f19f6b9cea3a7e88b04126e01015854f4 /Alc
parent12327da4fefe5aafb9d28d8db232ebd8f6ac93c3 (diff)
Avoid mixing silence to output
"Silence" being less than -100dB.
Diffstat (limited to 'Alc')
-rw-r--r--Alc/mixer_c.c4
-rw-r--r--Alc/mixer_sse.c12
2 files changed, 15 insertions, 1 deletions
diff --git a/Alc/mixer_c.c b/Alc/mixer_c.c
index cab3f8af..44ef5ded 100644
--- a/Alc/mixer_c.c
+++ b/Alc/mixer_c.c
@@ -100,9 +100,13 @@ void MixDirect_C(ALsource *Source, ALCdevice *Device, DirectParams *params,
}
for(c = 0;c < MaxChannels;c++)
{
+ if(DrySend[c] < 0.00001f)
+ continue;
+
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++)
diff --git a/Alc/mixer_sse.c b/Alc/mixer_sse.c
index d366ca8a..d2ea7439 100644
--- a/Alc/mixer_sse.c
+++ b/Alc/mixer_sse.c
@@ -156,7 +156,12 @@ void MixDirect_SSE(ALsource *Source, ALCdevice *Device, DirectParams *params,
}
for(c = 0;c < MaxChannels;c++)
{
- const __m128 gain = _mm_set1_ps(DrySend[c]);
+ __m128 gain;
+
+ if(DrySend[c] < 0.00001f)
+ continue;
+
+ gain = _mm_set1_ps(DrySend[c]);
for(pos = 0;pos < BufferSize-3;pos += 4)
{
const __m128 val4 = _mm_load_ps(&data[pos]);
@@ -165,15 +170,20 @@ void MixDirect_SSE(ALsource *Source, ALCdevice *Device, DirectParams *params,
_mm_store_ps(&DryBuffer[c][OutPos+pos], dry4);
}
}
+ pos = BufferSize&~3;
if(pos < BufferSize)
{
ALuint oldpos = pos;
for(c = 0;c < MaxChannels;c++)
{
+ if(DrySend[c] < 0.00001f)
+ continue;
+
pos = oldpos;
for(;pos < BufferSize;pos++)
DryBuffer[c][OutPos+pos] += data[pos]*DrySend[c];
}
+ pos = BufferSize;
}
if(OutPos+pos == SamplesToDo)
{