Fixed bug that may occaisionally cause sound to not shut down,

removed unnecessary synchronization.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2307 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2003-03-17 18:50:18 +00:00
parent d1d538376f
commit 632366d019
@@ -1,5 +1,5 @@
// //
// $Id: SoundManager.java,v 1.49 2003/03/17 05:28:26 ray Exp $ // $Id: SoundManager.java,v 1.50 2003/03/17 18:50:18 ray Exp $
package com.threerings.media.sound; package com.threerings.media.sound;
@@ -55,6 +55,7 @@ import com.threerings.media.MediaPrefs;
*/ */
// TODO: // TODO:
// - fade music out when stopped? // - fade music out when stopped?
// - be able to pause music
public class SoundManager public class SoundManager
implements MusicPlayer.MusicEventListener implements MusicPlayer.MusicEventListener
{ {
@@ -147,6 +148,7 @@ public class SoundManager
} else if (DIE == command) { } else if (DIE == command) {
LineSpooler.shutdown(); LineSpooler.shutdown();
shutdownMusic(); shutdownMusic();
_player = null;
} else { } else {
Log.warning("Got unknown command [cmd=" + command + Log.warning("Got unknown command [cmd=" + command +
@@ -171,9 +173,8 @@ public class SoundManager
/** /**
* Shut the damn thing off. * Shut the damn thing off.
*/ */
public synchronized void shutdown () public void shutdown ()
{ {
_player = null;
synchronized (_queue) { synchronized (_queue) {
_queue.clear(); _queue.clear();
_queue.append(DIE); // signal death _queue.append(DIE); // signal death
@@ -184,7 +185,7 @@ public class SoundManager
* Used by the sound playing thread to determine whether or not to * Used by the sound playing thread to determine whether or not to
* shut down. * shut down.
*/ */
protected synchronized boolean amRunning () protected boolean amRunning ()
{ {
return (_player == Thread.currentThread()); return (_player == Thread.currentThread());
} }