On Fri, Dec 22, 2006 at 05:18:32PM +0000, Jon Dowland wrote: > This certainly looked like a library issue to me,
I'm currently still convinced it is. > but apparently there's a fix for this in the latest prboom > upstream. I'm backporting the fix to the current prboom > version. No luck there: latest prboom is still broken for me. I think that this is not hardware related after all. Here are steps to reproduce the bug on any machine (I think): * ensure /etc/timidity/timidity.cfg does not exist (move it to /root or something) or sdl-mixer will always use it in preference * ensure that snd_seq_oss is loaded: this modules results in /dev/sequencer being created * now ensure snd_seq_dummy is loaded. My desktop loads this automatically on boot, my laptop doesn't. * best make sure no real snd_seq_* drivers are loaded (if you have hardware) * run prboom The current state of prboom should have this lock up when you fire the pistol, or when the first in-game sound effect happens... the attached patch pushes this lockup into the quit stages (by stopping the {Un,}LockAudio calls when sdl-mixer is linked in). I also get lock-ups at quit with chocolate-doom.org, which is why I think this might be a library issue. Digging a bit deeper, # modprobe snd_seq_oss # dd if=/dev/sequencer of=/dev/null count=1 dd: opening `/dev/sequencer': No such device # ls /dev/sequencer /dev/sequencer # modprobe snd_seq_dummy # dd if=/dev/sequencer of=/dev/null count=1 dd: reading `/dev/sequencer': Resource temporarily unavailable ... -- Jon Dowland
--- prboom-2.4.6/src/SDL/i_sound.c 2006-10-14 18:22:52.000000000 +0100 +++ prboom-2.4.6~/src/SDL/i_sound.c 2006-12-25 22:24:53.000000000 +0000 @@ -150,7 +150,7 @@ size_t len = 0; const unsigned char* data; - I_StopSound(channel); + stopchan(channel); // We will handle the new SFX. // Set pointer to raw data. @@ -165,7 +165,6 @@ // do the lump caching outside the SDL_LockAudio/SDL_UnlockAudio pair data = W_CacheLumpNum(lump); - SDL_LockAudio(); channelinfo[channel].data = data; /* Set pointer to end of raw data. */ channelinfo[channel].enddata = channelinfo[channel].data + len - 1; @@ -179,7 +178,6 @@ // Preserve sound SFX id, // e.g. for avoiding duplicates of chainsaw. channelinfo[channel].id = sfxid; - SDL_UnlockAudio(); return channel; } @@ -231,9 +229,13 @@ void I_UpdateSoundParams(int handle, int volume, int seperation, int pitch) { +#ifndef HAVE_MIXER SDL_LockAudio(); updateSoundParams(handle, volume, seperation, pitch); SDL_UnlockAudio(); +#else + updateSoundParams(handle, volume, seperation, pitch); +#endif } // @@ -308,12 +310,19 @@ int handle; // Returns a handle (not used). +#ifndef HAVE_MIXER + SDL_LockAudio(); +#endif handle = addsfx(id, channel); #ifdef RANGECHECK if ((handle < 0) || (handle >= MAX_CHANNELS)) I_Error("I_StartSound: handle out of range"); #endif - I_UpdateSoundParams(handle, vol, sep, pitch); + if ((handle >= 0) && (handle < MAX_CHANNELS)) + updateSoundParams(handle, vol, sep, pitch); +#ifndef HAVE_MIXER + SDL_UnlockAudio(); +#endif return handle; } @@ -326,9 +335,13 @@ if ((handle < 0) || (handle >= MAX_CHANNELS)) I_Error("I_StopSound: handle out of range"); #endif +#ifndef HAVE_MIXER SDL_LockAudio(); stopchan(handle); SDL_UnlockAudio(); +#else + stopchan(handle); +#endif } @@ -515,7 +528,7 @@ SAMPLECOUNT = audio_buffers; Mix_SetPostMix(I_UpdateSound, NULL); lprintf(LO_INFO," configured audio device with %d samples/slice\n", SAMPLECOUNT); -#else +#else /* we don't HAVE_MIXER */ SDL_AudioSpec audio; // Secure and configure sound device first. @@ -537,7 +550,7 @@ } SAMPLECOUNT = audio.samples; lprintf(LO_INFO," configured audio device with %d samples/slice\n", SAMPLECOUNT); -#endif +#endif /* we don't HAVE_MIXER */ if (first_sound_init) { atexit(I_ShutdownSound); @@ -611,7 +624,11 @@ { #ifdef HAVE_MIXER if ( music[handle] ) { - Mix_FadeInMusic(music[handle], looping ? -1 : 0, 500); + int ret; + ret = Mix_FadeInMusic(music[handle], looping ? -1 : 0, 500); + if(ret) { + fprintf(stderr,"warning: Mix_FadeInMusic returned %d\n",ret); + } } #endif }
signature.asc
Description: Digital signature