public class AudioFormat extends Object
Modifier and Type | Class and Description |
---|---|
static class |
AudioFormat.Encoding
This describes a given audio format encoding.
|
Modifier and Type | Field and Description |
---|---|
protected boolean |
bigEndian
True if the audio data is stored big-endian.
|
protected int |
channels
The number of channels of data in this format.
|
protected AudioFormat.Encoding |
encoding
The encoding of this format.
|
protected float |
frameRate
The frame rate of this format.
|
protected int |
frameSize
The number of bytes per frame in this format.
|
protected float |
sampleRate
The number of samples per second.
|
protected int |
sampleSizeInBits
The number of bits in each sample.
|
Constructor and Description |
---|
AudioFormat(AudioFormat.Encoding encoding,
float sampleRate,
int sampleSizeInBits,
int channels,
int frameSize,
float frameRate,
boolean bigEndian)
Create a new audio format, given various attributes of it.
|
AudioFormat(AudioFormat.Encoding encoding,
float sampleRate,
int sampleSizeInBits,
int channels,
int frameSize,
float frameRate,
boolean bigEndian,
Map<String,Object> properties)
Create a new audio format, given various attributes of it.
|
AudioFormat(float sampleRate,
int sampleSizeInBits,
int channels,
boolean signed,
boolean bigEndian)
Create a new PCM-based audio format, given various attributes of it.
|
Modifier and Type | Method and Description |
---|---|
int |
getChannels()
Return the number of channels in this format.
|
AudioFormat.Encoding |
getEncoding()
Return the encoding of this format.
|
float |
getFrameRate()
Return the frame rate of this format.
|
int |
getFrameSize()
Return the frame size of this format.
|
Object |
getProperty(String key)
Given a key, return a property associated with this format;
or null if this property is not set.
|
float |
getSampleRate()
Return the sample rate of this format.
|
int |
getSampleSizeInBits()
Return the sample size of this format, in bits.
|
boolean |
isBigEndian()
Return true if this format is big endian, false otherwise.
|
boolean |
matches(AudioFormat fmt)
Return true if this audio format matches another.
|
Map<String,Object> |
properties()
Return a read-only Map holding the properties associated with
this format.
|
String |
toString()
Return a description of this format.
|
protected boolean bigEndian
protected int channels
protected AudioFormat.Encoding encoding
protected float frameRate
protected int frameSize
protected float sampleRate
protected int sampleSizeInBits
public AudioFormat(AudioFormat.Encoding encoding, float sampleRate, int sampleSizeInBits, int channels, int frameSize, float frameRate, boolean bigEndian)
encoding
- the encoding for this formatsampleRate
- the sample ratesampleSizeInBits
- the sample size, in bitschannels
- the number of channelsframeSize
- the frame size, in bytesframeRate
- the frame rate, in frames per secondbigEndian
- true if the data is stored big-endianpublic AudioFormat(AudioFormat.Encoding encoding, float sampleRate, int sampleSizeInBits, int channels, int frameSize, float frameRate, boolean bigEndian, Map<String,Object> properties)
encoding
- the encoding for this formatsampleRate
- the sample ratesampleSizeInBits
- the sample size, in bitschannels
- the number of channelsframeSize
- the frame size, in bytesframeRate
- the frame rate, in frames per secondbigEndian
- true if the data is stored big-endianproperties
- a map describing properties of this formatpublic AudioFormat(float sampleRate, int sampleSizeInBits, int channels, boolean signed, boolean bigEndian)
sampleRate
- the sample ratesampleSizeInBits
- the sample size, in bitschannels
- the number of channelssigned
- true if this is a signed encodingbigEndian
- true if the data is stored big-endianpublic int getChannels()
public AudioFormat.Encoding getEncoding()
public float getFrameRate()
public int getFrameSize()
public Object getProperty(String key)
key
- the name of the propertypublic float getSampleRate()
public int getSampleSizeInBits()
public boolean isBigEndian()
public boolean matches(AudioFormat fmt)
fmt
- the format to match againstpublic Map<String,Object> properties()
public String toString()
toString
in class Object
Object.getClass()
,
Object.hashCode()
,
Class.getName()
,
Integer.toHexString(int)