Loading...
Searching...
No Matches
juce::dsp::Oscillator< SampleType > Class Template Reference

## Detailed Description

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

Generates a signal based on a user-supplied function.

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

- juce_dsp/widgets/juce_Oscillator.h

## 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).

## Public Member Functions

| Oscillator ()=default
| Creates an uninitialised oscillator.
| Oscillator (const std::function< NumericType(NumericType)> &function, size_t lookupTableNumPoints=0)
| Creates an oscillator with a periodic input function (-pi..pi).
bool | isInitialised () const noexcept
| Returns true if the Oscillator has been initialised.
void | initialise (const std::function< NumericType(NumericType)> &function, size_t lookupTableNumPoints=0)
| Initialises the oscillator with a waveform.
void | setFrequency (NumericType newFrequency, bool force=false) noexcept
| Sets the frequency of the oscillator.
NumericType | getFrequency () const noexcept
| Returns the current frequency of the oscillator.
void | prepare (const ProcessSpec &spec) noexcept
| Called before processing starts.
void | reset () noexcept
| Resets the internal state of the oscillator.
SampleType JUCE_VECTOR_CALLTYPE | processSample (SampleType input) noexcept
| Returns the result of processing a single sample.
template<typename ProcessContext>
void | process (const ProcessContext &context) noexcept
| Processes the input and output buffers supplied in the processing context.

## Member Typedef Documentation

## NumericType

template<typename SampleType>

using juce::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).

## Constructors and Destructors

## Oscillator() [1/2]

template<typename SampleType>

juce::dsp::Oscillator< SampleType >::Oscillator | ( |  | ) |

default

Creates an uninitialised oscillator.

Call initialise before first use.

## Oscillator() [2/2]

template<typename SampleType>

juce::dsp::Oscillator< SampleType >::Oscillator | ( | const std::function< NumericType(NumericType)> & | function,
|  | size_t | lookupTableNumPoints = 0 )

inline

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 initialise().

## Member Functions

## isInitialised()

template<typename SampleType>

bool juce::dsp::Oscillator< SampleType >::isInitialised | ( |  | ) | const

inline noexcept

Returns true if the Oscillator has been initialised.

Referenced by process(), and processSample().

## initialise()

template<typename SampleType>

void juce::dsp::Oscillator< SampleType >::initialise | ( | const std::function< NumericType(NumericType)> & | function,
|  | size_t | lookupTableNumPoints = 0 )

inline

Initialises the oscillator with a waveform.

References juce::MathConstants< FloatType >::pi, juce::table, and x.

Referenced by Oscillator().

## setFrequency()

template<typename SampleType>

void juce::dsp::Oscillator< SampleType >::setFrequency | ( | NumericType | newFrequency,
|  | bool | force = false )

inline noexcept

Sets the frequency of the oscillator.

## getFrequency()

template<typename SampleType>

NumericType juce::dsp::Oscillator< SampleType >::getFrequency | ( |  | ) | const

inline noexcept

Returns the current frequency of the oscillator.

## prepare()

template<typename SampleType>

void juce::dsp::Oscillator< SampleType >::prepare | ( | const ProcessSpec & | spec | ) |

inline noexcept

Called before processing starts.

References reset().

## reset()

template<typename SampleType>

void juce::dsp::Oscillator< SampleType >::reset | ( |  | ) |

inline noexcept

Resets the internal state of the oscillator.

Referenced by prepare().

## processSample()

template<typename SampleType>

SampleType JUCE_VECTOR_CALLTYPE juce::dsp::Oscillator< SampleType >::processSample | ( | SampleType | input | ) |

inline noexcept

Returns the result of processing a single sample.

References isInitialised(), jassert, JUCE_VECTOR_CALLTYPE, juce::MathConstants< FloatType >::pi, and juce::MathConstants< FloatType >::twoPi.

## process()

template<typename SampleType>
template<typename ProcessContext>

void juce::dsp::Oscillator< SampleType >::process | ( | const ProcessContext & | context | ) |

inline noexcept

Processes the input and output buffers supplied in the processing context.

References isInitialised(), jassert, juce::jmin(), juce::MathConstants< FloatType >::pi, and juce::MathConstants< FloatType >::twoPi.

### Purchase

Get JUCE

### Discover

What's New in JUCE Features

### Learn

Documentaion Tutorials Made with JUCE Resources

### Support

JUCE Forum Newsletter Archive

### About

Contact Us JUCE Legal JUCE Licensing FAQ

### Events

Audio Developer Conference
© Raw Material Software Limited