diff --git a/src/java/com/threerings/media/sound/SoundManager.java b/src/java/com/threerings/media/sound/SoundManager.java index ab5857d28..18ae63af4 100644 --- a/src/java/com/threerings/media/sound/SoundManager.java +++ b/src/java/com/threerings/media/sound/SoundManager.java @@ -1,5 +1,5 @@ // -// $Id: SoundManager.java,v 1.5 2002/08/02 01:45:19 shaper Exp $ +// $Id: SoundManager.java,v 1.6 2002/09/30 06:13:36 shaper Exp $ package com.threerings.media; @@ -91,13 +91,21 @@ public class SoundManager return (_player == Thread.currentThread()); } + /** + * Sets whether sound is enabled. + */ + public void setEnabled (boolean enabled) + { + _enabled = enabled; + } + /** * Queues up the sound file with the given pathname to be played when * the sound manager deems the time appropriate. */ public void play (String path) { - if (_player != null) { + if (_player != null && _enabled) { // Log.debug("Queueing sound [path=" + path + "]."); _clips.append(path); } @@ -110,6 +118,10 @@ public class SoundManager { // Log.debug("Playing sound [path=" + path + "]."); + if (!_enabled) { + return; + } + try { // get the audio input stream Tuple tup = getAudioInfo(path); @@ -264,6 +276,9 @@ public class SoundManager /** The cached audio file data. */ protected HashMap _data = new HashMap(); + /** Whether sound is enabled. */ + protected boolean _enabled = true; + /** The buffer size in bytes used when reading audio file data. */ protected static final int BUFFER_SIZE = 2048; }