From aef1ed4ac66fa11a551389153089c414947033d5 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 25 Sep 2019 15:40:27 -0400 Subject: [PATCH] audio: Set (something close to) the correct silence value for U16 audio. Partially fixes Bugzilla #4805. --- src/audio/SDL_audio.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c index 768db02c9..8296b56ec 100644 --- a/src/audio/SDL_audio.c +++ b/src/audio/SDL_audio.c @@ -1669,8 +1669,15 @@ SDL_CalculateAudioSpec(SDL_AudioSpec * spec) { switch (spec->format) { case AUDIO_U8: + + // !!! FIXME: 0x80 isn't perfect for U16, but we can't fit 0x8000 in a + // !!! FIXME: byte for memset() use. This is actually 0.1953 percent off + // from silence. Maybe just don't use U16. + case AUDIO_U16LSB: + case AUDIO_U16MSB: spec->silence = 0x80; break; + default: spec->silence = 0x00; break;