Skip to content

Commit af044d9

Browse files
author
falkTX
committed
Silence buffer before processing, fixes noise while rendering wav
1 parent 835f963 commit af044d9

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

release/distrib/replay/lib/sounddriver/sounddriver_linux.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ static int jaudio_process_callback(jack_nframes_t nframes, void*)
6666
float* audioBuf1 = (float*)jack_port_get_buffer(jaudio_port1, nframes);
6767
float* audioBuf2 = (float*)jack_port_get_buffer(jaudio_port2, nframes);
6868

69+
memset(audioBuf1, 0, sizeof(float)*nframes);
70+
memset(audioBuf2, 0, sizeof(float)*nframes);
71+
6972
AUDIO_Acknowledge = FALSE;
7073

7174
if (AUDIO_Play_Flag && (AUDIO_MixerFloat || AUDIO_Mixer))
@@ -75,7 +78,7 @@ static int jaudio_process_callback(jack_nframes_t nframes, void*)
7578
AUDIO_MixerFloat(audioBuf1, audioBuf2, nframes);
7679
}
7780
else
78-
{
81+
{
7982
Uint8 mixerBuf[nframes*2];
8083
AUDIO_Mixer(mixerBuf, nframes*2);
8184

@@ -88,8 +91,8 @@ static int jaudio_process_callback(jack_nframes_t nframes, void*)
8891
}
8992
else
9093
{
91-
for (jack_nframes_t i=0; i < nframes; ++i)
92-
*audioBuf1++ = *audioBuf2++ = 0.0f;
94+
//for (jack_nframes_t i=0; i < nframes; ++i)
95+
// *audioBuf1++ = *audioBuf2++ = 0.0f;
9396

9497
AUDIO_Acknowledge = TRUE;
9598
}

0 commit comments

Comments
 (0)