public class PlaybackThread
extends java.lang.Thread
Modifier and Type | Field and Description |
---|---|
(package private) boolean[] |
aEmpty
Flag if channel is empty: in this case, there will be silence on the respective channel
|
(package private) java.io.File[][] |
aFiles
Files to play
|
protected javax.sound.sampled.AudioInputStream[] |
ain |
(package private) java.awt.Point[] |
aPos |
(package private) boolean[] |
aWaitForDecoder
Flag: if
true , then the respective channel is waiting for a DecoderThread to finish. |
(package private) boolean |
bOtherChannelAlreadyFinished
(if bRepeat == false): if the first channel's musicfile stops, it is set to true.
|
protected boolean |
bQuitLoop |
(package private) boolean |
bRepeat_Shuffle
Flag: if true, then music is played endlessly, alwas repeating.
|
protected byte[][] |
buffer |
(package private) boolean |
bUpdStats
Flag: if false, no global statistic variable will be updated by this Thread
|
protected byte[] |
datalinebuffer |
protected int |
datalineframesize |
protected java.io.File |
file1 |
protected java.io.File |
file2 |
(package private) java.lang.String |
id |
protected javax.sound.sampled.SourceDataLine |
line |
protected int |
monoframesize |
(package private) float |
p_decode
Probability to decode a mp3 file to wav
|
protected boolean |
ready |
private boolean |
threadSuspended |
Constructor and Description |
---|
PlaybackThread(java.lang.String id,
TPlaybackThreadDataRecord record,
javax.sound.sampled.SourceDataLine line)
Convenience constructur that takes a
TPlaybackThreadDataRecord and pulls all data from it to create
a new thread |
PlaybackThread(java.lang.String id,
TPlaybackThreadDataRecord record,
javax.sound.sampled.SourceDataLine line,
boolean bRepeat,
float p_decode) |
PlaybackThread(java.lang.String id,
TPlaybackThreadDataRecord record,
javax.sound.sampled.SourceDataLine line,
boolean bRepeat,
float p_decode,
boolean bUpdStats) |
Modifier and Type | Method and Description |
---|---|
void |
decodingFailed(int channel,
boolean stats) |
void |
decodingFinished(java.io.File file,
int channel,
boolean stats,
DecoderThread dt) |
javax.sound.sampled.AudioInputStream |
getNextSong(int channel,
boolean stats) |
protected void |
log_fine(java.lang.String msg) |
protected void |
log_info(java.lang.String msg) |
protected void |
log_warning(java.lang.String msg) |
void |
muteChannel(int channel) |
void |
pause_playback() |
javax.sound.sampled.AudioInputStream |
prepareAin(java.io.File file,
int channel,
boolean stats) |
void |
resume_playback() |
void |
run() |
void |
stop_playback() |
void |
unmuteChannel(int channel) |
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
java.lang.String id
java.awt.Point[] aPos
java.io.File[][] aFiles
boolean[] aEmpty
boolean[] aWaitForDecoder
true
, then the respective channel is waiting for a DecoderThread
to finish.boolean bRepeat_Shuffle
If false, then on each channel there will be played each song in the list, from the first to the last, then exit.
boolean bUpdStats
float p_decode
boolean bOtherChannelAlreadyFinished
If the second channel's musicfile stops, this thread is stopped.
private boolean threadSuspended
protected java.io.File file1
protected java.io.File file2
protected javax.sound.sampled.SourceDataLine line
protected javax.sound.sampled.AudioInputStream[] ain
protected boolean ready
protected boolean bQuitLoop
protected int datalineframesize
protected int monoframesize
protected byte[][] buffer
protected byte[] datalinebuffer
public PlaybackThread(java.lang.String id, TPlaybackThreadDataRecord record, javax.sound.sampled.SourceDataLine line, boolean bRepeat, float p_decode, boolean bUpdStats)
public PlaybackThread(java.lang.String id, TPlaybackThreadDataRecord record, javax.sound.sampled.SourceDataLine line, boolean bRepeat, float p_decode)
public PlaybackThread(java.lang.String id, TPlaybackThreadDataRecord record, javax.sound.sampled.SourceDataLine line)
TPlaybackThreadDataRecord
and pulls all data from it to create
a new thread
Note the constructor call that looks quite crazy with all its necessary casts.
public void muteChannel(int channel)
public void unmuteChannel(int channel)
public javax.sound.sampled.AudioInputStream getNextSong(int channel, boolean stats) throws java.io.IOException, javax.sound.sampled.UnsupportedAudioFileException
java.io.IOException
javax.sound.sampled.UnsupportedAudioFileException
public javax.sound.sampled.AudioInputStream prepareAin(java.io.File file, int channel, boolean stats) throws java.io.IOException, javax.sound.sampled.UnsupportedAudioFileException
java.io.IOException
javax.sound.sampled.UnsupportedAudioFileException
public void decodingFinished(java.io.File file, int channel, boolean stats, DecoderThread dt)
public void decodingFailed(int channel, boolean stats)
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public void stop_playback()
public void pause_playback()
public void resume_playback()
protected void log_fine(java.lang.String msg)
protected void log_info(java.lang.String msg)
protected void log_warning(java.lang.String msg)