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 
17 // -----------------------------
18 // SynthLab SDK File //
19 // for //
20 // DynamicModule //
21 // Development //
22 // ----------------------------
23 
31 // -----------------------------------------------------------------------------
32 namespace SynthLab
33 {
98  class SynthLabCore : public ModuleCore
99  {
100  public:
102  SynthLabCore(); /* C-TOR */
103 
105  virtual ~SynthLabCore() {} /* D-TOR */
106 
108  virtual bool reset(CoreProcData& processInfo) override;
109  virtual bool update(CoreProcData& processInfo) override;
110  virtual bool render(CoreProcData& processInfo) override;
111  virtual bool doNoteOn(CoreProcData& processInfo) override;
112  virtual bool doNoteOff(CoreProcData& processInfo) override;
113 
115  double renderSawtoothSample(SynthClock& clock, bool advanceClock = true);
116  double renderSquareSample(SynthClock& clock, double& sawtoothSample);
117 
118  protected:
119  // --- basic variables
120  double sampleRate = 0.0;
121  double midiPitch = 0.0;
122  double outputAmplitude = 1.0;
123  double panLeftGain = 0.707;
124  double panRightGain = 0.707;
125  double pulseWidth = 0.5;
126 
127  // --- timebase
129  };
130 
131 } // namespace
132 
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
double pulseWidth
[0.5, 0.95] for square wave only
Definition: synthlabcore.h:125
virtual bool doNoteOff(CoreProcData &processInfo) override
Note-off handler for the ModuleCore.
Definition: synthlabcore.cpp:135
double renderSawtoothSample(SynthClock &clock, bool advanceClock=true)
BLEP sawtooth.
Definition: synthlabcore.cpp:182
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
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
virtual ~SynthLabCore()
Definition: synthlabcore.h:105
double renderSquareSample(SynthClock &clock, double &sawtoothSample)
sum of saws method
Definition: synthlabcore.cpp:229
This structure holds all of the information needed to call functions on a ModuleCore object...
Definition: synthbase.h:1071