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 {
99  class SynthLabCore : public ModuleCore
100  {
101  public:
103  SynthLabCore(); /* C-TOR */
104 
106  virtual ~SynthLabCore() {} /* D-TOR */
107 
109  virtual bool reset(CoreProcData& processInfo) override;
110  virtual bool update(CoreProcData& processInfo) override;
111  virtual bool render(CoreProcData& processInfo) override;
112  virtual bool doNoteOn(CoreProcData& processInfo) override;
113  virtual bool doNoteOff(CoreProcData& processInfo) override;
114 
116  virtual int32_t getState() override { return enumToInt(state); }
117  virtual bool shutdown() override;
118  virtual void setSustainOverride(bool b)override;
119 
120  protected:
122  inline double setStepInc(double timeMsec, double scale = 1.0);
123 
125  double egStepInc = 0.0;
126  double attackTimeScalar = 0.0;
127  double decayTimeScalar = 0.0;
128  EGState state = EGState::kOff;
129  double envelopeOutput = 0.0;
130  double linearEnvOutput = 0.0;
131  double curveEnvOutput = 0.0;
132  double dxOutput = 0.0;
133  double releaseLevel = 0.0;
134  double sampleRate = 0.0;
135 
136  bool sustainOverride = false;
137  bool releasePending = false;
138  bool resetToZero = false;
139  bool noteOff = false;
140  bool retriggered = false;
141  double lastTriggerMod = 0.0;
142 
143  // --- inc value for shutdown
144  double incShutdown = 0.0;
145  };
146 } // namespace
147 
148 
EGState state
EG state variable.
Definition: synthlabcore.h:202
#define enumToInt(ENUM)
macro helper to cast a typed enum to an int
Definition: synthfunctions.h:251
bool noteOff
for retriggering EG
Definition: synthlabcore.h:120
SynthLabCore()
Construction: Cores follow the same construction pattern.
Definition: synthlabcore.cpp:29
bool retriggered
for retriggering EG
Definition: synthlabcore.h:121
double egStepInc
linear time stepping
Definition: synthlabcore.h:125
virtual bool shutdown() override
Shutdown handler for EG.
Definition: synthlabcore.cpp:400
double dxOutput
final output value
Definition: synthlabcore.h:132
virtual int32_t getState() override
Definition: synthlabcore.h:116
virtual bool doNoteOff(CoreProcData &processInfo) override
Note-off handler for the ModuleCore.
Definition: synthlabcore.cpp:135
Definition: addosccore.cpp:4
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
bool sustainOverride
if true, places the EG into sustain mode
Definition: synthlabcore.h:195
bool resetToZero
notes the EG is in reset-to-zero mode
Definition: synthlabcore.h:138
double lastTriggerMod
for retriggering EG trigger detection
Definition: synthlabcore.h:122
EGState
Definition: synthlabparams.h:723
double decayTimeScalar
for MIDI modulations to decay time
Definition: synthlabcore.h:127
double envelopeOutput
the current envelope output sample
Definition: synthlabcore.h:176
virtual bool doNoteOn(CoreProcData &processInfo) override
Note-on handler for the ModuleCore.
Definition: synthlabcore.cpp:116
virtual bool reset(CoreProcData &processInfo) override
Resets object to initialized state.
Definition: synthlabcore.cpp:61
double setStepInc(double timeMsec, double scale=1.0)
Calculates linear step increment based on time in millisecs.
Definition: synthlabcore.cpp:486
virtual void setSustainOverride(bool b) override
Sustain pedal handler for EG.
Definition: synthlabcore.cpp:422
double curveEnvOutput
current outupt
Definition: synthlabcore.h:131
double releaseLevel
release end point
Definition: synthlabcore.h:133
virtual ~SynthLabCore()
Definition: synthlabcore.h:106
bool releasePending
a flag set when a note off event occurs while the sustain pedal is held, telling the EG to go to the ...
Definition: synthlabcore.h:196
double linearEnvOutput
current outupt
Definition: synthlabcore.h:130
double incShutdown
shutdown linear incrementer
Definition: synthlabcore.h:199
This structure holds all of the information needed to call functions on a ModuleCore object...
Definition: synthbase.h:1071
double attackTimeScalar
for MIDI modulations to attack time
Definition: synthlabcore.h:126