public class WaveFormat extends Object
Modifier and Type | Field and Description |
---|---|
boolean |
bigEndian |
int |
bitsPerSample |
int |
blockAlignment |
int |
bufferSizeInFrames
This is the size in frames of the buffer kept by the Eve VM before being
sent to or after being read from the underlying device.
|
int |
format
This should always be 1 for standard PCM format.
|
int |
numChannels |
int |
periodSizeInFrames
This is the size in frames of the block size used to write
bytes to the underlying device (known as the period).
|
int |
samplesPerSecond |
boolean |
signed |
Constructor and Description |
---|
WaveFormat() |
Modifier and Type | Method and Description |
---|---|
long |
countBytes(long numFrames)
Return the number of bytes used for the specified number of frames.
|
long |
countFramesForBytes(long numBytes)
Return the number of frames covered by the specified number of bytes.
|
long |
countFramesForMicroseconds(long microseconds)
Return the number of frames covered by the specified number of microseconds.
|
long |
countMicroseconds(long numFrames)
Return the number of microseconds that elapse for the specified number of frames.
|
boolean |
equals(Object other)
Returns if this object is considered equal to the other object.
|
int |
frameSize() |
int |
getBytesPerSecond() |
int |
hashCode()
Returns a hashCode for the object.
|
int |
readFrom(InputStream in)
This decodes the WaveFormat from the input stream and leaves the
stream at the start of the raw Wave data.
|
WaveFormat |
setForPCM(boolean stereo,
int samplesPerSecond,
boolean sixteenBits)
Use this to create a WaveFormat that will always be compatible with
.WAV files and with the underlying hardware.
|
String |
toString()
Return a String representation of this object.
|
public int format
public int numChannels
public int samplesPerSecond
public int bitsPerSample
public int blockAlignment
public boolean signed
public boolean bigEndian
public int bufferSizeInFrames
public int periodSizeInFrames
public WaveFormat setForPCM(boolean stereo, int samplesPerSecond, boolean sixteenBits)
stereo
- - true for stereo audio, false for mono.samplesPerSecond
- - sample rate ranging from 44100 for CD quality to 8000 for voice.sixteeenBits
- - true for 16 bit sound, false for 8 bit.public boolean equals(Object other)
Object
public int hashCode()
Object
public int readFrom(InputStream in) throws IOException, IllegalArgumentException
in
- the input stream.IOException
- on error.IllegalArgumentException
- if the stream is NOT wave format.public String toString()
Object
public int frameSize()
public long countBytes(long numFrames)
public long countMicroseconds(long numFrames)
public long countFramesForBytes(long numBytes)
public long countFramesForMicroseconds(long microseconds)
public int getBytesPerSecond()