Module name:    twilight
Repository:     twilight/nq/
Changes by:     knghtbrd        04 Nov 2001 14:37:43 UTC

Log message:
  The sound-won't-die-on-crash bug has been worked around.  SDL's sound is
  usually a seperate thread.  This means that when you want to muck around
  with the sound buffers, you need to lock things to prevent concurrency
  issues.  (Think waiting for retrace in graphics so you don't get tearing.)
  When I did SDL sound for Project Twilight, I looked at QF's stuff and saw
  they basically locked audio immediately.  I asked some people about this
  and was told that was necessary and got incoherent mumbling about threads
  for a reason.  It most certainly is not required, it's even a bad idea.
  
  The way things were happening, the sound was always locked until just
  after S_PaintChannels, in SNDDMA_Submit which unlocked and relocked the
  audio, perhaps giving the sound callback a chance to run if it needed to,
  but perhaps not.  (This would explain MacOS X sound problems, I'm amazed
  it works at all actually!)  The trick is to leave them unlocked until you
  hit S_Update and lock it then, unlocking it afterward.  Would probably
  also work if you lock only in S_PaintChannels.
  
  Except that the audio callback basically calls S_PaintChannels again in
  the audio callback.  If you lock audio in the audio thread, BAD THINGS
  will happen, okay?  Until tonight I really didn't understand the callback,
  I just used the one from QuakeForge as noted elsewhere.  The callback will
  try to fill the SDL buffer completely this way, except that it doesn't
  actually work out that way.  Solution?  Remove S_PaintChannels from the
  callback.  You lose the benefit of the thread this way, but we never had
  that benefit anyway.  You also are still using more memory than you need
  to, but ridding ourselves of the shm structure would involve a rewrite of
  the entire sound subsystem and isn't likely anytime soon.

Modified files:
      ./:
        TODO 
      twilight/include/:
        sound.h 
      twilight/qw/:
        snd_dma.c snd_sdl.c 
      twilight/nq/:
        snd_dma.c snd_sdl.c 
  
  Revision      Changes    Path
  1.45          +3 -8      twilight/TODO
  1.2           +1 -2      twilight/include/sound.h
  1.22          +5 -3      twilight/qw/snd_dma.c
  1.4           +2 -17     twilight/qw/snd_sdl.c
  1.20          +5 -3      twilight/nq/snd_dma.c
  1.4           +2 -17     twilight/nq/snd_sdl.c


_______________________________________________
twilight-commits mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/twilight-commits

Reply via email to