16 #include "mozzi_fixmath.h"
18 #define PHASOR_MAX_VALUE_UL 4294967295UL
27 template <
unsigned int UPDATE_RATE>
31 uint32_t current_value;
32 volatile uint32_t step_size;
48 current_value += step_size;
56 void set(uint32_t value)
70 step_size = ((((uint32_t)((PHASOR_MAX_VALUE_UL>>8)+1))/(UPDATE_RATE))*frequency)<<8;
81 step_size = (uint32_t)(((
float)PHASOR_MAX_VALUE_UL/UPDATE_RATE)*frequency);
96 return ((((uint32_t)((PHASOR_MAX_VALUE_UL>>8)+1))/(UPDATE_RATE))*frequency)<<8;
106 step_size = stepsize;
Phasor repeatedly generates a high resolution ramp at a variable frequency.
uint32_t next()
Increments one step along the phase.
uint32_t phaseIncFromFreq(int frequency)
phaseIncFromFreq() and setPhaseInc() are for saving processor time when sliding between frequencies.
void setFreq(float frequency)
Set the Phasor frequency with a float.
void set(uint32_t value)
Set the current value of the phasor.
void setPhaseInc(uint32_t stepsize)
Set a specific phase increment.
void setFreq(int frequency)
Set the Phasor frequency with an unsigned int.