|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
org.openstreetmap.josm.tools.AudioPlayer
public class AudioPlayer
Creates and controls a separate audio player thread.
Nested Class Summary | |
---|---|
private static class |
AudioPlayer.Command
|
private class |
AudioPlayer.Execute
Passes information from the control thread to the playing thread |
private static class |
AudioPlayer.Result
|
private static class |
AudioPlayer.State
|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
private static AudioPlayer |
audioPlayer
|
private double |
bytesPerSecond
|
private double |
calibration
|
private static long |
chunk
|
private AudioPlayer.Execute |
command
|
private double |
leadIn
|
private java.net.URL |
playingUrl
|
private double |
position
|
private double |
speed
|
private AudioPlayer.State |
state
|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
private |
AudioPlayer()
|
Method Summary | |
---|---|
static void |
audioMalfunction(java.lang.Exception ex)
|
private static AudioPlayer |
get()
gets the singleton object, and if this is the first time, creates it along with the thread to support audio |
static void |
pause()
Pauses the currently playing audio stream. |
static boolean |
paused()
Whether or not we are paused. |
static void |
play(java.net.URL url)
Plays a WAV audio file from the beginning. |
static void |
play(java.net.URL url,
double seconds)
Plays a WAV audio file from a specified position. |
static void |
play(java.net.URL url,
double seconds,
double speed)
Plays a WAV audio file from a specified position at variable speed. |
static boolean |
playing()
Whether or not we are playing. |
static double |
position()
How far we are through playing, in seconds. |
static void |
reset()
|
void |
run()
Starts the thread to actually play the audio, per Thread interface Not to be used as public, though Thread interface doesn't allow it to be made private |
static double |
speed()
Speed at which we will play. |
static java.net.URL |
url()
To get the Url of the playing or recently played audio. |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static AudioPlayer audioPlayer
private AudioPlayer.State state
private java.net.URL playingUrl
private double leadIn
private double calibration
private double position
private double bytesPerSecond
private static long chunk
private double speed
private AudioPlayer.Execute command
Constructor Detail |
---|
private AudioPlayer()
Method Detail |
---|
public static void play(java.net.URL url) throws java.lang.Exception
url
- The resource to play, which must be a WAV file or stream
audio
- fault exception, e.g. can't open stream, unhandleable audio format
java.lang.Exception
public static void play(java.net.URL url, double seconds) throws java.lang.Exception
url
- The resource to play, which must be a WAV file or streamseconds
- The number of seconds into the audio to start playing
audio
- fault exception, e.g. can't open stream, unhandleable audio format
java.lang.Exception
public static void play(java.net.URL url, double seconds, double speed) throws java.lang.Exception
url
- The resource to play, which must be a WAV file or streamseconds
- The number of seconds into the audio to start playingspeed
- Rate at which audio playes (1.0 = real time, > 1 is faster)
audio
- fault exception, e.g. can't open stream, unhandleable audio format
java.lang.Exception
public static void pause() throws java.lang.Exception
audio
- fault exception, e.g. can't open stream, unhandleable audio format
java.lang.Exception
public static java.net.URL url()
public static boolean paused()
public static boolean playing()
public static double position()
public static double speed()
private static AudioPlayer get()
public static void reset()
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public static void audioMalfunction(java.lang.Exception ex)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |