From f5b970b755f8193fba149a05ec55f4b60c50bdba Mon Sep 17 00:00:00 2001 From: Bradley Bell Date: Fri, 12 Oct 2001 06:36:55 +0000 Subject: [PATCH] Fix a gcc 3.0 warning, couple updates from d1x --- sound/sdl_digi.c | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/sound/sdl_digi.c b/sound/sdl_digi.c index 08162b83..684a6cfe 100644 --- a/sound/sdl_digi.c +++ b/sound/sdl_digi.c @@ -1,12 +1,15 @@ /* * $Source: /cvs/cvsroot/d2x/sound/sdl_digi.c,v $ - * $Revision: 1.2 $ + * $Revision: 1.3 $ * $Author: bradleyb $ - * $Date: 2001-01-29 13:53:28 $ + * $Date: 2001-10-12 06:36:55 $ * * SDL digital audio support * * $Log: not supported by cvs2svn $ + * Revision 1.2 2001/01/29 13:53:28 bradleyb + * Fixed build, minor fixes + * */ #ifdef HAVE_CONFIG_H @@ -200,7 +203,7 @@ static void audio_mixcallback(void *userdata, Uint8 *stream, int len) if (sl->playing) { Uint8 *sldata = sl->samples + sl->position, *slend = sl->samples + sl->length; - Uint8 *sp = stream; + Uint8 *sp = stream, s; signed char v; fix vl, vr; int x; @@ -229,8 +232,10 @@ static void audio_mixcallback(void *userdata, Uint8 *stream, int len) sldata = sl->samples; } v = *(sldata++) - 0x80; - *(sp++) = mix8[ *sp + fixmul(v, vl) + 0x80 ]; - *(sp++) = mix8[ *sp + fixmul(v, vr) + 0x80 ]; + s = *sp; + *(sp++) = mix8[ s + fixmul(v, vl) + 0x80 ]; + s = *sp; + *(sp++) = mix8[ s + fixmul(v, vr) + 0x80 ]; } sl->position = sldata - sl->samples; } @@ -241,11 +246,8 @@ static void audio_mixcallback(void *userdata, Uint8 *stream, int len) /* Initialise audio devices. */ int digi_init() { - - if (SDL_Init(SDL_INIT_AUDIO) < 0) - { - Warning("SDL library audio initialisation failed: %s.",SDL_GetError()); - return 1; + if (SDL_InitSubSystem(SDL_INIT_AUDIO)<0){ + Error("SDL audio initialisation failed: %s.",SDL_GetError()); } //added on 980905 by adb to init sound kill system memset(SampleHandles, 255, sizeof(SampleHandles)); @@ -804,7 +806,18 @@ int digi_is_sound_playing(int soundno) void digi_pause_all() { } void digi_resume_all() { } -void digi_stop_all() { } +void digi_stop_all() { + int i; + // ... Ano. The lack of this was causing ambient sounds to crash. + // fixed, added digi_stop_all 07/19/01 - bluecow + + for (i=0; i