SynthLab SDK
dxegcore.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "synthbase.h"
4 #include "synthfunctions.h"
5 
6 // -----------------------------
7 // --- SynthLab SDK File --- //
8 // ----------------------------
16 // -----------------------------------------------------------------------------
17 namespace SynthLab
18 {
84  class DXEGCore : public ModuleCore
85  {
86  public:
88  DXEGCore(); /* C-TOR */
89 
91  virtual ~DXEGCore() {} /* D-TOR */
92 
94  virtual bool reset(CoreProcData& processInfo) override;
95  virtual bool update(CoreProcData& processInfo) override;
96  virtual bool render(CoreProcData& processInfo) override;
97  virtual bool doNoteOn(CoreProcData& processInfo) override;
98  virtual bool doNoteOff(CoreProcData& processInfo) override;
99 
101  virtual int32_t getState() override { return enumToInt(state); }
102  virtual bool shutdown() override;
103  virtual void setSustainOverride(bool b)override;
104 
105  protected:
107  inline double setStepInc(double timeMsec, double scale = 1.0);
108 
110  double egStepInc = 0.0;
111  double attackTimeScalar = 0.0;
112  double decayTimeScalar = 0.0;
113  EGState state = EGState::kOff;
114  double envelopeOutput = 0.0;
115  double linearEnvOutput = 0.0;
116  double curveEnvOutput = 0.0;
117  double dxOutput = 0.0;
118  double releaseLevel = 0.0;
119  double sampleRate = 0.0;
120 
121  bool sustainOverride = false;
122  bool releasePending = false;
123  bool resetToZero = false;
124  bool noteOff = false;
125  bool retriggered = false;
126  double lastTriggerMod = 0.0;
127 
128  // --- inc value for shutdown
129  double incShutdown = 0.0;
130  };
131 } // namespace
132 
double egStepInc
linear time stepping
Definition: dxegcore.h:110
virtual bool update(CoreProcData &processInfo) override
Updates the object for the next block of audio processing.
Definition: dxegcore.cpp:97
#define enumToInt(ENUM)
macro helper to cast a typed enum to an int
Definition: synthfunctions.h:251
virtual bool render(CoreProcData &processInfo) override
Renders the output of the module.
Definition: dxegcore.cpp:161
Yamaha DX EG-based.
Definition: dxegcore.h:84
bool sustainOverride
if true, places the EG into sustain mode
Definition: dxegcore.h:121
virtual bool shutdown() override
Shutdown handler for EG.
Definition: dxegcore.cpp:440
double releaseLevel
release end point
Definition: dxegcore.h:118
double attackTimeScalar
for MIDI modulations to attack time
Definition: dxegcore.h:111
virtual ~DXEGCore()
Definition: dxegcore.h:91
DXEGCore()
Construction: Cores follow the same construction pattern.
Definition: dxegcore.cpp:29
double incShutdown
shutdown linear incrementer
Definition: dxegcore.h:129
double curveEnvOutput
current outupt
Definition: dxegcore.h:116
double linearEnvOutput
current outupt
Definition: dxegcore.h:115
double dxOutput
final output value
Definition: dxegcore.h:117
Definition: addosccore.cpp:4
EGState state
state variable for FSM
Definition: dxegcore.h:113
bool retriggered
for retrigger modulation
Definition: dxegcore.h:125
EGState
Definition: synthlabparams.h:723
virtual bool doNoteOn(CoreProcData &processInfo) override
Note-on handler for the ModuleCore.
Definition: dxegcore.cpp:344
double setStepInc(double timeMsec, double scale=1.0)
Calculates linear step increment based on time in millisecs.
Definition: dxegcore.cpp:483
bool resetToZero
notes the EG is in reset-to-zero mode
Definition: dxegcore.h:123
double decayTimeScalar
for MIDI modulations to decay time
Definition: dxegcore.h:112
virtual int32_t getState() override
Definition: dxegcore.h:101
double sampleRate
fs
Definition: dxegcore.h:119
double lastTriggerMod
for detecting rising edge of modulator
Definition: dxegcore.h:126
virtual bool reset(CoreProcData &processInfo) override
Resets object to initialized state.
Definition: dxegcore.cpp:67
virtual bool doNoteOff(CoreProcData &processInfo) override
Note-off handler for the ModuleCore.
Definition: dxegcore.cpp:407
virtual void setSustainOverride(bool b) override
Sustain pedal handler for EG.
Definition: dxegcore.cpp:462
hard-coded arrays of FIR filter coefficients for the sample rate conversion objects (Interpolator and...
This structure holds all of the information needed to call functions on a ModuleCore object...
Definition: synthbase.h:1071
double envelopeOutput
current outupt
Definition: dxegcore.h:114
Abstract base class that encapsulates functionality of a module core; used with the Module-Core parad...
Definition: synthbase.h:1516
bool noteOff
not currently used
Definition: dxegcore.h:124
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: dxegcore.h:122
See also Designing Software Synthesizers in C++ 2nd Ed. by Will Pirkle.