|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.InputStream
javax.sound.sampled.AudioInputStream
org.tritonus.share.sampled.FloatInputStream
public class FloatInputStream
An implementation of AudioInputStream that implements the FloatSampleInput interface. This is a convenience class to instantly make any AudioInputStream capable of fulfilling the FloatSampleInput interface, or vice versa: make an existing FloatSampleInput class compatible with AudioInputStream.
All calls to FloatSampleInput.read() will cause implicit conversion to FloatSampleBuffer. If the underlying stream implementes FloatSampleInput, the FloatSampleInput.read method is used for reading.
| Field Summary |
|---|
| Fields inherited from class javax.sound.sampled.AudioInputStream |
|---|
format, frameLength, framePos, frameSize, stream |
| Constructor Summary | |
|---|---|
FloatInputStream(AudioInputStream sourceStream)
Create a new FloatInputStream that shadows the sourceStream. |
|
FloatInputStream(FloatSampleInput sourceInput,
AudioFormat format,
long frameLength)
Create a new FloatInputStream that will make the specified FloatSampleInput a complete AudioInputStream. |
|
FloatInputStream(InputStream sourceStream,
AudioFormat format,
long frameLength)
Create a new FloatInputStream that shadows the sourceStream. |
|
| Method Summary | |
|---|---|
int |
available()
|
void |
close()
|
int |
getChannels()
|
float |
getSampleRate()
|
boolean |
isDone()
Determine if this stream has reached its end. |
void |
mark(int readlimit)
|
boolean |
markSupported()
|
int |
read()
|
int |
read(byte[] abData)
|
int |
read(byte[] abData,
int nOffset,
int nLength)
If an underlying InputStream is available, read from it, otherwise read from an underlying FloatSampleInput stream and convert to a byte array. |
void |
read(FloatSampleBuffer outBuffer)
Fill the entire buffer with audio data. |
void |
read(FloatSampleBuffer buffer,
int offset,
int sampleCount)
Fill the specified portion of the buffer with the next audio data to be read. |
protected int |
readBytesFromFloatInput(byte[] abData,
int nOffset,
int nLength)
internal method to read from the underlying InputStream. |
protected int |
readBytesFromInputStream(byte[] abData,
int nOffset,
int nLength)
internal method to read from the underlying InputStream. |
void |
reset()
|
long |
skip(long nSkip)
|
| Methods inherited from class javax.sound.sampled.AudioInputStream |
|---|
getFormat, getFrameLength |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FloatInputStream(AudioInputStream sourceStream)
sourceStream -
IllegalArgumentException - if the stream's format is not compatible
public FloatInputStream(InputStream sourceStream,
AudioFormat format,
long frameLength)
sourceStream - format - the native format of sourceStreamframeLength - the length in frames of the streams, or
AudioSystem.NOT_SPECIFIED if not known or unlimited.
IllegalArgumentException - if the stream's format is not compatible
public FloatInputStream(FloatSampleInput sourceInput,
AudioFormat format,
long frameLength)
sourceInput - format - the native format for the read(byte[]) methodframeLength - the length in frames of the stream, or
AudioSystem.NOT_SPECIFIED if not known or unlimited.
IllegalArgumentException - if the format is not compatible| Method Detail |
|---|
public void read(FloatSampleBuffer outBuffer)
FloatSampleInputThe buffer's channel count and sample rate may not be changed by the implementation of this method.
read in interface FloatSampleInputoutBuffer - the buffer to be filled
public void read(FloatSampleBuffer buffer,
int offset,
int sampleCount)
FloatSampleInputoffset.
The buffer's channel count and sample rate may not be changed by the implementation of this method.
read in interface FloatSampleInputbuffer - the buffer to be filledoffset - the start index, in samples, where to start filling the
buffersampleCount - the number fo samples to fill into the bufferpublic int getChannels()
getChannels in interface FloatSampleInputpublic float getSampleRate()
getSampleRate in interface FloatSampleInputpublic boolean isDone()
FloatSampleInput
isDone in interface FloatSampleInput
public int read()
throws IOException
read in class AudioInputStreamIOException
public int read(byte[] abData)
throws IOException
read in class AudioInputStreamIOExceptionread(byte[], int, int)
public int read(byte[] abData,
int nOffset,
int nLength)
throws IOException
read in class AudioInputStreamIOException
protected int readBytesFromInputStream(byte[] abData,
int nOffset,
int nLength)
throws IOException
IOException
protected int readBytesFromFloatInput(byte[] abData,
int nOffset,
int nLength)
throws IOException
abData - the byte array to fill, or null if just skipping
IOException
public long skip(long nSkip)
throws IOException
skip in class AudioInputStreamIOException
public int available()
throws IOException
available in class AudioInputStreamIOExceptionpublic void mark(int readlimit)
mark in class AudioInputStream
public void reset()
throws IOException
reset in class AudioInputStreamIOExceptionpublic boolean markSupported()
markSupported in class AudioInputStream
public void close()
throws IOException
close in interface Closeableclose in class AudioInputStreamIOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||