games.strategy.engine.sound
Class ClipPlayer

java.lang.Object
  extended by games.strategy.engine.sound.ClipPlayer

public class ClipPlayer
extends java.lang.Object

Utility for loading and playing sound clips. Stores a preference in the user preferences for being silent. The property will persist and be reloaded after the virtual machine has been stopped and restarted.


Method Summary
 boolean getBeSilent()
          Will we make noise?
static ClipPlayer getInstance()
           
 void playClip(java.lang.String clipName, java.lang.Class<SoundPath> resourceLocation)
          Clips are located using Class.getResource().
 void preLoadClip(java.lang.String clipName, java.lang.Class<SoundPath> resourceLocation)
          To reduce the delay when the clip is first played, we can preload clips here.
 void setBeSilent(boolean aBool)
          If set to true, no sounds will play.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static ClipPlayer getInstance()

getBeSilent

public boolean getBeSilent()
Will we make noise?


setBeSilent

public void setBeSilent(boolean aBool)
If set to true, no sounds will play. This property is persisted using the java.util.prefs API, and will persist after the vm has stopped.


playClip

public void playClip(java.lang.String clipName,
                     java.lang.Class<SoundPath> resourceLocation)
Clips are located using Class.getResource(). All clips must have a position relative to a class file.

Parameters:
clipName - String - the file name of the clip
resourceLocation - Class - the location of the clip.

preLoadClip

public void preLoadClip(java.lang.String clipName,
                        java.lang.Class<SoundPath> resourceLocation)
To reduce the delay when the clip is first played, we can preload clips here.