|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.newdawn.slick.Music
public class Music
A piece of music loaded and playable within the game. Only one piece of music can play at any given time and a channel is reserved so music will always play.
Constructor Summary | |
---|---|
Music(java.io.InputStream in,
java.lang.String ref)
Create and load a piece of music (either OGG or MOD/XM) |
|
Music(java.lang.String ref)
Create and load a piece of music (either OGG or MOD/XM) |
|
Music(java.lang.String ref,
boolean streamingHint)
Create and load a piece of music (either OGG or MOD/XM) |
|
Music(java.net.URL ref)
Create and load a piece of music (either OGG or MOD/XM) |
|
Music(java.net.URL url,
boolean streamingHint)
Create and load a piece of music (either OGG or MOD/XM) |
Method Summary | |
---|---|
void |
addListener(MusicListener listener)
Add a listener to this music |
void |
fade(int duration,
float endVolume,
boolean stopAfterFade)
Fade this music to the volume specified |
float |
getPosition()
The position into the sound thats being played |
float |
getVolume()
Get the individual volume of the music |
void |
loop()
Loop the music |
void |
loop(float pitch,
float volume)
Loop the music at a given pitch and volume |
void |
pause()
Pause the music playback |
void |
play()
Play the music |
void |
play(float pitch,
float volume)
Play the music at a given pitch and volume |
boolean |
playing()
Check if the music is being played |
static void |
poll(int delta)
Poll the state of the current music. |
void |
removeListener(MusicListener listener)
Remove a listener from this music |
void |
resume()
Resume the music playback |
boolean |
setPosition(float position)
Seeks to a position in the music. |
void |
setVolume(float volume)
Set the volume of the music as a factor of the global volume setting |
void |
stop()
Stop the music playing |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Music(java.lang.String ref) throws SlickException
ref
- The location of the music
SlickException
public Music(java.net.URL ref) throws SlickException
ref
- The location of the music
SlickException
public Music(java.io.InputStream in, java.lang.String ref) throws SlickException
in
- The stream to read the music fromref
- The symbolic name of this music
SlickException
- Indicates a failure to read the music from the streampublic Music(java.net.URL url, boolean streamingHint) throws SlickException
url
- The location of the musicstreamingHint
- A hint to indicate whether streaming should be used if possible
SlickException
public Music(java.lang.String ref, boolean streamingHint) throws SlickException
ref
- The location of the musicstreamingHint
- A hint to indicate whether streaming should be used if possible
SlickException
Method Detail |
---|
public static void poll(int delta)
delta
- The amount of time since last pollpublic void addListener(MusicListener listener)
listener
- The listener to addpublic void removeListener(MusicListener listener)
listener
- The listener to removepublic void loop()
public void play()
public void play(float pitch, float volume)
pitch
- The pitch to play the music at (1.0 = default)volume
- The volume to play the music at (1.0 = default)public void loop(float pitch, float volume)
pitch
- The pitch to play the music at (1.0 = default)volume
- The volume to play the music at (1.0 = default)public void pause()
public void stop()
public void resume()
public boolean playing()
public void setVolume(float volume)
volume
- The volume to play music at. 0 - 1, 1 is Maxpublic float getVolume()
public void fade(int duration, float endVolume, boolean stopAfterFade)
duration
- Fade time in milliseconds.endVolume
- The target volumestopAfterFade
- True if music should be stopped after fading in/outpublic boolean setPosition(float position)
position
- Position in seconds.
public float getPosition()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |