public static class SampleRateConversionProvider.SampleRateConverterStream
extends javax.sound.sampled.AudioInputStream
implements org.tritonus.share.sampled.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 |
---|
SampleRateConverterStream(javax.sound.sampled.AudioInputStream sourceStream,
javax.sound.sampled.AudioFormat targetFormat) |
SampleRateConverterStream(org.tritonus.share.sampled.FloatSampleInput sourceInput,
javax.sound.sampled.AudioFormat targetFormat,
long frameLength) |
Modifier and Type | Method and Description |
---|---|
int |
available() |
void |
close() |
protected void |
convertLinearInterpolation1(float[] inSamples,
double inSampleOffset,
int inSampleCount,
double increment,
float[] outSamples,
int outSampleOffset,
int outSampleCount,
float[] history,
int historyLength) |
protected void |
convertSampleAndHold1(float[] inSamples,
double inSampleOffset,
int inSampleCount,
double increment,
float[] outSamples,
int outSampleOffset,
int outSampleCount,
float[] history,
int historyLength) |
void |
flush()
Flushes the internal buffers
|
int |
getChannels() |
int |
getConversionAlgorithm() |
int |
getFrameSize() |
float |
getSampleRate() |
int |
getSourceFrameSize() |
float |
getTargetSampleRate() |
boolean |
isClosed() |
boolean |
isDone() |
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(org.tritonus.share.sampled.FloatSampleBuffer outBuffer) |
void |
read(org.tritonus.share.sampled.FloatSampleBuffer outBuffer,
int offset,
int count)
Main read method.
|
void |
reset() |
void |
setConversionAlgorithm(int algo) |
void |
setTargetSampleRate(float sr) |
long |
skip(long nSkip) |
protected long |
sourceBytes2targetBytes(long sourceBytes) |
protected double |
sourceFrames2targetFrames(double sourceFrames) |
protected long |
targetBytes2sourceBytes(long targetBytes) |
protected double |
targetFrames2sourceFrames(double targetFrames) |
public static final int SAMPLE_AND_HOLD
public static final int LINEAR_INTERPOLATION
public static final int RESAMPLE
public SampleRateConverterStream(javax.sound.sampled.AudioInputStream sourceStream, javax.sound.sampled.AudioFormat targetFormat)
public SampleRateConverterStream(org.tritonus.share.sampled.FloatSampleInput sourceInput, javax.sound.sampled.AudioFormat targetFormat, long frameLength)
protected void convertSampleAndHold1(float[] inSamples, double inSampleOffset, int inSampleCount, double increment, float[] outSamples, int outSampleOffset, int outSampleCount, float[] history, int historyLength)
protected void convertLinearInterpolation1(float[] inSamples, double inSampleOffset, int inSampleCount, double increment, float[] outSamples, int outSampleOffset, int outSampleCount, float[] history, int historyLength)
public int getChannels()
getChannels
in interface org.tritonus.share.sampled.FloatSampleInput
public float getSampleRate()
getSampleRate
in interface org.tritonus.share.sampled.FloatSampleInput
public boolean isDone()
isDone
in interface org.tritonus.share.sampled.FloatSampleInput
public void read(org.tritonus.share.sampled.FloatSampleBuffer outBuffer)
read
in interface org.tritonus.share.sampled.FloatSampleInput
public void read(org.tritonus.share.sampled.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 org.tritonus.share.sampled.FloatSampleInput
outBuffer
- the buffer that the converted samples will be
written to.java.lang.IllegalArgumentException
- when outBuffer's channel count does
not matchsetConversionAlgorithm(int)
protected double sourceFrames2targetFrames(double sourceFrames)
protected double targetFrames2sourceFrames(double targetFrames)
protected long sourceBytes2targetBytes(long sourceBytes)
protected long targetBytes2sourceBytes(long targetBytes)
public int getFrameSize()
public int getSourceFrameSize()
public int read() throws java.io.IOException
read
in class javax.sound.sampled.AudioInputStream
java.io.IOException
public int read(byte[] abData) throws java.io.IOException
read
in class javax.sound.sampled.AudioInputStream
java.io.IOException
read(byte[], int, int)
public int read(byte[] abData, int nOffset, int nLength) throws java.io.IOException
read
in class javax.sound.sampled.AudioInputStream
java.io.IOException
public long skip(long nSkip) throws java.io.IOException
skip
in class javax.sound.sampled.AudioInputStream
java.io.IOException
public int available() throws java.io.IOException
available
in class javax.sound.sampled.AudioInputStream
java.io.IOException
public void mark(int readlimit)
mark
in class javax.sound.sampled.AudioInputStream
public void reset() throws java.io.IOException
reset
in class javax.sound.sampled.AudioInputStream
java.io.IOException
public boolean markSupported()
markSupported
in class javax.sound.sampled.AudioInputStream
public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class javax.sound.sampled.AudioInputStream
public boolean isClosed()
public void flush()
public void setTargetSampleRate(float sr)
public void setConversionAlgorithm(int algo)
public float getTargetSampleRate()
public int getConversionAlgorithm()