SynthLab SDK
SynthLab::XHoldFader Class Reference

Crossfades two values (from A to B) and then holds B for some amount of time. More...

#include <synthbase.h>

Public Member Functions

void reset ()
 Reset to initial state; just resets counters to 0.
 
void setXFadeTimeSamples (uint32_t _xfadeTimeSamples)
 
uint32_t getXFadeTimeSamples ()
 
void setHoldTimeSamples (double _holdTimeSamples)
 Setting the hold time is slightly more complicated than the crossfade time becuase it may be done at any time; this requires checking and setting/clearing the holding boolean. More...
 
double getHoldTimeSamples ()
 
XFadeData getCrossfadeData ()
 Returns the current state of the crossfade or hold. More...
 

Protected Attributes

uint32_t xfadeTime_Samples = 4410
 target crossfade time
 
uint32_t xfadeTime_Counter = 0
 crossfade timer counter
 
uint32_t holdTime_Samples = 4410
 target hold time
 
uint32_t holdTime_Counter = 0
 hold timer counter
 
bool holding = false
 state variable for holding
 

Detailed Description

Crossfades two values (from A to B) and then holds B for some amount of time.

  • specified with two times in samples: crossfade time and hold time
  • unlike the XFader object, this does not mathematically manipulate two input values A and B to produce a final output value, but instead returns information about the current crossfade and hold states in a XFadeData structure
  • this allows for simpler use in the WaveSequencer object
  • note that this object returns ALL crossfade values for linear, square law, and constant power
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

◆ getCrossfadeData()

XFadeData SynthLab::XHoldFader::getCrossfadeData ( )

Returns the current state of the crossfade or hold.

perform crossfade from FROM A to B

  • this function is a timer-maintenance function
  • returns information in XFadeData structure that includes:
    • linear gain values (for A and B)
    • square law gain values (for A and B)
    • constant power gain values (for A and B)
    • crossfadeFinished flag is set to true once crossfade is done, and holding is occuring

◆ setHoldTimeSamples()

void SynthLab::XHoldFader::setHoldTimeSamples ( double  _holdTimeSamples)

Setting the hold time is slightly more complicated than the crossfade time becuase it may be done at any time; this requires checking and setting/clearing the holding boolean.

get/set hold time

◆ setXFadeTimeSamples()

void SynthLab::XHoldFader::setXFadeTimeSamples ( uint32_t  _xfadeTimeSamples)
inline

get/set crossfade time


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