From: Holger Schemel Date: Wed, 3 Feb 1999 00:26:14 +0000 (+0100) Subject: rnd-19990203-1 X-Git-Tag: 1.3.0^2~4 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=6c76f4a6d82bd6d75b16a3072f61e79865117d8b;p=rocksndiamonds.git rnd-19990203-1 --- diff --git a/src/Makefile b/src/Makefile index 37352916..4c0a427b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -69,9 +69,9 @@ CONFIG = $(CONFIG_GAME_DIR) $(SOUNDS) $(JOYSTICK) \ $(CONFIG_SCORE_ENTRIES) $(XPM_INCLUDE_FILE) # DEBUG = -DDEBUG -g -Wall -ansi -pedantic -# DEBUG = -DDEBUG -g -Wall +DEBUG = -DDEBUG -g -Wall # DEBUG = -O3 -Wall -ansi -pedantic -DEBUG = -O3 -Wall +# DEBUG = -O3 -Wall # DEBUG = -O3 # SYSTEM = -Aa -D_HPUX_SOURCE -Dhpux # for HP-UX (obsolete) diff --git a/src/game.c b/src/game.c index 52255c85..f51b2dc4 100644 --- a/src/game.c +++ b/src/game.c @@ -617,6 +617,7 @@ void InitGame() game_gadget[SOUND_CTRL_ID_LOOPS]->checked = setup.sound_loops; game_gadget[SOUND_CTRL_ID_SIMPLE]->checked = setup.sound_simple; MapGameButtons(); + MapTapeButtons(); #endif XCopyArea(display, drawto, pix[PIX_DB_DOOR], gc, diff --git a/src/screens.c b/src/screens.c index 0e395449..a27dcba8 100644 --- a/src/screens.c +++ b/src/screens.c @@ -58,6 +58,8 @@ void DrawMainMenu() int i; char *name_text = (!options.network && setup.team_mode ? "Team:" : "Name:"); + UnmapAllGadgets(); + FadeSounds(); XAutoRepeatOn(display); /* needed if last screen was the playing screen, invoked from level editor */ @@ -68,11 +70,9 @@ void DrawMainMenu() return; } - /* unmap gadgets from last screen, map gadgets for main menu screen */ - UnmapAllGadgets(); + /* map gadgets for main menu screen */ MapTapeButtons(); - FadeSounds(); GetPlayerConfig(); LoadLevel(level_nr); diff --git a/src/sound.c b/src/sound.c index c9e13525..51a75c88 100644 --- a/src/sound.c +++ b/src/sound.c @@ -134,7 +134,10 @@ void SoundServer() long sample_size; static long max_sample_size = 0; static long fragment_size = 0; - boolean stereo; + /* Even if the stereo flag is used as being boolean, it must be + defined as an integer, else 'ioctl()' will fail! */ + int stereo = TRUE; + int sample_rate = 8000; if (playing_sounds || (sound_device=open(sound_device_name,O_WRONLY))>=0) { @@ -143,12 +146,35 @@ void SoundServer() /* 2 buffers / 512 bytes, giving 1/16 second resolution */ /* (with stereo the effective buffer size will shrink to 256) */ fragment_size = 0x00020009; - ioctl(sound_device, SNDCTL_DSP_SETFRAGMENT, &fragment_size); + + if (ioctl(sound_device, SNDCTL_DSP_SETFRAGMENT, &fragment_size) < 0) + Error(ERR_EXIT_SOUND_SERVER, + "cannot set fragment size of /dev/dsp - no sounds"); + /* try if we can use stereo sound */ - stereo = TRUE; - ioctl(sound_device, SNDCTL_DSP_STEREO, &stereo); + if (ioctl(sound_device, SNDCTL_DSP_STEREO, &stereo) < 0) + { +#ifdef DEBUG + static boolean reported = FALSE; + + if (!reported) + { + Error(ERR_RETURN, "cannot get stereo sound on /dev/dsp"); + reported = TRUE; + } +#endif + stereo = FALSE; + } + + if (ioctl(sound_device, SNDCTL_DSP_SPEED, &sample_rate) < 0) + Error(ERR_EXIT_SOUND_SERVER, + "cannot set sample rate of /dev/dsp - no sounds"); + /* get the real fragmentation size; this should return 512 */ - ioctl(sound_device, SNDCTL_DSP_GETBLKSIZE, &fragment_size); + if (ioctl(sound_device, SNDCTL_DSP_GETBLKSIZE, &fragment_size) < 0) + Error(ERR_EXIT_SOUND_SERVER, + "cannot get fragment size of /dev/dsp - no sounds"); + max_sample_size = fragment_size / (stereo ? 2 : 1); } diff --git a/src/sound.h b/src/sound.h index ca97ff0a..0811e5a2 100644 --- a/src/sound.h +++ b/src/sound.h @@ -22,8 +22,14 @@ #ifndef VOXWARE #define VOXWARE #endif + +#if 0 /* where is the right declaration for 'ioctl'? */ extern void ioctl(long, long, void *); +#else +#include +#endif + #endif #ifdef __FreeBSD__