Linear sweep in interval [0,1) More...
#include <Oscillator.h>
Public Member Functions | |
| Sweep (float frq=440, float phs=0) | |
| float | operator() () |
| Alias of cycle() | |
| void | freq (float v) |
| Set frequency. | |
| float | freq () const |
| Get frequency. | |
| void | phase (float v) |
| Set phase from [0, 1) of one period. | |
| float | phase () const |
| Get phase in [0, 1) | |
| void | phaseMax () |
| Set phase to maximum value. | |
| void | phaseAdd (float v) |
| Add value to phase [0, 1) | |
| void | period (float v) |
| Set period length. | |
| void | reset () |
| Reset phase accumulator. | |
| bool | done () const |
| Returns true if tap is done. | |
| uint32_t | freqI () const |
| Get fixed-point frequency. | |
| float | freqUnit () const |
| Get frequency in [0, 1) | |
| uint32_t | phaseI () const |
| Get fixed-point phase. | |
| uint32_t | cycle () |
| Returns 0x80000000 on phase wrap, 0 otherwise. | |
| uint32_t | nextPhase () |
| Increment phase and return pre-incremented phase. | |
| uint32_t | nextPhasePost () |
| Increment phase and return post-incremented phase. | |
| uint32_t | cycles () |
| Get 1 to 0 transitions of all accumulator bits. | |
Linear sweep in interval [0,1)
| Sweep | ( | float | frq = 440, |
| float | phs = 0 |
||
| ) |
| [in] | frq | Frequency |
| [in] | phs | Phase in [0,1) |
| uint32_t cycle | ( | ) | [inherited] |
Returns 0x80000000 on phase wrap, 0 otherwise.
The return value can be used as a bool. It's an integer because it saves a conditional check converting to a bool.