SynthLab SDK
synthlabcore.h
1 #pragma once
2 
3 // *** NOTE: relative paths to SDK files ********************************************
4 // these are setup so that ModuleCore DM projects are compiled directly
5 // from the SDK itself with minimal effort
6 //
7 // You may want to adjust these to suit your particular development folder
8 // system if you only want to use parts of the SDK or plan on modifying
9 // SDK files, or need to alter the folder hierarchy for your setup.
10 //
11 // Alternatively, you may add a new "Include Path" to your compiler setup.
12 // **********************************************************************************
13 #include "../../../../source/synthbase.h"
14 #include "../../../../source/synthfunctions.h"
15 #include "../../../../source/synthlabwtsource.h"
16 #include "../../../../wavetables/static_tables/anasaw.h"
17 #include "../../../../wavetables/static_tables/anasquare.h"
18 #include "../../../../wavetables/static_tables/vs_wt.h"
19 #include "../../../../wavetables/static_tables/fm_wt.h"
20 #include "../../../../wavetables/static_tables/akwf_8.h"
21 
22 // -----------------------------
23 // SynthLab SDK File //
24 // for //
25 // DynamicModule //
26 // Development //
27 // ----------------------------
28 
36 // -----------------------------------------------------------------------------
37 namespace SynthLab
38 {
104  class SynthLabCore : public ModuleCore
105  {
106  public:
108  SynthLabCore(); /* C-TOR */
109 
111  virtual ~SynthLabCore() {} /* D-TOR */
112 
114  virtual bool reset(CoreProcData& processInfo) override;
115  virtual bool update(CoreProcData& processInfo) override;
116  virtual bool render(CoreProcData& processInfo) override;
117  virtual bool doNoteOn(CoreProcData& processInfo) override;
118  virtual bool doNoteOff(CoreProcData& processInfo) override;
119 
121  double renderSample(SynthClock& clock, double shape = 0.5);
122  double renderHardSyncSample(SynthClock& clock, double shape = 0.5);
123 
124  protected:
125  // --- basic variables
126  double sampleRate = 0.0;
127  double midiPitch = 0.0;
128  double outputAmplitude = 1.0;
129  double panLeftGain = 0.707;
130  double panRightGain = 0.707;
131  int32_t currentWaveIndex = -1;
132 
133  // --- timebase
135 
136  // --- table source
138 
139  // -- hard sync helper
141 
142  // --- function to add wavetables
143  void checkAddWavetable(SynthLabTableSet& slTableSet, CoreProcData& processInfo, uint32_t waveIndex);
144 
145  // --- wavetable sources; these are used to register the tables with the database
146  // if the tables already exist, these won't be used. Notice that the update() function
147  // ONLY uses wavetable sources from the database!
148  StaticTableSource wavetables[MODULE_STRINGS];
149  };
150 
151 } // namespace
SynthLabCore()
Construction: Cores follow the same construction pattern.
Definition: synthlabcore.cpp:29
Compact modulo counter with wrapping used as the timebase for all oscillators.
Definition: synthbase.h:137
double panRightGain
right channel gain
Definition: synthlabcore.h:130
Interface for wavetable sources.
Definition: synthbase.h:609
virtual bool doNoteOff(CoreProcData &processInfo) override
Note-off handler for the ModuleCore.
Definition: synthlabcore.cpp:135
Definition: addosccore.cpp:4
SynthClock oscClock
the oscillator timebase
Definition: synthlabcore.h:134
virtual bool update(CoreProcData &processInfo) override
Updates the object for the next block of audio processing.
Definition: synthlabcore.cpp:79
double sampleRate
sample rate
Definition: synthlabcore.h:108
virtual bool render(CoreProcData &processInfo) override
Renders the output of the module.
Definition: synthlabcore.cpp:98
const uint32_t MODULE_STRINGS
Definition: synthconstants.h:130
virtual bool doNoteOn(CoreProcData &processInfo) override
Note-on handler for the ModuleCore.
Definition: synthlabcore.cpp:116
double outputAmplitude
amplitude in dB
Definition: synthlabcore.h:128
double midiPitch
midi note pitch
Definition: synthlabcore.h:123
virtual bool reset(CoreProcData &processInfo) override
Resets object to initialized state.
Definition: synthlabcore.cpp:61
double panLeftGain
left channel gain
Definition: synthlabcore.h:129
int32_t currentWaveIndex
to minimize dictionary (map) lookup iterating
Definition: synthlabcore.h:131
double renderHardSyncSample(SynthClock &clock, double shape=0.5)
Renders one hard-synced sample from the wavetable Core Specific:
Definition: synthlabcore.cpp:262
Storage for one static table source; a static table is pre-compiled into the synth, or (optionally) read from a file. The "source" stores a set of these tables to maximize frequency content while prohibiting aliasing.
Definition: synthlabwtsource.h:39
virtual ~SynthLabCore()
Definition: synthlabcore.h:111
This is a very specialized object that performs the hard-sync operation using two SynthClocks...
Definition: synthbase.h:365
void checkAddWavetable(SynthLabTableSet &slTableSet, CoreProcData &processInfo, uint32_t waveIndex)
helper function to check database for wavetable and add it if the table does not exist ...
Definition: synthlabcore.cpp:419
This structure defines a set of wavetables that are usually found in .h files and compiled into the s...
Definition: synthbase.h:1126
This structure holds all of the information needed to call functions on a ModuleCore object...
Definition: synthbase.h:1071
IWavetableSource * selectedTableSource
selected table
Definition: synthlabcore.h:137
Synchronizer hardSyncronizer
hard sync helper
Definition: synthlabcore.h:140
double renderSample(SynthClock &clock, double shape=0.5)
Renders one sample out of the wavetable Core Specific:
Definition: synthlabcore.cpp:236