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
static int SAMPLE_SIZE
          Sample size (MUST use the Channel sample size!)
 
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
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SAMPLE_SIZE

public static final int SAMPLE_SIZE
Sample size (MUST use the Channel sample size!)
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.