SynthLab SDK
SynthLab::SynthProcessInfo Class Reference

This structure holds all of the information needed to for the plugin framework to send MIDI information into the engine, and receive rendered audio samples that result. More...

#include <synthbase.h>

Inheritance diagram for SynthLab::SynthProcessInfo:
SynthLab::AudioBuffer

Public Member Functions

 SynthProcessInfo (uint32_t _numInputChannels, uint32_t _numOutputChannels, uint32_t _blockSize)
 The normal constructor for the SynthProcessInfo object. More...
 
void pushMidiEvent (midiEvent event)
 Add a MIDI event to the queue. More...
 
void clearMidiEvents ()
 Clear the queue. More...
 
uint64_t getMidiEventCount ()
 
midiEventgetMidiEvent (uint32_t index)
 gets a MIDI event within the event queue More...
 
- Public Member Functions inherited from SynthLab::AudioBuffer
 AudioBuffer (uint32_t _numInputChannels, uint32_t _numOutputChannels, uint32_t _blockSize)
 Specialized constructor that initializes the buffers during construction. More...
 
 ~AudioBuffer ()
 As one of the few objects that uses naked pointers (for maximum compatibility between plugin frameworks and/or plugin APIs and the easiest of use) this deletes the audio buffer arrays.
 
void init (uint32_t _numInputChannels, uint32_t _numOutputChannels, uint32_t _blockSize)
 Main initializer that creates the new arrays and sets up the object. More...
 
void flushBuffers ()
 clear out the audio; used often More...
 
float * getInputBuffer (uint32_t channel)
 Get a naked pointer to an audio INPUT buffer by channel. More...
 
float * getOutputBuffer (uint32_t channel)
 Get a naked pointer to an audio OUTPUT buffer by channel. More...
 
float ** getInputBuffers ()
 
float ** getOutputBuffers ()
 
uint32_t getInputChannelCount ()
 
uint32_t getOutputChannelCount ()
 
uint32_t getBlockSize ()
 
uint32_t getSamplesInBlock ()
 
void setSamplesInBlock (uint32_t _samplesInBlock)
 Set the number of samples in a block for processing. More...
 

Public Attributes

double absoluteBufferTime_Sec = 0.0
 the time in seconds of the sample index at top of buffer More...
 
double BPM = 0.0
 beats per minute, aka "tempo"
 
double timeSigNumerator = 0.0
 time signature numerator
 
uint32_t timeSigDenomintor = 0
 time signature denominator
 

Protected Attributes

std::vector< midiEventmidiEventQueue
 queue More...
 
- Protected Attributes inherited from SynthLab::AudioBuffer
float ** inputBuffer = nullptr
 array of input buffer pointers
 
float ** outputBuffer = nullptr
 array of output buffer pointers
 
uint32_t numInputChannels = 1
 
uint32_t numOutputChannels = 1
 
uint32_t blockSize = 64
 the maximum block size
 
uint32_t samplesInBlock = 64
 the number of samples to process in the block (in case of partial blocks)
 

Additional Inherited Members

- Protected Member Functions inherited from SynthLab::AudioBuffer
void destroyInputBuffers ()
 Destroy dynamically allocated input buffer; done at destruct time, or if client want to re-size buffers.
 
void destroyOutputBuffers ()
 Destroy dynamically allocated output buffer; done at destruct time, or if client want to re-size buffers.
 

Detailed Description

This structure holds all of the information needed to for the plugin framework to send MIDI information into the engine, and receive rendered audio samples that result.

  • derived from AudioBuffer and inherits its input and outout audio buffers directly from the base class
  • many function calls to this object will be to the AudioBuffer below
  • adds functions and storage for MIDI events
  • includes special aux data from the DAW such as BPM
Author
Will Pirkle http://www.willpirkle.com
Remarks
This object is included and described in further detail in Designing Software Synthesizer Plugins in C++ 2nd Ed. by Will Pirkle
Version
Revision : 1.0
Date
Date : 2021 / 04 / 26

Constructor & Destructor Documentation

◆ SynthProcessInfo()

SynthLab::SynthProcessInfo::SynthProcessInfo ( uint32_t  _numInputChannels,
uint32_t  _numOutputChannels,
uint32_t  _blockSize 
)

The normal constructor for the SynthProcessInfo object.

  • the arguments setup the underlying AudioBuffer
  • nothing else to do
Parameters
_numInputChannelsnumber of input channels, OK to be 0 (for synths)
_numOutputChannelsnumber of outout channels, must not be 0
_blockSizethe maximum block size for rendering the synth audio

Member Function Documentation

◆ clearMidiEvents()

void SynthLab::SynthProcessInfo::clearMidiEvents ( )

Clear the queue.

  • called after the messages are decoded and used.

◆ getMidiEvent()

midiEvent * SynthLab::SynthProcessInfo::getMidiEvent ( uint32_t  index)

gets a MIDI event within the event queue

Parameters
indexlocation within the vector of the event
Returns
a pointer to the event, or nullptr if not found

◆ getMidiEventCount()

uint64_t SynthLab::SynthProcessInfo::getMidiEventCount ( )
Returns
the count of events in the queue; used by voice for iterating over messages

◆ pushMidiEvent()

void SynthLab::SynthProcessInfo::pushMidiEvent ( midiEvent  event)

Add a MIDI event to the queue.

MIDI events and functions

  • call this once per MIDI event per audio buffer, at the top of the block render cycle
  • these will be decoded and transmitted by the voice object prior to rendering data from the components
Parameters
eventMIDI event to push onto the stack

Member Data Documentation

◆ absoluteBufferTime_Sec

double SynthLab::SynthProcessInfo::absoluteBufferTime_Sec = 0.0

the time in seconds of the sample index at top of buffer

Aux information from the DAW

◆ midiEventQueue

std::vector<midiEvent> SynthLab::SynthProcessInfo::midiEventQueue
protected

queue

set of MIDI events for this audio processing block


The documentation for this class was generated from the following files: