cnrg.itx.datax.devices
Class MicrophoneSource

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

public class MicrophoneSource
extends java.lang.Object
implements java.lang.Runnable, Source

This class encapsulates the workings of the Microphone. It uses the jaudio subsystem to talk to hardware. Therefore, jaudio.dll must be in your path. .... Talk about usage..


Field Summary
private  boolean bAlive
           
private  boolean bMute
           
private  byte[] bSilence
           
private  int bytesWritten
          Attribute for storing the number of bytes written by this source.
private  Channel c
           
private  int iDevice
           
private  JAudioBlock[] jabBlocks
           
private  JAudioDevice jad
           
private  Stats microphoneStats
           
private static int QUEUE_SIZE
          JAudioBlock queue size
static int SAMPLE_BITS
           
static int SAMPLE_RATE
          Audio properties (8kHz @ 8 bits / sample)
static int SAMPLE_SIZE
          Sample size (just use the Channel sample size, although this isn't required)
static byte SILENCE
           
private  java.lang.Thread thread
           
 
Constructor Summary
MicrophoneSource(Channel c)
          Creates the microphone.
 
Method Summary
 void close()
          stops playout.
 PropertiesCollection getProperties()
          Returns a collection of properties supported.
 Stats getStatistics()
          Method to get the statistics of the microphone device.
 boolean mute(boolean mute)
          Mutes the playout.
 void run()
          Method to run the thread.
 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 (local);
 void start()
          Method to start the thread of the source
 void stop()
          Method to stop the thread.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

SAMPLE_RATE

public static final int SAMPLE_RATE
Audio properties (8kHz @ 8 bits / sample)

SAMPLE_BITS

public static final int SAMPLE_BITS

SILENCE

public static final byte SILENCE

SAMPLE_SIZE

public static final int SAMPLE_SIZE
Sample size (just use the Channel sample size, although this isn't required)

QUEUE_SIZE

private static final int QUEUE_SIZE
JAudioBlock queue size

jad

private JAudioDevice jad

jabBlocks

private JAudioBlock[] jabBlocks

bAlive

private boolean bAlive

bMute

private boolean bMute

bSilence

private byte[] bSilence

thread

private java.lang.Thread thread

bytesWritten

private int bytesWritten
Attribute for storing the number of bytes written by this source.

c

private Channel c

iDevice

private int iDevice

microphoneStats

private Stats microphoneStats
Constructor Detail

MicrophoneSource

public MicrophoneSource(Channel c)
                 throws DataException
Creates the microphone. Allocates all resources.
Throws:
DataException - thrown when resources could not be allocated.
Method Detail

start

public void start()
Method to start the thread of the source
Specified by:
start in interface Source

stop

public void stop()
Method to stop the thread.

run

public void run()
Method to run the thread.
Specified by:
run in interface java.lang.Runnable

close

public void close()
stops playout.
Specified by:
close in interface Source

mute

public boolean mute(boolean mute)
Mutes the playout.
Specified by:
mute in interface Source
Parameters:
mute - The new state.

getStatistics

public Stats getStatistics()
Method to get the statistics of the microphone 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 (local);

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.