Class AudioFormat.Encoding
- Enclosing class:
AudioFormat
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 may be signed or unsigned integers or floats. 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, and make these available through the
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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final AudioFormat.EncodingSpecifies a-law encoded data.static final AudioFormat.EncodingSpecifies floating-point PCM data.static final AudioFormat.EncodingSpecifies signed, linear PCM data.static final AudioFormat.EncodingSpecifies unsigned, linear PCM data.static final AudioFormat.EncodingSpecifies u-law encoded data. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether the specified object is equal to this encoding, returningtrueif the objects are equal.final inthashCode()Returns a hash code value for this encoding.final StringtoString()Returns encoding's name as the string representation of the encoding.Methods declared in class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.protected voidfinalize()Deprecated, for removal: This API element is subject to removal in a future version.May cause performance issues, deadlocks and hangs.getClass()Answers the unique instance of java.lang.Class which represents the class of the receiver.final voidnotify()Causes one thread which iswaiting on the receiver to be made ready to run.final voidCauses all threads which arewaiting on the receiver to be made ready to run.final voidwait()Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated bynotifyornotifyAll).final voidwait(long time) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.final voidwait(long time, int frac) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.
-
Field Details
-
PCM_SIGNED
Specifies signed, linear PCM data. -
PCM_UNSIGNED
Specifies unsigned, linear PCM data. -
PCM_FLOAT
-
ULAW
Specifies u-law encoded data. -
ALAW
Specifies a-law encoded data.
-
-
Constructor Details
-
Encoding
Constructs a new encoding.- Parameters:
name- the name of the new type of encoding
-
-
Method Details
-
equals
Indicates whether the specified object is equal to this encoding, returningtrueif the objects are equal. -
hashCode
-
toString
Returns encoding's name as the string representation of the encoding. 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".
-