|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectccs.audio.AudioController
public class AudioController
The main audio back-end object. MT-UNSAFE. This classes methods must only be invoked from a single thread. In most applications, this will be the Swing dispatch thread.
Field Summary | |
---|---|
static java.lang.String |
LOGNAME
The name of the Logger the audio system uses to log lifecycle events. |
static java.lang.String |
STATENAME
The name of the state property. |
Constructor Summary | |
---|---|
AudioController(Playlist playlist,
int fifoSize,
float lineSeconds,
Hurlable hurl,
boolean isAbortOnUnderrun)
Create an AudioController. |
Method Summary | |
---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener pcl)
Changes in the controller's state are broadcast to interested listeners as changes in the "state" property. |
void |
changeTrack(TrackChange motion)
Track change. |
void |
close()
Closedown. |
int |
getFIFOPercent()
Get the current FIFO fill in % |
javax.sound.sampled.AudioFormat |
getFormat()
|
Hurlable |
getHurlable()
|
TrackState |
getState()
|
long |
microsecondPosition()
|
void |
pause()
If a track is currently running (playing), pauses it. |
void |
play()
If a track is currently ready (paused), starts it. |
void |
propertyChange(java.beans.PropertyChangeEvent evt)
Responds to property changes from package internals. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener pcl)
|
void |
setAutoStart(boolean isAutostart)
Set whether a track should automatically start playing when it's ready. |
void |
setMasterGain(float dB)
Set the master gain. |
void |
setTrackMode(TrackMode mode)
Set the track mode. |
void |
stop()
Stop. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String STATENAME
public static final java.lang.String LOGNAME
Logger
the audio system uses to log lifecycle events.
Use the logging API to manipulate it.
Constructor Detail |
---|
public AudioController(Playlist playlist, int fifoSize, float lineSeconds, Hurlable hurl, boolean isAbortOnUnderrun)
playlist
- The playlist to play tracks from.fifoSize
- The size of the FIFO buffer. This is used to smooth out
transient data starves when playing over a network. Minimum 256 KiB;
the minimum should be OK for lightly loaded connections. Increasing it
improves robustness in the face of stressed network connections, but
increases application footprint and latency before starting the first
track. (So don't go too mad.)lineSeconds
- The duration of the line buffer. This contains decoded
(PCM) samples and is accessible by the low-level audio system. Increasing
it may avoid playback glitches on machines with poor multithreading
performance or long thread time-slices. 1.0 seconds recommended for most
cases. Line buffer costs 176KiB per second, so don't go too mad here either.hurl
- A hurlable for reporting errors from the system. This hurlable
will only be called from the Swing dispatch thread. If null, errors will
cause a FAULT status, but the details will be lost.isAbortOnUnderrun
- If the FIFO empties completely while playing
a track, the AudioController can suspend playback until the FIFO buffer fills
back up again. However, this doesn't always work; sometimes the audio decoder
libraries can't recover from this situation, and don't come back online when
the buffer has been refilled. Alternatively, the AudioController can simply
report this as a fault, and not attempt to fix it. To have the AudioController
attempt to recover from an underrun, set this false; allows playback to
continue, *maybe*, in adverse conditions, but doesn't always work. To have
it abort instead, set this true.Method Detail |
---|
public void addPropertyChangeListener(java.beans.PropertyChangeListener pcl)
public void removePropertyChangeListener(java.beans.PropertyChangeListener pcl)
public Hurlable getHurlable()
public TrackState getState()
public javax.sound.sampled.AudioFormat getFormat()
public long microsecondPosition()
public void changeTrack(TrackChange motion)
public void play()
public void pause()
public void stop()
public void close()
public void setTrackMode(TrackMode mode)
public void setAutoStart(boolean isAutostart)
public void setMasterGain(float dB)
public int getFIFOPercent()
public void propertyChange(java.beans.PropertyChangeEvent evt)
propertyChange
in interface java.beans.PropertyChangeListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |