public interface Playable
Playable
defines functionality that you would expect from a tapedeck
or CD player. Implementing classes are usually playing an audio file.Modifier and Type | Method and Description |
---|---|
void |
cue(int millis)
Sets the position to
millis milliseconds from
the beginning. |
AudioMetaData |
getMetaData()
Returns and
AudioMetaData object that describes this audio. |
boolean |
isLooping()
Returns true if this is currently playing and has more than one loop
left to play.
|
boolean |
isPlaying()
Returns true if this currently playing.
|
int |
length()
Returns the length of the sound in milliseconds.
|
void |
loop()
Sets looping to continuous.
|
void |
loop(int num)
Sets this to loop
num times. |
int |
loopCount()
Returns the number of loops left to do.
|
void |
pause()
Pauses playback.
|
void |
play()
Starts playback from the current position.
|
void |
play(int millis)
Starts playback
millis from the beginning. |
int |
position()
Returns the current position of the "playhead" (ie how much of
the sound has already been played)
|
void |
rewind()
Rewinds to the beginning.
|
void |
setLoopPoints(int start,
int stop)
Sets the loop points used when looping.
|
void |
skip(int millis)
Skips
millis from the current position. |
void play()
void play(int millis)
millis
from the beginning.
If this was previously set to loop, looping will be disabled.millis
- the position to start playing fromboolean isPlaying()
void loop()
void loop(int num)
num
times. If this is already playing,
the position will not be reset to the beginning.
If this is not playing, it will start playing.num
- the number of times to loopboolean isLooping()
int loopCount()
void setLoopPoints(int start, int stop)
start
- the start of the loop in millisecondsstop
- the end of the loop in millisecondsvoid pause()
void cue(int millis)
millis
milliseconds from
the beginning. This will not change the playstate. If an error
occurs while trying to cue, the position will not change.
If you try to cue to a negative position or try to a position
that is greater than length()
, the amount will be clamped
to zero or length()
.millis
- the position to place the "playhead"void skip(int millis)
millis
from the current position. millis
can be negative, which will make this skip backwards. If the skip amount
would result in a negative position or a position that is greater than
length()
, the new position will be clamped to zero or
length()
.millis
- how many milliseconds to skip, sign indicates directionvoid rewind()
int position()
int length()
AudioMetaData getMetaData()
AudioMetaData
object that describes this audio.AudioMetaData
for thisAudioMetaData