43template<u
int16_t TableSize>
56 void set_rate(
float freq_hz,
float sr = 48000.0f) {
81 void process(
float* out, uint16_t frames) {
82 for (uint16_t i = 0; i < frames; ++i) {
84 out[i] = reader_.
read(phase_.
phase()) * depth_;
93 return reader_.
read(phase_.
phase()) * depth_;
void reset()
Reset phase to zero.
void set_increment(uint32_t inc)
Set the phase increment per sample.
uint32_t increment() const
Current phase increment.
void advance()
Advance phase by one sample.
static uint32_t freq_to_inc(float freq_hz, float sr=48000.0f)
Convert frequency in Hz to phase increment.
uint32_t phase() const
Current phase value.
float read(uint32_t phase) const
Read a single sample with linear interpolation.
void set_table(const float *table)
Set the wavetable to read from (must have Size+1 guard points for linear)