public class Resampler
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Resampler.Result |
Constructor and Description |
---|
Resampler(boolean highQuality,
double minFactor,
double maxFactor)
Create a new resampling session.
|
Resampler(Resampler other)
Clone an existing resampling session.
|
Modifier and Type | Method and Description |
---|---|
int |
getFilterWidth() |
Resampler.Result |
process(double factor,
float[] inBuffer,
int inBufferOffset,
int inBufferLen,
boolean lastBatch,
float[] outBuffer,
int outBufferOffset,
int outBufferLen)
Process a batch of samples.
|
boolean |
process(double factor,
java.nio.FloatBuffer inputBuffer,
boolean lastBatch,
java.nio.FloatBuffer outputBuffer)
Process a batch of samples.
|
boolean |
process(double factor,
be.tarsos.dsp.resample.SampleBuffers buffers,
boolean lastBatch)
Process a batch of samples.
|
public Resampler(Resampler other)
other
- public Resampler(boolean highQuality, double minFactor, double maxFactor)
highQuality
- true for better quality, slower processing timeminFactor
- lower bound on resampling factor for this sessionmaxFactor
- upper bound on resampling factor for this sessionjava.lang.IllegalArgumentException
- if minFactor or maxFactor is not
positive, or if maxFactor is less than minFactorpublic int getFilterWidth()
public boolean process(double factor, be.tarsos.dsp.resample.SampleBuffers buffers, boolean lastBatch)
factor
- factor at which to resample this batchbuffers
- sample buffer for producing input and consuming outputlastBatch
- true if this is known to be the last batch of samplespublic boolean process(double factor, java.nio.FloatBuffer inputBuffer, boolean lastBatch, java.nio.FloatBuffer outputBuffer)
factor
- factor at which to resample this batchinputBuffer
- contains input samples in the range -1.0 to 1.0outputBuffer
- output samples will be deposited herelastBatch
- true if this is known to be the last batch of samplespublic Resampler.Result process(double factor, float[] inBuffer, int inBufferOffset, int inBufferLen, boolean lastBatch, float[] outBuffer, int outBufferOffset, int outBufferLen)
factor
- resampling rate for this batchinBuffer
- array containing input samples in the range -1.0 to 1.0inBufferOffset
- offset into inBuffer at which to start processinginBufferLen
- number of valid elements in the inputBufferlastBatch
- pass true if this is the last batch of samplesoutBuffer
- array to hold the resampled dataoutBufferOffset
- Offset in the output buffer.outBufferLen
- Output buffer length.