JUCE
|
Generates a signal based on a user-supplied function. More...
Public Types | |
using | NumericType = typename SampleTypeHelpers::ElementType< SampleType >::Type |
The NumericType is the underlying primitive type used by the SampleType (which could be either a primitive or vector) More... | |
Public Member Functions | |
Oscillator ()=default | |
Creates an uninitialised oscillator. More... | |
Oscillator (const std::function< NumericType(NumericType)> &function, size_t lookupTableNumPoints=0) | |
Creates an oscillator with a periodic input function (-pi..pi). More... | |
bool | isInitialised () const noexcept |
Returns true if the Oscillator has been initialised. More... | |
void | initialise (const std::function< NumericType(NumericType)> &function, size_t lookupTableNumPoints=0) |
Initialises the oscillator with a waveform. More... | |
void | setFrequency (NumericType newFrequency, bool force=false) noexcept |
Sets the frequency of the oscillator. More... | |
NumericType | getFrequency () const noexcept |
Returns the current frequency of the oscillator. More... | |
void | prepare (const ProcessSpec &spec) noexcept |
Called before processing starts. More... | |
void | reset () noexcept |
Resets the internal state of the oscillator. More... | |
SampleType JUCE_VECTOR_CALLTYPE | processSample (SampleType input) noexcept |
Returns the result of processing a single sample. More... | |
template<typename ProcessContext > | |
void | process (const ProcessContext &context) noexcept |
Processes the input and output buffers supplied in the processing context. More... | |
Generates a signal based on a user-supplied function.
using dsp::Oscillator< SampleType >::NumericType = typename SampleTypeHelpers::ElementType<SampleType>::Type |
The NumericType is the underlying primitive type used by the SampleType (which could be either a primitive or vector)
|
default |
Creates an uninitialised oscillator.
Call initialise before first use.
dsp::Oscillator< SampleType >::Oscillator | ( | const std::function< NumericType(NumericType)> & | function, |
size_t | lookupTableNumPoints = 0 |
||
) |
Creates an oscillator with a periodic input function (-pi..pi).
If lookup table is not zero, then the function will be approximated with a lookup table.
|
noexcept |
Returns true if the Oscillator has been initialised.
Referenced by dsp::Oscillator< SampleType >::process(), and dsp::Oscillator< SampleType >::processSample().
void dsp::Oscillator< SampleType >::initialise | ( | const std::function< NumericType(NumericType)> & | function, |
size_t | lookupTableNumPoints = 0 |
||
) |
Initialises the oscillator with a waveform.
|
noexcept |
Sets the frequency of the oscillator.
References SmoothedValueBase< SmoothedValueType >::setCurrentAndTargetValue(), and SmoothedValue< FloatType, SmoothingType >::setTargetValue().
|
noexcept |
Returns the current frequency of the oscillator.
References SmoothedValueBase< SmoothedValueType >::getTargetValue().
|
noexcept |
Called before processing starts.
References dsp::Oscillator< SampleType >::reset(), and Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::resize().
|
noexcept |
Resets the internal state of the oscillator.
References dsp::Phase< Type >::reset(), and SmoothedValue< FloatType, SmoothingType >::reset().
Referenced by dsp::Oscillator< SampleType >::prepare().
|
noexcept |
Returns the result of processing a single sample.
References dsp::Phase< Type >::advance(), SmoothedValue< FloatType, SmoothingType >::getNextValue(), dsp::Oscillator< SampleType >::isInitialised(), and jassert.
|
noexcept |
Processes the input and output buffers supplied in the processing context.
References dsp::Phase< Type >::advance(), SmoothedValue< FloatType, SmoothingType >::getNextValue(), Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::getRawDataPointer(), dsp::Oscillator< SampleType >::isInitialised(), SmoothedValueBase< SmoothedValueType >::isSmoothing(), jassert, jmin(), Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::size(), and SmoothedValue< FloatType, SmoothingType >::skip().