SynthLab SDK
synthstructures.h
1 #ifndef __synthSruxt_h__
2 #define __synthSruxt_h__
3 
4 #include <cmath>
5 #include <random>
6 #include <string>
7 #include <sstream>
8 #include <vector>
9 #include <stdint.h>
10 #include <memory>
11 
12 #include "synthconstants.h"
13 
14 #define _MATH_DEFINES_DEFINED
15 
16 namespace SynthLab
17 {
31  struct XFadeData
32  {
33  // --- stereo input/output crossfader
34  double linearGain[2] = { 0.0, 0.0 };
35  double constPwrGain[2] = { 0.0, 0.0 };
36  double squareLawGain[2] = { 0.0, 0.0 };
37  bool crossfadeFinished = false;
38  };
39 
40 
54  {
55  MidiOutputData() {}
56 
57  // --- shared MIDI tables, via IMIDIData
58  uint32_t globalMIDIData[kNumMIDIGlobals] = { 0 };
59  uint32_t ccMIDIData[kNumMIDICCs] = { 0 };
60  };
61 
75  {
76  WaveStringData(uint32_t _coreIndex, uint32_t _coreWaveIndex)
77  : coreIndex(_coreIndex)
78  , coreWaveIndex(_coreWaveIndex) {}
79 
80  uint32_t coreIndex = 0;
81  uint32_t coreWaveIndex = 0;
82  };
83 
98  struct LookUpTable
99  {
100  LookUpTable(uint32_t _tableLength)
101  {
102  tableLength = _tableLength;
103  table = new double[tableLength];
104  }
105  ~LookUpTable()
106  {
107  if (table) delete[] table;
108  }
109  uint32_t tableLength = 1024;
110  double* table = nullptr;
111  };
112 
113 
127  struct PluginInfo
128  {
129  PluginInfo() {}
130 
131  PluginInfo& operator=(const PluginInfo& data) // need this override for collections to work
132  {
133  if (this == &data)
134  return *this;
135 
136  pathToDLL = data.pathToDLL;
137 
138  return *this;
139  }
140 
141  const char* pathToDLL;
142  };
143 
155  struct midiEvent
156  {
157  midiEvent() {}
158 
159  midiEvent(uint32_t _midiMessage,
160  uint32_t _midiChannel,
161  uint32_t _midiData1,
162  uint32_t _midiData2,
163  uint32_t _midiSampleOffset = 0)
164  : midiMessage(_midiMessage)
165  , midiChannel(_midiChannel)
166  , midiData1(_midiData1)
167  , midiData2(_midiData2)
168  , midiSampleOffset(_midiSampleOffset) {}
169 
170  midiEvent& operator=(const midiEvent& data) // need this override for collections to work
171  {
172  if (this == &data)
173  return *this;
174 
175  midiMessage = data.midiMessage;
176  midiChannel = data.midiChannel;
177  midiData1 = data.midiData1;
178  midiData2 = data.midiData2;
180  return *this;
181  }
182 
183  uint32_t midiMessage = 0;
184  uint32_t midiChannel = 0;
185  uint32_t midiData1 = 0;
186  uint32_t midiData2 = 0;
187  uint32_t midiSampleOffset = 0;
188  };
189 
190 
202  struct GlideInfo
203  {
204  GlideInfo(uint32_t _startMIDINote, uint32_t _endMIDINote, double _glideTime_mSec, double _sampleRate)
205  : startMIDINote(_startMIDINote)
206  , endMIDINote(_endMIDINote)
207  , glideTime_mSec(_glideTime_mSec)
208  , sampleRate(_sampleRate) {}
209 
210  uint32_t startMIDINote = 0;
211  uint32_t endMIDINote = 0;
212  double glideTime_mSec = 0.0;
213  double sampleRate = 0.0;
214  };
215 
216 
229  {
230  // --- call with no params for default
231  MIDINoteEvent(double _midiPitch = 0.0, uint32_t _midiNoteNumber = 0, uint32_t _midiNoteVelocity = 0)
232  : midiPitch(_midiPitch)
233  , midiNoteNumber(_midiNoteNumber)
234  , midiNoteVelocity(_midiNoteVelocity) {}
235 
236  double midiPitch = 0.0;
237  uint32_t midiNoteNumber = 0;
238  uint32_t midiNoteVelocity = 0;
239  };
240 
254  {
255  // --- one droplist control, depending on type of module can contain max 8 slots
257  const char* modKnobStrings[MOD_KNOBS];
258  };
259 
260 
273  {
274  std::string bankName = empty_string.c_str();
275  uint32_t numTables = 1;
276  std::string tableNames[MODULE_STRINGS];
277  };
278 
279 } // namespace
280 
281 #endif /* defined(__synthDefs_h__) */
uint32_t midiData1
BYTE data 1 as UINT.
Definition: synthstructures.h:185
PluginInfo & operator=(const PluginInfo &data)
Definition: synthstructures.h:131
uint32_t globalMIDIData[kNumMIDIGlobals]
the global MIDI INPUT table that is shared across the voices via the IMIDIData interface ...
Definition: synthstructures.h:58
uint32_t numTables
number of wavetables in bank (up to 16)
Definition: synthstructures.h:275
double sampleRate
fs
Definition: synthstructures.h:213
uint32_t midiData2
BYTE data 2 as UINT.
Definition: synthstructures.h:186
uint32_t endMIDINote
ending MIDI note for the glide
Definition: synthstructures.h:211
std::string tableNames[MODULE_STRINGS]
names of wavetables
Definition: synthstructures.h:276
const char * moduleStrings[MODULE_STRINGS]
up to 16
Definition: synthstructures.h:256
Structure to hold a dynamic LUT and its length.
Definition: synthstructures.h:98
Information about the selected core and the selected wavform within that core.
Definition: synthstructures.h:74
Information about a bank of wavetables that are used in the morphing wavetable core.
Definition: synthstructures.h:272
uint32_t midiNoteNumber
note number (saved for portamento and voice steal)
Definition: synthstructures.h:237
Definition: synthlabcore.cpp:4
uint32_t midiChannel
BYTE channel as UINT.
Definition: synthstructures.h:184
Definition: synthstructures.h:202
uint32_t coreWaveIndex
selected waveform within core
Definition: synthstructures.h:81
double constPwrGain[2]
constant power coefficients
Definition: synthstructures.h:35
const uint32_t MODULE_STRINGS
Definition: synthconstants.h:116
uint32_t coreIndex
selected core
Definition: synthstructures.h:80
bool crossfadeFinished
crossfade is done
Definition: synthstructures.h:37
double midiPitch
pitch in Hz of the MIDI note that was played
Definition: synthstructures.h:236
const char * modKnobStrings[MOD_KNOBS]
up to 4
Definition: synthstructures.h:257
double linearGain[2]
linear coefficients
Definition: synthstructures.h:34
const uint32_t MOD_KNOBS
Definition: synthconstants.h:119
uint32_t ccMIDIData[kNumMIDICCs]
the global MIDI CC INPUT table that is shared across the voices via the IMIDIData interface ...
Definition: synthstructures.h:59
double squareLawGain[2]
square law coefficients
Definition: synthstructures.h:36
Data about a crossfade operation.
Definition: synthstructures.h:31
const std::string empty_string
Definition: synthconstants.h:168
MIDI output message and data information.
Definition: synthstructures.h:53
uint32_t startMIDINote
starting MIDI note for the glide
Definition: synthstructures.h:210
uint32_t midiMessage
BYTE message as UINT.
Definition: synthstructures.h:183
std::string bankName
one name for bank
Definition: synthstructures.h:274
uint32_t midiSampleOffset
sample offset of midi event within audio buffer
Definition: synthstructures.h:187
Structure that is used during the base class initilize( ) funciton call, after object instantiation i...
Definition: synthstructures.h:127
Information about a MIDI event.
Definition: synthstructures.h:155
Contains the two sets of strings unique to each core: the module strings (waveforms for oscillators) ...
Definition: synthstructures.h:253
const char * pathToDLL
complete path to the DLL (component) without trailing backslash
Definition: synthstructures.h:141
uint32_t midiNoteVelocity
note velocity (saved for portamento and voice steal)
Definition: synthstructures.h:238
double glideTime_mSec
glide time to cover the range of notes
Definition: synthstructures.h:212
const uint32_t kNumMIDICCs
Definition: synthconstants.h:548
Information about a MIDI note event (note on or note off).
Definition: synthstructures.h:228