Class SampleThread

    • Constructor Detail

      • SampleThread

        public SampleThread​(SampleProvider source,
                            float sampleRate)
        Create an instance and run at sampleRate.
        Parameters:
        source - A SampleProvider
        sampleRate - The sample rate expressed in Hertz (Samples / second)
    • Method Detail

      • isNewSampleAvailable

        public boolean isNewSampleAvailable()
      • fetchSample

        public void fetchSample​(float[] dst,
                                int off)
        Description copied from interface: SampleProvider
        Fetches a sample from a sensor or filter.
        Specified by:
        fetchSample in interface SampleProvider
        Overrides:
        fetchSample in class AbstractFilter
        Parameters:
        dst - The array to store the sample in.
        off - The elements of the sample are stored in the array starting at the offset position.
      • getSampleRate

        public float getSampleRate()
        Returns:
        rate in Hz
      • setSampleRate

        public void setSampleRate​(float rate)
        Parameters:
        rate - in Hz
      • start

        public void start()
        Start the sampling (Default at instantiation)
      • stop

        public void stop()
        Stop the sampling