audio: Set (something close to) the correct silence value for U16 audio.
authorRyan C. Gordon <icculus@icculus.org>
Wed, 25 Sep 2019 15:40:27 -0400
changeset 13093599ed6e984d2
parent 13092 307068253f19
child 13094 3def438a1540
audio: Set (something close to) the correct silence value for U16 audio.

Partially fixes Bugzilla #4805.
src/audio/SDL_audio.c
     1.1 --- a/src/audio/SDL_audio.c	Wed Sep 25 15:07:07 2019 -0400
     1.2 +++ b/src/audio/SDL_audio.c	Wed Sep 25 15:40:27 2019 -0400
     1.3 @@ -1669,8 +1669,15 @@
     1.4  {
     1.5      switch (spec->format) {
     1.6      case AUDIO_U8:
     1.7 +
     1.8 +    // !!! FIXME: 0x80 isn't perfect for U16, but we can't fit 0x8000 in a
     1.9 +    // !!! FIXME:  byte for memset() use. This is actually 0.1953 percent off
    1.10 +    //  from silence. Maybe just don't use U16.
    1.11 +    case AUDIO_U16LSB:
    1.12 +    case AUDIO_U16MSB:
    1.13          spec->silence = 0x80;
    1.14          break;
    1.15 +
    1.16      default:
    1.17          spec->silence = 0x00;
    1.18          break;