wyvern.kernel.player
Class MusicState

java.lang.Object
  extended bywyvern.kernel.player.MusicState
All Implemented Interfaces:
RemoteAudioState

public class MusicState
extends java.lang.Object
implements RemoteAudioState

A Bean property that keeps track of the current state of the running soundtrack on the client. The client, of course, also keeps track of its state, and all music state changes should be handled by this class to ensure consistency.

There's one of these per player, stored in a "@music-state" property. You can access it via player.getMusicState().

Version:
1.0, Jul 26, 2003
Author:
Steve Yegge

Nested Class Summary
static interface MusicState.States
          Allows for convenient import of the music states.
 
Field Summary
 
Fields inherited from interface wyvern.common.net.RemoteAudioState
PLAYING_INTRO_CONNECTED, PLAYING_INTRO_NOT_CONNECTED, PLAYING_OTHER_CONNECTED, PLAYING_OTHER_NOT_CONNECTED, READY_CONNECTED, READY_NOT_CONNECTED, START_STATE
 
Constructor Summary
MusicState()
          Constructs a new MusicState
MusicState(Player player)
          Constructs a new MusicState
 
Method Summary
 java.lang.String getPath()
          Returns relative path to the music/sound file for current background music.
 Player getPlayer()
          Returns the player we're attached to
 int getState()
          Returns the current state of the client's soundtrack
 java.lang.String getStateName(int state)
          Returns state name for the passed music state.
 boolean sameMusic(java.lang.String path)
          Returns true if the passed path is the same as the one the player is currently playing.
 void setPath(java.lang.String path)
          Sets relative path to the music/sound file
 void setPlayer(Player player)
          Sets the player we're attached to
 void setState(int state)
          Sets the current state of the client's soundtrack
 java.lang.String toString()
          Prints debugging representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MusicState

public MusicState()
Constructs a new MusicState


MusicState

public MusicState(Player player)
Constructs a new MusicState

Method Detail

getPlayer

public Player getPlayer()
Returns the player we're attached to

Returns:
the player we're attached to

setPlayer

public void setPlayer(Player player)
Sets the player we're attached to

Parameters:
player - the player we're attached to

getState

public int getState()
Returns the current state of the client's soundtrack

Returns:
the current state of the client's soundtrack

setState

public void setState(int state)
Sets the current state of the client's soundtrack

Parameters:
state - the current state of the client's soundtrack

getStateName

public java.lang.String getStateName(int state)
Returns state name for the passed music state.


getPath

public java.lang.String getPath()
Returns relative path to the music/sound file for current background music.

Returns:
relative path to the music/sound file

setPath

public void setPath(java.lang.String path)
Sets relative path to the music/sound file

Parameters:
path - relative path to the music/sound file

sameMusic

public boolean sameMusic(java.lang.String path)
Returns true if the passed path is the same as the one the player is currently playing.

Parameters:
path - any music file path
Returns:
true if our player is already playing that piece

toString

public java.lang.String toString()
Prints debugging representation.