game.sound
Class CPlayThread
java.lang.Object
game.sound.CPlayThread
- All Implemented Interfaces:
- java.lang.Runnable
class CPlayThread
- extends java.lang.Object
- implements java.lang.Runnable
A sound playing thread.
- Author:
- seb
Constructor Summary |
CPlayThread(byte[] soundData,
javax.sound.sampled.SourceDataLine sdl)
Constructor. |
Method Summary |
void |
run()
Stream the sound data to the SourceDataLine. |
void |
start()
Start playing the sound. |
void |
stop()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AUDIO_FORMAT
private static final javax.sound.sampled.AudioFormat AUDIO_FORMAT
NB_ALLOWED_CONSECUTIVE_MISS
private static final int NB_ALLOWED_CONSECUTIVE_MISS
- See Also:
- Constant Field Values
m_aByteSoundData
private final byte[] m_aByteSoundData
m_thread
private volatile java.lang.Thread m_thread
m_sourceDataLine
private volatile javax.sound.sampled.SourceDataLine m_sourceDataLine
m_nbRetries
private int m_nbRetries
CPlayThread
CPlayThread(byte[] soundData,
javax.sound.sampled.SourceDataLine sdl)
- Constructor.
- Parameters:
soundData
- : the sound to be played by the threadsdl
- : the SourceDataLine that will handle the sound stream. Provided by CSoundPlayer.
start
public void start()
- Start playing the sound.
stop
public void stop()
run
public void run()
- Stream the sound data to the SourceDataLine.
- Specified by:
run
in interface java.lang.Runnable