dsp::Oscillator< SampleType > Class Template Reference

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 (const std::function< NumericType(NumericType)> &function, size_t lookupTableNumPoints=0)
 Creates an oscillator with a periodic input function (-pi..pi). More...
 
void setFrequency (NumericType newGain) 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) 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...
 

Detailed Description

template<typename SampleType>
class dsp::Oscillator< SampleType >

Generates a signal based on a user-supplied function.

Member Typedef Documentation

◆ NumericType

template<typename SampleType >
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)

Constructor & Destructor Documentation

◆ Oscillator()

template<typename SampleType >
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.

References double_Pi.

Member Function Documentation

◆ setFrequency()

template<typename SampleType >
void dsp::Oscillator< SampleType >::setFrequency ( NumericType  newGain)
noexcept

Sets the frequency of the oscillator.

References LinearSmoothedValue< FloatType >::setValue().

◆ getFrequency()

template<typename SampleType >
NumericType dsp::Oscillator< SampleType >::getFrequency ( ) const
noexcept

Returns the current frequency of the oscillator.

References LinearSmoothedValue< FloatType >::getTargetValue().

◆ prepare()

template<typename SampleType >
void dsp::Oscillator< SampleType >::prepare ( const ProcessSpec spec)
noexcept

◆ reset()

template<typename SampleType >
void dsp::Oscillator< SampleType >::reset ( )
noexcept

Resets the internal state of the oscillator.

References LinearSmoothedValue< FloatType >::reset().

Referenced by dsp::Oscillator< SampleType >::prepare().

◆ processSample()

template<typename SampleType >
SampleType JUCE_VECTOR_CALLTYPE dsp::Oscillator< SampleType >::processSample ( SampleType  )
noexcept

Returns the result of processing a single sample.

References double_Pi, and LinearSmoothedValue< FloatType >::getNextValue().

◆ process()

template<typename SampleType >
template<typename ProcessContext >
void dsp::Oscillator< SampleType >::process ( const ProcessContext &  context)
noexcept

The documentation for this class was generated from the following file: