LMMS
Loading...
Searching...
No Matches
dsp::waveform_oscillator< SIZE_BITS > Struct Template Reference

#include <osc.h>

Inheritance diagram for dsp::waveform_oscillator< SIZE_BITS >:
dsp::simple_oscillator

Public Types

enum  { SIZE = 1 << SIZE_BITS , MASK = SIZE - 1 , SCALE = 1 << (32 - SIZE_BITS) }

Public Member Functions

 waveform_oscillator ()
float get ()
 Get the value from single oscillator at current position.
float get_phaseshifted (uint32_t shift, float mix)
 Add/substract two phase-shifted values.
float get_phaseshifted2 (uint32_t shift, int32_t gshift, float mix)
 Add/substract two phase-shifted values.
float get_phasedist (uint32_t sync, uint32_t shift, float mix)
 Get the value of a hard synced osc (65536 = 1:1 ratio).
void advance ()
 One step.
Public Member Functions inherited from dsp::simple_oscillator
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

float * waveform
Public Attributes inherited from dsp::simple_oscillator
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

template<int SIZE_BITS>
struct dsp::waveform_oscillator< SIZE_BITS >

Simple table-based lerping oscillator. Uses waveform of size 2^SIZE_BITS. Combine with waveform_family if bandlimited waveforms are needed. Because of linear interpolation, it's usually a good idea to use large tables (2048-4096 points), otherwise aliasing may be produced.

Member Enumeration Documentation

◆ anonymous enum

template<int SIZE_BITS>
anonymous enum
Enumerator
SIZE 
MASK 
SCALE 

Constructor & Destructor Documentation

◆ waveform_oscillator()

template<int SIZE_BITS>
dsp::waveform_oscillator< SIZE_BITS >::waveform_oscillator ( )
inline

Member Function Documentation

◆ advance()

template<int SIZE_BITS>
void dsp::waveform_oscillator< SIZE_BITS >::advance ( )
inline

One step.

◆ get()

template<int SIZE_BITS>
float dsp::waveform_oscillator< SIZE_BITS >::get ( )
inline

Get the value from single oscillator at current position.

◆ get_phasedist()

template<int SIZE_BITS>
float dsp::waveform_oscillator< SIZE_BITS >::get_phasedist ( uint32_t sync,
uint32_t shift,
float mix )
inline

Get the value of a hard synced osc (65536 = 1:1 ratio).

◆ get_phaseshifted()

template<int SIZE_BITS>
float dsp::waveform_oscillator< SIZE_BITS >::get_phaseshifted ( uint32_t shift,
float mix )
inline

Add/substract two phase-shifted values.

◆ get_phaseshifted2()

template<int SIZE_BITS>
float dsp::waveform_oscillator< SIZE_BITS >::get_phaseshifted2 ( uint32_t shift,
int32_t gshift,
float mix )
inline

Add/substract two phase-shifted values.

Member Data Documentation

◆ waveform

template<int SIZE_BITS>
float* dsp::waveform_oscillator< SIZE_BITS >::waveform

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