SynthLab SDK
|
See also Designing Software Synthesizers in C++ 2nd Ed. by Will Pirkle. More...
#include <cmath>
#include <random>
#include <string>
#include <sstream>
#include <vector>
#include <stdint.h>
#include <memory>
Go to the source code of this file.
Macros | |
#define | _MATH_DEFINES_DEFINED |
#define | FLT_EPSILON_PLUS 1.192092896e-07 |
/* smallest such that 1.0+FLT_EPSILON != 1.0 */ | |
#define | FLT_EPSILON_MINUS -1.192092896e-07 |
/* smallest such that 1.0-FLT_EPSILON != 1.0 */ | |
#define | FLT_MIN_PLUS 1.175494351e-38 |
/* min positive value */ | |
#define | FLT_MIN_MINUS -1.175494351e-38 |
/* min negative value */ | |
Enumerations | |
enum | SynthLab::modSource { kSourceLFO1_Norm, kSourceLFO1_Inv, kSourceLFO1_QP, kSourceLFO1_MaxDown, kSourceLFO2_Norm, kSourceLFO2_Inv, kSourceLFO2_QP, kSourceAmpEG_Norm, kSourceAmpEG_Bias, kSourceFilterEG_Norm, kSourceFilterEG_Bias, kSourceAuxEG_Norm, kSourceAuxEG_Bias, kSourceOsc1_Norm, kSourceJoystickAC, kSourceJoystickBD, kSourceWSWaveMix_A, kSourceWSWaveMix_B, kSourceWSWaveIndex_A, kSourceWSWaveIndex_B, kSourceWSWaveAmpMod_A, kSourceWSWaveAmpMod_B, kSourceWSPitchMod_A, kSourceWSPitchMod_B, kSourceWStepSeqMod, kSourceWSXfadeDone, kSourceWSStepNumber_A, kSourceWSStepNumber_B, kNumberModSources } |
Enumeration for accessing an array of modulator sources. More... | |
enum | SynthLab::modDestination { kDestOsc1_fo, kDestOsc2_fo, kDestOsc3_fo, kDestOsc4_fo, kDestOsc5_fo, kDestOsc6_fo, kDestOsc7_fo, kDestOsc8_fo, kDestOsc1_Shape, kDestOsc2_Shape, kDestOsc3_Shape, kDestOsc4_Shape, kDestOsc1_Amp, kDestOsc2_Amp, kDestOsc3_Amp, kDestOsc4_Amp, kDestOsc1_Mod, kDestOsc2_Mod, kDestOsc3_Mod, kDestOsc4_Mod, kDestOsc5_Mod, kDestOsc6_Mod, kDestOsc7_Mod, kDestOsc8_Mod, kDestOsc1_Morph, kDestOsc2_Morph, kDestOsc3_Morph, kDestOsc4_Morph, kDestOsc5_Morph, kDestOsc6_Morph, kDestOsc7_Morph, kDestOsc8_Morph, kDestOsc1_WSWaveMix_A, kDestOsc2_WSWaveMix_A, kDestOsc1_WSWaveMix_B, kDestOsc2_WSWaveMix_B, kDestOsc1_WSWaveIndex_A, kDestOsc2_WSWaveIndex_A, kDestOsc1_WSWaveIndex_B, kDestOsc2_WSWaveIndex_B, kDestOsc1_WSWaveAmp_A, kDestOsc2_WSWaveAmp_A, kDestOsc1_WSWaveAmp_B, kDestOsc2_WSWaveAmp_B, kDestOsc1_WSWavePitch_A, kDestOsc2_WSWavePitch_A, kDestOsc1_WSWavePitch_B, kDestOsc2_WSWavePitch_B, kDestOsc1WSXFadeDone, kDestOsc2WSXFadeDone, kDestOsc3WSXFadeDone, kDestOsc4WSXFadeDone, kDestWSWaveStepNumber_A1, kDestWSWaveStepNumber_B1, kDestWSWaveStepNumber_A2, kDestWSWaveStepNumber_B2, kDestAmpEGRetrigger, kDestFilterEGRetrigger, kDestAuxEGRetrigger, kDestLFO1_fo, kDestLFO2_fo, kDestFilter1_fc_EG, kDestFilter2_fc_EG, kDestFilter1_fc_Bipolar, kDestFilter2_fc_Bipolar, kDestDCA_EGMod, kDestDCA_AmpMod, kDestDCA_PanMod, kDestDCA_SampleHoldMod, kDestDCA_TriggerMod, kNumberModDestinations } |
Enumeration for accessing an array of modulator destinations. More... | |
enum | SynthLab::globalMIDI { kCurrentMIDINoteNumber, kCurrentMIDINoteVelocity, kLastMIDINoteNumber, kLastMIDINoteVelocity, kMIDIPitchBendDataLSB, kMIDIPitchBendDataMSB, kMIDIMasterPBSensCoarse, kMIDIMasterPBSensFine, kMIDIMasterTuneCoarseLSB, kMIDIMasterTuneCoarseMSB, kMIDIMasterTuneFineLSB, kMIDIMasterTuneFineMSB, kMIDIMasterVolumeLSB, kMIDIMasterVolumeMSB, kNumMIDIGlobals } |
Enumeration for the global MIDI data array. More... | |
enum | { kWSWaveMix_A, kWSWaveMix_B, kWSWaveIndex_A, kWSWaveIndex_B, kWSWaveAmpMod_A, kWSWaveAmpMod_B, kWSPitchMod_A, kWSPitchMod_B, kWStepSeqMod, kWSXFadeDone, kWSWaveStepNumber_A, kWSWaveStepNumber_B, kWSSoloingWaveIndex, kNumWSOutputs } |
enum | SynthLab::auxMIDI { kBPM, kTSNumerator, kTSDenominator, kAbsBufferTime, kDMBuild, kDualMonoFilters, kHalfSampleSet, kReduceUnisonVoices, kAnalogFGNFilters, kNumMIDIAuxes } |
Enumeration for the aux data that is transmitted with the MIDI input information; it may or may not originate as actual MIDI information, but is passed along with that info. | |
enum | SynthLab::SynthMode { kMono, kLegato, kUnison, kUnisonLegato, kPoly } |
enum | SynthLab::FilterMode { kSeries, kParallel } |
enum | SynthLab::DX100Algo { kFM1, kFM2, kFM3, kFM4, kFM5, kFM6, kFM7, kFM8 } |
enum | { kNoMMTransform, kMMTransformBipolar, kMMTransformUnipolar, kNumMMTransforms } |
enum | { kEGMod, kBiasedEGMod, kUnipolarMod, kBipolarMod, kFrequencyMod, kPhaseMod, kAmpMod, kMaxDownAmpMod, kPanMod, kShapeMod, kUniqueMod, kTriggerMod, kWaveMorphMod, kWaveSeqWave_AGainMod, kWaveSeqWave_BGainMod, kWaveSeqWaveIndex_AMod, kWaveSeqWaveIndex_BMod, kWaveSeqPitch_AMod, kWaveSeqPitch_BMod, kWaveSeqAmp_AMod, kWaveSeqAmp_BMod, kWaveSeqStepSeqMod, kWaveSeqXFadeDoneMod, kWaveStepNumber_A, kWaveStepNumber_B, kNumModulators } |
Variables | |
const double | SynthLab::kSqrtTwo = pow(2.0, 0.5) |
square root of 2 More... | |
const double | SynthLab::kPi = 3.14159265358979323846264338327950288419716939937510582097494459230781640628620899 |
pi to 80 decimal places More... | |
const double | SynthLab::kTwoPi = 2.0*3.14159265358979323846264338327950288419716939937510582097494459230781640628620899 |
2pi to 80 decimal places More... | |
const uint32_t | SynthLab::sineTableLength = 1024 |
const uint32_t | SynthLab::kNumMIDICCs = 128 |
const uint32_t | SynthLab::MAX_VOICES = 16 |
const uint32_t | SynthLab::MAX_SYNTH_CHANNELS = 32 |
const uint32_t | SynthLab::MAX_OSC_CHANNELS = 32 |
const uint32_t | SynthLab::MAX_PROCESSOR_CHANNELS = 32 |
const uint32_t | SynthLab::MAX_MODULATION_CHANNELS = 48 |
const bool | SynthLab::PITCHLESS_LOOP = true |
const bool | SynthLab::AUBIO_SLICES = true |
const uint32_t | SynthLab::NUM_OSC = 4 |
const uint32_t | SynthLab::NUM_LFO = 2 |
const uint32_t | SynthLab::NUM_FILTER = 2 |
const uint32_t | SynthLab::NUM_EG = 3 |
const uint32_t | SynthLab::NUM_WS_OSCILLATORS = 4 |
const uint32_t | SynthLab::NUM_OSCILLATORS = 4 |
const double | SynthLab::SHUTDOWN_TIME_MSEC = 2.0 |
short shutdown time when stealing a voice | |
const uint32_t | SynthLab::UNDEFINED_MODULE = 0 |
const uint32_t | SynthLab::LFO_MODULE = 1 |
const uint32_t | SynthLab::EG_MODULE = 2 |
const uint32_t | SynthLab::DCA_MODULE = 3 |
const uint32_t | SynthLab::FILTER_MODULE = 4 |
const uint32_t | SynthLab::WTO_MODULE = 5 |
const uint32_t | SynthLab::VAO_MODULE = 6 |
const uint32_t | SynthLab::FMO_MODULE = 7 |
const uint32_t | SynthLab::PCMO_MODULE = 8 |
const uint32_t | SynthLab::KSO_MODULE = 9 |
const uint32_t | SynthLab::OSC_MODULE = 10 |
const uint32_t | SynthLab::MODULE_STRINGS = 16 |
const uint32_t | SynthLab::HALF_LEGACY_STRINGS = 8 |
const uint32_t | SynthLab::HALF_MELLOTRON_STRINGS = 5 |
const uint32_t | SynthLab::WTBANK_SOURCES = MODULE_STRINGS |
const uint32_t | SynthLab::SMPLBANK_SOURCES = MODULE_STRINGS |
const uint32_t | SynthLab::MOD_KNOBS = 4 |
const uint32_t | SynthLab::NUM_MODULE_CORES = 4 |
const uint32_t | SynthLab::DEFAULT_CORE = 0 |
const uint32_t | SynthLab::CUSTOM_CORE_0 = 1 |
const uint32_t | SynthLab::CUSTOM_CORE_1 = 2 |
const uint32_t | SynthLab::CUSTOM_CORE_2 = 3 |
const uint32_t | SynthLab::LFO1_WAVEFORMS = 0x1 |
const uint32_t | SynthLab::LFO2_WAVEFORMS = 0x2 |
const uint32_t | SynthLab::OSC1_WAVEFORMS = 0x4 |
const uint32_t | SynthLab::OSC2_WAVEFORMS = 0x8 |
const uint32_t | SynthLab::OSC3_WAVEFORMS = 0x10 |
const uint32_t | SynthLab::OSC4_WAVEFORMS = 0x20 |
const uint32_t | SynthLab::EG1_CONTOUR = 0x40 |
const uint32_t | SynthLab::EG2_CONTOUR = 0x80 |
const uint32_t | SynthLab::EG3_CONTOUR = 0x100 |
const uint32_t | SynthLab::FILTER1_TYPES = 0x200 |
const uint32_t | SynthLab::FILTER2_TYPES = 0x400 |
const uint32_t | SynthLab::LFO1_SOURCE = 0x800 |
const uint32_t | SynthLab::LFO2_SOURCE = 0x1000 |
const uint32_t | SynthLab::OSC1_SOURCE = 0x2000 |
const uint32_t | SynthLab::OSC2_SOURCE = 0x4000 |
const uint32_t | SynthLab::OSC3_SOURCE = 0x8000 |
const uint32_t | SynthLab::OSC4_SOURCE = 0x10000 |
const uint32_t | SynthLab::EG1_SOURCE = 0x20000 |
const uint32_t | SynthLab::EG2_SOURCE = 0x40000 |
const uint32_t | SynthLab::EG3_SOURCE = 0x80000 |
const uint32_t | SynthLab::FILTER1_SOURCE = 0x100000 |
const uint32_t | SynthLab::FILTER2_SOURCE = 0x200000 |
const uint32_t | SynthLab::WAVE_SEQ_WAVES_1 = 0x400000 |
const uint32_t | SynthLab::WAVE_SEQ_WAVES_2 = 0x800000 |
const uint32_t | SynthLab::WAVE_SEQ_WAVES_3 = 0x1000000 |
const uint32_t | SynthLab::WAVE_SEQ_WAVES_4 = 0x2000000 |
const uint32_t | SynthLab::WAVE_SEQ_WAVES_5 = 0x4000000 |
const uint32_t | SynthLab::WAVE_SEQ_WAVES_6 = 0x8000000 |
const uint32_t | SynthLab::WAVE_SEQ_WAVES_7 = 0x10000000 |
const uint32_t | SynthLab::WAVE_SEQ_WAVES_8 = 0x20000000 |
const std::string | SynthLab::empty_string = "-----" |
const double | SynthLab::kMinModGain_dB = -60.0 |
const double | SynthLab::kMaxModGain_dB = 0.0 |
const double | SynthLab::kMinAbsoluteGain_dB = -96.0 |
const double | SynthLab::kDCA_Amp_ModRange = 1.0 |
const double | SynthLab::kDCA_Pan_ModRange = 1.0 |
const double | SynthLab::kOscBipolarModRangeSemitones = 12.0 |
const double | SynthLab::kPiSqared = kPi * kPi |
const double | SynthLab::kFourPi = kPi * 4.0 |
const double | SynthLab::kPiOverFour = kPi / 4.0 |
enum | { LEFT_CHANNEL, RIGHT_CHANNEL } |
enum | { LEFT, RIGHT, STEREO } |
enum | { MONO_CHANNEL = 0, STEREO_CHANNELS = 2 } |
enum | { MONO_TO_MONO, MONO_TO_STEREO, STEREO_TO_STEREO } |
const uint32_t | SynthLab::NO_CHANNELS = 0 |
enum | SynthLab::XFadeType { kLinear, kSquareLaw, kConstantPower } |
enum | SynthLab::LoopDirection { kForward, kBackward, kForwardBackward } |
enum | SynthLab::StepMode { kNote, kRest, kGate } |
enum | { WAVE_LANE, PITCH_LANE, STEP_SEQ_LANE, NUM_MOD_LANES } |
const uint32_t | SynthLab::MAX_SEQ_STEPS = 8 |
const uint32_t | SynthLab::MAX_SEQ_STEPSPLUS_OFF = MAX_SEQ_STEPS + 1 |
const uint32_t | SynthLab::WRAP_MASK = MAX_SEQ_STEPS - 1 |
enum | { MOD_KNOB_A, MOD_KNOB_B, MOD_KNOB_C, MOD_KNOB_D } |
const uint32_t | SynthLab::LFO1_MOD_KNOBS = 0x1 |
const uint32_t | SynthLab::LFO2_MOD_KNOBS = 0x2 |
const uint32_t | SynthLab::OSC1_MOD_KNOBS = 0x4 |
const uint32_t | SynthLab::OSC2_MOD_KNOBS = 0x8 |
const uint32_t | SynthLab::OSC3_MOD_KNOBS = 0x10 |
const uint32_t | SynthLab::OSC4_MOD_KNOBS = 0x20 |
const uint32_t | SynthLab::EG1_MOD_KNOBS = 0x40 |
const uint32_t | SynthLab::EG2_MOD_KNOBS = 0x80 |
const uint32_t | SynthLab::EG3_MOD_KNOBS = 0x100 |
const uint32_t | SynthLab::FILTER1_MOD_KNOBS = 0x200 |
const uint32_t | SynthLab::FILTER2_MOD_KNOBS = 0x400 |
enum | { HANN_LUT, HAMMING_LUT } |
const uint32_t | SynthLab::DEFAULT_LUT_LENGTH = 1024 |
const uint32_t | SynthLab::DEFAULT_LUT_WRAP_MASK = 1023 |
enum | SynthLab::midiChannels { MIDI_CH_1 = 0, MIDI_CH_2, MIDI_CH_3, MIDI_CH_4, MIDI_CH_5, MIDI_CH_6, MIDI_CH_7, MIDI_CH_8, MIDI_CH_9, MIDI_CH_10, MIDI_CH_11, MIDI_CH_12, MIDI_CH_13, MIDI_CH_14, MIDI_CH_15, MIDI_CH_16, MIDI_CH_ALL } |
const unsigned char | SynthLab::NOTE_OFF = 0x80 |
const unsigned char | SynthLab::NOTE_ON = 0x90 |
const unsigned char | SynthLab::POLY_PRESSURE = 0xA0 |
const unsigned char | SynthLab::CONTROL_CHANGE = 0xB0 |
const unsigned char | SynthLab::PROGRAM_CHANGE = 0xC0 |
const unsigned char | SynthLab::CHANNEL_PRESSURE = 0xD0 |
const unsigned char | SynthLab::PITCH_BEND = 0xE0 |
const unsigned char | SynthLab::MOD_WHEEL = 0x01 |
const unsigned char | SynthLab::VOLUME_CC07 = 0x07 |
const unsigned char | SynthLab::PAN_CC10 = 0x0A |
const unsigned char | SynthLab::EXPRESSION_CC11 = 0x0B |
const unsigned char | SynthLab::JOYSTICK_X = 0x10 |
const unsigned char | SynthLab::JOYSTICK_Y = 0x11 |
const unsigned char | SynthLab::SUSTAIN_PEDAL = 0x40 |
const unsigned char | SynthLab::RESET_ALL_CONTROLLERS = 0x79 |
const unsigned char | SynthLab::ALL_NOTES_OFF = 0x7B |
const unsigned char | SynthLab::SYSTEM_EXCLUSIVE = 0xF0 |
const unsigned char | SynthLab::MIDI_TIME_CODE = 0xF1 |
const unsigned char | SynthLab::SONG_POSITION_POINTER = 0xF2 |
const unsigned char | SynthLab::SONG_SELECT = 0xF3 |
const unsigned char | SynthLab::TUNE_REQUEST = 0xF6 |
const unsigned char | SynthLab::END_OF_EXCLUSIVE = 0xF7 |
const unsigned char | SynthLab::TIMING_CLOCK = 0xF8 |
const unsigned char | SynthLab::START = 0xFA |
const unsigned char | SynthLab::CONTINUE = 0xFB |
const unsigned char | SynthLab::SToP = 0xFC |
const unsigned char | SynthLab::ACTIVE_SENSING = 0xFE |
const unsigned char | SynthLab::SYSTEM_RESET = 0xFF |
const uint32_t | SynthLab::NUM_MIDI_NOTES = 128 |
const uint32_t | SynthLab::MIDI_NOTE_A0 = 21 |
const uint32_t | SynthLab::MIDI_NOTE_A4 = 69 |
const double | SynthLab::MIDI_NOTE_0_FREQ = 8.176 |
See also Designing Software Synthesizers in C++ 2nd Ed. by Will Pirkle.
anonymous enum |
Top level, global constants for dealing with indexing audio channels, specifically for MONO and STEREO support. If your synth supports rendering more than 2 channels, you can define your own constants with these.
anonymous enum |
Top level, global constants for dealing with indexing audio channels, specifically for MONO and STEREO support. If your synth supports rendering more than 2 channels, you can define your own constants with these.
anonymous enum |
Top level, global constants for dealing with indexing audio channels, specifically for MONO and STEREO support. If your synth supports rendering more than 2 channels, you can define your own constants with these.
anonymous enum |
Top level, global constants for dealing with indexing audio channels, specifically for MONO and STEREO support. If your synth supports rendering more than 2 channels, you can define your own constants with these.
anonymous enum |
Constant for decoding the MOD KNOB custom update code that I use for updating GUI controls with dynamic strings.
anonymous enum |
Used for built-in lookup tables
MIDI constants
const unsigned char SynthLab::ACTIVE_SENSING = 0xFE |
MIDI constants
const unsigned char SynthLab::ALL_NOTES_OFF = 0x7B |
MIDI constants
const unsigned char SynthLab::CHANNEL_PRESSURE = 0xD0 |
MIDI constants
const unsigned char SynthLab::CONTINUE = 0xFB |
MIDI constants
const unsigned char SynthLab::CONTROL_CHANGE = 0xB0 |
MIDI constants
const uint32_t SynthLab::DEFAULT_LUT_LENGTH = 1024 |
Used for built-in lookup tables
const uint32_t SynthLab::DEFAULT_LUT_WRAP_MASK = 1023 |
Used for built-in lookup tables
const uint32_t SynthLab::EG1_MOD_KNOBS = 0x40 |
Constant for decoding the MOD KNOB custom update code that I use for updating GUI controls with dynamic strings.
const uint32_t SynthLab::EG2_MOD_KNOBS = 0x80 |
Constant for decoding the MOD KNOB custom update code that I use for updating GUI controls with dynamic strings.
const uint32_t SynthLab::EG3_MOD_KNOBS = 0x100 |
Constant for decoding the MOD KNOB custom update code that I use for updating GUI controls with dynamic strings.
const unsigned char SynthLab::END_OF_EXCLUSIVE = 0xF7 |
MIDI constants
const unsigned char SynthLab::EXPRESSION_CC11 = 0x0B |
MIDI constants
const uint32_t SynthLab::FILTER1_MOD_KNOBS = 0x200 |
Constant for decoding the MOD KNOB custom update code that I use for updating GUI controls with dynamic strings.
const uint32_t SynthLab::FILTER2_MOD_KNOBS = 0x400 |
Constant for decoding the MOD KNOB custom update code that I use for updating GUI controls with dynamic strings.
const unsigned char SynthLab::JOYSTICK_X = 0x10 |
MIDI constants
const unsigned char SynthLab::JOYSTICK_Y = 0x11 |
MIDI constants
const uint32_t SynthLab::LFO2_MOD_KNOBS = 0x2 |
Constant for decoding the MOD KNOB custom update code that I use for updating GUI controls with dynamic strings.
const double SynthLab::MIDI_NOTE_0_FREQ = 8.176 |
MIDI constants
const uint32_t SynthLab::MIDI_NOTE_A0 = 21 |
MIDI constants
const uint32_t SynthLab::MIDI_NOTE_A4 = 69 |
MIDI constants
const unsigned char SynthLab::MIDI_TIME_CODE = 0xF1 |
MIDI constants
const unsigned char SynthLab::MOD_WHEEL = 0x01 |
MIDI constants
const unsigned char SynthLab::NOTE_ON = 0x90 |
MIDI constants
const uint32_t SynthLab::NUM_MIDI_NOTES = 128 |
MIDI constants
const uint32_t SynthLab::OSC1_MOD_KNOBS = 0x4 |
Constant for decoding the MOD KNOB custom update code that I use for updating GUI controls with dynamic strings.
const uint32_t SynthLab::OSC2_MOD_KNOBS = 0x8 |
Constant for decoding the MOD KNOB custom update code that I use for updating GUI controls with dynamic strings.
const uint32_t SynthLab::OSC3_MOD_KNOBS = 0x10 |
Constant for decoding the MOD KNOB custom update code that I use for updating GUI controls with dynamic strings.
const uint32_t SynthLab::OSC4_MOD_KNOBS = 0x20 |
Constant for decoding the MOD KNOB custom update code that I use for updating GUI controls with dynamic strings.
const unsigned char SynthLab::PAN_CC10 = 0x0A |
MIDI constants
const unsigned char SynthLab::PITCH_BEND = 0xE0 |
MIDI constants
const unsigned char SynthLab::POLY_PRESSURE = 0xA0 |
MIDI constants
const unsigned char SynthLab::PROGRAM_CHANGE = 0xC0 |
MIDI constants
const unsigned char SynthLab::RESET_ALL_CONTROLLERS = 0x79 |
MIDI constants
const unsigned char SynthLab::SONG_POSITION_POINTER = 0xF2 |
MIDI constants
const unsigned char SynthLab::SONG_SELECT = 0xF3 |
MIDI constants
const unsigned char SynthLab::START = 0xFA |
MIDI constants
const unsigned char SynthLab::SToP = 0xFC |
MIDI constants
const unsigned char SynthLab::SUSTAIN_PEDAL = 0x40 |
MIDI constants
const unsigned char SynthLab::SYSTEM_EXCLUSIVE = 0xF0 |
MIDI constants
const unsigned char SynthLab::SYSTEM_RESET = 0xFF |
MIDI constants
const unsigned char SynthLab::TIMING_CLOCK = 0xF8 |
MIDI constants
const unsigned char SynthLab::TUNE_REQUEST = 0xF6 |
MIDI constants
const unsigned char SynthLab::VOLUME_CC07 = 0x07 |
MIDI constants