cnrg.itx.datax.devices
Class SpeakerDestination

java.lang.Object
  |
  +--cnrg.itx.datax.devices.SpeakerDestination

public class SpeakerDestination
extends java.lang.Object
implements Destination

Class to play output to the computer speaker. Uses the jaudio system to communicate with the sound device. Consequently, jaudio.dll must be in your system path.


Field Summary
private  byte[] bData
           
private  boolean bMute
           
private  byte[] bOldData
           
private  boolean bOpen
           
private  int bytesRead
           
(package private)  int iDevice
           
private  int iRead
           
private  JAudioBlock jabBlockToWaitOn
           
private  JAudioBlock jabLastBlock
           
private  JAudioBlock jabTemp
           
private  JAudioDevice jad
           
private  JABQueue qFree
           
private static int QUEUE_SIZE
          JAudioBlock queue size
private  JABQueue qUsed
           
static int SAMPLE_SIZE
          Sample size (MUST use the Channel sample size!)
private  Stats speakerStats
           
 
Constructor Summary
SpeakerDestination()
          Creates a speaker object by acquiring the necessary resources from jaudio.
 
Method Summary
 void close()
          Closes the device.
 PropertiesCollection getProperties()
          Returns a collection of properties supported.
 Stats getStatistics()
          Method to get the statistics for the speaker device.
 boolean mute(boolean mute)
          Mutes the device
 void setPeerProperties(PropertiesCollection pc)
          Interface to set the given properties collection into the device.
 void setProperties(PropertiesCollection pc)
          Sets the given properties collection into the device
 void write(byte[] b)
          Method to write data to the speaker.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

SAMPLE_SIZE

public static final int SAMPLE_SIZE
Sample size (MUST use the Channel sample size!)

QUEUE_SIZE

private static final int QUEUE_SIZE
JAudioBlock queue size

jad

private JAudioDevice jad

jabLastBlock

private JAudioBlock jabLastBlock

jabBlockToWaitOn

private JAudioBlock jabBlockToWaitOn

qUsed

private JABQueue qUsed

qFree

private JABQueue qFree

bMute

private boolean bMute

bOpen

private boolean bOpen

speakerStats

private Stats speakerStats

iDevice

int iDevice

bytesRead

private int bytesRead

jabTemp

private JAudioBlock jabTemp

bData

private byte[] bData

bOldData

private byte[] bOldData

iRead

private int iRead
Constructor Detail

SpeakerDestination

public SpeakerDestination()
                   throws DataException
Creates a speaker object by acquiring the necessary resources from jaudio.
Throws:
DataException - if resources could not be acquired.
Method Detail

write

public void write(byte[] b)
           throws DataException
Method to write data to the speaker.
Specified by:
write in interface Destination
Parameters:
b - the byte array to be written to the speaker
Throws:
DataException - thrown if the size of the data buffer is not valid

close

public void close()
Closes the device.
Specified by:
close in interface Destination

mute

public boolean mute(boolean mute)
Mutes the device
Specified by:
mute in interface Destination
Parameters:
mute - the device

getStatistics

public Stats getStatistics()
Method to get the statistics for the speaker device.
Returns:
Stats the statistics for the speaker device

getProperties

public PropertiesCollection getProperties()
                                   throws DataException
Returns a collection of properties supported.

setProperties

public void setProperties(PropertiesCollection pc)
                   throws DataException
Sets the given properties collection into the device

setPeerProperties

public void setPeerProperties(PropertiesCollection pc)
                       throws DataException
Interface to set the given properties collection into the device. WOrks under the assumption that this is the properties collection of the peer.