|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.freecol.client.gui.sound.SoundPlayer
public class SoundPlayer
Class for playing sound. See the package description for
net.sf.freecol.client.gui.sound for information on how to play
sfx/music.
| Nested Class Summary | |
|---|---|
(package private) class |
SoundPlayer.SoundPlayerThread
Thread for playing a Playlist. |
| Field Summary | |
|---|---|
private SoundPlayer.SoundPlayerThread |
currentSoundPlayerThread
Used with multipleSounds. |
private int |
defaultPickMode
This is the default pick-mode for a playlist. |
private boolean |
defaultPlayContinues
Should the player continue playing after it it finished with a sound-clip? This is the default used with the play(Playlist playlist). |
private int |
defaultRepeatMode
This is the default repeat-mode for a playlist. |
private static int |
FADE_UPDATE_MS
|
private static java.util.logging.Logger |
logger
|
private static int |
MAXIMUM_FADE_MS
|
private javax.sound.sampled.Mixer |
mixer
|
private boolean |
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. |
private boolean |
soundPaused
Is the sound paused? |
private java.lang.ThreadGroup |
soundPlayerThreads
The thread-group containing all of the SoundPlayerThreads. |
private boolean |
soundStopped
Is the sound stopped? |
static int |
STANDARD_DELAY
|
private PercentageOption |
volume
|
| 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 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final java.util.logging.Logger logger
public static final int STANDARD_DELAY
private static final int MAXIMUM_FADE_MS
private static final int FADE_UPDATE_MS
private java.lang.ThreadGroup soundPlayerThreads
private boolean soundPaused
private boolean soundStopped
private boolean multipleSounds
private SoundPlayer.SoundPlayerThread currentSoundPlayerThread
multipleSounds.
private boolean defaultPlayContinues
private final int defaultRepeatMode
Playlist-class to get the different values.
Playlistprivate final int defaultPickMode
Playlist-class to get the different values.
Playlistprivate javax.sound.sampled.Mixer mixer
private PercentageOption volume
| Constructor Detail |
|---|
public SoundPlayer(AudioMixerOption mixerOption,
PercentageOption volume,
boolean multipleSounds,
boolean defaultPlayContinues)
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).
public SoundPlayer(AudioMixerOption mixerOption,
PercentageOption volume,
boolean multipleSounds,
boolean defaultPlayContinues,
int defaultRepeatMode,
int defaultPickMode)
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 |
|---|
public void play(Playlist playlist)
playlist - The Playlist to be played.
public void play(Playlist playlist,
int delay)
playlist - The Playlist to be played.delay - A delay before playing the sound (ms).public void playOnce(Playlist playlist)
playlist - The Playlist to be played.
public void playOnce(Playlist playlist,
int delay)
playlist - The Playlist to be played.delay - A delay before playing the sound (ms).
public void play(Playlist playlist,
boolean playContinues,
int repeatMode,
int pickMode,
int delay)
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).public void stop()
public boolean isStopped()
true is the sounds are stopped.public void pause()
public boolean isPaused()
true is the sounds are paused.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||