game.sound
Class CPlayThread

java.lang.Object
  extended by 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

Field Summary
private static javax.sound.sampled.AudioFormat AUDIO_FORMAT
           
private  byte[] m_aByteSoundData
           
private  int m_nbRetries
           
private  javax.sound.sampled.SourceDataLine m_sourceDataLine
           
private  java.lang.Thread m_thread
           
private static int NB_ALLOWED_CONSECUTIVE_MISS
           
 
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
 

Field Detail

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
Constructor Detail

CPlayThread

CPlayThread(byte[] soundData,
            javax.sound.sampled.SourceDataLine sdl)
Constructor.

Parameters:
soundData - : the sound to be played by the thread
sdl - : the SourceDataLine that will handle the sound stream. Provided by CSoundPlayer.
Method Detail

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