SynthLab SDK
basiclookuptables.h
Go to the documentation of this file.
1 #pragma once
2 #ifndef __basiclookuptables_h__
3 #define __basiclookuptables_h__
4 
5 #include "synthbase.h"
6 #include "synthfunctions.h"
7 
8 // -----------------------------
9 // --- SynthLab SDK File --- //
10 // ----------------------------
18 // -----------------------------------------------------------------------------
19 namespace SynthLab
20 {
38  {
39  public:
41  ~BasicLookupTables() {}
42  double readTableByTablePointer(double* table, double index);
43  double readTableByTableIndex(uint32_t tableIndex, double index);
44  inline double readTableByTableIndexNormalized(uint32_t table, double normalizedIndex) { return readTableByTableIndex(table, normalizedIndex*DEFAULT_LUT_LENGTH); }
45  inline double readHannTableWithNormIndex(double normalizedIndex) { return readTableByTablePointer(hannTable->table, normalizedIndex*DEFAULT_LUT_LENGTH); }
46  inline double readSineTableWithNormIndex(double normalizedIndex) { return readTableByTablePointer(&sin_1024[0], normalizedIndex*DEFAULT_LUT_LENGTH); }
47 
48  protected:
49  // --- tables go here
50  std::unique_ptr<LookUpTable> hannTable = nullptr;
51  };
52 
53 
54 } // namespace
55 
56 #endif
double readSineTableWithNormIndex(double normalizedIndex)
read sine table
Definition: basiclookuptables.h:46
double readTableByTablePointer(double *table, double index)
Reads and interpolates a table using a pointer to the table.
Definition: basiclookuptables.cpp:41
Definition: addosccore.cpp:4
Very basic lookup table object.
Definition: basiclookuptables.h:37
double readTableByTableIndex(uint32_t tableIndex, double index)
Reads and interpolates a table using a table index (codified enum)
Definition: basiclookuptables.cpp:61
std::unique_ptr< LookUpTable > hannTable
a single lookup table - you can add more tables here
Definition: basiclookuptables.h:50
double readHannTableWithNormIndex(double normalizedIndex)
read Hann table
Definition: basiclookuptables.h:45
const uint32_t DEFAULT_LUT_LENGTH
Definition: synthconstants.h:217
BasicLookupTables()
Construction:
Definition: basiclookuptables.cpp:23
hard-coded arrays of FIR filter coefficients for the sample rate conversion objects (Interpolator and...
double readTableByTableIndexNormalized(uint32_t table, double normalizedIndex)
read a table with enumerated table index
Definition: basiclookuptables.h:44
See also Designing Software Synthesizers in C++ 2nd Ed. by Will Pirkle.