net.sf.freecol.client.gui.sound
Class SoundPlayer

java.lang.Object
  extended by net.sf.freecol.client.gui.sound.SoundPlayer

public class SoundPlayer
extends java.lang.Object

Class for playing sound. See the package description for net.sf.freecol.client.gui.sound for information on how to play sfx/music.


Field Summary
static int STANDARD_DELAY
           
 
Constructor Summary
SoundPlayer(AudioMixerOption mixerOption, PercentageOption volume, boolean multipleSounds, boolean defaultPlayContinues)
          Use this constructor.
SoundPlayer(AudioMixerOption mixerOption, PercentageOption volume, boolean multipleSounds, boolean defaultPlayContinues, int defaultRepeatMode, int defaultPickMode)
          Or this.
 
Method Summary
 boolean isPaused()
          Are the sounds paused?
 boolean isStopped()
          Are the sounds stopped?
 void pause()
          Pauses all the sounds.
 void play(Playlist playlist)
          Plays a playlist using the default play-continues, repeat-mode and pick-mode for this SoundPlayer.
 void play(Playlist playlist, boolean playContinues, int repeatMode, int pickMode, int delay)
          Plays a playlist.
 void play(Playlist playlist, int delay)
          Plays a playlist using the default play-continues, repeat-mode and pick-mode for this SoundPlayer.
 void playOnce(Playlist playlist)
          Plays a single random sound from the given playlist.
 void playOnce(Playlist playlist, int delay)
          Plays a single random sound from the given playlist.
 void stop()
          Stop playing the sounds.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STANDARD_DELAY

public static final int STANDARD_DELAY
See Also:
Constant Field Values
Constructor Detail

SoundPlayer

public SoundPlayer(AudioMixerOption mixerOption,
                   PercentageOption volume,
                   boolean multipleSounds,
                   boolean defaultPlayContinues)
Use this constructor.

Parameters:
mixerOption - The option for setting the mixer used by this SoundPlayer.
volume - The volume to be used when playing audio.
multipleSounds - Should the SoundPlayer play multiple sounds at the same time, or only one? If it does not allow multiple sounds, then using play will stop the sound currently playing and play the new instead.
defaultPlayContinues - Should the player continue playing after it it finished with a sound-clip? This is the default used with the play(Playlist playlist).

SoundPlayer

public SoundPlayer(AudioMixerOption mixerOption,
                   PercentageOption volume,
                   boolean multipleSounds,
                   boolean defaultPlayContinues,
                   int defaultRepeatMode,
                   int defaultPickMode)
Or this.

Parameters:
mixerOption - The option for setting the mixer used by this SoundPlayer.
volume - The volume to be used when playing audio.
multipleSounds - Should the SoundPlayer play multiple sounds at the same time, or only one? If it does not allow multiple sounds, then using play will stop the sound currently playing and play the new instead.
defaultRepeatMode - This is the default repeat-mode for a playlist. Refer to the field summary of the Playlist-class to get the different values.
defaultPickMode - This is the default pick-mode for a playlist. Refer to the field summary of the Playlist-class to get the different values.
defaultPlayContinues - Should the player continue playing after it it finished with a sound-clip? This is the default used with the play(Playlist playlist).
Method Detail

play

public void play(Playlist playlist)
Plays a playlist using the default play-continues, repeat-mode and pick-mode for this SoundPlayer.

Parameters:
playlist - The Playlist to be played.

play

public void play(Playlist playlist,
                 int delay)
Plays a playlist using the default play-continues, repeat-mode and pick-mode for this SoundPlayer.

Parameters:
playlist - The Playlist to be played.
delay - A delay before playing the sound (ms).

playOnce

public void playOnce(Playlist playlist)
Plays a single random sound from the given playlist.

Parameters:
playlist - The Playlist to be played.

playOnce

public void playOnce(Playlist playlist,
                     int delay)
Plays a single random sound from the given playlist.

Parameters:
playlist - The Playlist to be played.
delay - A delay before playing the sound (ms).

play

public void play(Playlist playlist,
                 boolean playContinues,
                 int repeatMode,
                 int pickMode,
                 int delay)
Plays a playlist.

Parameters:
playlist - The Playlist to be played.
playContinues - true if the SoundPlayer should continue playing after playing the first entry on the playlist.
repeatMode - The method this PlayList should be repeated.
pickMode - The method to be used for picking the songs.
delay - A delay before playing the sound (ms).

stop

public void stop()
Stop playing the sounds.


isStopped

public boolean isStopped()
Are the sounds stopped?

Returns:
true is the sounds are stopped.

pause

public void pause()
Pauses all the sounds.


isPaused

public boolean isPaused()
Are the sounds paused?

Returns:
true is the sounds are paused.