|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ddf.minim.Controller ddf.minim.AudioSource ddf.minim.AudioPlayer
public class AudioPlayer
An AudioPlayer
is used for playing an
AudioRecording
. Strictly speaking, you don't need an
AudioPlayer
to play an AudioRecording
, because
the recording is itself Playable
. However, an
AudioPlayer
does you the favor of providing
AudioBuffer
s that are sync'd with the recording's output as
well as providing direct control over the DataLine
being used
to transmit the recording to the system. You can get an
AudioPlayer
by calling Minim.loadFile(String)
, but
you can also construct one yourself if you've written your own implementation
of AudioRecording
.
Field Summary |
---|
Fields inherited from class ddf.minim.AudioSource |
---|
left, mix, right |
Fields inherited from class ddf.minim.Controller |
---|
BALANCE, GAIN, MUTE, PAN, SAMPLE_RATE, VOLUME |
Constructor Summary | |
---|---|
AudioPlayer(AudioRecordingStream recording,
AudioOut out)
Constructs an AudioPlayer that plays recording . |
Method Summary | |
---|---|
void |
close()
Closes the AudioStream this was constructed with. |
void |
cue(int millis)
Sets the position to millis milliseconds from
the beginning. |
AudioMetaData |
getMetaData()
Returns the meta data for the recording being played by this player. |
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 n)
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. |
Methods inherited from class ddf.minim.AudioSource |
---|
addEffect, addListener, bufferSize, clearEffects, disableEffect, disableEffect, effectCount, effects, enableEffect, enableEffect, getEffect, getFormat, hasEffect, isEffected, isEnabled, noEffects, removeEffect, removeEffect, removeListener, sampleRate, type |
Methods inherited from class ddf.minim.Controller |
---|
balance, gain, getBalance, getControl, getControls, getGain, getPan, getVolume, hasControl, isMuted, mute, pan, printControls, setBalance, setGain, setPan, setVolume, shiftBalance, shiftGain, shiftPan, shiftVolume, unmute, volume |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AudioPlayer(AudioRecordingStream recording, AudioOut out)
AudioPlayer
that plays recording
.
It is expected that recording
will have a
DataLine
to control. If it doesn't, any calls to
Controller
's methods will result in a
NullPointerException
.
recording
- the AudioRecording
to playMethod Detail |
---|
public void play()
Playable
play
in interface Playable
public void play(int millis)
Playable
millis
from the beginning. If this was previous set to loop,
looping will be disabled.
play
in interface Playable
public void pause()
Playable
pause
in interface Playable
public void rewind()
Playable
rewind
in interface Playable
public void loop()
Playable
loop
in interface Playable
public void loop(int n)
Playable
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.
loop
in interface Playable
n
- the number of times to looppublic int loopCount()
Playable
loopCount
in interface Playable
public int length()
Playable
length
in interface Playable
public int position()
Playable
position
in interface Playable
public void cue(int millis)
Playable
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()
.
cue
in interface Playable
millis
- the position to place the "playhead"public void skip(int millis)
Playable
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()
.
skip
in interface Playable
millis
- how many milliseconds to skip, sign indicates directionpublic boolean isLooping()
Playable
isLooping
in interface Playable
public boolean isPlaying()
Playable
isPlaying
in interface Playable
public AudioMetaData getMetaData()
getMetaData
in interface Playable
public void setLoopPoints(int start, int stop)
Playable
setLoopPoints
in interface Playable
start
- the start of the loop in millisecondsstop
- the end of the loop in millisecondspublic void close()
AudioSource
AudioStream
this was constructed with.
close
in class AudioSource
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |