SynthLab SDK
SynthLab::WavetableDatabase Struct Reference

Object that acts as the wavetable database, as shared synth-wide resource. You should study this especially if you want to implement your own database with your own wavetable formats, etc... More...

#include <synthbase.h>

Inheritance diagram for SynthLab::WavetableDatabase:
SynthLab::IWavetableDatabase

Public Member Functions

 ~WavetableDatabase ()
 clear out the table sources
 
virtual IWavetableSourcegetTableSource (const char *uniqueTableName) override
 selects a table source based on the unique table name More...
 
virtual IWavetableSourcegetTableSource (uint32_t uniqueTableIndex) override
 
virtual bool addTableSource (const char *uniqueTableName, IWavetableSource *tableSource, uint32_t &uniqueIndex) override
 add a table source to the database More...
 
virtual bool removeTableSource (const char *uniqueTableName) override
 remove a table source from the database More...
 
virtual bool clearTableSources () override
 clear all entries from the std::map More...
 
virtual int32_t getWaveformIndex (const char *uniqueTableName) override
 get the vector index of a waveform, use at reset() or startup, not runtime More...
 
IWavetableDatabasegetIWavetableDatabase ()
 

Protected Types

typedef std::map< std::string, IWavetableSource *> wavetableSourceMap
 map that connects wavetable names to source objects
 

Protected Attributes

wavetableSourceMap wavetableDatabase
 
std::vector< IWavetableSource * > wavetableVector
 

Detailed Description

Object that acts as the wavetable database, as shared synth-wide resource. You should study this especially if you want to implement your own database with your own wavetable formats, etc...

  • exposes the IWavetableDatabase; your own object only needs to expose this interface
  • this is an example object to study if you want to roll your own version
  • the wavetable sources in the database are uniquely identified with their name strings
  • a std::map is used to make the dictionary of table sources
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

◆ addTableSource()

bool SynthLab::WavetableDatabase::addTableSource ( const char *  uniqueTableName,
IWavetableSource tableSource,
uint32_t &  uniqueIndex 
)
overridevirtual

add a table source to the database

Parameters
uniqueTableNamename of the table set, usually the same as the waveform string the user sees
tableSourceIWavetableSource* to add
Returns
true if sucessful

Implements SynthLab::IWavetableDatabase.

◆ clearTableSources()

bool SynthLab::WavetableDatabase::clearTableSources ( )
overridevirtual

clear all entries from the std::map

  • does not delete or destroy anything
    Returns
    true if sucessful

Implements SynthLab::IWavetableDatabase.

◆ getIWavetableDatabase()

IWavetableDatabase* SynthLab::WavetableDatabase::getIWavetableDatabase ( )
inline

convenience function to return this as interface pointer

◆ getTableSource()

IWavetableSource * SynthLab::WavetableDatabase::getTableSource ( const char *  uniqueTableName)
overridevirtual

selects a table source based on the unique table name

IWavetableDatabase overrides

Parameters
uniqueTableNamename of the table set, usually the same as the waveform string the user sees
Returns
a pointer to the IWavetableSource to be used for reading table data

Implements SynthLab::IWavetableDatabase.

◆ getWaveformIndex()

int32_t SynthLab::WavetableDatabase::getWaveformIndex ( const char *  uniqueTableName)
overridevirtual

get the vector index of a waveform, use at reset() or startup, not runtime

  • does not delete or destroy anything
    Returns
    index of waveform or -1 if not found

Reimplemented from SynthLab::IWavetableDatabase.

◆ removeTableSource()

bool SynthLab::WavetableDatabase::removeTableSource ( const char *  uniqueTableName)
overridevirtual

remove a table source from the database

Parameters
uniqueTableNamename of the table set, usually the same as the waveform string the user sees
Returns
true if sucessful

Implements SynthLab::IWavetableDatabase.


The documentation for this struct was generated from the following files: