|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Music
A Music instance represents a streamed audio file. The interface supports setting the play back position, pausing and resuming
and so on. When you are done with using the Music instance you have to dispose it via the dispose()
method.
Music instances are created via Audio.newMusic(FileHandle)
.
Music instances are automatically paused and resumed when an Application
is paused or resumed. See
ApplicationListener
.
Note: any values provided will not be clamped, it is the developer's responsibility to do so
Nested Class Summary | |
---|---|
static interface |
Music.OnCompletionListener
Interface definition for a callback to be invoked when playback of a music stream has completed. |
Method Summary | |
---|---|
void |
dispose()
Needs to be called when the Music is no longer needed. |
float |
getPosition()
Returns the playback position in milliseconds. |
float |
getVolume()
|
boolean |
isLooping()
|
boolean |
isPlaying()
|
void |
pause()
Pauses the play back. |
void |
play()
Starts the play back of the music stream. |
void |
setLooping(boolean isLooping)
Sets whether the music stream is looping. |
void |
setOnCompletionListener(Music.OnCompletionListener listener)
Register a callback to be invoked when the end of a music stream has been reached during playback. |
void |
setPan(float pan,
float volume)
Sets the panning and volume of this music stream. |
void |
setVolume(float volume)
Sets the volume of this music stream. |
void |
stop()
Stops a playing or paused Music instance. |
Method Detail |
---|
void play()
void pause()
void stop()
boolean isPlaying()
void setLooping(boolean isLooping)
isLooping
- whether to loop the streamboolean isLooping()
void setVolume(float volume)
volume
- float getVolume()
void setPan(float pan, float volume)
pan
- panning in the range -1 (full left) to 1 (full right). 0 is center position.volume
- the volume in the range [0,1].float getPosition()
void dispose()
dispose
in interface Disposable
void setOnCompletionListener(Music.OnCompletionListener listener)
listener
- the callback that will be run.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |