SynthLab SDK
classicwtcore.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "synthbase.h"
4 #include "synthfunctions.h"
5 #include "synthlabwtsource.h"
6 
7 // -----------------------------
8 // --- SynthLab SDK File --- //
9 // ----------------------------
17 // -----------------------------------------------------------------------------
18 namespace SynthLab
19 {
85  class ClassicWTCore : public ModuleCore
86  {
87  public:
89  ClassicWTCore(); /* C-TOR */
90 
92  virtual ~ClassicWTCore() {} /* D-TOR */
93 
95  virtual bool reset(CoreProcData& processInfo) override;
96  virtual bool update(CoreProcData& processInfo) override;
97  virtual bool render(CoreProcData& processInfo) override;
98  virtual bool doNoteOn(CoreProcData& processInfo) override;
99  virtual bool doNoteOff(CoreProcData& processInfo) override;
100 
102  double renderSample(SynthClock& clock, double shape = 0.5);
103  double renderHardSyncSample(SynthClock& clock, double shape = 0.5);
104 
105  protected:
106  // --- basic variables
107  double sampleRate = 0.0;
108  double midiPitch = 0.0;
109  double outputAmplitude = 1.0;
110  double panLeftGain = 0.707;
111  double panRightGain = 0.707;
112  int32_t currentWaveIndex = -1;
113 
114  // --- timebase
116 
117  // --- table source
119 
120  // -- hard sync helper
122 
123  // --- function to add wavetables
124  void checkAddWavetable(SynthLabTableSet& slTableSet, CoreProcData& processInfo, uint32_t waveIndex);
125 
126  // --- wavetable sources; these are used to register the tables with the database
127  // if the tables already exist, these won't be used. Notice that the update() function
128  // ONLY uses wavetable sources from the database!
129  StaticTableSource wavetables[MODULE_STRINGS];
130  };
131 
132 } // namespace
133 
Compact modulo counter with wrapping used as the timebase for all oscillators.
Definition: synthbase.h:137
double outputAmplitude
amplitude in dB
Definition: classicwtcore.h:109
double midiPitch
the midi pitch
Definition: classicwtcore.h:108
Interface for wavetable sources.
Definition: synthbase.h:609
virtual bool doNoteOff(CoreProcData &processInfo) override
Note-off handler for the ModuleCore.
Definition: classicwtcore.cpp:403
Synchronizer hardSyncronizer
hard sync helper
Definition: classicwtcore.h:121
Definition: addosccore.cpp:4
virtual bool render(CoreProcData &processInfo) override
Renders the output of the module.
Definition: classicwtcore.cpp:312
SynthClock oscClock
the oscillator timebase
Definition: classicwtcore.h:115
const uint32_t MODULE_STRINGS
Definition: synthconstants.h:130
virtual ~ClassicWTCore()
Definition: classicwtcore.h:92
void checkAddWavetable(SynthLabTableSet &slTableSet, CoreProcData &processInfo, uint32_t waveIndex)
helper function to check database for wavetable and add it if the table does not exist ...
Definition: classicwtcore.cpp:422
virtual bool reset(CoreProcData &processInfo) override
Resets object to initialized state.
Definition: classicwtcore.cpp:77
Storage for one static table source; a static table is pre-compiled into the synth, or (optionally) read from a file. The "source" stores a set of these tables to maximize frequency content while prohibiting aliasing.
Definition: synthlabwtsource.h:39
int32_t currentWaveIndex
to minimize dictionary (map) lookup iterating
Definition: classicwtcore.h:112
IWavetableSource * selectedTableSource
selected table
Definition: classicwtcore.h:118
virtual bool doNoteOn(CoreProcData &processInfo) override
Note-on handler for the ModuleCore.
Definition: classicwtcore.cpp:373
This is a very specialized object that performs the hard-sync operation using two SynthClocks...
Definition: synthbase.h:365
double panRightGain
right channel gain
Definition: classicwtcore.h:111
double panLeftGain
left channel gain
Definition: classicwtcore.h:110
double renderSample(SynthClock &clock, double shape=0.5)
Renders one sample out of the wavetable Core Specific:
Definition: classicwtcore.cpp:239
double renderHardSyncSample(SynthClock &clock, double shape=0.5)
Renders one hard-synced sample from the wavetable Core Specific:
Definition: classicwtcore.cpp:265
This structure defines a set of wavetables that are usually found in .h files and compiled into the s...
Definition: synthbase.h:1126
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
Wavetable oscillator with classic waveforms.
Definition: classicwtcore.h:85
double sampleRate
sample rate
Definition: classicwtcore.h:107
Abstract base class that encapsulates functionality of a module core; used with the Module-Core parad...
Definition: synthbase.h:1516
ClassicWTCore()
Construction: Cores follow the same construction pattern.
Definition: classicwtcore.cpp:36
virtual bool update(CoreProcData &processInfo) override
Updates the object for the next block of audio processing.
Definition: classicwtcore.cpp:130
See also Designing Software Synthesizers in C++ 2nd Ed. by Will Pirkle.