SynthLab SDK
SynthLab::GlideModulator Class Reference

Specialized version of the RampModulator, with nearly identically named functions to peform the portamento operation (aka glide modulation) More...

#include <synthbase.h>

Public Member Functions

bool startModulator (double startNote, double endNote, double glideTime_mSec, double sampleRate)
 Setup the timers and start the ramp modulator running. The modulator produces an output on the range of [startValue, endValue] over a specified duration in mSec. More...
 
bool setGlideTime (double glideTime_mSec, double sampleRate)
 Change the glide time; this is optional. More...
 
double getNextModulationValue (uint32_t advanceClock=1)
 Get the current output of the modulator; this is called repeatedly over the ramp modulation time. More...
 
void advanceClock (uint32_t ticks=1)
 Nudge the clock on the modulator; this is used for block processing where the modulator output outputs one value per audio block. This is called repeatedly to get the modulator clock "caught up" to where it needs to be for the next block of audio to process. More...
 
bool isActive ()
 checks to see if the modulator is running, or completed
 

Protected Attributes

bool timerActive = false
 state of modulator, running (true) or expired (false)
 
double timerInc = 0.0
 timer incrementer value
 
double countDownTimer = 1.0
 current timer value; this always counts DOWN regardless of the polarity of the modulation (up or down)
 
double glideRange = 1.0
 range (distance between MIDI note numbers, as double)
 

Detailed Description

Specialized version of the RampModulator, with nearly identically named functions to peform the portamento operation (aka glide modulation)

  • optimized to perform the ramp modulation between two MIDI note numbers, startNote and endNote
  • still performs the linear modulation; caller can convert this modulation value to a pitch modulation for oscillator pitch modulation in semitones; this converts the portamento from linear to linear-in-semitones
  • the timer always counts DOWN regardless of the direction of the ramp
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

Member Function Documentation

◆ advanceClock()

void SynthLab::GlideModulator::advanceClock ( uint32_t  ticks = 1)

Nudge the clock on the modulator; this is used for block processing where the modulator output outputs one value per audio block. This is called repeatedly to get the modulator clock "caught up" to where it needs to be for the next block of audio to process.

manually advance the clock

Parameters
ticksnumber of tics to advance the clock for the next value

◆ getNextModulationValue()

double SynthLab::GlideModulator::getNextModulationValue ( uint32_t  advanceClock = 1)

Get the current output of the modulator; this is called repeatedly over the ramp modulation time.

get the next modulation value - this is the main output function; auto advances the clock

  • check the modulator to see when it is done, then stop calling this function
Parameters
advanceClocknumber of tics to advance the clock for the next value

◆ setGlideTime()

bool SynthLab::GlideModulator::setGlideTime ( double  glideTime_mSec,
double  sampleRate 
)

Change the glide time; this is optional.

the glide time may be changed while running, normally not used but permitted

Parameters
glideTime_mSectime for the ramp-up or ramp-down across the values
sampleRatefs for calculating timer increment

◆ startModulator()

bool SynthLab::GlideModulator::startModulator ( double  startValue,
double  endValue,
double  glideTime_mSec,
double  sampleRate 
)

Setup the timers and start the ramp modulator running. The modulator produces an output on the range of [startValue, endValue] over a specified duration in mSec.

the main function that sets up and start the modulator

Parameters
startValuestarting MIDI note number
endValueending MIDI note number
glideTime_mSectime for the glide-up or glide-down across the values
sampleRatefs for calculating timer increment

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