Added other SDL_(Un)LockAudio statements to protect the audio_mixcallback function - making that hopefully stable on multicores; Resetting warn_func at quit_request so we do not accidently show any menu; Open gamelog.txt unbuffered

This commit is contained in:
zicodxx 2008-11-15 20:49:54 +00:00
parent aee0198f2e
commit be02298290
5 changed files with 11 additions and 1 deletions

View file

@ -1,5 +1,9 @@
D1X-Rebirth Changelog
20081115
--------
arch/sdl/digi_audio.c: include/error.h, main/console.c, main/inferno.c: Added other SDL_(Un)LockAudio statements to protect the audio_mixcallback function - making that hopefully stable on multicores; Resetting warn_func at quit_request so we do not accidently show any menu; Open gamelog.txt unbuffered
20081114
--------
include/args.h, include/3d.h, include/rle.h, include/rbaudio.h, main/text.c, main/text.h, main/bm.c, main/gamefont.c, main/inferno.c, main/bm.c, main/bmread.c, main/piggy.c, main/render.c, main/render.h, main/songs.c, main/gameseq.c, main/gamerend.c, main/netdrv.c, main/endlevel.c, main/endlevel.h, main/terrain.c, main/terrain.h, main/polyobj.c, main/polyobj.h, main/game.c, main/gauges.c, main/texmerge.c, main/mission.c, main/mission.h, misc/args.c, 2d/rle.c, 3d/setup.c, SConstruct, D1X.make, arch/linux/alsadigi.c, arch/ogl/gr.c, arch/sdl/digi_mixer.c, arch/sdl/joy.c, arch/sdl/init.c, arch/sdl/rbaudio.c, arch/sdl/gr.c, arch/sdl/key.c, arch/sdl/digi_audio.c, arch/include/mouse.h: Using a clean flow for closing game data at the end of main() instead of using atexit; Now only use atexit for SDL stuff, error, mem, console (and editor which we do later); Small Cleanup

View file

@ -151,6 +151,8 @@ static void audio_mixcallback(void *userdata, Uint8 *stream, int len)
memset(stream, 0x80, len); // fix "static" sound bug on Mac OS X
SDL_LockAudio();
for (sl = SoundSlots; sl < SoundSlots + MAX_SOUND_SLOTS; sl++) {
if (sl->playing) {
Uint8 *sldata = sl->samples + sl->position, *slend = sl->samples + sl->length;
@ -185,6 +187,8 @@ static void audio_mixcallback(void *userdata, Uint8 *stream, int len)
sl->position = sldata - sl->samples;
}
}
SDL_UnlockAudio();
}
//end changes by adb

View file

@ -30,6 +30,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#define __format
#endif
void warn_printf(char *s);
int error_init(void (*func)(char *), char *fmt,...); //init error system, set default message, returns 0=ok
void set_exit_message(char *fmt,...); //specify message to print at exit
void Warning(char *fmt,...); //print out warning message to user

View file

@ -212,7 +212,7 @@ void con_init(void)
{
memset(con_buffer,0,sizeof(con_buffer));
gamelog_fp = PHYSFSX_openWriteBuffered("gamelog.txt");
gamelog_fp = PHYSFS_openWrite("gamelog.txt");
atexit(con_close);
}

View file

@ -436,5 +436,6 @@ int main(int argc,char *argv[])
void quit_request()
{
set_warn_func(warn_printf);
exit(0);
}