Skip to content

daisy::WaveTableLoader

More...

#include <WaveTableLoader.h>

Public Types

Name
enum class Result

Public Functions

Name
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)

Detailed Description

class daisy::WaveTableLoader;

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.

Public Types Documentation

enum Result

Enumerator Value Description
OK
ERR_TABLE_INFO_OVERFLOW
ERR_FILE_READ
ERR_GENERIC

Public Functions Documentation

function WaveTableLoader

inline WaveTableLoader()

function ~WaveTableLoader

inline ~WaveTableLoader()

function Init

void Init(
    float * mem,
    size_t mem_size
)

Initializes the Loader


function SetWaveTableInfo

Result SetWaveTableInfo(
    size_t samps,
    size_t count
)

Sets the size of the tables to allow access to the specific waveforms


function Import

Result Import(
    const char * filename
)

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)


function GetTable

float * GetTable(
    size_t idx
)

Returns pointer to specific table start or nullptr if invalid idx

---

Updated on 2024-01-03 at 19:41:01 +0000