SynthLab SDK
SynthLab::DrumWTSource Class Reference

Storage for one static table source, specifically for drums which are pitchless and one-shot. More...

#include <synthlabwtsource.h>

Inheritance diagram for SynthLab::DrumWTSource:
SynthLab::IWavetableSource

Public Member Functions

 DrumWTSource ()
 empty constructor
 
 ~DrumWTSource ()
 empty destructor
 
virtual const char * getWaveformName () override
 
virtual void selectTable (uint32_t midiNoteNumber) override
 Select a table based on MIDI note number; nothing to do here.
 
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 (const double *_table, uint32_t length, const char *name, double outputComp=1.0)
 Adds a new wavetable to the array of 128 tables, one for each MIDI note. More...
 
void addWavetable (const uint64_t *_table, uint32_t length, const char *name, double outputComp=1.0)
 Adds a new wavetable to the array of 128 tables, one for each MIDI note. More...
 

Protected Attributes

StaticWavetable drumTable
 one table per drum
 

Detailed Description

Storage for one static table source, specifically for drums which are pitchless and one-shot.

  • exposes the IWavetableSource interface
  • the owning object (a wavetable core) selects the table based on MIDI note number during the update() phase, then makes calls to read the table during the render() phase
  • see also StaticWavetable
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() [1/2]

void SynthLab::DrumWTSource::addWavetable ( const double *  _table,
uint32_t  length,
const char *  name,
double  outputComp = 1.0 
)
inline

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

  • this function uses pointers to double arrays
Parameters
_tablethe shared pointer to the table (array)
lengththe size of the table (array)
namethe unique name of this table
outputCompa scaling factor used on playback to amplify or attenuate the output

◆ addWavetable() [2/2]

void SynthLab::DrumWTSource::addWavetable ( const uint64_t *  _table,
uint32_t  length,
const char *  name,
double  outputComp = 1.0 
)
inline

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

  • this function uses pointers to unsinged 64-bit int arrays
Parameters
_tablethe shared pointer to the table (array)
lengththe size of the table (array)
namethe unique name of this table
outputCompa scaling factor used on playback to amplify or attenuate the output

◆ getWaveformName()

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

Implements SynthLab::IWavetableSource.

◆ getWaveTableLength()

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

Implements SynthLab::IWavetableSource.

◆ readWaveTable()

virtual double SynthLab::DrumWTSource::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: