micromod.resamplers
Interface Resampler

All Known Implementing Classes:
FIRResampler, LinearResampler

public interface Resampler

The Resampler interface specifies a pure resampling algorithm. The algorithm need not maintain any state between invocations, making implementations of resamplers far more straight-forward. As an added advantage, the resampling loop (where most of the cpu time is spent) can be made tighter. Since an implementation need not have to maintain a state, a single instance of a Resampler can be used for all channels, and this may be switched on the fly.


Field Summary
static int FIXED_POINT_BITMASK
           
static int FIXED_POINT_ONE
           
static int FIXED_POINT_SHIFT
           
 
Method Summary
 int getCushionSize()
          Return minimum number of samples required by the resampler before and after the audio to be processed.
 void resample(short[] inputBuf, int samplePos, int subSamplePos, int step, int subStep, short[] outputBuf, int position, int length)
          Resample the audio in inputBuf to outputBuf.
 

Field Detail

FIXED_POINT_SHIFT

public static final int FIXED_POINT_SHIFT
See Also:
Constant Field Values

FIXED_POINT_ONE

public static final int FIXED_POINT_ONE
See Also:
Constant Field Values

FIXED_POINT_BITMASK

public static final int FIXED_POINT_BITMASK
See Also:
Constant Field Values
Method Detail

resample

public void resample(short[] inputBuf,
                     int samplePos,
                     int subSamplePos,
                     int step,
                     int subStep,
                     short[] outputBuf,
                     int position,
                     int length)
Resample the audio in inputBuf to outputBuf. The resampler should be able to deal correctly with a length of at least 1.

Parameters:
samplePos - The index of the sample in inputBuf
subSamplePos - The fractional part of the index, in 16 bit fixed point.
step - The integer part of the number of input samples per output sample.
subStep - The fractional part of the number of input samples per output sample. The value is in 16 bit fixed point.
position - The index of the output buffer to start writing to.
length - The number of samples of output to produce.

getCushionSize

public int getCushionSize()
Return minimum number of samples required by the resampler before and after the audio to be processed. A cubic resampler might return 3, for example.