template<unsigned int UPDATE_RATE>
class Phasor< UPDATE_RATE >
Phasor repeatedly generates a high resolution ramp at a variable frequency.
The output of Phasor.next() is an unsigned number between 0 and 4294967295, the maximum that can be expressed by an unsigned 32 bit integer.
- Template Parameters
-
UPDATE_RATE | the rate at which the Phasor will be updated, usually MOZZI_CONTROL_RATE or MOZZI_AUDIO_RATE. |
Definition at line 28 of file Phasor.h.
template<unsigned int UPDATE_RATE>
uint32_t Phasor< UPDATE_RATE >::phaseIncFromFreq |
( |
int |
frequency | ) |
|
|
inline |
phaseIncFromFreq() and setPhaseInc() are for saving processor time when sliding between frequencies.
Instead of recalculating the phase increment for each frequency in between, you can just calculate the phase increment for each end frequency with phaseIncFromFreq(), then use a Line to interpolate on the fly and use setPhaseInc() to set the phase increment at each step. (Note: I should really profile this with the oscilloscope to see if it's worth the extra confusion!)
- Parameters
-
frequency | for which you want to calculate a phase increment value. |
- Returns
- the phase increment value which will produce a given frequency.
Definition at line 94 of file Phasor.h.