LMMS
Loading...
Searching...
No Matches
dsp::simple_oscillator Struct Reference

#include <osc.h>

Inheritance diagram for dsp::simple_oscillator:
dsp::waveform_oscillator< MONOSYNTH_WAVE_BITS > calf_plugins::wavetable_oscillator dsp::triangle_lfo dsp::waveform_oscillator< SIZE_BITS >

Public Member Functions

void reset ()
 Reset oscillator phase to zero.
void set_freq (float freq, float sr)
 Set phase delta based on oscillator frequency and sample rate.
void set_freq_odsr (float freq, double odsr)
 Set phase delta based on oscillator frequency and inverse of sample rate.
void step ()
 Make one phase increment.
float get ()
 Make one phase increment and return a value from -0.5 to 0.5.

Public Attributes

uint32_t phase
 Phase (from 0 to 0xFFFFFFFF).
uint32_t phasedelta
 Per-sample phase delta (phase increment), equal to 2^32*freq/sr.

Detailed Description

Very simple, non-bandlimited saw oscillator. Should not be used for anything else than testing/prototyping. Unless get() function is replaced with something with "proper" oscillator code, as the frequency setting function is fine.

Member Function Documentation

◆ get()

float dsp::simple_oscillator::get ( )
inline

Make one phase increment and return a value from -0.5 to 0.5.

◆ reset()

void dsp::simple_oscillator::reset ( )
inline

Reset oscillator phase to zero.

◆ set_freq()

void dsp::simple_oscillator::set_freq ( float freq,
float sr )
inline

Set phase delta based on oscillator frequency and sample rate.

◆ set_freq_odsr()

void dsp::simple_oscillator::set_freq_odsr ( float freq,
double odsr )
inline

Set phase delta based on oscillator frequency and inverse of sample rate.

◆ step()

void dsp::simple_oscillator::step ( )
inline

Make one phase increment.

Member Data Documentation

◆ phase

uint32_t dsp::simple_oscillator::phase

Phase (from 0 to 0xFFFFFFFF).

◆ phasedelta

uint32_t dsp::simple_oscillator::phasedelta

Per-sample phase delta (phase increment), equal to 2^32*freq/sr.


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