SynthLab SDK
|
Encapsulates an entire synth engine, producing one type of synthesizer set of voices (e.g. Virtual Analog, Sample Based, FM, etc...) More...
#include <synthengine.h>
Public Member Functions | |
SynthEngine (uint32_t blockSize=64) | |
Construction: More... | |
virtual | ~SynthEngine () |
Destruction: More... | |
virtual bool | reset (double _sampleRate) |
Resets all voices and the audio delay object. More... | |
virtual bool | render (SynthProcessInfo &synthProcessInfo) |
Render a buffer of output audio samples. More... | |
virtual bool | processMIDIEvent (midiEvent &event) |
The MIDI event handler function; for note on/off messages it finds the voices to turn on/off. MIDI CC information is placed in the shared CC array. More... | |
virtual bool | initialize (const char *dllPath=nullptr) |
Initializes all voices with the DLL path. More... | |
void | accumulateVoice (SynthProcessInfo &synthProcessInfo, double scaling=0.707) |
Accumulates voice buffers into a single mix buffer for each channel. More... | |
void | applyGlobalVolume (SynthProcessInfo &synthProcessInfo) |
Apply a single global volume control to output mix buffers. More... | |
void | getParameters (std::shared_ptr< SynthEngineParameters > &_parameters) |
void | setParameters (std::shared_ptr< SynthEngineParameters > &_parameters) |
Function to update the engine and voice parameters. More... | |
int | getFreeVoiceIndex () |
Helper function to find a free voice to use. More... | |
int | getVoiceIndexToSteal () |
Helper function to find a free voice to steal based on some kind of heuristic. More... | |
int | getActiveVoiceIndexInNoteOn (unsigned int midiNoteNumber) |
Helper function to find the voice that is playing a certain MIDI note. More... | |
int | getStealingVoiceIndexInNoteOn (unsigned int midiNoteNumber) |
Helper function to find the voice that is playing a certain MIDI note and that will be stolen. More... | |
SynthEngine (uint32_t blockSize=64, DMConfig *config=nullptr) | |
Construction: More... | |
virtual bool | reset (double _sampleRate) |
virtual bool | render (SynthProcessInfo &synthProcessInfo) |
virtual bool | processMIDIEvent (midiEvent &event) |
virtual bool | initialize (const char *dllPath=nullptr) |
void | accumulateVoice (SynthProcessInfo &synthProcessInfo, double scaling=0.707) |
void | applyGlobalVolume (SynthProcessInfo &synthProcessInfo) |
void | getParameters (std::shared_ptr< SynthEngineParameters > &_parameters) |
void | setParameters (std::shared_ptr< SynthEngineParameters > &_parameters) |
int | getFreeVoiceIndex () |
int | getVoiceIndexToSteal () |
int | getActiveVoiceIndexInNoteOn (uint32_t midiNoteNumber) |
Helper function to find the voice that is playing a certain MIDI note. More... | |
int | getStealingVoiceIndexInNoteOn (uint32_t midiNoteNumber) |
Helper function to find the voice that is playing a certain MIDI note and that will be stolen. More... | |
std::vector< std::string > | getModuleStrings (uint32_t mask) |
Gets module-specific core STRINGS (e.g. waveform names for oscillators, filter types for filters, etc... More... | |
std::vector< std::string > | getModKnobStrings (uint32_t mask) |
Gets module-specific Mod Knob label STRINGS. More... | |
void | setAllCustomUpdateCodes () |
Forwards custom code settings to first voice (since all voices share the same architecture) More... | |
uint32_t | getVoiceCount () |
void | setDynamicModules (std::vector< std::shared_ptr< SynthLab::ModuleCore >> modules, uint32_t voiceIndex) |
Adds dynamic module cores to the voice's member obejcts. More... | |
std::vector< std::string > | getModuleCoreNames (uint32_t moduleType) |
Gets module core names, four per object. More... | |
SynthEngine (uint32_t blockSize=64) | |
virtual bool | reset (double _sampleRate) |
virtual bool | render (SynthProcessInfo &synthProcessInfo) |
virtual bool | processMIDIEvent (midiEvent &event) |
virtual bool | initialize (const char *dllPath=nullptr) |
void | accumulateVoice (SynthProcessInfo &synthProcessInfo, double scaling=0.707) |
void | applyGlobalVolume (SynthProcessInfo &synthProcessInfo) |
void | getParameters (std::shared_ptr< SynthEngineParameters > &_parameters) |
void | setParameters (std::shared_ptr< SynthEngineParameters > &_parameters) |
int | getFreeVoiceIndex () |
int | getVoiceIndexToSteal () |
int | getActiveVoiceIndexInNoteOn (unsigned int midiNoteNumber) |
int | getStealingVoiceIndexInNoteOn (unsigned int midiNoteNumber) |
Protected Attributes | |
SynthProcessInfo | voiceProcessInfo |
std::shared_ptr< SynthEngineParameters > | parameters = std::make_shared<SynthEngineParameters>() |
std::shared_ptr< MidiInputData > | midiInputData = std::make_shared<MidiInputData>() |
std::shared_ptr< MidiOutputData > | midiOutputData = std::make_shared<MidiOutputData>() |
std::unique_ptr< SynthVoice > | synthVoices [MAX_VOICES] = { 0, 0, 0, 0, 0, 0, 0, 0,0, 0, 0, 0, 0, 0, 0, 0 } |
array of voice objects for the engine | |
std::shared_ptr< WavetableDatabase > | wavetableDatabase = nullptr |
std::shared_ptr< PCMSampleDatabase > | sampleDatabase = nullptr |
std::unique_ptr< AudioDelay > | pingPongDelay = nullptr |
Encapsulates an entire synth engine, producing one type of synthesizer set of voices (e.g. Virtual Analog, Sample Based, FM, etc...)
SynthLab::SynthEngine::SynthEngine | ( | uint32_t | blockSize = 64 | ) |
Construction:
blockSize | the block size to be used for the lifetime of operation; OK if arriving blocks are smaller than this value, NOT OK if larger |
|
virtual |
Destruction:
SynthLab::SynthEngine::SynthEngine | ( | uint32_t | blockSize = 64 , |
DMConfig * | config = nullptr |
||
) |
Construction:
blockSize | the block size to be used for the lifetime of operation; OK if arriving blocks are smaller than this value, NOT OK if larger |
config | OPTIONAL argument for DM synth configuration; can be safely ignored for non DM products |
void SynthLab::SynthEngine::accumulateVoice | ( | SynthProcessInfo & | synthProcessInfo, |
double | scaling = 0.707 |
||
) |
Functions to help with rendering the final synth output audio stream
void SynthLab::SynthEngine::accumulateVoice | ( | SynthProcessInfo & | synthProcessInfo, |
double | scaling = 0.707 |
||
) |
Accumulates voice buffers into a single mix buffer for each channel.
Functions to help with rendering the final synth output audio stream
synthProcessInfo | structure containing all information needed about the current block to process including:
|
scaling | a scalar value to apply while accumulating |
void SynthLab::SynthEngine::accumulateVoice | ( | SynthProcessInfo & | synthProcessInfo, |
double | scaling = 0.707 |
||
) |
Functions to help with rendering the final synth output audio stream
void SynthLab::SynthEngine::applyGlobalVolume | ( | SynthProcessInfo & | synthProcessInfo | ) |
Apply a single global volume control to output mix buffers.
synthProcessInfo | structure containing all information needed about the current block to process including:
|
int SynthLab::SynthEngine::getActiveVoiceIndexInNoteOn | ( | unsigned int | midiNoteNumber | ) |
Helper function to find the voice that is playing a certain MIDI note.
midiNoteNumber | note number that a voice may or may not be plaing |
int SynthLab::SynthEngine::getActiveVoiceIndexInNoteOn | ( | uint32_t | midiNoteNumber | ) |
Helper function to find the voice that is playing a certain MIDI note.
midiNoteNumber | note number that a voice may or may not be plaing |
int SynthLab::SynthEngine::getFreeVoiceIndex | ( | ) |
Voice stealing helper functions
int SynthLab::SynthEngine::getFreeVoiceIndex | ( | ) |
Helper function to find a free voice to use.
Voice stealing helper functions
int SynthLab::SynthEngine::getFreeVoiceIndex | ( | ) |
Voice stealing helper functions
std::vector< std::string > SynthLab::SynthEngine::getModKnobStrings | ( | uint32_t | mask | ) |
Gets module-specific Mod Knob label STRINGS.
std::vector< std::string > SynthLab::SynthEngine::getModuleCoreNames | ( | uint32_t | moduleType | ) |
Gets module core names, four per object.
std::vector< std::string > SynthLab::SynthEngine::getModuleStrings | ( | uint32_t | mask | ) |
Gets module-specific core STRINGS (e.g. waveform names for oscillators, filter types for filters, etc...
OPTIONAL methods for getting string values for dynamic GUIs – see your framework's GUI documentaiton
int SynthLab::SynthEngine::getStealingVoiceIndexInNoteOn | ( | unsigned int | midiNoteNumber | ) |
Helper function to find the voice that is playing a certain MIDI note and that will be stolen.
midiNoteNumber | note number that a voice may or may not be plaing |
int SynthLab::SynthEngine::getStealingVoiceIndexInNoteOn | ( | uint32_t | midiNoteNumber | ) |
Helper function to find the voice that is playing a certain MIDI note and that will be stolen.
midiNoteNumber | note number that a voice may or may not be plaing |
int SynthLab::SynthEngine::getVoiceIndexToSteal | ( | ) |
Helper function to find a free voice to steal based on some kind of heuristic.
|
virtual |
Initializes all voices with the DLL path.
dllPath | path to the folder that contains the plugin DLL |
|
virtual |
The MIDI event handler function; for note on/off messages it finds the voices to turn on/off. MIDI CC information is placed in the shared CC array.
event | a single MIDI Event to decode and process |
|
virtual |
Render a buffer of output audio samples.
synthProcessInfo | structure containing all information needed about the current block to process including:
|
|
virtual |
main functions, declared as virtual so you can use as as base class if needed
|
virtual |
Resets all voices and the audio delay object.
main functions, declared as virtual so you can use as as base class if needed
_sampleRate | the initial or newly changed sample rate |
|
virtual |
main functions, declared as virtual so you can use as as base class if needed
void SynthLab::SynthEngine::setAllCustomUpdateCodes | ( | ) |
Forwards custom code settings to first voice (since all voices share the same architecture)
OPTIONAL function - this uses the 32-bit enumeration codes to create a wire-or'ed register for keeping track of GUI updates for dynamic string and core loading ADVANCED: see your framework's GUI documentaiton to use; this is NOT tied to any framwork and is only here an an example
void SynthLab::SynthEngine::setDynamicModules | ( | std::vector< std::shared_ptr< SynthLab::ModuleCore >> | modules, |
uint32_t | voiceIndex | ||
) |
Adds dynamic module cores to the voice's member obejcts.
void SynthLab::SynthEngine::setParameters | ( | std::shared_ptr< SynthEngineParameters > & | _parameters | ) |
Function to update the engine and voice parameters.
_parameters | custom parameter structure, delivered from plugin framework prior to calling the render function |