|
JavaTM Platform Standard Ed. 6 |
|||||||||
��һ���� ��һ���� | ��� ��� ������ | |||||||||
ժҪ�� Ƕ�� | �ֶ� | ���췽�� | ���� | ��ϸ��Ϣ�� �ֶ� | ���췽�� | ���� |
java.lang.Objectjavax.sound.sampled.AudioFormat
public class AudioFormat
AudioFormat
������������ָ���ض����ݰ��ŵ��ࡣͨ���������Ƶ��ʽ�洢����Ϣ�����Է����ڶ��������������н���λ�ķ�ʽ��
ÿ�������ж���������������ص���Ƶ��ʽ��Դ���طţ������е���Ƶ��ʽָʾ��������������������������͡�����Ŀ�꣨���������У���Ƶ��ʽָ�����ԴӸ��ж�ȡ���������ࡣ��Ȼ�������ļ�Ҳ����Ƶ��ʽ��
���װ AudioFileFormat
AudioFormat
�Լ������ض����ļ�����Ϣ�����Ƶأ�
���� AudioInputStream
AudioFormat
��
AudioFormat
����Ӧ���ֳ��������ļ����뼼������������������ (PCM)��mu-law ����� a-law ���롣��Щ���뼼����Ԥ�ȶ���ģ��������ṩ�߿��Դ����µı������͡��ض���ʽʹ�õı���ͨ���� encoding
�ֶ�������
�������⣬��Ƶ��ʽ��������һ��ָ���������ݰ��ŵ��������ԡ���Щ�������ŵ������������ʡ�������С���ֽ�˳��֡���ʺ�֡��С�����������в�ͬ��������Ƶ�ŵ�����������һ���ŵ����������������ŵ����������ʲ���ÿ�ŵ���ÿ���Ӳ��õ���ѹ“����”������������������������������������ǵ�����������ÿ��˲��ʵ�ʲ�������������һ��������������һ���������������������������Բ���ÿ�����������������Բ����������Ƕ��٣����ʶ�һ�������Ǹ�����ı���;����������Сָʾ���ڴ洢ÿ�����յ�λ��������ֵ�� 8 �� 16������ 16 λ�����������һ���ֽڴ�С���κ��������������ֽ�˳�����Ҫ��ÿ�������е��ֽ�Ҫô�� "little-endian" ��ʽ���У�Ҫô�� "big-endian" ��ʽ���С��������� PCM �ı��룬֡���ڸ���ʱ�������������������������ɣ����֡�Ĵ�С�����ֽ�Ϊ��λ�����ǵ���������С�����ֽ�Ϊ��λ��������������������ʹ����������ı��룬֡����������ϵ��������ѹ�����ݰ����Լ��������������ݡ�������Щ���룬�������ʺ�������С�ڽ����ݽ��뵽 PCM ֮�����ø����ݣ�����������֡���ʺ�֡��С��ȫ��ͬ��
AudioFormat
������������Եļ��ϡ�������һ����ֵ�ԣ������� String
���ͣ��������ֵ��Ϊ�����������ָ��������ʽ�淶����ѹ����ʽ�ı����ʡ�������Ҫ�������������ڷ����ṩ�ߵ�������Ƶ��ʽ��Ϣ�ķ�������ˣ������� matches(AudioFormat)
�����б����ԡ������������Ѱ�װ�ķ����ṩ�ߵķ������� (AudioFormat, AudioFormat) isConversionSupported
�����Կ���ʹ�����ԣ�����ȡ���ڸ��Եķ����ṩ��ʵ�֡�
�±��г��˷����ṩ��Ӧ��ʹ�õ�һЩ�������ԣ�������ã���
���Լ� | ֵ���� | ���� |
---|---|---|
“������” | Integer |
��λÿ��Ϊ��λ��ƽ�������� |
“�ɱ������” | Boolean |
����ļ����ÿɱ������ (VBR) ���б��룬��Ϊ true |
“����” | Integer |
����/ת��������1 �� 100 |
���������ṩ�ߣ�������Ĺ�Ӧ��Ѱ�ҹ��������Ѿ��ڵ���������н��������Ե���Ϣ������ѭ��ͬ��Լ����
DataLine.getFormat()
,
AudioInputStream.getFormat()
,
AudioFileFormat
,
FormatConversionProvider
Ƕ����ժҪ | |
---|---|
static class |
AudioFormat.Encoding
Encoding ������������Ƶ�������ݱ�ʾ��ʽ���ض����͡� |
�ֶ�ժҪ | |
---|---|
protected boolean |
bigEndian
ָʾ���� big-endian ˳���� little-endian ˳��洢��Ƶ���ݡ� |
protected int |
channels
ʹ�ô˸�ʽ����Ƶ�ŵ�����������Ϊ 1��������Ϊ 2���� |
protected AudioFormat.Encoding |
encoding
�˸�ʽʹ�õ���Ƶ���뼼���� |
protected float |
frameRate
���д˸�ʽ������ÿ�벥�ź�¼�Ƶ�֡���� |
protected int |
frameSize
ÿ�����д˸�ʽ������֡�������ֽ����� |
protected float |
sampleRate
���д˸�ʽ������ÿ�벥�Ż�¼�Ƶ��������� |
protected int |
sampleSizeInBits
ÿ�����д˸�ʽ�����������е�λ���� |
���췽��ժҪ | |
---|---|
AudioFormat(AudioFormat.Encoding encoding,
float sampleRate,
int sampleSizeInBits,
int channels,
int frameSize,
float frameRate,
boolean bigEndian)
�������������� AudioFormat �� |
|
AudioFormat(AudioFormat.Encoding encoding,
float sampleRate,
int sampleSizeInBits,
int channels,
int frameSize,
float frameRate,
boolean bigEndian,
Map<String,Object> properties)
�������������� AudioFormat �� |
|
AudioFormat(float sampleRate,
int sampleSizeInBits,
int channels,
boolean signed,
boolean bigEndian)
����������� PCM ������������� AudioFormat �� |
����ժҪ | |
---|---|
int |
getChannels()
��ȡ�ŵ����� |
AudioFormat.Encoding |
getEncoding()
��ȡ�˸�ʽ�����ı������͡� |
float |
getFrameRate()
��ȡ��֡ÿ��Ϊ��λ��֡���ʡ� |
int |
getFrameSize()
��ȡ���ֽ�Ϊ��λ��֡��С�� |
Object |
getProperty(String key)
��ȡ��ָ��������ֵ�� |
float |
getSampleRate()
��ȡ�������ʡ� |
int |
getSampleSizeInBits()
��ȡ�����Ĵ�С�� |
boolean |
isBigEndian()
ָʾ���� big-endian ˳������ little-endian ˳��洢��Ƶ���ݡ� |
boolean |
matches(AudioFormat format)
ָʾ�˸�ʽ�Ƿ���ָ����ʽƥ�䡣 |
Map<String,Object> |
properties()
��ȡ�����ĵ�����ӳ�䡣 |
String |
toString()
����������ʽ���ַ������磺"PCM SIGNED 22050 Hz 16 bit mono big-endian"�� |
���� java.lang.Object �̳еķ��� |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
�ֶ���ϸ��Ϣ |
---|
protected AudioFormat.Encoding encoding
protected float sampleRate
protected int sampleSizeInBits
protected int channels
protected int frameSize
protected float frameRate
protected boolean bigEndian
���췽����ϸ��Ϣ |
---|
public AudioFormat(AudioFormat.Encoding encoding, float sampleRate, int sampleSizeInBits, int channels, int frameSize, float frameRate, boolean bigEndian)
AudioFormat
���ñ���ָ�����ڱ�ʾ���ݵ�Լ��������������������
�н�һ�����͡�
encoding
- ��Ƶ���뼼��sampleRate
- ÿ���������sampleSizeInBits
- ÿ�������е�λ��channels
- �������������� 1 ���������� 2 �����ȵȣ�frameSize
- ÿ֡�е��ֽ���frameRate
- ÿ���֡��bigEndian
- ָʾ�Ƿ��� big-endian �ֽ�˳��洢���������е����ݣ�false
��� little-endian����public AudioFormat(AudioFormat.Encoding encoding, float sampleRate, int sampleSizeInBits, int channels, int frameSize, float frameRate, boolean bigEndian, Map<String,Object> properties)
AudioFormat
���ñ���ָ�����ڱ�ʾ���ݵ�Լ��������������������
�н�һ�����͡�
encoding
- ��Ƶ���뼼��sampleRate
- ÿ��������sampleSizeInBits
- ÿ�������е�λ��channels
- ��������������Ϊ 1��������Ϊ 2���ȵȣ�frameSize
- ÿ֡�������ֽ���frameRate
- ÿ��֡��bigEndian
- ָʾ�Ƿ��� big-endian �ֽ�˳��洢���ݣ�false
��� little-endian��properties
- ������ʽ���Ե� Map<String,Object>
����public AudioFormat(float sampleRate, int sampleSizeInBits, int channels, boolean signed, boolean bigEndian)
AudioFormat
����֡��С����Ϊ����ÿ������һ������������ֽ�������֡��������Ϊ�������ʡ�
sampleRate
- ÿ���������sampleSizeInBits
- ÿ�������е�λ��channels
- �������������� 1 ���������� 2 ����signed
- ָʾ�������з��ŵģ��������ŵ�bigEndian
- ָʾ�Ƿ��� big-endian �ֽ�˳��洢���������е����ݣ�false
��ζ�� little-endian����������ϸ��Ϣ |
---|
public AudioFormat.Encoding getEncoding()
AudioFormat.Encoding.PCM_SIGNED
,
AudioFormat.Encoding.PCM_UNSIGNED
,
AudioFormat.Encoding.ULAW
,
AudioFormat.Encoding.ALAW
public float getSampleRate()
AudioSystem.isConversionSupported
�����ܣ��� DataLine.Info.getFormats
��ʱ��AudioSystem.NOT_SPECIFIED
������������ζ�ſ��Խ����κ��������ʡ���û��Ϊ����Ƶ��ʽ������������ʱ�����᷵�� AudioSystem.NOT_SPECIFIED
��
AudioSystem.NOT_SPECIFIED
getFrameRate()
,
AudioSystem.NOT_SPECIFIED
public int getSampleSizeInBits()
AudioSystem.isConversionSupported
�����ܣ��� DataLine.Info.getFormats
��ʱ��AudioSystem.NOT_SPECIFIED
��������С��ζ�ſ��Խ����κ�������С����û��Ϊ����Ƶ��ʽ����������Сʱ�����᷵�� AudioSystem.NOT_SPECIFIED
��
AudioSystem.NOT_SPECIFIED
getFrameSize()
,
AudioSystem.NOT_SPECIFIED
public int getChannels()
AudioSystem.isConversionSupported
�����ܣ��� DataLine.Info.getFormats
��ʱ��AudioSystem.NOT_SPECIFIED
�ķ���ֵ��ζ�ſ��Խ����κΣ������������ŵ���
AudioSystem.NOT_SPECIFIED
AudioSystem.NOT_SPECIFIED
public int getFrameSize()
AudioSystem.isConversionSupported
�����ܣ��� DataLine.Info.getFormats
��ʱ��AudioSystem.NOT_SPECIFIED
��֡��С��ζ�ſ��Խ����κ�֡��С����û��Ϊ����Ƶ��ʽ����֡��Сʱ�����᷵�� AudioSystem.NOT_SPECIFIED
��
AudioSystem.NOT_SPECIFIED
getSampleSizeInBits()
,
AudioSystem.NOT_SPECIFIED
public float getFrameRate()
AudioSystem.isConversionSupported
�����ܣ��� DataLine.Info.getFormats
��ʱ��AudioSystem.NOT_SPECIFIED
��֡������ζ�ſ��Խ����κ�֡���ʡ���û��Ϊ����Ƶ��ʽ����֡����ʱ�����᷵�� AudioSystem.NOT_SPECIFIED
��
AudioSystem.NOT_SPECIFIED
getSampleRate()
,
AudioSystem.NOT_SPECIFIED
public boolean isBigEndian()
true
������� little-endian ˳���� false
public Map<String,Object> properties()
������
��һ�����͡�
Map<String,Object>
���������ʶ���κ����ԣ��ؿ�ӳ�䡣getProperty(String)
public Object getProperty(String key)
������
��һ�����͡�
���ָ�����Բ���Ϊ�ض��ļ���ʽ����ģ���˷������� null
��
key
- �������Եļ�
null
��properties
public boolean matches(AudioFormat format)
AudioSystem.NOT_SPECIFIED
����ʾ�κβ������ʾ�ƥ�䣩���������ָ�ʽ�����������ͬ�IJ������ʡ����ָ����ʽ��֡���ʲ�Ϊ AudioSystem.NOT_SPECIFIED
������ߵ�֡���ʱ��������ȡ����������С����һ���ֽڣ����ֽڴ洢˳��big-endian �� little-endian������ƥ�䡣
format
- Ҫ�����Ƿ�ƥ��ĸ�ʽ
true
�������� false
��public String toString()
Object
�е� toString
|
JavaTM Platform Standard Ed. 6 |
|||||||||
��һ���� ��һ���� | ��� ��� ������ | |||||||||
ժҪ�� Ƕ�� | �ֶ� | ���췽�� | ���� | ��ϸ��Ϣ�� �ֶ� | ���췽�� | ���� |
��Ȩ���� 2007 Sun Microsystems, Inc. ��������Ȩ���� ����������֤��������������ĵ����·ַ�������