SynthLab SDK
SynthLab::DynamicTableSource Class Reference

Storage for one dynamic table source; a wavetable that is created dynamically at load time, rather than being loaded from a static resource or table array. More...

#include <dynamictablesource.h>

Inheritance diagram for SynthLab::DynamicTableSource:
SynthLab::IWavetableSource

Public Member Functions

 DynamicTableSource ()
 empty constructor
 
 ~DynamicTableSource ()
 empty destructor
 
virtual const char * getWaveformName () override
 
virtual void selectTable (uint32_t midiNoteNumber) override
 Select a table based on MIDI note number.
 
virtual double readWaveTable (double normalizedPhaseInc) override
 Read and interpolate the table; uses linear interpolation but could be changed to 4th order LaGrange interpolation instead. More...
 
virtual uint32_t getWaveTableLength () override
 
void addWavetable (uint32_t startNoteNumber, uint32_t endNoteNumber, std::shared_ptr< double > _table, uint32_t length, const char *name)
 Adds a new wavetable or tables to the array of 128 tables, one for each MIDI note. More...
 
void clearAllWavetables ()
 Clear out the wavetables to initialize or re-initialize.
 

Protected Attributes

DynamicWavetable wavetableSet [NUM_MIDI_NOTES]
 — prefab table valid for all MIDI notes
 
DynamicWavetable selectedTable
 — selected table, stored here
 

Detailed Description

Storage for one dynamic table source; a wavetable that is created dynamically at load time, rather than being loaded from a static resource or table array.

  • exposes the IWavetableSource interface
  • stores 128 DynamicWavetable objects, one for each MIDI note
  • stores a selected table
  • the owning object (a wavetable core) selects the table based on pitch during the update() phase, then makes calls to read the table during the render() phase
  • see also DynamicWavetable
Author
Will Pirkle http://www.willpirkle.com
Remarks
This object is included and described in further detail in Designing Software Synthesizer Plugins in C++ 2nd Ed. by Will Pirkle
Version
Revision : 1.0
Date
Date : 2021 / 04 / 26

Member Function Documentation

◆ addWavetable()

void SynthLab::DynamicTableSource::addWavetable ( uint32_t  startNoteNumber,
uint32_t  endNoteNumber,
std::shared_ptr< double >  _table,
uint32_t  length,
const char *  name 
)
inline

Adds a new wavetable or tables to the array of 128 tables, one for each MIDI note.

  • one table may be used to cover multiple MIDI notes
  • if a single table is used for a single MIDI note, set the start and end numbers identically
Parameters
startNoteNumberthe MIDI note number of the first note to add the table
endNoteNumberthe MIDI note number of the last note to add the table
_tablethe shared pointer to the table (array)
lengththe size of the table (array)
namethe unique name of this table

◆ getWaveformName()

virtual const char* SynthLab::DynamicTableSource::getWaveformName ( )
inlineoverridevirtual
Returns
name of selected string as const char*

Implements SynthLab::IWavetableSource.

◆ getWaveTableLength()

virtual uint32_t SynthLab::DynamicTableSource::getWaveTableLength ( )
inlineoverridevirtual
Returns
the length of the selected wavetable

Implements SynthLab::IWavetableSource.

◆ readWaveTable()

virtual double SynthLab::DynamicTableSource::readWaveTable ( double  normalizedPhaseInc)
inlineoverridevirtual

Read and interpolate the table; uses linear interpolation but could be changed to 4th order LaGrange interpolation instead.

Parameters
normalizedPhaseIncthe phase increment value; usually this is the mcounter member of a SynthClock object and is fo/fs where fo is the desired oscillator frequency

Implements SynthLab::IWavetableSource.


The documentation for this class was generated from the following file: