public static class SampleRateConversionProvider.SampleRateConverterStream extends AudioInputStream implements FloatSampleInput
Modifier and Type | Field and Description |
---|---|
static int |
LINEAR_INTERPOLATION
Conversion algorithm
|
static int |
RESAMPLE
Conversion algorithm
|
static int |
SAMPLE_AND_HOLD
Conversion algorithm
|
Constructor and Description |
---|
SampleRateConversionProvider.SampleRateConverterStream(AudioInputStream sourceStream,
AudioFormat targetFormat) |
SampleRateConversionProvider.SampleRateConverterStream(FloatSampleInput sourceInput,
AudioFormat targetFormat,
long frameLength) |
Modifier and Type | Method and Description |
---|---|
int |
available() |
void |
close() |
void |
flush()
Flushes the internal buffers
|
int |
getChannels() |
int |
getConversionAlgorithm() |
int |
getFrameSize() |
float |
getSampleRate() |
int |
getSourceFrameSize() |
float |
getTargetSampleRate() |
boolean |
isClosed() |
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)
Read nLength bytes that will be the converted samples of the original
inputStream.
|
void |
read(FloatSampleBuffer outBuffer)
Fill the entire buffer with audio data.
|
void |
read(FloatSampleBuffer outBuffer,
int offset,
int count)
Main read method.
|
void |
reset() |
void |
setConversionAlgorithm(int algo) |
void |
setTargetSampleRate(float sr) |
long |
skip(long nSkip) |
getFormat, getFrameLength
public static final int SAMPLE_AND_HOLD
public static final int LINEAR_INTERPOLATION
public static final int RESAMPLE
public SampleRateConversionProvider.SampleRateConverterStream(AudioInputStream sourceStream, AudioFormat targetFormat)
public SampleRateConversionProvider.SampleRateConverterStream(FloatSampleInput sourceInput, AudioFormat targetFormat, long frameLength)
public int getChannels()
getChannels
in interface FloatSampleInput
public float getSampleRate()
getSampleRate
in interface FloatSampleInput
public boolean isDone()
FloatSampleInput
isDone
in interface FloatSampleInput
public void read(FloatSampleBuffer outBuffer)
FloatSampleInput
The buffer's channel count and sample rate may not be changed by the implementation of this method.
read
in interface FloatSampleInput
outBuffer
- the buffer to be filledpublic void read(FloatSampleBuffer outBuffer, int offset, int count)
conversionAlgorithm
. At most
outBuffer.getSampleCount() are converted. In general, if
outBuffer.getSampleCount()) is less after processing this function,
then it is an indicator that it was the last block to be processed.read
in interface FloatSampleInput
outBuffer
- the buffer that the converted samples will be
written to.offset
- the start index, in samples, where to start filling the
buffercount
- the number fo samples to fill into the bufferjava.lang.IllegalArgumentException
- when outBuffer's channel count does
not matchsetConversionAlgorithm(int)
public int getFrameSize()
public int getSourceFrameSize()
public int read() throws java.io.IOException
read
in class AudioInputStream
java.io.IOException
public int read(byte[] abData) throws java.io.IOException
read
in class AudioInputStream
java.io.IOException
read(byte[], int, int)
public int read(byte[] abData, int nOffset, int nLength) throws java.io.IOException
read
in class AudioInputStream
java.io.IOException
public long skip(long nSkip) throws java.io.IOException
skip
in class AudioInputStream
java.io.IOException
public int available() throws java.io.IOException
available
in class AudioInputStream
java.io.IOException
public void mark(int readlimit)
mark
in class AudioInputStream
public void reset() throws java.io.IOException
reset
in class AudioInputStream
java.io.IOException
public boolean markSupported()
markSupported
in class AudioInputStream
public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class AudioInputStream
public boolean isClosed()
public void flush()
public void setTargetSampleRate(float sr)
public void setConversionAlgorithm(int algo)
public float getTargetSampleRate()
public int getConversionAlgorithm()