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 
14 #include "../../../../source/synthbase.h"
15 #include "../../../../source/synthfunctions.h"
16 #include "../../../../source/sinetablesource.h"
17 #include "../../../../source/dynamictablesource.h"
18 
19 // -----------------------------
20 // SynthLab SDK File //
21 // for //
22 // DynamicModule //
23 // Development //
24 // ----------------------------
25 
33 // -----------------------------------------------------------------------------
34 namespace SynthLab
35 {
102  class SynthLabCore : public ModuleCore
103  {
104  public:
106  SynthLabCore(); /* C-TOR */
107 
109  virtual ~SynthLabCore() {} /* D-TOR */
110 
112  virtual bool reset(CoreProcData& processInfo) override;
113  virtual bool update(CoreProcData& processInfo) override;
114  virtual bool render(CoreProcData& processInfo) override;
115  virtual bool doNoteOn(CoreProcData& processInfo) override;
116  virtual bool doNoteOff(CoreProcData& processInfo) override;
117 
119  double renderSample(SynthClock& clock, double shape = 0.5);
120  double renderHardSyncSample(SynthClock& clock, double shape);
121 
123  bool createTables(double sampleRate = 44100.0);
124 
125  protected:
126  // --- basic variables
127  double sampleRate = 0.0;
128  double currentTableRate = 0.0;
129  double midiPitch = 0.0;
130  double outputAmplitude = 1.0;
131  double panLeftGain = 0.707;
132  double panRightGain = 0.707;
133  double hardSyncRatio = 1.0;
134  int32_t currentWaveIndex = -1;
135 
136  // --- timebase
138 
139  // --- table source
141 
142  // -- hard sync helper
144 
147  };
148 
149 } // namespace
SineTableSource sineTableSource
a single sinewave table
Definition: synthlabcore.h:130
DynamicTableSource dynamicTableSource
dynamic tables come out of this source
Definition: synthlabcore.h:146
bool createTables(double sampleRate=44100.0)
Table Creation funciont.
Definition: synthlabcore.cpp:409
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
double currentTableRate
sample rate
Definition: synthlabcore.h:128
virtual bool doNoteOff(CoreProcData &processInfo) override
Note-off handler for the ModuleCore.
Definition: synthlabcore.cpp:135
Storage for one static sinusoidal table source; stores a single sine table that is used for all notes...
Definition: sinetablesource.h:39
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
double hardSyncRatio
for hard sync
Definition: synthlabcore.h:133
virtual bool render(CoreProcData &processInfo) override
Renders the output of the module.
Definition: synthlabcore.cpp:98
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
virtual ~SynthLabCore()
Definition: synthlabcore.h:109
This is a very specialized object that performs the hard-sync operation using two SynthClocks...
Definition: synthbase.h:365
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
Storage for one dynamic table source; a wavetable that is created dynamically at load time...
Definition: dynamictablesource.h:38
double renderSample(SynthClock &clock, double shape=0.5)
Renders one sample out of the wavetable Core Specific:
Definition: synthlabcore.cpp:236