javax.sound.sampled
Class AudioFormat
This class describes an audio format, including its encoding,
the number of channels, its frame rate, etc.
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.
|
AudioFormat(float sampleRate, int sampleSizeInBits, int channels, boolean signed, boolean bigEndian) - Create a new PCM-based audio format, given various attributes of it.
|
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 properties) - Create a new audio format, given various attributes of it.
|
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
bigEndian
protected boolean bigEndian
True if the audio data is stored big-endian.
channels
protected int channels
The number of channels of data in this format.
frameRate
protected float frameRate
The frame rate of this format. This is the number of frames
per second.
frameSize
protected int frameSize
The number of bytes per frame in this format.
sampleRate
protected float sampleRate
The number of samples per second.
sampleSizeInBits
protected int sampleSizeInBits
The number of bits in each sample.
AudioFormat
public AudioFormat(float sampleRate,
int sampleSizeInBits,
int channels,
boolean signed,
boolean bigEndian)
Create a new PCM-based audio format, given various attributes of it.
The encoding will either be Encoding#PCM_SIGNED or Encoding#PCM_UNSIGNED.
The frame size for this format will be derived from the sample size in
bits and the number of channels, unless one of those is
AudioSystem#NOT_SPECIFIED. The frame rate will be the same as the sample
rate, and the properties map will be empty.
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-endian
AudioFormat
public 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.
The properties map for this format will be empty.
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-endian
AudioFormat
public AudioFormat(AudioFormat.Encoding encoding,
float sampleRate,
int sampleSizeInBits,
int channels,
int frameSize,
float frameRate,
boolean bigEndian,
Map properties)
Create a new audio format, given various attributes of it.
The properties map is copied by this constructor, so changes
to the argument Map will not affect the new object.
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 format
Object> properties
public MapObject> properties()
Return a read-only Map holding the properties associated with
this format.
getChannels
public int getChannels()
Return the number of channels in this format.
getFrameRate
public float getFrameRate()
Return the frame rate of this format.
getFrameSize
public int getFrameSize()
Return the frame size of this format.
getProperty
public Object getProperty(String key)
Given a key, return a property associated with this format;
or null if this property is not set.
key
- the name of the property
- the value of the property, or null if the property is not set
getSampleRate
public float getSampleRate()
Return the sample rate of this format.
getSampleSizeInBits
public int getSampleSizeInBits()
Return the sample size of this format, in bits.
isBigEndian
public boolean isBigEndian()
Return true if this format is big endian, false otherwise.
This only matters for formats whose sample size is greater than
one byte.
matches
public boolean matches(AudioFormat fmt)
Return true if this audio format matches another.
fmt
- the format to match against
- true if they match, false otherwise
An audio format
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.