Class SampleRateConverter


  • public class SampleRateConverter
    extends com.sedmelluq.lava.common.natives.NativeResourceHolder
    Sample rate converter backed by libsamplerate
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void freeResources()  
      void process​(float[] input, int inputOffset, int inputLength, float[] output, int outputOffset, int outputLength, boolean endOfInput, SampleRateConverter.Progress progress)  
      void reset()
      Reset the converter, makes sure previous data does not affect next incoming data
      • Methods inherited from class com.sedmelluq.lava.common.natives.NativeResourceHolder

        checkNotReleased, close, finalize
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SampleRateConverter

        public SampleRateConverter​(SampleRateConverter.ResamplingType type,
                                   int channels,
                                   int sourceRate,
                                   int targetRate)
        Parameters:
        type - Resampling type
        channels - Number of channels
        sourceRate - Source sample rate
        targetRate - Target sample rate
    • Method Detail

      • reset

        public void reset()
        Reset the converter, makes sure previous data does not affect next incoming data
      • process

        public void process​(float[] input,
                            int inputOffset,
                            int inputLength,
                            float[] output,
                            int outputOffset,
                            int outputLength,
                            boolean endOfInput,
                            SampleRateConverter.Progress progress)
        Parameters:
        input - Input buffer
        inputOffset - Offset for input buffer
        inputLength - Length for input buffer
        output - Output buffer
        outputOffset - Offset for output buffer
        outputLength - Length for output buffer
        endOfInput - If this is the last piece of input
        progress - Instance that is filled with the progress
      • freeResources

        protected void freeResources()
        Specified by:
        freeResources in class com.sedmelluq.lava.common.natives.NativeResourceHolder