From: Holger Schemel Date: Sat, 27 Apr 2002 00:55:02 +0000 (+0200) Subject: rnd-20020427-2-src X-Git-Tag: 2.1.0^2~49 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=caed1f8c1a80db15b94da8a59bba3e95f7bd06db;p=rocksndiamonds.git rnd-20020427-2-src --- diff --git a/src/libgame/sound.c b/src/libgame/sound.c index 75634f14..144dd1ad 100644 --- a/src/libgame/sound.c +++ b/src/libgame/sound.c @@ -401,11 +401,9 @@ void SoundServer(void) sample_size = max_sample_size; } -#if 0 /* expand sample from 8 to 16 bit */ for(j=0; j> PSND_MAX_VOLUME_BITS; /* fill the last mixing buffer with stereo or mono sound */ if (stereo) { - int middle_pos = PSND_MAX_LEFT2RIGHT/2; + int middle_pos = PSND_MAX_LEFT2RIGHT / 2; int left_volume = stereo_volume[middle_pos + playlist[i].stereo]; int right_volume= stereo_volume[middle_pos - playlist[i].stereo]; for(j=0; j> PSND_MAX_LEFT2RIGHT_BITS; premix_right_buffer[j] = - (right_volume * (int)premix_first_buffer[j]) + (right_volume * premix_second_buffer[j]) >> PSND_MAX_LEFT2RIGHT_BITS; premix_last_buffer[2 * j + 0] += premix_left_buffer[j]; @@ -442,7 +440,7 @@ void SoundServer(void) else { for(j=0; j 255) - playing_buffer[i] = 255; - else - playing_buffer[i] = (premix_last_buffer[i] >> 1) ^ 0x80; - } -#else for(i=0; i 255) - playing_buffer[i] = 127; + if (premix_last_buffer[i] < -65535) + playing_buffer[i] = -32767; + else if (premix_last_buffer[i] > 65535) + playing_buffer[i] = 32767; else - playing_buffer[i] = (premix_last_buffer[i] >> 1); - - playing_buffer[i] <<= 8; + playing_buffer[i] = (short)(premix_last_buffer[i] >> 1); } -#endif /* finally play the sound fragment */ write(audio.device_fd, playing_buffer, fragment_size); diff --git a/src/libgame/sound.h b/src/libgame/sound.h index ebca45f5..cb606b0b 100644 --- a/src/libgame/sound.h +++ b/src/libgame/sound.h @@ -92,7 +92,7 @@ #if !defined(PLATFORM_MSDOS) #define PSND_SILENCE 0 -#define PSND_MAX_VOLUME_BITS 7 +#define PSND_MAX_VOLUME_BITS 15 #define PSND_MIN_VOLUME 0 #define PSND_MAX_VOLUME (1 << PSND_MAX_VOLUME_BITS) #define PSND_MIDDLE 0