|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
at.tuwien.ifs.somtoolbox.audio.PlaybackThread
public class PlaybackThread
Thread to play music files.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
Thread.State, Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
protected AudioInputStream[] |
audioInputStream
|
protected byte[][] |
buffer
|
protected byte[] |
datalineBuffer
|
static int |
decodedCount
|
static LinkedHashMap<File,File> |
decodedFiles
|
private String |
decodedOutputDir
|
static float |
DEFAULT_PROBABILITY_TO_DECODE
Probability to decode a mp3 file to wav |
(package private) boolean[] |
empty
Flag if channel is empty: in this case, there will be silence on the respective channel |
protected File |
file1
|
protected File |
file2
|
(package private) File[][] |
files
Files to play |
(package private) String |
id
|
protected SourceDataLine |
line
|
protected int |
monoFramesize
|
(package private) boolean |
otherChannelAlreadyFinished
(if bRepeat == false): if the first channel's musicfile stops, it is set to true. If the second channel's musicfile stops, this thread is stopped. |
private Vector<PlaybackListener> |
playbackListeners
|
(package private) Point[] |
positions
|
(package private) float |
probalityToDecode
|
protected boolean |
quitLoop
|
static Random |
rand
|
protected boolean |
ready
|
(package private) boolean |
repeatShuffle
Flag: if true, then music is played endlessly, alwas repeating. |
static int |
songCount
|
private boolean |
threadSuspended
|
(package private) boolean |
updateStats
Flag: if false, no global statistic variable will be updated by this Thread |
(package private) boolean[] |
waitForDecoder
Flag: if true , then the respective channel is waiting for a DecoderThread to finish. |
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
PlaybackThread(String id,
PlaybackThreadDataRecord record,
SourceDataLine line,
boolean repeat,
float probalityToDecode,
boolean updateStats,
String decodedOutputDir)
|
|
PlaybackThread(String id,
PlaybackThreadDataRecord record,
SourceDataLine line,
boolean repeat,
float probalityToDecode,
String decodedOutputDir)
|
|
PlaybackThread(String id,
PlaybackThreadDataRecord record,
SourceDataLine line,
String decodedOutputDir)
Convenience constructur that takes a PlaybackThreadDataRecord and pulls all data from it to create a new
thread.Note the constructor call that looks quite crazy with all its necessary casts. |
Method Summary | |
---|---|
boolean |
addPlaybackListener(PlaybackListener listener)
|
void |
decodingFailed(int channel,
boolean stats)
|
void |
decodingFinished(File file,
int channel,
boolean stats,
DecoderThread dt)
|
AudioInputStream |
getNextSong(int channel,
boolean stats)
|
boolean |
isReady()
|
void |
muteChannel(int channel)
|
void |
pausePlayback()
|
AudioInputStream |
prepareAudioInputStream(File file,
int channel,
boolean stats)
|
boolean |
removePlaybackListener(PlaybackListener listener)
|
void |
resumePlayback()
|
void |
run()
|
void |
stopPlayback()
|
void |
unMuteChannel(int channel)
|
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, 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 |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static int decodedCount
public static LinkedHashMap<File,File> decodedFiles
public static final float DEFAULT_PROBABILITY_TO_DECODE
public static Random rand
public static int songCount
protected AudioInputStream[] audioInputStream
protected byte[][] buffer
protected byte[] datalineBuffer
private String decodedOutputDir
boolean[] empty
protected File file1
protected File file2
File[][] files
String id
protected SourceDataLine line
protected int monoFramesize
boolean otherChannelAlreadyFinished
private Vector<PlaybackListener> playbackListeners
Point[] positions
float probalityToDecode
protected boolean quitLoop
protected boolean ready
boolean repeatShuffle
If false, then on each channel there will be played each song in the list, from the first to the last, then exit.
private boolean threadSuspended
boolean updateStats
boolean[] waitForDecoder
true
, then the respective channel is waiting for a DecoderThread
to finish.
Constructor Detail |
---|
public PlaybackThread(String id, PlaybackThreadDataRecord record, SourceDataLine line, boolean repeat, float probalityToDecode, boolean updateStats, String decodedOutputDir)
public PlaybackThread(String id, PlaybackThreadDataRecord record, SourceDataLine line, boolean repeat, float probalityToDecode, String decodedOutputDir)
public PlaybackThread(String id, PlaybackThreadDataRecord record, SourceDataLine line, String decodedOutputDir)
PlaybackThreadDataRecord
and pulls all data from it to create a new
thread.
Method Detail |
---|
public boolean addPlaybackListener(PlaybackListener listener)
public void decodingFailed(int channel, boolean stats)
public void decodingFinished(File file, int channel, boolean stats, DecoderThread dt)
public AudioInputStream getNextSong(int channel, boolean stats) throws IOException, UnsupportedAudioFileException
IOException
UnsupportedAudioFileException
public boolean isReady()
public void muteChannel(int channel)
public void pausePlayback()
public AudioInputStream prepareAudioInputStream(File file, int channel, boolean stats) throws IOException, UnsupportedAudioFileException
IOException
UnsupportedAudioFileException
public boolean removePlaybackListener(PlaybackListener listener)
public void resumePlayback()
public void run()
run
in interface Runnable
run
in class Thread
public void stopPlayback()
public void unMuteChannel(int channel)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |