cnrg.itx.datax.devices
Class AudioProperty

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

public class AudioProperty
extends java.lang.Object
implements Property

Class that models the properties of an audio device. This class has information about the audio sampling rate and the sample size.

See Also:
Serialized Form

Field Summary
static int A_LAW
           
static int MU_LAW
           
static int PCM
          Some of the supported audio formats.
 
Constructor Summary
AudioProperty(int sampleRate, int bitsPerSample, int sampleFormat)
          Creates an audioProperty.
 
Method Summary
 PropertiesCollection findOptimal(PropertiesCollection pc)
          Finds the optimal set of properties when merging this property with a properties collection.
 int getBitsPerSample()
          Returns the number of bits that each sample contains.
 int getSampleFormat()
          Get the format of the sample (PCM< MU_LAW, A_LAW).
 int getSampleRate()
          Returns the sample rate in terms of bits per second.
 PropertiesCollection merge(PropertiesCollection pc)
          Merges the audio property in the property collection.
 java.lang.String toString()
          Tranforms this class into String format.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PCM

public static final int PCM
Some of the supported audio formats.

MU_LAW

public static final int MU_LAW

A_LAW

public static final int A_LAW
Constructor Detail

AudioProperty

public AudioProperty(int sampleRate,
                     int bitsPerSample,
                     int sampleFormat)
Creates an audioProperty.
Parameters:
sampleRate - the rate of audio samples, in terms of bytes per second
bitsPerSample - the number of bits that a sample contains. Typical values include 8 or 16
sampleFormat - the format of the sample (PCM, MU_LAW, A_LAW)
Method Detail

getSampleRate

public int getSampleRate()
Returns the sample rate in terms of bits per second.
Returns:
int the sampling rate

getBitsPerSample

public int getBitsPerSample()
Returns the number of bits that each sample contains.
Returns:
int the number of bits per sample

getSampleFormat

public int getSampleFormat()
Get the format of the sample (PCM< MU_LAW, A_LAW).
Returns:
int the sample format

merge

public PropertiesCollection merge(PropertiesCollection pc)
                           throws DataException
Merges the audio property in the property collection.
Specified by:
merge in interface Property
Parameters:
pc - the properties collection to merge the audio property with
Returns:
PropertiesCollection the merged collection of properties
Throws:
DataException - thrown if there are incompatible AudioFormat objects

findOptimal

public PropertiesCollection findOptimal(PropertiesCollection pc)
                                 throws DataException
Finds the optimal set of properties when merging this property with a properties collection.
Specified by:
findOptimal in interface Property
Parameters:
pc - the properties collection to find the optimal properties from
Returns:
PropertiesCollection the optimal properties collection
Throws:
DataException - thrown if there are incompatible AudioFormat objects

toString

public java.lang.String toString()
Tranforms this class into String format.
Returns:
the String depiction of AudioProperty
Overrides:
toString in class java.lang.Object