Class JSoundCardAudioListener

java.lang.Object
  |
  +--JSoundCardAudioListener
All Implemented Interfaces:
javax.speech.AudioListener, ElanAudioListener, java.util.EventListener

public class JSoundCardAudioListener
extends java.lang.Object
implements ElanAudioListener

A basic implementation of com.elantts.tts.jsapi.ElanAudioListener writing sound in soundcard buffer.


Constructor Summary
JSoundCardAudioListener()
          Creates a new instance of JSoundCardAudioListener
 
Method Summary
protected  void finalize()
          Called when the JSoundCard listener is no more referenced (garbage collector).
 int getFreeSpace()
          should return the available bytes count in the allocated soundcard source data line.
 void setFormat(javax.sound.sampled.AudioFormat Format)
          Register the current required AudioFormat to properly play the received sound.
 void write(byte[] signal, int off, int len)
          Writes byte in soundcard buffer.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSoundCardAudioListener

public JSoundCardAudioListener()
Creates a new instance of JSoundCardAudioListener

Method Detail

setFormat

public void setFormat(javax.sound.sampled.AudioFormat Format)
               throws javax.sound.sampled.LineUnavailableException
Register the current required AudioFormat to properly play the received sound. And try to open a souncard line matching this format.

Parameters:
Format - an AudioFormat matching the selected voice.
Throws:
javax.sound.sampled.LineUnavailableException - Thrown if the format is not supported.

getFreeSpace

public int getFreeSpace()
should return the available bytes count in the allocated soundcard source data line. This sample implementation returns 0x00FFFFFF.

Specified by:
getFreeSpace in interface ElanAudioListener
Returns:
0x00FFFFFF

write

public void write(byte[] signal,
                  int off,
                  int len)
           throws javax.speech.AudioException
Writes byte in soundcard buffer.

Specified by:
write in interface ElanAudioListener
Parameters:
signal - see com.elantts.tts.jsapi.ElanAudioListener definition.
off - see com.elantts.tts.jsapi.ElanAudioListener definition.
len - see com.elantts.tts.jsapi.ElanAudioListener definition.
Throws:
javax.speech.AudioException - see com.elantts.tts.jsapi.ElanAudioListener definition.

finalize

protected void finalize()
Called when the JSoundCard listener is no more referenced (garbage collector). Close the soundcard buffer.

Overrides:
finalize in class java.lang.Object