Skip to content

Commit

Permalink
audio: Set (something close to) the correct silence value for U16 audio.
Browse files Browse the repository at this point in the history
Partially fixes Bugzilla #4805.
  • Loading branch information
icculus committed Sep 25, 2019
1 parent 693755f commit aef1ed4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/audio/SDL_audio.c
Expand Up @@ -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;
Expand Down

0 comments on commit aef1ed4

Please sign in to comment.