java.lang.Object
org.refcodes.audio.CurveFunctionSoundSampleBuilderImpl
- All Implemented Interfaces:
CurveFunctionSoundSampleBuilder,SamplingRateAccessor,SamplingRateAccessor.SamplingRateBuilder<CurveFunctionSoundSampleBuilder>,SamplingRateAccessor.SamplingRateMutator,SamplingRateAccessor.SamplingRateProperty
public class CurveFunctionSoundSampleBuilderImpl
extends Object
implements CurveFunctionSoundSampleBuilder
The
CurveFunctionSoundSampleBuilderImpl implements the
CurveFunctionSoundSampleBuilder interface.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.refcodes.audio.SamplingRateAccessor
SamplingRateAccessor.SamplingRateBuilder<B extends SamplingRateAccessor.SamplingRateBuilder<B>>, SamplingRateAccessor.SamplingRateMutator, SamplingRateAccessor.SamplingRateProperty -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubleReturns the amplitude being used when generatingMonoSampleinstances.doubleReturns the frequency in Hz being used when generatingMonoSampleinstances.intgetIndex()Returns the index being used when generatingMonoSampleinstances.intRetrieves the sampling rate from the sampling rate property.Returns the trigonometric function being used when generatingMonoSampleinstances.intReturns the x-offset being used when generatingMonoSampleinstances.doubleReturns the yOffset being used when generatingMonoSampleinstances.next()Returns the nextMonoSamplefor the current index (as ofCurveFunctionSoundSampleBuilder.getIndex()) as well as for the other builder's settings and increases the index by one.voidsetAmplitude(double aAmplitude) Sets the amplitude to be used when generatingMonoSampleinstances.voidsetFrequency(double aFrequencyInHz) Sets the frequency in Hz to be used when generatingMonoSampleinstances.voidsetIndex(int aIndex) Sets the index to be used when generatingMonoSampleinstances.voidsetSamplingRate(int aSamplingRate) Sets the sampling rate for the sampling rate property.voidsetTrigonometricFunction(Function<Double, Double> aFunction) Sets the trigonometric function to be used when generatingMonoSample.voidsetXOffset(int aXOffset) Sets the x-offset to be used when generatingMonoSampleinstances.voidsetYOffset(double aYOffset) Sets the y-offset to be used when generatingMonoSampleinstances.Creates aMonoSampleas of the builder's settings.toMonoSample(int index) Creates aMonoSamplefor the given index and the the builder's settings.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.refcodes.audio.CurveFunctionSoundSampleBuilder
setTrigonometricFunction, withAmplitude, withFrequency, withIndex, withSamplingRate, withTrigonometricFunction, withTrigonometricFunction, withXOffset, withYOffsetMethods inherited from interface org.refcodes.audio.SamplingRateAccessor.SamplingRateProperty
letSamplingRate
-
Constructor Details
-
CurveFunctionSoundSampleBuilderImpl
public CurveFunctionSoundSampleBuilderImpl()
-
-
Method Details
-
setTrigonometricFunction
Sets the trigonometric function to be used when generatingMonoSample.- Specified by:
setTrigonometricFunctionin interfaceCurveFunctionSoundSampleBuilder- Parameters:
aFunction- TheFunctionto be set.
-
getTrigonometricFunction
Returns the trigonometric function being used when generatingMonoSampleinstances.- Specified by:
getTrigonometricFunctionin interfaceCurveFunctionSoundSampleBuilder- Returns:
- The
Functionbeing set.
-
setIndex
public void setIndex(int aIndex) Sets the index to be used when generatingMonoSampleinstances.- Specified by:
setIndexin interfaceCurveFunctionSoundSampleBuilder- Parameters:
aIndex- The index to be set.
-
getIndex
public int getIndex()Returns the index being used when generatingMonoSampleinstances.- Specified by:
getIndexin interfaceCurveFunctionSoundSampleBuilder- Returns:
- The index being set.
-
setFrequency
public void setFrequency(double aFrequencyInHz) Sets the frequency in Hz to be used when generatingMonoSampleinstances.- Specified by:
setFrequencyin interfaceCurveFunctionSoundSampleBuilder- Parameters:
aFrequencyInHz- The frequency to be set.
-
getFrequency
public double getFrequency()Returns the frequency in Hz being used when generatingMonoSampleinstances.- Specified by:
getFrequencyin interfaceCurveFunctionSoundSampleBuilder- Returns:
- The frequency in Hz being set.
-
setAmplitude
public void setAmplitude(double aAmplitude) Sets the amplitude to be used when generatingMonoSampleinstances.- Specified by:
setAmplitudein interfaceCurveFunctionSoundSampleBuilder- Parameters:
aAmplitude- The amplitude to be set.
-
getAmplitude
public double getAmplitude()Returns the amplitude being used when generatingMonoSampleinstances.- Specified by:
getAmplitudein interfaceCurveFunctionSoundSampleBuilder- Returns:
- The amplitude being set.
-
setXOffset
public void setXOffset(int aXOffset) Sets the x-offset to be used when generatingMonoSampleinstances.- Specified by:
setXOffsetin interfaceCurveFunctionSoundSampleBuilder- Parameters:
aXOffset- The x-offset to be set.
-
getXOffset
public int getXOffset()Returns the x-offset being used when generatingMonoSampleinstances.- Specified by:
getXOffsetin interfaceCurveFunctionSoundSampleBuilder- Returns:
- The x-offset being set.
-
setYOffset
public void setYOffset(double aYOffset) Sets the y-offset to be used when generatingMonoSampleinstances.- Specified by:
setYOffsetin interfaceCurveFunctionSoundSampleBuilder- Parameters:
aYOffset- The y-offset to be set.
-
getYOffset
public double getYOffset()Returns the yOffset being used when generatingMonoSampleinstances.- Specified by:
getYOffsetin interfaceCurveFunctionSoundSampleBuilder- Returns:
- The yOffset being set.
-
setSamplingRate
public void setSamplingRate(int aSamplingRate) Sets the sampling rate for the sampling rate property.- Specified by:
setSamplingRatein interfaceSamplingRateAccessor.SamplingRateMutator- Parameters:
aSamplingRate- The sampling rate to be stored by the sampling rate property.
-
getSamplingRate
public int getSamplingRate()Retrieves the sampling rate from the sampling rate property.- Specified by:
getSamplingRatein interfaceSamplingRateAccessor- Returns:
- The sampling rate stored by the sampling rate property.
-
next
Returns the nextMonoSamplefor the current index (as ofCurveFunctionSoundSampleBuilder.getIndex()) as well as for the other builder's settings and increases the index by one.- Specified by:
nextin interfaceCurveFunctionSoundSampleBuilder- Returns:
- The next
MonoSamplebeing set up.
-
toMonoSample
Creates aMonoSampleas of the builder's settings.- Specified by:
toMonoSamplein interfaceCurveFunctionSoundSampleBuilder- Returns:
- The sound sample as of the builder's settings.
-
toMonoSample
Creates aMonoSamplefor the given index and the the builder's settings.- Specified by:
toMonoSamplein interfaceCurveFunctionSoundSampleBuilder- Parameters:
index- The index for which to create the sound sample.- Returns:
- The sound sample as of the index and the builder's settings.
-