Interface CurveFunctionSoundSampleBuilder

    • Method Detail

      • setTrigonometricFunction

        void setTrigonometricFunction​(Function<Double,Double> aFunction)
        Sets the trigonometric function to be used when generating MonoSample.
        Parameters:
        aFunction - The Function to be set.
      • getTrigonometricFunction

        Function<Double,Double> getTrigonometricFunction​()
        Returns the trigonometric function being used when generating MonoSample instances.
        Returns:
        The Function being set.
      • setIndex

        void setIndex​(int aIndex)
        Sets the index to be used when generating MonoSample instances.
        Parameters:
        aIndex - The index to be set.
      • getIndex

        int getIndex​()
        Returns the index being used when generating MonoSample instances.
        Returns:
        The index being set.
      • setFrequency

        void setFrequency​(double aFrequencyInHz)
        Sets the frequency in Hz to be used when generating MonoSample instances.
        Parameters:
        aFrequencyInHz - The frequency to be set.
      • getFrequency

        double getFrequency​()
        Returns the frequency in Hz being used when generating MonoSample instances.
        Returns:
        The frequency in Hz being set.
      • setAmplitude

        void setAmplitude​(double aAmplitude)
        Sets the amplitude to be used when generating MonoSample instances.
        Parameters:
        aAmplitude - The amplitude to be set.
      • getAmplitude

        double getAmplitude​()
        Returns the amplitude being used when generating MonoSample instances.
        Returns:
        The amplitude being set.
      • setXOffset

        void setXOffset​(int aXOffset)
        Sets the x-offset to be used when generating MonoSample instances.
        Parameters:
        aXOffset - The x-offset to be set.
      • getXOffset

        int getXOffset​()
        Returns the x-offset being used when generating MonoSample instances.
        Returns:
        The x-offset being set.
      • setYOffset

        void setYOffset​(double aYOffset)
        Sets the y-offset to be used when generating MonoSample instances.
        Parameters:
        aYOffset - The y-offset to be set.
      • getYOffset

        double getYOffset​()
        Returns the yOffset being used when generating MonoSample instances.
        Returns:
        The yOffset being set.
      • next

        MonoSample next​()
        Returns the next MonoSample for the current index (as of getIndex()) as well as for the other builder's settings and increases the index by one.
        Returns:
        The next MonoSample being set up.
      • toMonoSample

        MonoSample toMonoSample​()
        Creates a MonoSample as of the builder's settings.
        Returns:
        The sound sample as of the builder's settings.
      • toMonoSample

        MonoSample toMonoSample​(int aIndex)
        Creates a MonoSample for the given index and the the builder's settings.
        Parameters:
        aIndex - The index for which to create the sound sample.
        Returns:
        The sound sample as of the index and the builder's settings.
      • asMonoSample

        static MonoSampleBuilder asMonoSample​(double aIndex,
                                              Function<Double,Double> aFunction,
                                              double aFrequencyHz,
                                              double aAmplitude,
                                              int aXOffset,
                                              double aYOffset,
                                              int aSamplingRate)
        Creates a MonoSample for the given arguments and the given function. Thanks to willemsenzo, May 18, 2017: return Mathf.Sin(2 * Mathf.PI * timeIndex * frequency / sampleRate); See "https://forum.unity.com/threads/generating-a-simple-sinewave.471529"
        Parameters:
        aIndex - The index of the sample to generate.
        aFunction - The function to be applied (sine, cosine, ...).
        aFrequencyHz - The frequency (Hz) to use.
        aAmplitude - The maximum amplitude to produce.
        aXOffset - The x-offset (in samples) to be used.
        aYOffset - The y-offset for the amplitude to be used.
        aSamplingRate - The samples per second to generate.
        Returns:
        The MonoSample generated from the given input values.
      • build

        static CurveFunctionSoundSampleBuilder build​()
        This is a convenience method for easily instantiating the according builder.
        Returns:
        an instance (using a default implementation) of this builder