15#ifndef SBL_DSP_PRIMITIVES_WAVETABLE_READER_HPP_
16#define SBL_DSP_PRIMITIVES_WAVETABLE_READER_HPP_
24template<u
int16_t Size>
33 const float*
table()
const {
return table_; }
40 float read(uint32_t phase)
const {
41 return lut::lookup_linear<Size>(table_, phase);
50 return lut::lookup_cubic<Size>(table_, phase);
59 void read_block(
const uint32_t* phases,
float* out, uint16_t frames)
const {
60 for (uint16_t i = 0; i < frames; ++i) {
61 out[i] = lut::lookup_linear<Size>(table_, phases[i]);
66 const float* table_ =
nullptr;
float read_cubic(uint32_t phase) const
Read a single sample with cubic Hermite interpolation.
const float * table() const
Current table pointer.
void set_table(const float *table)
Set the wavetable to read from (must have Size+1 guard points for linear)
float read(uint32_t phase) const
Read a single sample with linear interpolation.
void read_block(const uint32_t *phases, float *out, uint16_t frames) const
Read a block of samples using linear interpolation.
Lookup table interpolation functions.
Stateful, single-concern building blocks.