From: Holger Schemel Date: Sat, 27 Apr 2002 15:20:15 +0000 (+0200) Subject: rnd-20020427-4-src X-Git-Tag: 2.1.0^2~47 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=b3affbb697be5cd5cfe64b757fa018ec4441d76c;p=rocksndiamonds.git rnd-20020427-4-src --- 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 */