Loads a bank of wavetables into memory. Pointers to the start of each waveform will be provided, but the user can do whatever they want with the data once it's imported.
A internal 4kB workspace is used for reading from the file, and conveting to the correct memory location.
#include <WaveTableLoader.h>
Public Types | |
enum class | Result { OK , ERR_TABLE_INFO_OVERFLOW , ERR_FILE_READ , ERR_GENERIC } |
Public Member Functions | |
WaveTableLoader () | |
~WaveTableLoader () | |
void | Init (float *mem, size_t mem_size) |
Result | SetWaveTableInfo (size_t samps, size_t count) |
Result | Import (const char *filename) |
float * | GetTable (size_t idx) |
|
inline |
|
inline |
Returns pointer to specific table start or nullptr if invalid idx
Opens and loads the file The data will be converted from its original type to float And the wavheader data will be stored internally to the class, but will not be stored in the user-provided buffer.
Currently only 16-bit and 32-bit data is supported. The importer also assumes data is mono so stereo data will be loaded as-is (i.e. interleaved)
Sets the size of the tables to allow access to the specific waveforms