bluegammon
Class Audio

java.lang.Object
  extended bybluegammon.Audio

public class Audio
extends java.lang.Object

Audio manager. Contains one player for each sound.

Implementation note: the format of the sound is hardcoded in method playSound.

Author:
Peter Andersson

Field Summary
static int CONN_FAIL
          Connection failed sound
static int DICES_LONG
          Dices hitting board, long sound
static int DICES_SHORT
          Dices hitting board, short sound
static int LOSER
          Loser sound
static int MESSAGE
          Message sound
static int MUSIC
          Jazzy background music
static int PIECE
          Piece sound
static int WINNER
          Winner sound
 
Method Summary
static void playSound(int snd)
          Starts playing specified sound, one of Audio.MUSIC, Audio.DICES_LONG, Audio.DICES_SHORT, Audio.PIECE.
static void shutdown()
          Stops all sounds and cleans up resources.
static void stopSound(int snd)
          Stops specified sound if it is playing.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MUSIC

public static final int MUSIC
Jazzy background music

See Also:
Constant Field Values

DICES_LONG

public static final int DICES_LONG
Dices hitting board, long sound

See Also:
Constant Field Values

DICES_SHORT

public static final int DICES_SHORT
Dices hitting board, short sound

See Also:
Constant Field Values

PIECE

public static final int PIECE
Piece sound

See Also:
Constant Field Values

MESSAGE

public static final int MESSAGE
Message sound

See Also:
Constant Field Values

CONN_FAIL

public static final int CONN_FAIL
Connection failed sound

See Also:
Constant Field Values

WINNER

public static final int WINNER
Winner sound

See Also:
Constant Field Values

LOSER

public static final int LOSER
Loser sound

See Also:
Constant Field Values
Method Detail

playSound

public static void playSound(int snd)
Starts playing specified sound, one of Audio.MUSIC, Audio.DICES_LONG, Audio.DICES_SHORT, Audio.PIECE. If there is another sound playing, it is stopped.

Parameters:
snd - The id of the sound to play.

stopSound

public static void stopSound(int snd)
Stops specified sound if it is playing.

Parameters:
snd - The id of the sound to stop.

shutdown

public static void shutdown()
Stops all sounds and cleans up resources.