From b3affbb697be5cd5cfe64b757fa018ec4441d76c Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sat, 27 Apr 2002 17:20:15 +0200 Subject: [PATCH] rnd-20020427-4-src --- src/libgame/sound.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/libgame/sound.c b/src/libgame/sound.c index 1a31557a..30416a90 100644 --- a/src/libgame/sound.c +++ b/src/libgame/sound.c @@ -40,14 +40,14 @@ static struct SoundControl emptySoundControl = }; #if defined(PLATFORM_UNIX) -static int stereo_volume[PSND_MAX_LEFT2RIGHT+1]; +static int stereo_volume[PSND_MAX_LEFT2RIGHT + 1]; static short premix_first_buffer[SND_BLOCKSIZE]; #if defined(AUDIO_STREAMING_DSP) static short premix_left_buffer[SND_BLOCKSIZE]; static short premix_right_buffer[SND_BLOCKSIZE]; static long premix_last_buffer[SND_BLOCKSIZE]; #endif -static short playing_buffer[SND_BLOCKSIZE]; +static byte playing_buffer[SND_BLOCKSIZE]; #endif /* forward declaration of internal functions */ @@ -453,12 +453,19 @@ void SoundServer(void) /* put last mixing buffer to final playing buffer */ for(i=0; i 65535) - playing_buffer[i] = 32767; - else - playing_buffer[i] = (short)(premix_last_buffer[i] >> 1); + premix_last_buffer[i] = 65535; + + /* shift to 16 bit value */ + premix_last_buffer[i] >>= 1; + + /* fill playing buffer for "signed 16 bit little endian" audio + format (independently of endianess of "short" integer type) */ + playing_buffer[2 * i + 0] = premix_last_buffer[i] & 0xff; + playing_buffer[2 * i + 1] = premix_last_buffer[i] >> 8; } /* finally play the sound fragment */ -- 2.34.1