SynthLab SDK
SynthLab::PCMSampleDatabase Struct Reference

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

#include <synthbase.h>

Inheritance diagram for SynthLab::PCMSampleDatabase:
SynthLab::IPCMSampleDatabase

Public Member Functions

 ~PCMSampleDatabase ()
 clear out the table sources
 
virtual IPCMSampleSourcegetSampleSource (const char *uniqueSampleSetName) override
 selects a PCM sample source based on the unique table name More...
 
virtual bool addSampleSource (const char *uniqueSampleSetName, IPCMSampleSource *sampleSource) override
 add a PCM sample source to the database More...
 
virtual bool removeSampleSource (const char *uniqueSampleSetName) override
 remove a PCM sample source from the database More...
 
virtual bool clearSampleSources () override
 clear all entries from the std::map More...
 
IPCMSampleDatabasegetIPCMSampleDatabase ()
 

Protected Types

typedef std::map< std::string, IPCMSampleSource *> sampleSourceMap
 

Protected Attributes

sampleSourceMap sampleDatabase
 map that connects PCM sample set names to source objects
 
std::vector< IPCMSampleSource * > sources
 

Detailed Description

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

  • exposes the IPCMSampleDatabase; 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 PCM 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

◆ addSampleSource()

bool SynthLab::PCMSampleDatabase::addSampleSource ( const char *  uniqueSampleSetName,
IPCMSampleSource sampleSource 
)
overridevirtual

add a PCM sample source to the database

Parameters
uniqueSampleSetNamename of the PCM sample set, usually the same as the folder that holds the WAV samples
sampleSourceIPCMSampleSource* to add
Returns
true if sucessful

Implements SynthLab::IPCMSampleDatabase.

◆ clearSampleSources()

bool SynthLab::PCMSampleDatabase::clearSampleSources ( )
overridevirtual

clear all entries from the std::map

  • this DOES call the sample deleter function on the source as part of the destruction of dynamic data
Returns
true if sucessful

Implements SynthLab::IPCMSampleDatabase.

◆ getIPCMSampleDatabase()

IPCMSampleDatabase* SynthLab::PCMSampleDatabase::getIPCMSampleDatabase ( )
inline

convenience function to return this as interface pointer

◆ getSampleSource()

IPCMSampleSource * SynthLab::PCMSampleDatabase::getSampleSource ( const char *  uniqueSampleSetName)
overridevirtual

selects a PCM sample source based on the unique table name

IPCMSampleDatabase overrides

Parameters
uniqueSampleSetNamename of the sample set, usually the same as the folder that holds the WAV files for the samples
Returns
a pointer to the IPCMSampleSource to be used for reading table data

Implements SynthLab::IPCMSampleDatabase.

◆ removeSampleSource()

bool SynthLab::PCMSampleDatabase::removeSampleSource ( const char *  uniqueSampleSetName)
overridevirtual

remove a PCM sample source from the database

Parameters
uniqueSampleSetNamename of the PCM sample set, usually the same as the folder that holds the WAV samples
Returns
true if sucessful

Implements SynthLab::IPCMSampleDatabase.


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