Skip to content
Igor Zinken edited this page Dec 22, 2018 · 6 revisions

See <utilities/tablepool.h>

The TablePool class provides static methods to retrieve cached instances of WaveTables. This cache provides the benefit that a wave table only has to be pre-calculated once for a unique waveform type and table length, after which its resource can be shared when desired. For instance : you can have dozens of instruments each spawning dozens of SynthEvents sounding sinewaves, by taking a single pre-calculated WaveTable instance as the input, greatly reducing both CPU and memory resources.

public methods

WaveTable* TablePool::getTable( std::string tableId )

Retrieves the WaveTable registered in the pool under given identifier tableId. Returns null pointer if table couldn't be found.

bool setTable( WaveTable* waveTable, std::string tableId )

Registers given waveTable into the pool under given identifier tableId, which can be used to retrieve it (see getTable()). Returns true when has been inserted successfully, false when a table under given tableId has already been registered.

bool hasTable( std::string tableId )

Queries whether a WaveTable has been registered into the pool under given tableId.

bool removeTable( std::string tableId, bool free )

Unregisters the WaveTable registered under given tableId from the pool. Indeed free is true, the WaveTable will also be deleted.

"private" properties

TablePool::std::map<std::string, WaveTable*> _cachedTables

The map used by the getTable()-method to load / store previously created WaveTable instances.

Clone this wiki locally