SynthLab SDK
basiclookuptables.h
1 #pragma once
2 #ifndef __basiclookuptables_h__
3 #define __basiclookuptables_h__
4 
5 #include "synthbase.h"
6 #include "synthfunctions.h"
7 
8 namespace SynthLab
9 {
26  class BasicLookupTables
27  {
28  public:
30  ~BasicLookupTables() {}
31  double readTableByTablePointer(double* table, double index);
32  double readTableByTableIndex(uint32_t tableIndex, double index);
33  inline double readTableByTableIndexNormalized(uint32_t table, double normalizedIndex) { return readTableByTableIndex(table, normalizedIndex*DEFAULT_LUT_LENGTH); }
34  inline double readHannTableWithNormIndex(double normalizedIndex) { return readTableByTablePointer(hannTable->table, normalizedIndex*DEFAULT_LUT_LENGTH); }
35  inline double readSineTableWithNormIndex(double normalizedIndex) { return readTableByTablePointer(&sin_1024[0], normalizedIndex*DEFAULT_LUT_LENGTH); }
36 
37  protected:
38  // --- tables go here
39  std::unique_ptr<LookUpTable> hannTable = nullptr;
40  };
41 
42 
43 } // namespace
44 
45 #endif
double readSineTableWithNormIndex(double normalizedIndex)
read sine table
Definition: basiclookuptables.h:35
double readTableByTablePointer(double *table, double index)
Reads and interpolates a table using a pointer to the table.
Definition: basiclookuptables.cpp:42
Definition: synthengine.cpp:16
std::unique_ptr< LookUpTable > hannTable
a single lookup table - you can add more tables here
Definition: basiclookuptables.h:50
double readTableByTableIndex(uint32_t tableIndex, double index)
Reads and interpolates a table using a table index (codified enum)
Definition: basiclookuptables.cpp:62
double readHannTableWithNormIndex(double normalizedIndex)
read Hann table
Definition: basiclookuptables.h:34
BasicLookupTables()
Construction:
Definition: basiclookuptables.cpp:24
double readTableByTableIndexNormalized(uint32_t table, double normalizedIndex)
read a table with enumerated table index
Definition: basiclookuptables.h:33