SynthLab SDK
synthlabcore.h
1 #pragma once
2 
3 #include "synthbase.h"
4 #include "synthfunctions.h"
5 #include "sinetablesource.h"
6 #include "dynamictablesource.h"
7 
8 namespace SynthLab
9 {
10 
11  class SynthLabCore : public ModuleCore
12  {
13  public:
15  SynthLabCore(); /* C-TOR */
16 
18  virtual ~SynthLabCore() {} /* D-TOR */
19 
21  virtual bool reset(CoreProcData& processInfo) override;
22  virtual bool update(CoreProcData& processInfo) override;
23  virtual bool render(CoreProcData& processInfo) override;
24  virtual bool doNoteOn(CoreProcData& processInfo) override;
25  virtual bool doNoteOff(CoreProcData& processInfo) override;
26 
28  double renderSample(SynthClock& clock, double shape = 0.5);
29  double renderHardSyncSample(SynthClock& clock, double shape);
30 
32  bool createTables(double sampleRate = 44100.0);
33 
34  protected:
35  // --- basic variables
36  double sampleRate = 0.0;
37  double currentTableRate = 0.0;
38  double midiPitch = 0.0;
39  double outputAmplitude = 1.0;
40  double panLeftGain = 0.707;
41  double panRightGain = 0.707;
42  double hardSyncRatio = 1.0;
43 
44  // --- timebase
46 
47  // --- table source
49 
50  // -- hard sync helper
52 
55  };
56 
57 } // namespace
58 
SineTableSource sineTableSource
sine table for very high frequney notes that have only one harmonic (the fundamental) ...
Definition: synthlabcore.h:53
double renderHardSyncSample(SynthClock &clock, double shape)
Renders one hard-synced sample from the wavetable Core Specific:
Definition: synthlabcore.cpp:213
DynamicTableSource dynamicTableSource
dynamic tables come out of this source
Definition: synthlabcore.h:54
bool createTables(double sampleRate=44100.0)
Table Creation funciont.
Definition: synthlabcore.cpp:364
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:122
double panRightGain
right channel gain
Definition: synthlabcore.h:41
Interface for wavetable sources.
Definition: synthbase.h:588
double currentTableRate
sample rate
Definition: synthlabcore.h:37
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: synthengine.cpp:16
SynthClock oscClock
timebase
Definition: synthlabcore.h:45
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:42
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:39
double midiPitch
the midi pitch
Definition: synthlabcore.h:35
virtual bool reset(CoreProcData &processInfo) override
Resets object to initialized state.
Definition: synthlabcore.cpp:61
double panLeftGain
left channel gain
Definition: synthlabcore.h:40
IWavetableSource * selectedTableSource
selected dynamic table
Definition: synthlabcore.h:48
virtual ~SynthLabCore()
Definition: synthlabcore.h:18
This is a very specialized object that performs the hard-sync operation using two SynthClocks...
Definition: synthbase.h:350
This structure holds all of the information needed to call functions on a ModuleCore object...
Definition: synthbase.h:1020
Synchronizer hardSyncronizer
hard sync helper
Definition: synthlabcore.h:51
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:192