vooga.engine.util
Class SoundPlayer

java.lang.Object
  extended by vooga.engine.util.SoundPlayer

public class SoundPlayer
extends java.lang.Object

Singleton class designed to allow the ability to play sounds and music from anywhere in the game. The game must be set first, after that calling SoundPlayer.playMusic() or SoundPlayer.playSound will be the equivalent of calling those methods in your game.


Constructor Summary
SoundPlayer()
           
 
Method Summary
static void playMusic(java.lang.String audioFilePath)
          Plays background music for your game.
static void playSound(java.lang.String audioFilePath)
          Play a sound effect for your game.
static void setGame(Game game)
          Sets the game for playing music.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SoundPlayer

public SoundPlayer()
Method Detail

setGame

public static void setGame(Game game)
Sets the game for playing music. Do this first.

Parameters:
game - the current game which you would like to play sounds in

playMusic

public static void playMusic(java.lang.String audioFilePath)
Plays background music for your game. Make sure that the game is set before calling this.

Parameters:
audioFilePath - File path to the music file. Resources supplies the filepath.

playSound

public static void playSound(java.lang.String audioFilePath)
Play a sound effect for your game. Make sure that the game is set before calling this.

Parameters:
audioFilePath - File path to the music file. Resources supplies the filepath.