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/synthlabpcmsource.h"
17 
18 // -----------------------------
19 // SynthLab SDK File //
20 // for //
21 // DynamicModule //
22 // Development //
23 // ----------------------------
24 
32 // -----------------------------------------------------------------------------
33 namespace SynthLab
34 {
100  class SynthLabCore : public ModuleCore
101  {
102  public:
104  SynthLabCore(); /* C-TOR */
105 
107  virtual ~SynthLabCore() {} /* D-TOR */
108 
110  virtual bool reset(CoreProcData& processInfo) override;
111  virtual bool update(CoreProcData& processInfo) override;
112  virtual bool render(CoreProcData& processInfo) override;
113  virtual bool doNoteOn(CoreProcData& processInfo) override;
114  virtual bool doNoteOff(CoreProcData& processInfo) override;
115 
116  protected:
117  // --- basic variables
118  double sampleRate = 0.0;
119  double midiPitch = 0.0;
120  double outputAmplitude = 1.0;
121  double panLeftGain = 0.707;
122  double panRightGain = 0.707;
123 
124  // --- timebase
125  double readIndex = 0.0;
126  double phaseInc = 0.0;
127 
128  // --- unit3
129  uint32_t currentIndex = 0;
130 
131  // --- PCM sample source
133 
134  // --- PCM sources; these are used to register the samples with the database
135  // if the samples already exist, these won't be used. Notice that the update() function
136  // ONLY uses PCM sources from the database!
137  SynthLabPCMSource pcmSources[MODULE_STRINGS];
138 
139  // --- helper function
140  void checkAddSampleSet(std::string sampleDirectory, std::string sampleName, CoreProcData& processInfo, uint32_t index);
141  };
142 
143 } // namespace
144 
145 
SynthLabCore()
Construction: Cores follow the same construction pattern.
Definition: synthlabcore.cpp:29
double panRightGain
right channel gain
Definition: synthlabcore.h:130
virtual bool doNoteOff(CoreProcData &processInfo) override
Note-off handler for the ModuleCore.
Definition: synthlabcore.cpp:135
double phaseInc
must persist between update and render
Definition: synthlabcore.h:127
Storage for a set of PCM samples that constitute a patch or instrument.
Definition: synthlabpcmsource.h:41
Interface for PCM sample sources.
Definition: synthbase.h:766
Definition: addosccore.cpp:4
double readIndex
must persist between update and render
Definition: synthlabcore.h:126
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
void checkAddSampleSet(std::string sampleDirectory, std::string sampleName, CoreProcData &processInfo, uint32_t index)
Query the PCM database and add sample sources as needed.
Definition: synthlabcore.cpp:296
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
uint32_t currentIndex
must persist between update and render
Definition: synthlabcore.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
virtual ~SynthLabCore()
Definition: synthlabcore.h:107
IPCMSampleSource * selectedSampleSource
current PCM sample
Definition: synthlabcore.h:133
This structure holds all of the information needed to call functions on a ModuleCore object...
Definition: synthbase.h:1071