|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.ThreadGroup
com.brackeen.javagamebook.util.ThreadPool
com.brackeen.javagamebook.sound.SoundManager
The SoundManager class manages sound playback. The SoundManager is a ThreadPool, with each thread playing back one sound at a time. This allows the SoundManager to easily limit the number of simultaneous sounds being played.
Possible ideas to extend this class:
Constructor Summary | |
SoundManager(javax.sound.sampled.AudioFormat playbackFormat)
Creates a new SoundManager using the maximum number of simultaneous sounds. |
|
SoundManager(javax.sound.sampled.AudioFormat playbackFormat,
int maxSimultaneousSounds)
Creates a new SoundManager with the specified maximum number of simultaneous sounds. |
Method Summary | |
void |
close()
Closes this ThreadPool and returns immediately. |
javax.sound.sampled.AudioInputStream |
getAudioInputStream(java.io.InputStream is)
Creates an AudioInputStream from a sound from an input stream |
javax.sound.sampled.AudioInputStream |
getAudioInputStream(java.lang.String filename)
Creates an AudioInputStream from a sound from the file system. |
static int |
getMaxSimultaneousSounds(javax.sound.sampled.AudioFormat playbackFormat)
Gets the maximum number of simultaneous sounds with the specified AudioFormat that the default mixer can play. |
Sound |
getSound(javax.sound.sampled.AudioInputStream audioStream)
Loads a Sound from an AudioInputStream. |
Sound |
getSound(java.io.InputStream is)
Loads a Sound from an input stream. |
Sound |
getSound(java.lang.String filename)
Loads a Sound from the file system. |
boolean |
isPaused()
Returns the paused state. |
void |
join()
Closes this ThreadPool and waits for all running threads to finish. |
java.io.InputStream |
play(java.io.InputStream is)
Plays a sound from an InputStream. |
java.io.InputStream |
play(java.io.InputStream is,
SoundFilter filter)
Plays a sound from an InputStream with an optional sound filter. |
java.io.InputStream |
play(Sound sound)
Plays a sound. |
java.io.InputStream |
play(Sound sound,
SoundFilter filter,
boolean loop)
Plays a sound with an optional SoundFilter, and optionally looping. |
void |
setPaused(boolean paused)
Sets the paused state. |
Methods inherited from class com.brackeen.javagamebook.util.ThreadPool |
runTask |
Methods inherited from class java.lang.ThreadGroup |
activeCount, activeGroupCount, allowThreadSuspension, checkAccess, destroy, enumerate, enumerate, enumerate, enumerate, getMaxPriority, getName, getParent, interrupt, isDaemon, isDestroyed, list, parentOf, resume, setDaemon, setMaxPriority, stop, suspend, toString, uncaughtException |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public SoundManager(javax.sound.sampled.AudioFormat playbackFormat)
public SoundManager(javax.sound.sampled.AudioFormat playbackFormat, int maxSimultaneousSounds)
Method Detail |
public static int getMaxSimultaneousSounds(javax.sound.sampled.AudioFormat playbackFormat)
public void close()
ThreadPool
close
in class ThreadPool
public void join()
ThreadPool
join
in class ThreadPool
public void setPaused(boolean paused)
public boolean isPaused()
public Sound getSound(java.lang.String filename)
public Sound getSound(java.io.InputStream is)
public Sound getSound(javax.sound.sampled.AudioInputStream audioStream)
public javax.sound.sampled.AudioInputStream getAudioInputStream(java.lang.String filename)
public javax.sound.sampled.AudioInputStream getAudioInputStream(java.io.InputStream is)
public java.io.InputStream play(Sound sound)
public java.io.InputStream play(Sound sound, SoundFilter filter, boolean loop)
public java.io.InputStream play(java.io.InputStream is)
public java.io.InputStream play(java.io.InputStream is, SoundFilter filter)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |