javax.sound.sampled
Class AudioFormat.Encoding

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by javax.sound.sampled.AudioFormat.Encoding
Enclosing class:
AudioFormat sample code for javax.sound.sampled.AudioFormat definition code for javax.sound.sampled.AudioFormat

public static class AudioFormat.Encoding
extends Object sample code for java.lang.Object definition code for java.lang.Object

The Encoding class names the specific type of data representation used for an audio stream. The encoding includes aspects of the sound format other than the number of channels, sample rate, sample size, frame rate, frame size, and byte order.

One ubiquitous type of audio encoding is pulse-code modulation (PCM), which is simply a linear (proportional) representation of the sound waveform. With PCM, the number stored in each sample is proportional to the instantaneous amplitude of the sound pressure at that point in time. The numbers are frequently signed or unsigned integers. Besides PCM, other encodings include mu-law and a-law, which are nonlinear mappings of the sound amplitude that are often used for recording speech.

You can use a predefined encoding by referring to one of the static objects created by this class, such as PCM_SIGNED or PCM_UNSIGNED. Service providers can create new encodings, such as compressed audio formats or floating-point PCM samples, and make these available through the AudioSystem sample code for javax.sound.sampled.AudioSystem definition code for javax.sound.sampled.AudioSystem class.

The Encoding class is static, so that all AudioFormat objects that have the same encoding will refer to the same object (rather than different instances of the same class). This allows matches to be made by checking that two format's encodings are equal.

Since:
1.3
See Also:
AudioFormat sample code for javax.sound.sampled.AudioFormat definition code for javax.sound.sampled.AudioFormat , FormatConversionProvider sample code for javax.sound.sampled.spi.FormatConversionProvider definition code for javax.sound.sampled.spi.FormatConversionProvider

Field Summary
static AudioFormat.Encoding sample code for javax.sound.sampled.AudioFormat.Encoding definition code for javax.sound.sampled.AudioFormat.Encoding ALAW sample code for javax.sound.sampled.AudioFormat.Encoding.ALAW definition code for javax.sound.sampled.AudioFormat.Encoding.ALAW
          Specifies a-law encoded data.
static AudioFormat.Encoding sample code for javax.sound.sampled.AudioFormat.Encoding definition code for javax.sound.sampled.AudioFormat.Encoding PCM_SIGNED sample code for javax.sound.sampled.AudioFormat.Encoding.PCM_SIGNED definition code for javax.sound.sampled.AudioFormat.Encoding.PCM_SIGNED
          Specifies signed, linear PCM data.
static AudioFormat.Encoding sample code for javax.sound.sampled.AudioFormat.Encoding definition code for javax.sound.sampled.AudioFormat.Encoding PCM_UNSIGNED sample code for javax.sound.sampled.AudioFormat.Encoding.PCM_UNSIGNED definition code for javax.sound.sampled.AudioFormat.Encoding.PCM_UNSIGNED
          Specifies unsigned, linear PCM data.
static AudioFormat.Encoding sample code for javax.sound.sampled.AudioFormat.Encoding definition code for javax.sound.sampled.AudioFormat.Encoding ULAW sample code for javax.sound.sampled.AudioFormat.Encoding.ULAW definition code for javax.sound.sampled.AudioFormat.Encoding.ULAW
          Specifies u-law encoded data.
 
Constructor Summary
AudioFormat.Encoding sample code for javax.sound.sampled.AudioFormat.Encoding.AudioFormat.Encoding(java.lang.String) definition code for javax.sound.sampled.AudioFormat.Encoding.AudioFormat.Encoding(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  name)
          Constructs a new encoding.
 
Method Summary
 boolean equals sample code for javax.sound.sampled.AudioFormat.Encoding.equals(java.lang.Object) definition code for javax.sound.sampled.AudioFormat.Encoding.equals(java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  obj)
          Finalizes the equals method
 int hashCode sample code for javax.sound.sampled.AudioFormat.Encoding.hashCode() definition code for javax.sound.sampled.AudioFormat.Encoding.hashCode() ()
          Finalizes the hashCode method
 String sample code for java.lang.String definition code for java.lang.String toString sample code for javax.sound.sampled.AudioFormat.Encoding.toString() definition code for javax.sound.sampled.AudioFormat.Encoding.toString() ()
          Provides the String representation of the encoding.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Field Detail

PCM_SIGNED sample code for javax.sound.sampled.AudioFormat.Encoding.PCM_SIGNED

public static final AudioFormat.Encoding sample code for javax.sound.sampled.AudioFormat.Encoding definition code for javax.sound.sampled.AudioFormat.Encoding  PCM_SIGNED
Specifies signed, linear PCM data.


PCM_UNSIGNED sample code for javax.sound.sampled.AudioFormat.Encoding.PCM_UNSIGNED

public static final AudioFormat.Encoding sample code for javax.sound.sampled.AudioFormat.Encoding definition code for javax.sound.sampled.AudioFormat.Encoding  PCM_UNSIGNED
Specifies unsigned, linear PCM data.


ULAW sample code for javax.sound.sampled.AudioFormat.Encoding.ULAW

public static final AudioFormat.Encoding sample code for javax.sound.sampled.AudioFormat.Encoding definition code for javax.sound.sampled.AudioFormat.Encoding  ULAW
Specifies u-law encoded data.


ALAW sample code for javax.sound.sampled.AudioFormat.Encoding.ALAW

public static final AudioFormat.Encoding sample code for javax.sound.sampled.AudioFormat.Encoding definition code for javax.sound.sampled.AudioFormat.Encoding  ALAW
Specifies a-law encoded data.

Constructor Detail

AudioFormat.Encoding sample code for javax.sound.sampled.AudioFormat.Encoding(java.lang.String) definition code for javax.sound.sampled.AudioFormat.Encoding(java.lang.String)

public AudioFormat.Encoding(String sample code for java.lang.String definition code for java.lang.String  name)
Constructs a new encoding.

Parameters:
name - the name of the new type of encoding
Method Detail

equals sample code for javax.sound.sampled.AudioFormat.Encoding.equals(java.lang.Object) definition code for javax.sound.sampled.AudioFormat.Encoding.equals(java.lang.Object)

public final boolean equals(Object sample code for java.lang.Object definition code for java.lang.Object  obj)
Finalizes the equals method

Overrides:
equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) in class Object sample code for java.lang.Object definition code for java.lang.Object
Parameters:
obj - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.
See Also:
Object.hashCode() sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , Hashtable sample code for java.util.Hashtable definition code for java.util.Hashtable

hashCode sample code for javax.sound.sampled.AudioFormat.Encoding.hashCode() definition code for javax.sound.sampled.AudioFormat.Encoding.hashCode()

public final int hashCode()
Finalizes the hashCode method

Overrides:
hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() in class Object sample code for java.lang.Object definition code for java.lang.Object
Returns:
a hash code value for this object.
See Also:
Object.equals(java.lang.Object) sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , Hashtable sample code for java.util.Hashtable definition code for java.util.Hashtable

toString sample code for javax.sound.sampled.AudioFormat.Encoding.toString() definition code for javax.sound.sampled.AudioFormat.Encoding.toString()

public final String sample code for java.lang.String definition code for java.lang.String  toString()
Provides the String representation of the encoding. This String is the same name that was passed to the constructor. For the predefined encodings, the name is similar to the encoding's variable (field) name. For example, PCM_SIGNED.toString() returns the name "pcm_signed".

Overrides:
toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() in class Object sample code for java.lang.Object definition code for java.lang.Object
Returns:
the encoding name