Pay our respects to Chapter 12 of the JLS.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1619 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: SoundManager.java,v 1.3 2002/07/26 00:16:47 ray Exp $
|
// $Id: SoundManager.java,v 1.4 2002/07/26 16:00:19 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.media;
|
package com.threerings.media;
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ public class SoundManager
|
|||||||
// create a thread to manage the sound queue
|
// create a thread to manage the sound queue
|
||||||
_player = new Thread() {
|
_player = new Thread() {
|
||||||
public void run () {
|
public void run () {
|
||||||
while (Thread.currentThread() == _player) {
|
while (amRunning()) {
|
||||||
// wait for a sound
|
// wait for a sound
|
||||||
_clips.waitForItem();
|
_clips.waitForItem();
|
||||||
|
|
||||||
@@ -69,12 +69,21 @@ public class SoundManager
|
|||||||
/**
|
/**
|
||||||
* Shut the damn thing off.
|
* Shut the damn thing off.
|
||||||
*/
|
*/
|
||||||
public void shutdown ()
|
public synchronized void shutdown ()
|
||||||
{
|
{
|
||||||
_player = null;
|
_player = null;
|
||||||
_clips.append(this); // signal death
|
_clips.append(this); // signal death
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used by the sound playing thread to determine whether or not to
|
||||||
|
* shut down.
|
||||||
|
*/
|
||||||
|
protected synchronized boolean amRunning ()
|
||||||
|
{
|
||||||
|
return (_player == Thread.currentThread());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Queues up the sound file with the given pathname to be played when
|
* Queues up the sound file with the given pathname to be played when
|
||||||
* the sound manager deems the time appropriate.
|
* the sound manager deems the time appropriate.
|
||||||
|
|||||||
Reference in New Issue
Block a user