ref: f9bde6c72bc7d6bf4f0a9d30ed904eb766577d3f
parent: 65a3aed39e922745d4a920266a0316c97c36e386
author: Matthew Wang <mjw7@princeton.edu>
date: Fri Jul 17 11:38:12 EDT 2020
added comment blocks for all objects; removed tSine, now redundant to the more general tTable
--- a/.gitignore
+++ b/.gitignore
@@ -10,4 +10,4 @@
*.swp
*/Builds
*/JuceLibraryCode
-doxygen/html
+doxygen/leaf
--- a/leaf/Inc/leaf-analysis.h
+++ b/leaf/Inc/leaf-analysis.h
@@ -37,46 +37,33 @@
@ingroup analysis
@brief
@{
- */
-
- /*!
+
@fn void tEnvelopeFollower_init (tEnvelopeFollower* const, float attackThreshold, float decayCoeff)
@brief
@param
- */
-
- /*!
+
@fn void tEnvelopeFollower_initToPool (tEnvelopeFollower* const, float attackThreshold, float decayCoeff, tMempool* const)
@brief
@param
- */
-
- /*!
+
@fn void tEnvelopeFollower_free (tEnvelopeFollower* const)
@brief
@param
- */
-
- /*!
+
@fn float tEnvelopeFollower_tick (tEnvelopeFollower* const, float x)
@brief
@param
- */
-
- /*!
+
@fn int tEnvelopeFollower_decayCoeff (tEnvelopeFollower* const, float decayCoeff)
@brief
@param
- */
-
- /*!
+
@fn int tEnvelopeFollower_attackThresh (tEnvelopeFollower* const, float attackThresh)
@brief
@param
- */
+ 
+ @} */
- /*! @} */
-
typedef struct _tEnvelopeFollower
{
tMempool mempool;
@@ -103,40 +90,29 @@
@ingroup analysis
@brief
@{
- */
-
- /*!
+
@fn void tZeroCrossing_init (tZeroCrossing* const, int maxWindowSize)
@brief
@param
- */
-
- /*!
+
@fn void tZeroCrossing_initToPool (tZeroCrossing* const, int maxWindowSize, tMempool* const)
@brief
@param
- */
-
- /*!
+
@fn void tZeroCrossing_free (tZeroCrossing* const)
@brief
@param
- */
-
- /*!
+
@fn float tZeroCrossing_tick (tZeroCrossing* const, float input)
@brief
@param
- */
-
- /*!
+
@fn void tZeroCrossing_setWindow (tZeroCrossing* const, float windowSize)
@brief
@param
- */
+ 
+ @} */
- /*! @} */
-
/* Zero Crossing Detector */
typedef struct _tZeroCrossing {
tMempool mempool;
@@ -166,46 +142,33 @@
@ingroup analysis
@brief
@{
- */
-
- /*!
+
@fn void tPowerFollower_init (tPowerFollower* const, float factor)
@brief
@param
- */
-
- /*!
+
@fn void tPowerFollower_initToPool (tPowerFollower* const, float factor, tMempool* const)
@brief
@param
- */
-
- /*!
+
@fn void tPowerFollower_free (tPowerFollower* const)
@brief
@param
- */
-
- /*!
+
@fn float tPowerFollower_tick (tPowerFollower* const, float input)
@brief
@param
- */
-
- /*!
+
@fn float tPowerFollower_sample (tPowerFollower* const)
@brief
@param
- */
-
- /*!
+
@fn int tPowerFollower_setFactor (tPowerFollower* const, float factor)
@brief
@param
- */
+ 
+ @} */
- /*! @} */
-
/* PowerEnvelopeFollower */
typedef struct _tPowerFollower
{
@@ -232,41 +195,29 @@
@ingroup analysis
@brief
@{
- */
-
- /*!
+
@fn void tEnvPD_init (tEnvPD* const, int windowSize, int hopSize, int blockSize)
@brief
@param
- */
-
- /*!
+
@fn void tEnvPD_initToPool (tEnvPD* const, int windowSize, int hopSize, int blockSize, tMempool* const)
@brief
@param
- */
-
- /*!
+
@fn void tEnvPD_free (tEnvPD* const)
@brief
@param
- */
-
-
- /*!
+
@fn float tEnvPD_tick (tEnvPD* const)
@brief
@param
- */
-
- /*!
+
@fn void tEnvPD_processBlock (tEnvPD* const, float* in)
@brief
@param
- */
+ 
+ @} */
- /*! @} */
-
// ENV~ from PD, modified for LEAF
#define MAXOVERLAP 32
#define INITVSTAKEN 64
@@ -304,64 +255,45 @@
@ingroup analysis
@brief
@{
- */
-
- /*!
+
@fn void tAttackDetection_init (tAttackDetection* const, int blocksize, int atk, int rel)
@brief
@param
- */
-
- /*!
+
@fn void tAttackDetection_initToPool (tAttackDetection* const, int blocksize, int atk, int rel, tMempool* const)
@brief
@param
- */
-
- /*!
+
@fn void tAttackDetection_free (tAttackDetection* const)
@brief
@param
- */
-
- /*!
+
@fn void tAttackDetection_setBlocksize (tAttackDetection* const, int size)
@brief Set expected input blocksize
@param
- */
-
- /*!
+
@fn void tAttackDetection_setSamplerate (tAttackDetection* const, int inRate)
@brief Set attack detection sample rate
@param
- */
-
- /*!
+
@fn void tAttackDetection_setAttack (tAttackDetection* const, int inAtk)
@brief Set attack time and coeff
@param
- */
-
- /*!
+
@fn void tAttackDetection_setRelease (tAttackDetection* const, int inRel)
@brief Set release time and coeff
@param
- */
-
- /*!
+
@fn void tAttackDetection_setThreshold (tAttackDetection* const, float thres)
@brief Set level above which values are identified as attacks
@param
- */
-
- /*!
+
@fn int tAttackDetection_detect (tAttackDetection* const, float *in)
@brief Find the largest transient in input block, return index of attack
@param
- */
+ 
+ @} */
- /*! @} */
-
#define DEFBLOCKSIZE 1024
#define DEFTHRESHOLD 6
#define DEFATTACK 10
@@ -410,64 +342,45 @@
@ingroup analysis
@brief Period detection algorithm from Katja Vetters http://www.katjaas.nl/helmholtz/helmholtz.html
@{
- */
-
- /*!
+
@fn void tSNAC_init (tSNAC* const, int overlaparg)
@brief
@param
- */
-
- /*!
+
@fn void tSNAC_initToPool (tSNAC* const, int overlaparg, tMempool* const)
@brief
@param
- */
-
- /*!
+
@fn void tSNAC_free (tSNAC* const)
@brief
@param
- */
-
- /*!
+
@fn void tSNAC_ioSamples (tSNAC *s, float *in, float *out, int size)
@brief
@param
- */
-
- /*!
+
@fn void tSNAC_setOverlap (tSNAC *s, int lap)
@brief
@param
- */
-
- /*!
+
@fn void tSNAC_setBias (tSNAC *s, float bias)
@brief
@param
- */
-
- /*!
+
@fn void tSNAC_setMinRMS (tSNAC *s, float rms)
@brief
@param
- */
-
- /*!
+
@fn float tSNAC_getPeriod (tSNAC *s)
@brief
@param
- */
-
- /*!
+
@fn float tSNAC_getFidelity (tSNAC *s)
@brief
@param
- */
+ 
+ @} */
- /*! @} */
-
#define SNAC_FRAME_SIZE 1024 // default analysis framesize // should be the same as (or smaller than?) PS_FRAME_SIZE
#define DEFOVERLAP 1 // default overlap
#define DEFBIAS 0.2f // default bias
@@ -522,64 +435,45 @@
@fn void tPeriodDetection_init (tPeriodDetection* const, float* in, float* out, int bufSize, int frameSize)
@brief
@param
- */
-
- /*!
+
@fn void tPeriodDetection_initToPool (tPeriodDetection* const, float* in, float* out, int bufSize, int frameSize, tMempool* const)
@brief
@param
- */
-
- /*!
+
@fn void tPeriodDetection_free (tPeriodDetection* const)
@brief
@param
- */
-
- /*!
+
@fn float tPeriodDetection_tick (tPeriodDetection* const, float sample)
@brief
@param
- */
-
- /*!
+
@fn float tPeriodDetection_getPeriod (tPeriodDetection* const)
@brief
@param
- */
-
- /*!
+
@fn void tPeriodDetection_setHopSize (tPeriodDetection* const, int hs)
@brief
@param
- */
-
- /*!
+
@fn void tPeriodDetection_setWindowSize (tPeriodDetection* const, int ws)
@brief
@param
- */
-
- /*!
+
@fn void tPeriodDetection_setFidelityThreshold(tPeriodDetection* const, float threshold)
@brief
@param
- */
-
- /*!
+
@fn void tPeriodDetection_setAlpha (tPeriodDetection* const, float alpha)
@brief
@param
- */
-
- /*!
+
@fn void tPeriodDetection_setTolerance (tPeriodDetection* const, float tolerance)
@brief
@param
- */
+ 
+ @} */
- /*! @} */
-
#define DEFPITCHRATIO 2.0f
#define DEFTIMECONSTANT 100.0f
#define DEFHOPSIZE 64
@@ -640,6 +534,8 @@
//==============================================================================
+ // Maybe keep these up to PeriodDetector internal?
+
typedef struct _tZeroCrossing2
{
tMempool mempool;
@@ -761,6 +657,50 @@
//==============================================================================
+ /*!
+ @defgroup tperioddetector tPeriodDetector
+ @ingroup analysis
+ @brief
+ @{
+
+ @fn void tPeriodDetector_init (tPeriodDetector* const detector, float lowestFreq, float highestFreq, float hysteresis)
+ @brief
+ @param
+
+ @fn void tPeriodDetector_initToPool (tPeriodDetector* const detector, float lowestFreq, float highestFreq, float hysteresis, tMempool* const mempool)
+ @brief
+ @param
+
+ @fn void tPeriodDetector_free (tPeriodDetector* const detector)
+ @brief
+ @param
+
+ @fn int tPeriodDetector_tick (tPeriodDetector* const detector, float sample)
+ @brief
+ @param
+
+ @fn float tPeriodDetector_getPeriod (tPeriodDetector* const detector)
+ @brief Get the periodicity for a given harmonic of the detected pitch.
+ @param
+
+ @fn float tPeriodDetector_getPeriodicity (tPeriodDetector* const detector)
+ @brief
+ @param
+
+ @fn float tPeriodDetector_harmonic (tPeriodDetector* const detector, int harmonicIndex)
+ @brief
+ @param
+
+ @fn float tPeriodDetector_predictPeriod (tPeriodDetector* const detector)
+ @brief
+ @param
+
+ @fn int tPeriodDetector_isReady (tPeriodDetector* const detector)
+ @brief
+ @param
+ 
+ @} */
+
#define PULSE_THRESHOLD 0.6f
#define HARMONIC_PERIODICITY_FACTOR 16
#define PERIODICITY_DIFF_FACTOR 0.008f
@@ -826,6 +766,50 @@
int tPeriodDetector_isReady (tPeriodDetector* const detector);
//==============================================================================
+
+ /*!
+ @defgroup tpitchdetector tPitchDetector
+ @ingroup analysis
+ @brief
+ @{
+
+ @fn void tPitchDetector_init (tPitchDetector* const detector, float lowestFreq, float highestFreq, float hysteresis)
+ @brief
+ @param
+
+ @fn void tPitchDetector_initToPool (tPitchDetector* const detector, float lowestFreq, float highestFreq, float hysteresis, tMempool* const mempool)
+ @brief
+ @param
+
+ @fn void tPitchDetector_free (tPitchDetector* const detector)
+ @brief
+ @param
+
+ @fn int tPitchDetector_tick (tPitchDetector* const detector, float sample)
+ @brief
+ @param
+
+ @fn float tPitchDetector_getFrequency (tPitchDetector* const detector)
+ @brief
+ @param
+
+ @fn float tPitchDetector_getPeriodicity (tPitchDetector* const detector)
+ @brief
+ @param
+
+ @fn float tPitchDetector_harmonic (tPitchDetector* const detector, int harmonicIndex)
+ @brief
+ @param
+
+ @fn float tPitchDetector_predictFrequency (tPitchDetector* const detector, int init)
+ @brief
+ @param
+
+ @fn void tPitchDetector_reset (tPitchDetector* const detector)
+ @brief
+ @param
+ 
+ @} */
#define MAX_DEVIATION 0.9f
#define MIN_PERIODICITY 0.8f
--- a/leaf/Inc/leaf-delay.h
+++ b/leaf/Inc/leaf-delay.h
@@ -33,82 +33,57 @@
@ingroup delay
@brief Non-interpolating delay, reimplemented from STK (Cook and Scavone).
@{
- */
-
- /*!
+
@fn void tDelay_init (tDelay* const, uint32_t delay, uint32_t maxDelay)
@brief
@param
- */
-
- /*!
+
@fn void tDelay_initToPool (tDelay* const, uint32_t delay, uint32_t maxDelay, tMempool* const)
@brief
@param
- */
-
- /*!
+
@fn void tDelay_free (tDelay* const)
@brief
@param
- */
-
- /*!
+
@fn void tDelay_clear (tDelay* const)
@brief
@param
- */
-
- /*!
+
@fn int tDelay_setDelay (tDelay* const, uint32_t delay)
@brief
@param
- */
-
- /*!
+
@fn uint32_t tDelay_getDelay (tDelay* const)
@brief
@param
- */
-
- /*!
+
@fn void tDelay_tapIn (tDelay* const, float in, uint32_t tapDelay)
@brief
@param
- */
-
- /*!
+
@fn float tDelay_tapOut (tDelay* const, uint32_t tapDelay)
@brief
@param
- */
-
- /*!
+
@fn float tDelay_addTo (tDelay* const, float value, uint32_t tapDelay)
@brief
@param
- */
-
- /*!
+
@fn float tDelay_tick (tDelay* const, float sample)
@brief
@param
- */
-
- /*!
+
@fn float tDelay_getLastOut (tDelay* const)
@brief
@param
- */
-
- /*!
+
@fn float tDelay_getLastIn (tDelay* const)
@brief
@param
- */
+ 
+ @} */
- /*! @} */
-
typedef struct _tDelay
{
tMempool mempool;
@@ -147,94 +122,65 @@
@ingroup delay
@brief Linearly-interpolating delay, reimplemented from STK (Cook and Scavone).
@{
- */
-
- /*!
+
@fn void tLinearDelay_init (tLinearDelay* const, float delay, uint32_t maxDelay)
@brief
@param
- */
-
- /*!
+
@fn void tLinearDelay_initToPool (tLinearDelay* const, float delay, uint32_t maxDelay, tMempool* const)
@brief
@param
- */
-
- /*!
+
@fn void tLinearDelay_free (tLinearDelay* const)
@brief
@param
- */
-
- /*!
+
@fn void tLinearDelay_clear (tLinearDelay* const dl)
@brief
@param
- */
-
- /*!
+
@fn int tLinearDelay_setDelay (tLinearDelay* const, float delay)
@brief
@param
- */
-
- /*!
+
@fn float tLinearDelay_getDelay (tLinearDelay* const)
@brief
@param
- */
-
- /*!
+
@fn void tLinearDelay_tapIn (tLinearDelay* const, float in, uint32_t tapDelay)
@brief
@param
- */
-
- /*!
+
@fn float tLinearDelay_tapOut (tLinearDelay* const, uint32_t tapDelay)
@brief
@param
- */
-
- /*!
+
@fn float tLinearDelay_addTo (tLinearDelay* const, float value, uint32_t tapDelay)
@brief
@param
- */
-
- /*!
+
@fn float tLinearDelay_tick (tLinearDelay* const, float sample)
@brief
@param
- */
-
- /*!
+
@fn void tLinearDelay_tickIn (tLinearDelay* const, float input)
@brief
@param
- */
-
- /*!
+
@fn float tLinearDelay_tickOut (tLinearDelay* const)
@brief
@param
- */
-
- /*!
+
@fn float tLinearDelay_getLastOut (tLinearDelay* const)
@brief
@param
- */
-
- /*!
+
@fn float tLinearDelay_getLastIn (tLinearDelay* const)
@brief
@param
- */
+ 
+ @} */
- /*! @} */
-
typedef struct _tLinearDelay
{
tMempool mempool;
@@ -281,106 +227,73 @@
@ingroup delay
@brief Hermite-interpolating delay, created by adapting STK linear delay with Hermite interpolation.
@{
- */
-
- /*!
+
@fn void tHermiteDelay_init (tHermiteDelay* const dl, float delay, uint32_t maxDelay)
@brief
@param
- */
-
- /*!
+
@fn void tHermiteDelay_initToPool (tHermiteDelay* const dl, float delay, uint32_t maxDelay, tMempool* const mp)
@brief
@param
- */
-
- /*!
+
@fn void tHermiteDelay_free (tHermiteDelay* const dl)
@brief
@param
- */
-
- /*!
+
@fn void tHermiteDelay_clear (tHermiteDelay* const dl)
@brief
@param
- */
-
- /*!
+
@fn float tHermiteDelay_tick (tHermiteDelay* const dl, float input)
@brief
@param
- */
-
- /*!
+
@fn void tHermiteDelay_tickIn (tHermiteDelay* const dl, float input)
@brief
@param
- */
-
- /*!
+
@fn float tHermiteDelay_tickOut (tHermiteDelay* const dl)
@brief
@param
- */
-
- /*!
+
@fn int tHermiteDelay_setDelay (tHermiteDelay* const dl, float delay)
@brief
@param
- */
-
- /*!
+
@fn float tHermiteDelay_tapOut (tHermiteDelay* const dl, uint32_t tapDelay)
@brief
@param
- */
-
- /*!
+
@fn void tHermiteDelay_tapIn (tHermiteDelay* const dl, float value, uint32_t tapDelay)
@brief
@param
- */
-
- /*!
+
@fn float tHermiteDelay_addTo (tHermiteDelay* const dl, float value, uint32_t tapDelay)
@brief
@param
- */
-
- /*!
+
@fn float tHermiteDelay_getDelay (tHermiteDelay* const dl)
@brief
@param
- */
-
- /*!
+
@fn float tHermiteDelay_getLastOut (tHermiteDelay* const dl)
@brief
@param
- */
-
- /*!
+
@fn float tHermiteDelay_getLastIn (tHermiteDelay* const dl)
@brief
@param
- */
-
- /*!
+
@fn void tHermiteDelay_setGain (tHermiteDelay* const dl, float gain)
@brief
@param
- */
-
- /*!
+
@fn float tHermiteDelay_getGain (tHermiteDelay* const dl)
@brief
@param
- */
+ 
+ @} */
- /*! @} */
-
typedef struct _tHermiteDelay
{
tMempool mempool;
@@ -427,82 +340,57 @@
@ingroup delay
@brief Allpass-interpolating delay, reimplemented from STK (Cook and Scavone).
@{
- */
-
- /*!
+
@fn void tAllpassDelay_init (tAllpassDelay* const, float delay, uint32_t maxDelay)
@brief
@param
- */
-
- /*!
+
@fn void tAllpassDelay_initToPool (tAllpassDelay* const, float delay, uint32_t maxDelay, tMempool* const)
@brief
@param
- */
-
- /*!
+
@fn void tAllpassDelay_free (tAllpassDelay* const)
@brief
@param
- */
-
- /*!
+
@fn void tAllpassDelay_clear (tAllpassDelay* const)
@brief
@param
- */
-
- /*!
+
@fn int tAllpassDelay_setDelay (tAllpassDelay* const, float delay)
@brief
@param
- */
-
- /*!
+
@fn float tAllpassDelay_getDelay (tAllpassDelay* const)
@brief
@param
- */
-
- /*!
+
@fn void tAllpassDelay_tapIn (tAllpassDelay* const, float in, uint32_t tapDelay)
@brief
@param
- */
-
- /*!
+
@fn float tAllpassDelay_tapOut (tAllpassDelay* const, uint32_t tapDelay)
@brief
@param
- */
-
- /*!
+
@fn float tAllpassDelay_addTo (tAllpassDelay* const, float value, uint32_t tapDelay)
@brief
@param
- */
-
- /*!
+
@fn float tAllpassDelay_tick (tAllpassDelay* const, float sample)
@brief
@param
- */
-
- /*!
+
@fn float tAllpassDelay_getLastOut (tAllpassDelay* const)
@brief
@param
- */
-
- /*!
+
@fn float tAllpassDelay_getLastIn (tAllpassDelay* const)
@brief
@param
- */
+ 
+ @} */
- /*! @} */
-
typedef struct _tAllpassDelay
{
tMempool mempool;
@@ -547,88 +435,61 @@
@ingroup delay
@brief Linear interpolating delay with fixed read and write pointers, variable rate.
@{
- */
-
- /*!
+
@fn void tTapeDelay_init (tTapeDelay* const, float delay, uint32_t maxDelay)
@brief
@param
- */
-
- /*!
+
@fn void tTapeDelay_initToPool (tTapeDelay* const, float delay, uint32_t maxDelay, tMempool* const)
@brief
@param
- */
-
- /*!
+
@fn void tTapeDelay_free (tTapeDelay* const)
@brief
@param
- */
-
- /*!
+
@fn void tTapeDelay_clear (tTapeDelay* const)
@brief
@param
- */
-
- /*!
+
@fn void tTapeDelay_setDelay (tTapeDelay* const, float delay)
@brief
@param
- */
-
- /*!
+
@fn float tTapeDelay_getDelay (tTapeDelay* const)
@brief
@param
- */
-
- /*!
+
@fn void tTapeDelay_tapIn (tTapeDelay* const, float in, uint32_t tapDelay)
@brief
@param
- */
-
- /*!
+
@fn float tTapeDelay_tapOut (tTapeDelay* const d, float tapDelay)
@brief
@param
- */
-
- /*!
+
@fn float tTapeDelay_addTo (tTapeDelay* const, float value, uint32_t tapDelay)
@brief
@param
- */
-
- /*!
+
@fn float tTapeDelay_tick (tTapeDelay* const, float sample)
@brief
@param
- */
-
- /*!
+
@fn void tTapeDelay_incrementInPoint(tTapeDelay* const dl)
@brief
@param
- */
-
- /*!
+
@fn float tTapeDelay_getLastOut (tTapeDelay* const)
@brief
@param
- */
-
- /*!
+
@fn float tTapeDelay_getLastIn (tTapeDelay* const)
@brief
@param
- */
+ 
+ @} */
- /*! @} */
-
typedef struct _tTapeDelay
{
tMempool mempool;
@@ -667,6 +528,49 @@
//==============================================================================
+ /*!
+ @defgroup tringbuffer tRingBuffer
+ @ingroup delay
+ @brief
+ @{
+
+ @fn void tRingBuffer_init (tRingBuffer* const ring, int size)
+ @brief
+ @param
+
+ @fn void tRingBuffer_initToPool (tRingBuffer* const ring, int size, tMempool* const mempool)
+ @brief
+ @param
+
+ @fn void tRingBuffer_free (tRingBuffer* const ring)
+ @brief
+ @param
+
+ @fn void tRingBuffer_push (tRingBuffer* const ring, float val)
+ @brief
+ @param
+
+ @fn float tRingBuffer_getNewest (tRingBuffer* const ring)
+ @brief
+ @param
+
+ @fn float tRingBuffer_getOldest (tRingBuffer* const ring)
+ @brief
+ @param
+
+ @fn float tRingBuffer_get (tRingBuffer* const ring, int index)
+ @brief
+ @param
+
+ @fn float tRingBuffer_clear (tRingBuffer* const ring)
+ @brief
+ @param
+
+ @fn int tRingBuffer_getSize (tRingBuffer* const ring)
+ @brief
+ @param
+ 
+ @} */
typedef struct _tRingBuffer
{
tMempool mempool;
--- a/leaf/Inc/leaf-distortion.h
+++ b/leaf/Inc/leaf-distortion.h
@@ -34,40 +34,29 @@
@ingroup distortion
@brief
@{
- */
-
- /*!
+
@fn void tSampleReducer_init (tSampleReducer* const)
@brief
@param
- */
-
- /*!
+
@fn void tSampleReducer_initToPool (tSampleReducer* const, tMempool* const)
@brief
@param
- */
-
- /*!
+
@fn void tSampleReducer_free (tSampleReducer* const)
@brief
@param
- */
-
- /*!
+
@fn float tSampleReducer_tick (tSampleReducer* const, float input)
@brief
@param
- */
-
- /*!
+
@fn void tSampleReducer_setRatio (tSampleReducer* const, float ratio)
@brief
@param
- */
+ 
+ @} */
- /*! @} */
-
typedef struct _tSampleReducer
{
tMempool mempool;
@@ -92,52 +81,37 @@
@ingroup distortion
@brief
@{
- */
-
- /*!
- @fn void tOversampler_init (tOversampler* const, int order, oBool extraQuality)
+
+ @fn void tOversampler_init (tOversampler* const, int order, int extraQuality)
@brief
@param
- */
-
- /*!
- @fn void tOversampler_initToPool (tOversampler* const, int order, oBool extraQuality, tMempool* const)
+
+ @fn void tOversampler_initToPool (tOversampler* const, int order, int extraQuality, tMempool* const)
@brief
@param
- */
-
- /*!
+
@fn void tOversampler_free (tOversampler* const)
@brief
@param
- */
-
- /*!
+
@fn void tOversampler_upsample (tOversampler* const, float input, float* output)
@brief
@param
- */
-
- /*!
+
@fn float tOversampler_downsample (tOversampler* const os, float* input)
@brief
@param
- */
-
- /*!
+
@fn float tOversampler_tick (tOversampler* const, float input, float* oversample, float (*effectTick)(float))
@brief
@param
- */
-
- /*!
+
@fn int tOversampler_getLatency (tOversampler* const os)
@brief
@param
- */
+ 
+ @} */
- /*! @} */
-
typedef struct _tOversampler
{
tMempool mempool;
@@ -151,8 +125,8 @@
typedef _tOversampler* tOversampler;
- void tOversampler_init (tOversampler* const, int order, oBool extraQuality);
- void tOversampler_initToPool (tOversampler* const, int order, oBool extraQuality, tMempool* const);
+ void tOversampler_init (tOversampler* const, int order, int extraQuality);
+ void tOversampler_initToPool (tOversampler* const, int order, int extraQuality, tMempool* const);
void tOversampler_free (tOversampler* const);
void tOversampler_upsample (tOversampler* const, float input, float* output);
@@ -167,34 +141,25 @@
@ingroup distortion
@brief
@{
- */
-
- /*!
+
@fn void tLockhartWavefolder_init (tLockhartWavefolder* const)
@brief
@param
- */
-
- /*!
+
@fn void tLockhartWavefolder_initToPool (tLockhartWavefolder* const, tMempool* const)
@brief
@param
- */
-
- /*!
+
@fn void tLockhartWavefolder_free (tLockhartWavefolder* const)
@brief
@param
- */
-
- /*!
+
@fn float tLockhartWavefolder_tick (tLockhartWavefolder* const, float samp)
@brief
@param
- */
+ 
+ @} */
- /*! @} */
-
typedef struct _tLockhartWavefolder
{
tMempool mempool;
@@ -241,57 +206,40 @@
@ingroup distortion
@brief
@{
- */
-
- /*!
+
@fn void tCrusher_init (tCrusher* const)
@brief
@param
- */
-
- /*!
+
@fn void tCrusher_initToPool (tCrusher* const, tMempool* const)
@brief
@param
- */
-
- /*!
+
@fn void tCrusher_free (tCrusher* const)
@brief
@param
- */
-
- /*!
+
@fn float tCrusher_tick (tCrusher* const, float input)
@brief
@param
- */
-
- /*!
+
@fn void tCrusher_setOperation (tCrusher* const, float op)
@brief
@param 0.0 - 1.0
- */
-
- /*!
+
@fn void tCrusher_setQuality (tCrusher* const, float val)
@brief
@param 0.0 - 1.0
- */
-
- /*!
+
@fn void tCrusher_setRound (tCrusher* const, float rnd)
@brief
@param what division to round to
- */
-
- /*!
+
@fn void tCrusher_setSamplingRatio (tCrusher* const, float ratio)
@brief
@param sampling ratio
- */
-
- /*! @} */
+ 
+ @} */
typedef struct _tCrusher
{
--- a/leaf/Inc/leaf-dynamics.h
+++ b/leaf/Inc/leaf-dynamics.h
@@ -36,33 +36,24 @@
@ingroup dynamics
@brief
@{
- */
-
- /*!
+
@fn void tCompressor_init (tCompressor* const)
@brief
@param
- */
- /*!
@fn void tCompressor_initToPool (tCompressor* const, tMempool* const)
@brief
@param
- */
- /*!
@fn void tCompressor_free (tCompressor* const)
@brief
@param
- */
-
- /*!
+
@fn float tCompressor_tick (tCompressor* const, float input)
@brief
@param
- */
-
- /*! @} */
+ 
+ @} */
typedef struct _tCompressor
{
@@ -73,7 +64,7 @@
float x_G[2], y_G[2], x_T[2], y_T[2];
- oBool isActive;
+ int isActive;
} _tCompressor;
@@ -89,67 +80,48 @@
/*!
@defgroup tfeedbackleveler tFeedbackLeveler
@ingroup dynamics
- @brief
+ @brief An auto VCA that you put into a feedback circuit to make it stay at the same level.
@detail An auto VCA that you put into a feedback circuit to make it stay at the same level. It can enforce level bidirectionally (amplifying and attenuating as needed) or just attenutating. The former option allows for infinite sustain strings, for example, while The latter option allows for decaying strings, which can never exceed a specific level.
@{
- */
-
- /*!
+
@fn void tFeedbackLeveler_init (tFeedbackLeveler* const, float targetLevel, float factor, float strength, int mode)
@brief
@param
- */
-
- /*!
+
@fn void tFeedbackLeveler_initToPool (tFeedbackLeveler* const, float targetLevel, float factor, float strength, int mode, tMempool* const)
@brief
@param
- */
-
- /*!
+
@fn void tFeedbackLeveler_free (tFeedbackLeveler* const)
@brief
@param
- */
-
- /*!
+
@fn float tFeedbackLeveler_tick (tFeedbackLeveler* const, float input)
@brief
@param
- */
-
- /*!
+
@fn float tFeedbackLeveler_sample (tFeedbackLeveler* const)
@brief
@param
- */
-
- /*!
+
@fn void tFeedbackLeveler_setTargetLevel (tFeedbackLeveler* const, float TargetLevel)
@brief
@param
- */
-
- /*!
+
@fn void tFeedbackLeveler_setFactor (tFeedbackLeveler* const, float factor)
@brief
@param
- */
-
- /*!
+
@fn void tFeedbackLeveler_setMode (tFeedbackLeveler* const, int mode)
@brief
- @param
- */ // 0 for upwards limiting only, 1 for biderctional limiting
+ @param 0 for upwards limiting only, 1 for biderctional limiting
- /*!
@fn void tFeedbackLeveler_setStrength (tFeedbackLeveler* const, float strength)
@brief
@param
- */
+ 
+ @} */
- /*! @} */
-
typedef struct _tFeedbackLeveler
{
tMempool mempool;
@@ -183,45 +155,32 @@
@ingroup dynamics
@brief Threshold with hysteresis (like Max/MSP thresh~ object)
@{
- */
-
- /*!
+
@fn void tThreshold_init (tThreshold* const, float low, float high)
@brief
@param
- */
- /*!
@fn void tThreshold_initToPool (tThreshold* const, float low, float high, tMempool* const)
@brief
@param
- */
- /*!
@fn void tThreshold_free (tThreshold* const)
@brief
@param
- */
-
- /*!
+
@fn int tThreshold_tick (tThreshold* const, float input)
@brief
@param
- */
- /*!
@fn void tThreshold_setLow (tThreshold* const, float low)
@brief
@param
- */
- /*!
@fn void tThreshold_setHigh (tThreshold* const, float high)
@brief
@param
- */
-
- /*! @} */
+
+ @} */
typedef struct _tThreshold
{
--- a/leaf/Inc/leaf-effects.h
+++ b/leaf/Inc/leaf-effects.h
@@ -24,7 +24,70 @@
//==============================================================================
- /* tTalkbox */
+ /*!
+ @defgroup ttalkbox tTalkbox
+ @ingroup effects
+ @brief
+ @{
+
+ @fn void tTalkbox_init (tTalkbox* const, int bufsize)
+ @brief
+ @param
+
+ @fn void tTalkbox_initToPool (tTalkbox* const, int bufsize, tMempool* const)
+ @brief
+ @param
+
+ @fn void tTalkbox_free (tTalkbox* const)
+ @brief
+ @param
+
+ @fn float tTalkbox_tick (tTalkbox* const, float synth, float voice)
+ @brief
+ @param
+
+ @fn float tTalkbox_tickFrozen (tTalkbox* const voc, float synth, float voice)
+ @brief
+ @param
+
+ @fn void tTalkbox_update (tTalkbox* const)
+ @brief
+ @param
+
+ @fn void tTalkbox_suspend (tTalkbox* const)
+ @brief
+ @param
+
+ @fn void tTalkbox_lpcDurbin (float *r, int p, float *k, float *g)
+ @brief
+ @param
+
+ @fn void tTalkbox_lpc (float *buf, float *car, double* dl, double* Rt, int32_t n, int32_t o, float warp, int warpOn, float *k, int freeze, float *G)
+ @brief
+ @param
+
+ @fn void tTalkbox_setQuality (tTalkbox* const, float quality)
+ @brief
+ @param
+
+ @fn void tTalkbox_setWarpFactor (tTalkbox* const voc, float warp)
+ @brief
+ @param
+
+ @fn void tTalkbox_setWarpOn (tTalkbox* const voc, float warpOn)
+ @brief
+ @param
+
+ @fn void tTalkbox_setFreeze (tTalkbox* const voc, float freeze)
+ @brief
+ @param
+
+ @fn void tTalkbox_warpedAutocorrelate (float * x, double* dl, double* Rt, unsigned int L, float * R, unsigned int P, float lambda)
+ @brief
+ @param
+
+ @} */
+
#define NUM_TALKBOX_PARAM 4
typedef struct _tTalkbox
@@ -72,10 +135,74 @@
void tTalkbox_setWarpOn (tTalkbox* const voc, float warpOn);
void tTalkbox_setFreeze (tTalkbox* const voc, float freeze);
void tTalkbox_warpedAutocorrelate (float * x, double* dl, double* Rt, unsigned int L, float * R, unsigned int P, float lambda);
+
+
//==============================================================================
- ///////
+ /*!
+ @defgroup ttalkboxfloat tTalkboxFloat
+ @ingroup effects
+ @brief
+ @{
+
+ @fn void tTalkboxFloat_init (tTalkboxFloat* const, int bufsize)
+ @brief
+ @param
+
+ @fn void tTalkboxFloat_initToPool (tTalkboxFloat* const, int bufsize, tMempool* const)
+ @brief
+ @param
+
+ @fn void tTalkboxFloat_free (tTalkboxFloat* const)
+ @brief
+ @param
+
+ @fn float tTalkboxFloat_tick (tTalkboxFloat* const, float synth, float voice)
+ @brief
+ @param
+
+ @fn float tTalkboxFloat_tickFrozen (tTalkboxFloat* const voc, float synth, float voice)
+ @brief
+ @param
+
+ @fn void tTalkboxFloat_update (tTalkboxFloat* const)
+ @brief
+ @param
+
+ @fn void tTalkboxFloat_suspend (tTalkboxFloat* const)
+ @brief
+ @param
+
+ @fn void tTalkboxFloat_lpcDurbin (float *r, int p, float *k, float *g)
+ @brief
+ @param
+
+ @fn void tTalkboxFloat_lpc (float *buf, float *car, float* dl, float* Rt, int32_t n, int32_t o, float warp, int warpOn, float *k, int freeze, float *G)
+ @brief
+ @param
+
+ @fn void tTalkboxFloat_setQuality (tTalkboxFloat* const, float quality)
+ @brief
+ @param
+
+ @fn void tTalkboxFloat_setWarpFactor (tTalkboxFloat* const voc, float warp)
+ @brief
+ @param
+
+ @fn void tTalkboxFloat_setWarpOn (tTalkboxFloat* const voc, float warpOn)
+ @brief
+ @param
+
+ @fn void tTalkboxFloat_setFreeze (tTalkboxFloat* const voc, float freeze)
+ @brief
+ @param
+
+ @fn void tTalkboxFloat_warpedAutocorrelate (float * x, float* dl, float* Rt, unsigned int L, float * R, unsigned int P, float lambda)
+ @brief
+ @param
+
+ @} */
typedef struct _tTalkboxFloat
{
@@ -102,7 +229,6 @@
float* dl;
float* Rt;
-
} _tTalkboxFloat;
typedef _tTalkboxFloat* tTalkboxFloat;
@@ -125,8 +251,38 @@
//==============================================================================
-
- /* tVocoder */
+ /*!
+ @defgroup tvocoder tVocoder
+ @ingroup effects
+ @brief
+ @{
+
+ @fn void tVocoder_init (tVocoder* const)
+ @brief
+ @param
+
+ @fn void tVocoder_initToPool (tVocoder* const, tMempool* const)
+ @brief
+ @param
+
+ @fn void tVocoder_free (tVocoder* const)
+ @brief
+ @param
+
+ @fn float tVocoder_tick (tVocoder* const, float synth, float voice)
+ @brief
+ @param
+
+ @fn void tVocoder_update (tVocoder* const)
+ @brief
+ @param
+
+ @fn void tVocoder_suspend (tVocoder* const)
+ @brief
+ @param
+
+ @} */
+
#define NUM_VOCODER_PARAM 8
#define NBANDS 16
@@ -159,7 +315,49 @@
//==============================================================================
- // tRosenbergGlottalPulse
+ /*!
+ @defgroup trosenbergglottalpulse tRosenbergGlottalPulse
+ @ingroup effects
+ @brief
+ @{
+
+ @fn void tRosenbergGlottalPulse_init (tRosenbergGlottalPulse* const)
+ @brief
+ @param
+
+ @fn void tRosenbergGlottalPulse_initToPool (tRosenbergGlottalPulse* const, tMempool* const)
+ @brief
+ @param
+
+ @fn void tRosenbergGlottalPulse_free (tRosenbergGlottalPulse* const)
+ @brief
+ @param
+
+ @fn float tRosenbergGlottalPulse_tick (tRosenbergGlottalPulse* const)
+ @brief
+ @param
+
+ @fn float tRosenbergGlottalPulse_tickHQ (tRosenbergGlottalPulse* const gp)
+ @brief
+ @param
+
+ @fn void tRosenbergGlottalPulse_setFreq (tRosenbergGlottalPulse* const, float freq)
+ @brief
+ @param
+
+ @fn void tRosenbergGlottalPulse_setOpenLength (tRosenbergGlottalPulse* const, float openLength)
+ @brief
+ @param
+
+ @fn void tRosenbergGlottalPulse_setPulseLength (tRosenbergGlottalPulse* const, float pulseLength)
+ @brief
+ @param
+
+ @fn void tRosenbergGlottalPulse_setOpenLengthAndPulseLength (tRosenbergGlottalPulse* const gp, float openLength, float pulseLength)
+ @brief
+ @param
+
+ @} */
typedef struct _tRosenbergGlottalPulse
{
@@ -188,10 +386,46 @@
void tRosenbergGlottalPulse_setOpenLengthAndPulseLength (tRosenbergGlottalPulse* const gp, float openLength, float pulseLength);
//==============================================================================
- // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
+ /*!
+ @defgroup tsolad tSOLAD
+ @ingroup effects
+ @brief pitch shifting algorithm that underlies tRetune etc from Katja Vetters http://www.katjaas.nl/pitchshiftlowlatency/pitchshiftlowlatency.html
+ @{
+
+ @fn void tSOLAD_init (tSOLAD* const)
+ @brief
+ @param
+
+ @fn void tSOLAD_initToPool (tSOLAD* const, tMempool* const)
+ @brief
+ @param
+
+ @fn void tSOLAD_free (tSOLAD* const)
+ @brief
+ @param
+
+ @fn void tSOLAD_ioSamples (tSOLAD *w, float* in, float* out, int blocksize)
+ @brief send one block of input samples, receive one block of output samples
+ @param
+
+ @fn void tSOLAD_setPeriod (tSOLAD *w, float period)
+ @brief set periodicity analysis data
+ @param
+
+ @fn void tSOLAD_setPitchFactor (tSOLAD *w, float pitchfactor)
+ @brief set pitch factor between 0.25 and 4
+ @param
+
+ @fn void tSOLAD_setReadLag (tSOLAD *w, float readlag)
+ @brief force readpointer lag
+ @param
+
+ @fn void tSOLAD_resetState (tSOLAD *w)
+ @brief reset state variables
+ @param
+
+ @} */
- /* tSOLAD : pitch shifting algorithm that underlies tRetune etc */
- // from Katja Vetters http://www.katjaas.nl/pitchshiftlowlatency/pitchshiftlowlatency.html
#define LOOPSIZE (2048*2) // (4096*2) // loop size must be power of two
#define LOOPMASK (LOOPSIZE - 1)
#define PITCHFACTORDEFAULT 1.0f
@@ -233,7 +467,42 @@
// reset state variables
void tSOLAD_resetState (tSOLAD *w);
- // Pitch shift
+ /*!
+ @defgroup tpitchshift tPitchShift
+ @ingroup effects
+ @brief
+ @{
+
+ @fn void tPitchShift_init (tPitchShift* const, tPeriodDetection* const, float* out, int bufSize)
+ @brief
+ @param
+
+ @fn void tPitchShift_initToPool (tPitchShift* const, tPeriodDetection* const, float* out, int bufSize, tMempool* const)
+ @brief
+ @param
+
+ @fn void tPitchShift_free (tPitchShift* const)
+ @brief
+ @param
+
+ @fn float tPitchShift_shift (tPitchShift* const)
+ @brief
+ @param
+
+ @fn float tPitchShift_shiftToFunc (tPitchShift* const, float (*fun)(float))
+ @brief
+ @param
+
+ @fn float tPitchShift_shiftToFreq (tPitchShift* const, float freq)
+ @brief
+ @param
+
+ @fn void tPitchShift_setPitchFactor (tPitchShift* const, float pf)
+ @brief
+ @param
+
+ @} */
+
typedef struct _tPitchShift
{
tMempool mempool;
@@ -267,7 +536,66 @@
float tPitchShift_shiftToFreq (tPitchShift* const, float freq);
void tPitchShift_setPitchFactor (tPitchShift* const, float pf);
- // Retune
+ /*!
+ @defgroup tretune tRetune
+ @ingroup effects
+ @brief
+ @{
+
+ @fn void tRetune_init (tRetune* const, int numVoices, int bufSize, int frameSize)
+ @brief
+ @param
+
+ @fn void tRetune_initToPool (tRetune* const, int numVoices, int bufSize, int frameSize, tMempool* const)
+ @brief
+ @param
+
+ @fn void tRetune_free (tRetune* const)
+ @brief
+ @param
+
+ @fn float* tRetune_tick (tRetune* const, float sample)
+ @brief
+ @param
+
+ @fn void tRetune_setNumVoices (tRetune* const, int numVoices)
+ @brief
+ @param
+
+ @fn void tRetune_setPitchFactors (tRetune* const, float pf)
+ @brief
+ @param
+
+ @fn void tRetune_setPitchFactor (tRetune* const, float pf, int voice)
+ @brief
+ @param
+
+ @fn void tRetune_setTimeConstant (tRetune* const, float tc)
+ @brief
+ @param
+
+ @fn void tRetune_setHopSize (tRetune* const, int hs)
+ @brief
+ @param
+
+ @fn void tRetune_setWindowSize (tRetune* const, int ws)
+ @brief
+ @param
+
+ @fn void tRetune_setFidelityThreshold(tRetune* const, float threshold)
+ @brief
+ @param
+
+ @fn float tRetune_getInputPeriod (tRetune* const)
+ @brief
+ @param
+
+ @fn float tRetune_getInputFreq (tRetune* const)
+ @brief
+ @param
+
+ @} */
+
typedef struct _tRetune
{
tMempool mempool;
@@ -311,7 +639,74 @@
float tRetune_getInputPeriod (tRetune* const);
float tRetune_getInputFreq (tRetune* const);
- // Autotune
+ /*!
+ @defgroup tautotune tAutotune
+ @ingroup effects
+ @brief
+ @{
+
+ @fn void tAutotune_init (tAutotune* const, int numVoices, int bufSize, int frameSize)
+ @brief
+ @param
+
+ @fn void tAutotune_initToPool (tAutotune* const, int numVoices, int bufSize, int frameSize, tMempool* const)
+ @brief
+ @param
+
+ @fn void tAutotune_free (tAutotune* const)
+ @brief
+ @param
+
+ @fn float* tAutotune_tick (tAutotune* const, float sample)
+ @brief
+ @param
+
+ @fn void tAutotune_setNumVoices (tAutotune* const, int numVoices)
+ @brief
+ @param
+
+ @fn void tAutotune_setFreqs (tAutotune* const, float f)
+ @brief
+ @param
+
+ @fn void tAutotune_setFreq (tAutotune* const, float f, int voice)
+ @brief
+ @param
+
+ @fn void tAutotune_setTimeConstant (tAutotune* const, float tc)
+ @brief
+ @param
+
+ @fn void tAutotune_setHopSize (tAutotune* const, int hs)
+ @brief
+ @param
+
+ @fn void tAutotune_setWindowSize (tAutotune* const, int ws)
+ @brief
+ @param
+
+ @fn void tAutotune_setFidelityThreshold (tAutotune* const, float threshold)
+ @brief
+ @param
+
+ @fn void tAutotune_setAlpha (tAutotune* const, float alpha)
+ @brief
+ @param
+
+ @fn void tAutotune_setTolerance (tAutotune* const, float tolerance)
+ @brief
+ @param
+
+ @fn float tAutotune_getInputPeriod (tAutotune* const)
+ @brief
+ @param
+
+ @fn float tAutotune_getInputFreq (tAutotune* const)
+ @brief
+ @param
+
+ @} */
+
typedef struct _tAutotune
{
tMempool mempool;
@@ -359,6 +754,49 @@
//==============================================================================
+ /*!
+ @defgroup tformantshifter tFormantShifter
+ @ingroup effects
+ @brief
+ @{
+
+ @fn void tFormantShifter_init (tFormantShifter* const, int order)
+ @brief
+ @param
+
+ @fn void tFormantShifter_initToPool (tFormantShifter* const, int order, tMempool* const)
+ @brief
+ @param
+
+ @fn void tFormantShifter_free (tFormantShifter* const)
+ @brief
+ @param
+
+ @fn float tFormantShifter_tick (tFormantShifter* const, float input)
+ @brief
+ @param
+
+ @fn float tFormantShifter_remove (tFormantShifter* const, float input)
+ @brief
+ @param
+
+ @fn float tFormantShifter_add (tFormantShifter* const, float input)
+ @brief
+ @param
+
+ @fn void tFormantShifter_ioSamples (tFormantShifter* const, float* in, float* out, int size, float fwarp)
+ @brief
+ @param
+
+ @fn void tFormantShifter_setShiftFactor (tFormantShifter* const, float shiftFactor)
+ @brief
+ @param
+
+ @fn void tFormantShifter_setIntensity (tFormantShifter* const, float intensity)
+ @brief
+ @param
+
+ @} */
typedef struct _tFormantShifter
{
--- a/leaf/Inc/leaf-electrical.h
+++ b/leaf/Inc/leaf-electrical.h
@@ -28,6 +28,66 @@
//==============================================================================
+ /*!
+ @defgroup twdf tWDF
+ @ingroup electrical
+ @brief
+ @{
+
+ @fn void tWDF_init (tWDF* const, WDFComponentType type, float value, tWDF* const rL, tWDF* const rR)
+ @brief
+ @param
+
+ @fn void tWDF_initToPool (tWDF* const, WDFComponentType type, float value, tWDF* const rL, tWDF* const rR, tMempool* const)
+ @brief
+ @param
+
+ @fn void tWDF_free (tWDF* const)
+ @brief
+ @param
+
+ @fn float tWDF_tick (tWDF* const, float sample, tWDF* const outputPoint, uint8_t paramsChanged)
+ @brief
+ @param
+
+ @fn void tWDF_setValue (tWDF* const, float value)
+ @brief
+ @param
+
+ @fn void tWDF_setSampleRate (tWDF* const, float sample_rate)
+ @brief
+ @param
+
+ @fn uint8_t tWDF_isLeaf (tWDF* const)
+ @brief
+ @param
+
+ @fn float tWDF_getPortResistance (tWDF* const)
+ @brief
+ @param
+
+ @fn float tWDF_getReflectedWaveUp (tWDF* const, float input)
+ @brief
+ @param
+
+ @fn float tWDF_getReflectedWaveDown (tWDF* const, float input, float incident_wave)
+ @brief
+ @param
+
+ @fn void tWDF_setIncidentWave (tWDF* const, float incident_wave, float input)
+ @brief
+ @param
+
+ @fn float tWDF_getVoltage (tWDF* const)
+ @brief
+ @param
+
+ @fn float tWDF_getCurrent (tWDF* const)
+ @brief
+ @param
+
+ @} */
+
typedef enum WDFComponentType
{
SeriesAdaptor = 0,
--- a/leaf/Inc/leaf-envelopes.h
+++ b/leaf/Inc/leaf-envelopes.h
@@ -31,10 +31,49 @@
* @example basic-oscillators.c
* An example.
*/
-
+
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
- /* Attack-Decay envelope */
+ /*!
+ @defgroup tenvelope tEnvelope
+ @ingroup envelopes
+ @brief Attack-decay envelope.
+ @{
+
+ @fn void tEnvelope_init (tEnvelope* const, float attack, float decay, int loop)
+ @brief
+ @param
+
+ @fn void tEnvelope_initToPool (tEnvelope* const, float attack, float decay, int loop, tMempool* const)
+ @brief
+ @param
+
+ @fn void tEnvelope_free (tEnvelope* const)
+ @brief
+ @param
+
+ @fn float tEnvelope_tick (tEnvelope* const)
+ @brief
+ @param
+
+ @fn void tEnvelope_setAttack (tEnvelope* const, float attack)
+ @brief
+ @param
+
+ @fn void tEnvelope_setDecay (tEnvelope* const, float decay)
+ @brief
+ @param
+
+ @fn void tEnvelope_loop (tEnvelope* const, int loop)
+ @brief
+ @param
+
+ @fn void tEnvelope_on (tEnvelope* const, float velocity)
+ @brief
+ @param
+
+ @} */
+
typedef struct _tEnvelope
{
tMempool mempool;
@@ -71,9 +110,51 @@
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
-
-
- /* Exponential Smoother */
+
+ /*!
+ @defgroup texpsmooth tExpSmooth
+ @ingroup envelopes
+ @brief
+ @{
+
+ @fn void tExpSmooth_init (tExpSmooth* const, float val, float factor)
+ @brief
+ @param
+
+ @fn void tExpSmooth_initToPool (tExpSmooth* const, float val, float factor, tMempool* const)
+ @brief
+ @param
+
+ @fn void tExpSmooth_free (tExpSmooth* const)
+ @brief
+ @param
+
+ @fn float tExpSmooth_tick (tExpSmooth* const)
+ @brief
+ @param
+
+ @fn float tExpSmooth_sample (tExpSmooth* const)
+ @brief
+ @param
+
+ @fn void tExpSmooth_setFactor (tExpSmooth* const, float factor)
+ @brief
+ @param
+
+ @fn void tExpSmooth_setDest (tExpSmooth* const, float dest)
+ @brief
+ @param
+
+ @fn void tExpSmooth_setVal (tExpSmooth* const, float val)
+ @brief
+ @param
+
+ @fn void tExpSmooth_setValAndDest(tExpSmooth* const expsmooth, float val)
+ @brief
+ @param
+
+ @} */
+
typedef struct _tExpSmooth
{
tMempool mempool;
@@ -80,13 +161,13 @@
float factor, oneminusfactor;
float curr,dest;
} _tExpSmooth;
-
+
typedef _tExpSmooth* tExpSmooth;
-
+
void tExpSmooth_init (tExpSmooth* const, float val, float factor);
void tExpSmooth_initToPool (tExpSmooth* const, float val, float factor, tMempool* const);
void tExpSmooth_free (tExpSmooth* const);
-
+
float tExpSmooth_tick (tExpSmooth* const);
float tExpSmooth_sample (tExpSmooth* const);
void tExpSmooth_setFactor (tExpSmooth* const, float factor);
@@ -93,194 +174,434 @@
void tExpSmooth_setDest (tExpSmooth* const, float dest);
void tExpSmooth_setVal (tExpSmooth* const, float val);
void tExpSmooth_setValAndDest(tExpSmooth* const expsmooth, float val);
-
+
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
-
-
+
+
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
-
-
+
+ /*!
+ @defgroup tadsr tADSR
+ @ingroup envelopes
+ @brief
+ @{
+
+ @fn void tADSR_init (tADSR* const adsrenv, float attack, float decay, float sustain, float release)
+ @brief
+ @param
+
+ @fn void tADSR_initToPool (tADSR* const adsrenv, float attack, float decay, float sustain, float release, tMempool* const mp)
+ @brief
+ @param
+
+ @fn void tADSR_free (tADSR* const)
+ @brief
+ @param
+
+ @fn float tADSR_tick (tADSR* const)
+ @brief
+ @param
+
+ @fn void tADSR_setAttack (tADSR* const, float attack)
+ @brief
+ @param
+
+ @fn void tADSR_setDecay (tADSR* const, float decay)
+ @brief
+ @param
+
+ @fn void tADSR_setSustain (tADSR* const, float sustain)
+ @brief
+ @param
+
+ @fn void tADSR_setRelease (tADSR* const, float release)
+ @brief
+ @param
+
+ @fn void tADSR_setLeakFactor (tADSR* const, float leakFactor)
+ @brief
+ @param
+
+ @fn void tADSR_on (tADSR* const, float velocity)
+ @brief
+ @param
+
+ @fn void tADSR_off (tADSR* const)
+ @brief
+ @param
+
+ @} */
+
/* ADSR */
- typedef struct _tADSR
- {
- tMempool mempool;
-
- const float *exp_buff;
- const float *inc_buff;
- uint32_t buff_size;
-
- float next;
-
- float attackInc, decayInc, releaseInc, rampInc;
-
- oBool inAttack, inDecay, inSustain, inRelease, inRamp;
-
- float sustain, gain, rampPeak, releasePeak;
-
- float attackPhase, decayPhase, releasePhase, rampPhase;
-
- float leakFactor;
- } _tADSR;
-
- typedef _tADSR* tADSR;
-
- void tADSR_init (tADSR* const adsrenv, float attack, float decay, float sustain, float release);
- void tADSR_initToPool (tADSR* const adsrenv, float attack, float decay, float sustain, float release, tMempool* const mp);
- void tADSR_free (tADSR* const);
-
- float tADSR_tick (tADSR* const);
- void tADSR_setAttack (tADSR* const, float attack);
- void tADSR_setDecay (tADSR* const, float decay);
- void tADSR_setSustain (tADSR* const, float sustain);
- void tADSR_setRelease (tADSR* const, float release);
- void tADSR_setLeakFactor (tADSR* const, float leakFactor);
- void tADSR_on (tADSR* const, float velocity);
- void tADSR_off (tADSR* const);
-
-
+ typedef struct _tADSR
+ {
+ tMempool mempool;
+
+ const float *exp_buff;
+ const float *inc_buff;
+ uint32_t buff_size;
+
+ float next;
+
+ float attackInc, decayInc, releaseInc, rampInc;
+
+ int inAttack, inDecay, inSustain, inRelease, inRamp;
+
+ float sustain, gain, rampPeak, releasePeak;
+
+ float attackPhase, decayPhase, releasePhase, rampPhase;
+
+ float leakFactor;
+ } _tADSR;
+ typedef _tADSR* tADSR;
+ void tADSR_init (tADSR* const adsrenv, float attack, float decay, float sustain, float release);
+ void tADSR_initToPool (tADSR* const adsrenv, float attack, float decay, float sustain, float release, tMempool* const mp);
+ void tADSR_free (tADSR* const);
+
+ float tADSR_tick (tADSR* const);
+ void tADSR_setAttack (tADSR* const, float attack);
+ void tADSR_setDecay (tADSR* const, float decay);
+ void tADSR_setSustain (tADSR* const, float sustain);
+ void tADSR_setRelease (tADSR* const, float release);
+ void tADSR_setLeakFactor (tADSR* const, float leakFactor);
+ void tADSR_on (tADSR* const, float velocity);
+ void tADSR_off (tADSR* const);
+
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
-
-
- /* ADSR2 */
- typedef struct _tADSR2
- {
- tMempool mempool;
- float sampleRateInMs;
- float attack;
- float decay;
- float release;
- float attackLambda;
- float decayLambda;
- float releaseLambda;
- float sustain;
- float leakGain;
- float leakFactor;
- float targetGainSquared;
- float factor;
- float oneMinusFactor;
- float gain;
- uint8_t attacking;
- uint8_t gate;
- float env;
- float envTarget;
- } _tADSR2;
-
- typedef _tADSR2* tADSR2;
-
- void tADSR2_init (tADSR2* const, float attack, float decay, float sustain, float release);
- void tADSR2_initToPool (tADSR2* const, float attack, float decay, float sustain, float release, tMempool* const);
- void tADSR2_free (tADSR2* const);
-
- float tADSR2_tick (tADSR2* const);
- void tADSR2_setAttack (tADSR2* const, float attack);
- void tADSR2_setDecay (tADSR2* const, float decay);
- void tADSR2_setSustain (tADSR2* const, float sustain);
- void tADSR2_setRelease (tADSR2* const, float release);
- void tADSR2_setLeakFactor (tADSR2* const, float leakFactor);
- void tADSR2_on (tADSR2* const, float velocity);
- void tADSR2_off (tADSR2* const);
-
-
- // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
-
- // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
- enum envState {
- env_idle = 0,
- env_attack,
- env_decay,
- env_sustain,
- env_release,
- env_ramp
- };
-
- /* ADSR3 */
- typedef struct _tADSR3
- {
- tMempool mempool;
- float sampleRateInMs;
- int state;
- float output;
- float attackRate;
- float decayRate;
- float releaseRate;
- float attackCoef;
- float decayCoef;
- float releaseCoef;
- float sustainLevel;
- float targetRatioA;
- float targetRatioDR;
- float attackBase;
- float decayBase;
- float releaseBase;
- float leakFactor;
- float targetGainSquared;
- float factor;
- float oneMinusFactor;
- float gain;
-
- } _tADSR3;
-
- typedef _tADSR3* tADSR3;
-
- void tADSR3_init (tADSR3* const, float attack, float decay, float sustain, float release);
- void tADSR3_initToPool (tADSR3* const, float attack, float decay, float sustain, float release, tMempool* const);
- void tADSR3_free (tADSR3* const);
-
- float tADSR3_tick (tADSR3* const);
- void tADSR3_setAttack (tADSR3* const, float attack);
- void tADSR3_setDecay (tADSR3* const, float decay);
- void tADSR3_setSustain (tADSR3* const, float sustain);
- void tADSR3_setRelease (tADSR3* const, float release);
- void tADSR3_setLeakFactor (tADSR3* const, float leakFactor);
- void tADSR3_on (tADSR3* const, float velocity);
- void tADSR3_off (tADSR3* const);
-
+ /*!
+ @defgroup tasdr2 tADSR2
+ @ingroup envelopes
+ @brief
+ @{
+
+ @fn void tADSR2_init (tADSR2* const, float attack, float decay, float sustain, float release)
+ @brief
+ @param
+
+ @fn void tADSR2_initToPool (tADSR2* const, float attack, float decay, float sustain, float release, tMempool* const)
+ @brief
+ @param
+
+ @fn void tADSR2_free (tADSR2* const)
+ @brief
+ @param
+
+ @fn float tADSR2_tick (tADSR2* const)
+ @brief
+ @param
+
+ @fn void tADSR2_setAttack (tADSR2* const, float attack)
+ @brief
+ @param
+
+ @fn void tADSR2_setDecay (tADSR2* const, float decay)
+ @brief
+ @param
+
+ @fn void tADSR2_setSustain (tADSR2* const, float sustain)
+ @brief
+ @param
+
+ @fn void tADSR2_setRelease (tADSR2* const, float release)
+ @brief
+ @param
+
+ @fn void tADSR2_setLeakFactor (tADSR2* const, float leakFactor)
+ @brief
+ @param
+
+ @fn void tADSR2_on (tADSR2* const, float velocity)
+ @brief
+ @param
+
+ @fn void tADSR2_off (tADSR2* const)
+ @brief
+ @param
+
+ @} */
+
+ typedef struct _tADSR2
+ {
+ tMempool mempool;
+ float sampleRateInMs;
+ float attack;
+ float decay;
+ float release;
+ float attackLambda;
+ float decayLambda;
+ float releaseLambda;
+ float sustain;
+ float leakGain;
+ float leakFactor;
+ float targetGainSquared;
+ float factor;
+ float oneMinusFactor;
+ float gain;
+ uint8_t attacking;
+ uint8_t gate;
+ float env;
+ float envTarget;
+ } _tADSR2;
+
+ typedef _tADSR2* tADSR2;
+
+ void tADSR2_init (tADSR2* const, float attack, float decay, float sustain, float release);
+ void tADSR2_initToPool (tADSR2* const, float attack, float decay, float sustain, float release, tMempool* const);
+ void tADSR2_free (tADSR2* const);
+
+ float tADSR2_tick (tADSR2* const);
+ void tADSR2_setAttack (tADSR2* const, float attack);
+ void tADSR2_setDecay (tADSR2* const, float decay);
+ void tADSR2_setSustain (tADSR2* const, float sustain);
+ void tADSR2_setRelease (tADSR2* const, float release);
+ void tADSR2_setLeakFactor (tADSR2* const, float leakFactor);
+ void tADSR2_on (tADSR2* const, float velocity);
+ void tADSR2_off (tADSR2* const);
+
+
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
- //ADSR4
-
+ /*!
+ @defgroup tadsr3 tADSR3
+ @ingroup envelopes
+ @brief
+ @{
- typedef struct _tADSR4
- {
- tMempool mempool;
- const float *exp_buff;
- uint32_t buff_size;
- uint32_t buff_sizeMinusOne;
- float bufferSizeDividedBySampleRateInMs;
- float next;
-
- float attackInc, decayInc, releaseInc, rampInc;
-
- uint32_t whichStage;
-
- float sustain, gain, rampPeak, releasePeak;
-
- float attackPhase, decayPhase, releasePhase, rampPhase;
-
- float leakFactor;
- } _tADSR4;
-
- typedef _tADSR4* tADSR4;
-
- void tADSR4_init (tADSR4* const, float attack, float decay, float sustain, float release, float* expBuffer, int bufferSize);
- void tADSR4_initToPool (tADSR4* const, float attack, float decay, float sustain, float release, float* expBuffer, int bufferSize, tMempool* const);
- void tADSR4_free (tADSR4* const);
-
- float tADSR4_tick (tADSR4* const);
- float tADSR4_tickNoInterp (tADSR4* const adsrenv);
- void tADSR4_setAttack (tADSR4* const, float attack);
- void tADSR4_setDecay (tADSR4* const, float decay);
- void tADSR4_setSustain (tADSR4* const, float sustain);
- void tADSR4_setRelease (tADSR4* const, float release);
- void tADSR4_setLeakFactor (tADSR4* const, float leakFactor);
- void tADSR4_on (tADSR4* const, float velocity);
- void tADSR4_off (tADSR4* const);
- // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
-
- /* Ramp */
+ @fn void tADSR3_init (tADSR3* const, float attack, float decay, float sustain, float release)
+ @brief
+ @param
+
+ @fn void tADSR3_initToPool (tADSR3* const, float attack, float decay, float sustain, float release, tMempool* const)
+ @brief
+ @param
+
+ @fn void tADSR3_free (tADSR3* const)
+ @brief
+ @param
+
+ @fn float tADSR3_tick (tADSR3* const)
+ @brief
+ @param
+
+ @fn void tADSR3_setAttack (tADSR3* const, float attack)
+ @brief
+ @param
+
+ @fn void tADSR3_setDecay (tADSR3* const, float decay)
+ @brief
+ @param
+
+ @fn void tADSR3_setSustain (tADSR3* const, float sustain)
+ @brief
+ @param
+
+ @fn void tADSR3_setRelease (tADSR3* const, float release)
+ @brief
+ @param
+
+ @fn void tADSR3_setLeakFactor (tADSR3* const, float leakFactor)
+ @brief
+ @param
+
+ @fn void tADSR3_on (tADSR3* const, float velocity)
+ @brief
+ @param
+
+ @fn void tADSR3_off (tADSR3* const)
+ @brief
+ @param
+
+ @} */
+
+ enum envState {
+ env_idle = 0,
+ env_attack,
+ env_decay,
+ env_sustain,
+ env_release,
+ env_ramp
+ };
+
+ typedef struct _tADSR3
+ {
+ tMempool mempool;
+ float sampleRateInMs;
+ int state;
+ float output;
+ float attackRate;
+ float decayRate;
+ float releaseRate;
+ float attackCoef;
+ float decayCoef;
+ float releaseCoef;
+ float sustainLevel;
+ float targetRatioA;
+ float targetRatioDR;
+ float attackBase;
+ float decayBase;
+ float releaseBase;
+ float leakFactor;
+ float targetGainSquared;
+ float factor;
+ float oneMinusFactor;
+ float gain;
+
+ } _tADSR3;
+
+ typedef _tADSR3* tADSR3;
+
+ void tADSR3_init (tADSR3* const, float attack, float decay, float sustain, float release);
+ void tADSR3_initToPool (tADSR3* const, float attack, float decay, float sustain, float release, tMempool* const);
+ void tADSR3_free (tADSR3* const);
+
+ float tADSR3_tick (tADSR3* const);
+ void tADSR3_setAttack (tADSR3* const, float attack);
+ void tADSR3_setDecay (tADSR3* const, float decay);
+ void tADSR3_setSustain (tADSR3* const, float sustain);
+ void tADSR3_setRelease (tADSR3* const, float release);
+ void tADSR3_setLeakFactor (tADSR3* const, float leakFactor);
+ void tADSR3_on (tADSR3* const, float velocity);
+ void tADSR3_off (tADSR3* const);
+
+ // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
+
+ /*!
+ @defgroup tadsr4 tADSR4
+ @ingroup envelopes
+ @brief
+ @{
+
+ @fn void tADSR4_init (tADSR4* const, float attack, float decay, float sustain, float release, float* expBuffer, int bufferSize)
+ @brief
+ @param
+
+ @fn void tADSR4_initToPool (tADSR4* const, float attack, float decay, float sustain, float release, float* expBuffer, int bufferSize, tMempool* const)
+ @brief
+ @param
+
+ @fn void tADSR4_free (tADSR4* const)
+ @brief
+ @param
+
+ @fn float tADSR4_tick (tADSR4* const)
+ @brief
+ @param
+
+ @fn float tADSR4_tickNoInterp (tADSR4* const adsrenv)
+ @brief
+ @param
+
+ @fn void tADSR4_setAttack (tADSR4* const, float attack)
+ @brief
+ @param
+
+ @fn void tADSR4_setDecay (tADSR4* const, float decay)
+ @brief
+ @param
+
+ @fn void tADSR4_setSustain (tADSR4* const, float sustain)
+ @brief
+ @param
+
+ @fn void tADSR4_setRelease (tADSR4* const, float release)
+ @brief
+ @param
+
+ @fn void tADSR4_setLeakFactor (tADSR4* const, float leakFactor)
+ @brief
+ @param
+
+ @fn void tADSR4_on (tADSR4* const, float velocity)
+ @brief
+ @param
+
+ @fn void tADSR4_off (tADSR4* const)
+ @brief
+ @param
+
+ @} */
+
+ typedef struct _tADSR4
+ {
+ tMempool mempool;
+ const float *exp_buff;
+ uint32_t buff_size;
+ uint32_t buff_sizeMinusOne;
+ float bufferSizeDividedBySampleRateInMs;
+ float next;
+
+ float attackInc, decayInc, releaseInc, rampInc;
+
+ uint32_t whichStage;
+
+ float sustain, gain, rampPeak, releasePeak;
+
+ float attackPhase, decayPhase, releasePhase, rampPhase;
+
+ float leakFactor;
+ } _tADSR4;
+
+ typedef _tADSR4* tADSR4;
+
+ void tADSR4_init (tADSR4* const, float attack, float decay, float sustain, float release, float* expBuffer, int bufferSize);
+ void tADSR4_initToPool (tADSR4* const, float attack, float decay, float sustain, float release, float* expBuffer, int bufferSize, tMempool* const);
+ void tADSR4_free (tADSR4* const);
+
+ float tADSR4_tick (tADSR4* const);
+ float tADSR4_tickNoInterp (tADSR4* const adsrenv);
+ void tADSR4_setAttack (tADSR4* const, float attack);
+ void tADSR4_setDecay (tADSR4* const, float decay);
+ void tADSR4_setSustain (tADSR4* const, float sustain);
+ void tADSR4_setRelease (tADSR4* const, float release);
+ void tADSR4_setLeakFactor (tADSR4* const, float leakFactor);
+ void tADSR4_on (tADSR4* const, float velocity);
+ void tADSR4_off (tADSR4* const);
+
+ // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
+
+ /*!
+ @defgroup tramp tRamp
+ @ingroup envelopes
+ @brief
+ @{
+
+ @fn void tRamp_init (tRamp* const, float time, int samplesPerTick)
+ @brief
+ @param
+
+ @fn void tRamp_initToPool (tRamp* const, float time, int samplesPerTick, tMempool* const)
+ @brief
+ @param
+
+ @fn void tRamp_free (tRamp* const)
+ @brief
+ @param
+
+ @fn float tRamp_tick (tRamp* const)
+ @brief
+ @param
+
+ @fn float tRamp_sample (tRamp* const)
+ @brief
+ @param
+
+ @fn void tRamp_setTime (tRamp* const, float time)
+ @brief
+ @param
+
+ @fn void tRamp_setDest (tRamp* const, float dest)
+ @brief
+ @param
+
+ @fn void tRamp_setVal (tRamp* const, float val)
+ @brief
+ @param
+
+ @} */
+
typedef struct _tRamp
{
tMempool mempool;
@@ -304,9 +625,51 @@
void tRamp_setTime (tRamp* const, float time);
void tRamp_setDest (tRamp* const, float dest);
void tRamp_setVal (tRamp* const, float val);
-
- ///=============
- /* Ramp Updown*/
+
+ /*!
+ @defgroup trampupdown tRampUpDown
+ @ingroup envelopes
+ @brief
+ @{
+
+ @fn void tRampUpDown_init (tRampUpDown* const, float upTime, float downTime, int samplesPerTick)
+ @brief
+ @param
+
+ @fn void tRampUpDown_initToPool (tRampUpDown* const, float upTime, float downTime, int samplesPerTick, tMempool* const)
+ @brief
+ @param
+
+ @fn void tRampUpDown_free (tRampUpDown* const)
+ @brief
+ @param
+
+ @fn float tRampUpDown_tick (tRampUpDown* const)
+ @brief
+ @param
+
+ @fn float tRampUpDown_sample (tRampUpDown* const)
+ @brief
+ @param
+
+ @fn void tRampUpDown_setUpTime (tRampUpDown* const, float upTime)
+ @brief
+ @param
+
+ @fn void tRampUpDown_setDownTime (tRampUpDown* const, float downTime)
+ @brief
+ @param
+
+ @fn void tRampUpDown_setDest (tRampUpDown* const, float dest)
+ @brief
+ @param
+
+ @fn void tRampUpDown_setVal (tRampUpDown* const, float val)
+ @brief
+ @param
+
+ @} */
+
typedef struct _tRampUpDown
{
tMempool mempool;
@@ -319,9 +682,9 @@
float downTime;
int samples_per_tick;
} _tRampUpDown;
-
+
typedef _tRampUpDown* tRampUpDown;
-
+
void tRampUpDown_init (tRampUpDown* const, float upTime, float downTime, int samplesPerTick);
void tRampUpDown_initToPool (tRampUpDown* const, float upTime, float downTime, int samplesPerTick, tMempool* const);
void tRampUpDown_free (tRampUpDown* const);
@@ -332,44 +695,78 @@
void tRampUpDown_setDownTime (tRampUpDown* const, float downTime);
void tRampUpDown_setDest (tRampUpDown* const, float dest);
void tRampUpDown_setVal (tRampUpDown* const, float val);
-
-
- ///=========================
- //Slide (based on Max/MSP's slide~)
- typedef struct _tSlide
+
+
+
+ /*!
+ @defgroup tslide tSlide
+ @ingroup envelopes
+ @brief based on Max/MSP's slide~
+ @{
+
+ @fn void tSlide_init (tSlide* const, float upSlide, float downSlide)
+ @brief
+ @param
+
+ @fn void tSlide_initToPool (tSlide* const, float upSlide, float downSlide, tMempool* const)
+ @brief
+ @param
+
+ @fn void tSlide_free (tSlide* const)
+ @brief
+ @param
+
+ @fn float tSlide_tick (tSlide* const, float in)
+ @brief
+ @param
+
+ @fn float tSlide_tickNoInput (tSlide* const sl)
+ @brief
+ @param
+
+ @fn void tSlide_setUpSlide (tSlide* const sl, float upSlide)
+ @brief
+ @param
+
+ @fn void tSlide_setDownSlide (tSlide* const sl, float downSlide)
+ @brief
+ @param
+
+ @fn void tSlide_setDest (tSlide* const sl, float dest)
+ @brief
+ @param
+
+ @} */
+
+ typedef struct _tSlide
{
tMempool mempool;
- float prevOut;
- float currentOut;
- float prevIn;
- float invUpSlide;
- float invDownSlide;
- float dest;
- } _tSlide;
-
- typedef _tSlide* tSlide;
-
- void tSlide_init (tSlide* const, float upSlide, float downSlide);
- void tSlide_initToPool (tSlide* const, float upSlide, float downSlide, tMempool* const);
- void tSlide_free (tSlide* const);
-
- void tSlide_setUpSlide (tSlide* const sl, float upSlide);
-
- void tSlide_setDownSlide (tSlide* const sl, float downSlide);
-
-
- void tSlide_setDest (tSlide* const sl, float dest);
-
-
- float tSlide_tickNoInput (tSlide* const sl);
-
- float tSlide_tick (tSlide* const, float in);
-
+ float prevOut;
+ float currentOut;
+ float prevIn;
+ float invUpSlide;
+ float invDownSlide;
+ float dest;
+ } _tSlide;
+
+ typedef _tSlide* tSlide;
+
+ void tSlide_init (tSlide* const, float upSlide, float downSlide);
+ void tSlide_initToPool (tSlide* const, float upSlide, float downSlide, tMempool* const);
+ void tSlide_free (tSlide* const);
+
+ float tSlide_tick (tSlide* const, float in);
+ float tSlide_tickNoInput (tSlide* const sl);
+ void tSlide_setUpSlide (tSlide* const sl, float upSlide);
+ void tSlide_setDownSlide (tSlide* const sl, float downSlide);
+ void tSlide_setDest (tSlide* const sl, float dest);
+
#ifdef __cplusplus
}
#endif
#endif // LEAF_ENVELOPES_H_INCLUDED
+
--- a/leaf/Inc/leaf-filters.h
+++ b/leaf/Inc/leaf-filters.h
@@ -35,10 +35,33 @@
@ingroup filters
@brief Schroeder allpass. Comb-filter with feedforward and feedback.
@{
- */
+
+ @fn void tAllpass_init (tAllpass* const, float initDelay, uint32_t maxDelay)
+ @brief
+ @param
+
+ @fn void tAllpass_initToPool (tAllpass* const, float initDelay, uint32_t maxDelay, tMempool* const)
+ @brief
+ @param
+
+ @fn void tAllpass_free (tAllpass* const)
+ @brief
+ @param
+
+ @fn float tAllpass_tick (tAllpass* const, float input)
+ @brief
+ @param
+
+ @fn void tAllpass_setGain (tAllpass* const, float gain)
+ @brief
+ @param
+
+ @fn void tAllpass_setDelay (tAllpass* const, float delay)
+ @brief
+ @param
+ 
+ @} */
- /*! @} */
-
typedef struct _tAllpass
{
tMempool mempool;
@@ -68,10 +91,49 @@
@ingroup filters
@brief OnePole filter, reimplemented from STK (Cook and Scavone).
@{
- */
+
+ @fn void tOnePole_init (tOnePole* const, float thePole)
+ @brief
+ @param
+
+ @fn void tOnePole_initToPool (tOnePole* const, float thePole, tMempool* const)
+ @brief
+ @param
+
+ @fn void tOnePole_free (tOnePole* const)
+ @brief
+ @param
+
+ @fn float tOnePole_tick (tOnePole* const, float input)
+ @brief
+ @param
+
+ @fn void tOnePole_setB0 (tOnePole* const, float b0)
+ @brief
+ @param
+
+ @fn void tOnePole_setA1 (tOnePole* const, float a1)
+ @brief
+ @param
+
+ @fn void tOnePole_setPole (tOnePole* const, float thePole)
+ @brief
+ @param
+
+ @fn void tOnePole_setFreq (tOnePole* const, float freq)
+ @brief
+ @param
+
+ @fn void tOnePole_setCoefficients(tOnePole* const, float b0, float a1)
+ @brief
+ @param
+
+ @fn void tOnePole_setGain (tOnePole* const, float gain)
+ @brief
+ @param
+ 
+ @} */
- /*! @} */
-
typedef struct _tOnePole
{
tMempool mempool;
@@ -102,9 +164,48 @@
@ingroup filters
@brief TwoPole filter, reimplemented from STK (Cook and Scavone).
@{
- */
-
- /*! @} */
+
+ @fn void tTwoPole_init (tTwoPole* const)
+ @brief
+ @param
+
+ @fn void tTwoPole_initToPool (tTwoPole* const, tMempool* const)
+ @brief
+ @param
+
+ @fn void tTwoPole_free (tTwoPole* const)
+ @brief
+ @param
+
+ @fn float tTwoPole_tick (tTwoPole* const, float input)
+ @brief
+ @param
+
+ @fn void tTwoPole_setB0 (tTwoPole* const, float b0)
+ @brief
+ @param
+
+ @fn void tTwoPole_setA1 (tTwoPole* const, float a1)
+ @brief
+ @param
+
+ @fn void tTwoPole_setA2 (tTwoPole* const, float a2)
+ @brief
+ @param
+
+ @fn void tTwoPole_setResonance (tTwoPole* const, float freq, float radius, int normalize)
+ @brief
+ @param
+
+ @fn void tTwoPole_setCoefficients(tTwoPole* const, float b0, float a1, float a2)
+ @brief
+ @param
+
+ @fn void tTwoPole_setGain (tTwoPole* const, float gain)
+ @brief
+ @param
+ 
+ @} */
typedef struct _tTwoPole
{
@@ -115,7 +216,7 @@
float b0;
float radius, frequency;
- oBool normalize;
+ int normalize;
float lastOut[2];
} _tTwoPole;
@@ -130,7 +231,7 @@
void tTwoPole_setB0 (tTwoPole* const, float b0);
void tTwoPole_setA1 (tTwoPole* const, float a1);
void tTwoPole_setA2 (tTwoPole* const, float a2);
- void tTwoPole_setResonance (tTwoPole* const, float freq, float radius, oBool normalize);
+ void tTwoPole_setResonance (tTwoPole* const, float freq, float radius, int normalize);
void tTwoPole_setCoefficients(tTwoPole* const, float b0, float a1, float a2);
void tTwoPole_setGain (tTwoPole* const, float gain);
@@ -141,10 +242,49 @@
@ingroup filters
@brief OneZero filter, reimplemented from STK (Cook and Scavone).
@{
- */
+
+ @fn void tOneZero_init (tOneZero* const, float theZero)
+ @brief
+ @param
+
+ @fn void tOneZero_initToPool (tOneZero* const, float theZero, tMempool* const)
+ @brief
+ @param
+
+ @fn void tOneZero_free (tOneZero* const)
+ @brief
+ @param
+
+ @fn float tOneZero_tick (tOneZero* const, float input)
+ @brief
+ @param
+
+ @fn void tOneZero_setB0 (tOneZero* const, float b0)
+ @brief
+ @param
+
+ @fn void tOneZero_setB1 (tOneZero* const, float b1)
+ @brief
+ @param
+
+ @fn void tOneZero_setZero (tOneZero* const, float theZero)
+ @brief
+ @param
+
+ @fn void tOneZero_setCoefficients(tOneZero* const, float b0, float b1)
+ @brief
+ @param
+
+ @fn void tOneZero_setGain (tOneZero* const, float gain)
+ @brief
+ @param
+
+ @fn float tOneZero_getPhaseDelay (tOneZero *f, float frequency)
+ @brief
+ @param
+ 
+ @} */
- /*! @} */
-
typedef struct _tOneZero
{
tMempool mempool;
@@ -165,7 +305,7 @@
void tOneZero_setZero (tOneZero* const, float theZero);
void tOneZero_setCoefficients(tOneZero* const, float b0, float b1);
void tOneZero_setGain (tOneZero* const, float gain);
- float tOneZero_getPhaseDelay (tOneZero *f, float frequency );
+ float tOneZero_getPhaseDelay (tOneZero *f, float frequency);
//==============================================================================
@@ -174,9 +314,49 @@
@ingroup filters
@brief TwoZero filter, reimplemented from STK (Cook and Scavone).
@{
- */
-
- /*! @} */
+
+ @fn void tTwoZero_init (tTwoZero* const)
+ @brief
+ @param
+
+ @fn void tTwoZero_initToPool (tTwoZero* const, tMempool* const)
+ @brief
+ @param
+
+ @fn void tTwoZero_free (tTwoZero* const)
+ @brief
+ @param
+
+ @fn float tTwoZero_tick (tTwoZero* const, float input)
+ @brief
+ @param
+
+ @fn void tTwoZero_setB0 (tTwoZero* const, float b0)
+ @brief
+ @param
+
+ @fn void tTwoZero_setB1 (tTwoZero* const, float b1)
+ @brief
+ @param
+
+ @fn void tTwoZero_setB2 (tTwoZero* const, float b2)
+ @brief
+ @param
+
+ @fn void tTwoZero_setNotch (tTwoZero* const, float frequency, float radius)
+ @brief
+ @param
+
+ @fn void tTwoZero_setCoefficients(tTwoZero* const, float b0, float b1, float b2)
+ @brief
+ @param
+
+ @fn void tTwoZero_setGain (tTwoZero* const, float gain)
+ @brief
+ @param
+
+ 
+ @} */
typedef struct _tTwoZero
{
@@ -211,10 +391,55 @@
@ingroup filters
@brief PoleZero filter, reimplemented from STK (Cook and Scavone).
@{
- */
+
+ @fn void tPoleZero_init (tPoleZero* const)
+ @brief
+ @param
+
+ @fn void tPoleZero_initToPool (tPoleZero* const, tMempool* const)
+ @brief
+ @param
+
+ @fn void tPoleZero_free (tPoleZero* const)
+ @brief
+ @param
+
+
+ @fn float tPoleZero_tick (tPoleZero* const, float input)
+ @brief
+ @param
+
+ @fn void tPoleZero_setB0 (tPoleZero* const, float b0)
+ @brief
+ @param
+
+ @fn void tPoleZero_setB1 (tPoleZero* const, float b1)
+ @brief
+ @param
+
+ @fn void tPoleZero_setA1 (tPoleZero* const, float a1)
+ @brief
+ @param
+
+ @fn void tPoleZero_setCoefficients (tPoleZero* const, float b0, float b1, float a1)
+ @brief
+ @param
+
+ @fn void tPoleZero_setAllpass (tPoleZero* const, float coeff)
+ @brief
+ @param
+
+ @fn void tPoleZero_setBlockZero (tPoleZero* const, float thePole)
+ @brief
+ @param
+
+ @fn void tPoleZero_setGain (tPoleZero* const, float gain)
+ @brief
+ @param
+
+ 
+ @} */
- /*! @} */
-
typedef struct _tPoleZero
{
tMempool mempool;
@@ -248,10 +473,63 @@
@ingroup filters
@brief BiQuad filter, reimplemented from STK (Cook and Scavone).
@{
- */
+
+ @fn void tBiQuad_init (tBiQuad* const)
+ @brief
+ @param
+
+ @fn void tBiQuad_initToPool (tBiQuad* const, tMempool* const)
+ @brief
+ @param
+
+ @fn void tBiQuad_free (tBiQuad* const)
+ @brief
+ @param
+
+
+ @fn float tBiQuad_tick (tBiQuad* const, float input)
+ @brief
+ @param
+
+ @fn void tBiQuad_setB0 (tBiQuad* const, float b0)
+ @brief
+ @param
+
+ @fn void tBiQuad_setB1 (tBiQuad* const, float b1)
+ @brief
+ @param
+
+ @fn void tBiQuad_setB2 (tBiQuad* const, float b2)
+ @brief
+ @param
+
+ @fn void tBiQuad_setA1 (tBiQuad* const, float a1)
+ @brief
+ @param
+
+ @fn void tBiQuad_setA2 (tBiQuad* const, float a2)
+ @brief
+ @param
+
+ @fn void tBiQuad_setNotch (tBiQuad* const, float freq, float radius)
+ @brief
+ @param
+
+ @fn void tBiQuad_setResonance (tBiQuad* const, float freq, float radius, int normalize)
+ @brief
+ @param
+
+ @fn void tBiQuad_setCoefficients(tBiQuad* const, float b0, float b1, float b2, float a1, float a2)
+ @brief
+ @param
+
+ @fn void tBiQuad_setGain (tBiQuad* const, float gain)
+ @brief
+ @param
+
+ 
+ @} */
- /*! @} */
-
typedef struct _tBiQuad
{
tMempool mempool;
@@ -264,7 +542,7 @@
float lastOut[2];
float frequency, radius;
- oBool normalize;
+ int normalize;
} _tBiQuad;
typedef _tBiQuad* tBiQuad;
@@ -280,7 +558,7 @@
void tBiQuad_setA1 (tBiQuad* const, float a1);
void tBiQuad_setA2 (tBiQuad* const, float a2);
void tBiQuad_setNotch (tBiQuad* const, float freq, float radius);
- void tBiQuad_setResonance (tBiQuad* const, float freq, float radius, oBool normalize);
+ void tBiQuad_setResonance (tBiQuad* const, float freq, float radius, int normalize);
void tBiQuad_setCoefficients(tBiQuad* const, float b0, float b1, float b2, float a1, float a2);
void tBiQuad_setGain (tBiQuad* const, float gain);
@@ -291,10 +569,37 @@
@ingroup filters
@brief State Variable Filter, algorithm from Andy Simper.
@{
- */
+
+ @fn void tSVF_init (tSVF* const, SVFType type, float freq, float Q)
+ @brief
+ @param
+
+ @fn void tSVF_initToPool (tSVF* const, SVFType type, float freq, float Q, tMempool* const)
+ @brief
+ @param
+
+ @fn void tSVF_free (tSVF* const)
+ @brief
+ @param
+
+ @fn float tSVF_tick (tSVF* const, float v0)
+
+ @brief
+ @param
+ @fn void tSVF_setFreq (tSVF* const, float freq)
+ @brief
+ @param
+
+ @fn void tSVF_setQ (tSVF* const, float Q)
+ @brief
+ @param
+
+ @fn void tSVF_setFreqAndQ (tSVF* const svff, float freq, float Q)
+ @brief
+ @param
+ 
+ @} */
- /*! @} */
-
typedef enum SVFType
{
SVFTypeHighpass = 0,
@@ -325,6 +630,7 @@
void tSVF_setFreq (tSVF* const, float freq);
void tSVF_setQ (tSVF* const, float Q);
void tSVF_setFreqAndQ (tSVF* const svff, float freq, float Q);
+
//==============================================================================
/*!
@@ -332,10 +638,33 @@
@ingroup filters
@brief Efficient State Variable Filter for 14-bit control input, [0, 4096).
@{
- */
+
+ @fn void tEfficientSVF_init (tEfficientSVF* const, SVFType type, uint16_t input, float Q)
+ @brief
+ @param
+
+ @fn void tEfficientSVF_initToPool (tEfficientSVF* const, SVFType type, uint16_t input, float Q, tMempool* const)
+ @brief
+ @param
+
+ @fn void tEfficientSVF_free (tEfficientSVF* const)
+ @brief
+ @param
+
+ @fn float tEfficientSVF_tick (tEfficientSVF* const, float v0)
+ @brief
+ @param
+
+ @fn void tEfficientSVF_setFreq (tEfficientSVF* const, uint16_t controlFreq)
+ @brief
+ @param
+
+ @fn void tEfficientSVF_setQ (tEfficientSVF* const, float Q)
+ @brief
+ @param
+ 
+ @} */
- /*! @} */
-
typedef struct _tEfficientSVF
{
tMempool mempool;
@@ -362,10 +691,33 @@
@ingroup filters
@brief Simple Highpass filter.
@{
- */
+
+ @fn void tHighpass_init (tHighpass* const, float freq)
+ @brief
+ @param
+
+ @fn void tHighpass_initToPool (tHighpass* const, float freq, tMempool* const)
+ @brief
+ @param
+
+ @fn void tHighpass_free (tHighpass* const)
+ @brief
+ @param
+
+ @fn float tHighpass_tick (tHighpass* const, float x)
+ @brief
+ @param
+
+ @fn void tHighpass_setFreq (tHighpass* const, float freq)
+ @brief
+ @param
+
+ @fn float tHighpass_getFreq (tHighpass* const)
+ @brief
+ @param
+ 
+ @} */
- /*! @} */
-
typedef struct _tHighpass
{
tMempool mempool;
@@ -390,10 +742,37 @@
@ingroup filters
@brief
@{
- */
+
+ @fn void tButterworth_init (tButterworth* const, int N, float f1, float f2)
+ @brief
+ @param
+
+ @fn void tButterworth_initToPool (tButterworth* const, int N, float f1, float f2, tMempool* const)
+ @brief
+ @param
+
+ @fn void tButterworth_free (tButterworth* const)
+ @brief
+ @param
+
+ @fn float tButterworth_tick (tButterworth* const, float input)
+ @brief
+ @param
+
+ @fn void tButterworth_setF1 (tButterworth* const, float in)
+ @brief
+ @param
+
+ @fn void tButterworth_setF2 (tButterworth* const, float in)
+ @brief
+ @param
+
+ @fn void tButterworth_setFreqs (tButterworth* const, float f1, float f2)
+ @brief
+ @param
+ 
+ @} */
- /*! @} */
-
#define NUM_SVF_BW 16
typedef struct _tButterworth
{
@@ -427,10 +806,25 @@
@ingroup filters
@brief
@{
- */
+
+ @fn void tFIR_init (tFIR* const, float* coeffs, int numTaps)
+ @brief
+ @param
+
+ @fn void tFIR_initToPool (tFIR* const, float* coeffs, int numTaps, tMempool* const)
+ @brief
+ @param
+
+ @fn void tFIR_free (tFIR* const)
+ @brief
+ @param
+
+ @fn float tFIR_tick (tFIR* const, float input)
+ @brief
+ @param
+ 
+ @} */
- /*! @} */
-
typedef struct _tFIR
{
tMempool mempool;
@@ -455,10 +849,25 @@
@ingroup filters
@brief
@{
- */
+
+ @fn void tMedianFilter_init (tMedianFilter* const, int size)
+ @brief
+ @param
+
+ @fn void tMedianFilter_initToPool (tMedianFilter* const, int size, tMempool* const)
+ @brief
+ @param
+
+ @fn void tMedianFilter_free (tMedianFilter* const)
+ @brief
+ @param
+
+ @fn float tMedianFilter_tick (tMedianFilter* const, float input)
+ @brief
+ @param
+ 
+ @} */
- /*! @} */
-
typedef struct _tMedianFilter
{
tMempool mempool;
@@ -483,14 +892,61 @@
/*!
@defgroup tvzfilter tVZFilter
@ingroup filters
- @brief
+ @brief Vadim Zavalishin style from VA book (from implementation in RSlib posted to kvr forum)
@{
- */
+
+ @fn void tVZFilter_init (tVZFilter* const, VZFilterType type, float freq, float Q)
+ @brief
+ @param
+
+ @fn void tVZFilter_initToPool (tVZFilter* const, VZFilterType type, float freq, float Q, tMempool* const)
+ @brief
+ @param
+
+ @fn void tVZFilter_free (tVZFilter* const)
+ @brief
+ @param
+
+ @fn void tVZFilter_setSampleRate (tVZFilter* const, float sampleRate)
+ @brief
+ @param
+
+ @fn float tVZFilter_tick (tVZFilter* const, float input)
+ @brief
+ @param
+
+ @fn float tVZFilter_tickEfficient (tVZFilter* const vf, float in)
+ @brief
+ @param
+
+ @fn void tVZFilter_calcCoeffs (tVZFilter* const)
+ @brief
+ @param
+
+ @fn void tVZFilter_setBandwidth (tVZFilter* const, float bandWidth)
+ @brief
+ @param
+
+ @fn void tVZFilter_setFreq (tVZFilter* const, float freq)
+ @brief
+ @param
+
+ @fn void tVZFilter_setFreqAndBandwidth (tVZFilter* const vf, float freq, float bw)
+ @brief
+ @param
+ @fn void tVZFilter_setGain (tVZFilter* const, float gain)
+ @brief
+ @param
+ @fn void tVZFilter_setType (tVZFilter* const, VZFilterType type)
+ @brief
+ @param
+
+ @fn float tVZFilter_BandwidthToR (tVZFilter* const vf, float B)
+ @brief
+ @param
+ 
+ @} */
- /*! @} */
-
- //Vadim Zavalishin style from VA book (from implementation in RSlib posted to kvr forum)
-
typedef enum VZFilterType
{
Highpass = 0,
@@ -538,16 +994,16 @@
void tVZFilter_initToPool (tVZFilter* const, VZFilterType type, float freq, float Q, tMempool* const);
void tVZFilter_free (tVZFilter* const);
- void tVZFilter_setSampleRate (tVZFilter* const, float sampleRate);
+ void tVZFilter_setSampleRate (tVZFilter* const, float sampleRate);
float tVZFilter_tick (tVZFilter* const, float input);
float tVZFilter_tickEfficient (tVZFilter* const vf, float in);
- void tVZFilter_calcCoeffs (tVZFilter* const);
- void tVZFilter_setBandwidth (tVZFilter* const, float bandWidth);
- void tVZFilter_setFreq (tVZFilter* const, float freq);
- void tVZFilter_setFreqAndBandwidth (tVZFilter* const vf, float freq, float bw);
- void tVZFilter_setGain (tVZFilter* const, float gain);
- void tVZFilter_setType (tVZFilter* const, VZFilterType type);
- float tVZFilter_BandwidthToR (tVZFilter* const vf, float B);
+ void tVZFilter_calcCoeffs (tVZFilter* const);
+ void tVZFilter_setBandwidth (tVZFilter* const, float bandWidth);
+ void tVZFilter_setFreq (tVZFilter* const, float freq);
+ void tVZFilter_setFreqAndBandwidth (tVZFilter* const vf, float freq, float bw);
+ void tVZFilter_setGain (tVZFilter* const, float gain);
+ void tVZFilter_setType (tVZFilter* const, VZFilterType type);
+ float tVZFilter_BandwidthToR (tVZFilter* const vf, float B);
/*!
@@ -555,9 +1011,32 @@
@ingroup filters
@brief
@{
- */
-
- /*! @} */
+
+ @fn void tDiodeFilter_init (tDiodeFilter* const, float freq, float Q)
+ @brief
+ @param
+
+ @fn void tDiodeFilter_initToPool (tDiodeFilter* const, float freq, float Q, tMempool* const)
+ @brief
+ @param
+
+ @fn void tDiodeFilter_free (tDiodeFilter* const)
+ @brief
+ @param
+
+ @fn float tDiodeFilter_tick (tDiodeFilter* const, float input)
+ @brief
+ @param
+
+ @fn void tDiodeFilter_setFreq (tDiodeFilter* const vf, float cutoff)
+ @brief
+ @param
+
+ @fn void tDiodeFilter_setQ (tDiodeFilter* const vf, float resonance)
+ @brief
+ @param
+ 
+ @} */
//diode ladder filter
typedef struct _tDiodeFilter
--- a/leaf/Inc/leaf-instruments.h
+++ b/leaf/Inc/leaf-instruments.h
@@ -31,7 +31,58 @@
//==============================================================================
- // 808 Cowbell
+ /*!
+ @defgroup t808cowbell t808Cowbell
+ @ingroup instruments
+ @brief
+ @{
+
+ @fn void t808Cowbell_init (t808Cowbell* const, int useStick)
+ @brief
+ @param
+
+ @fn void t808Cowbell_initToPool (t808Cowbell* const, int useStick, tMempool* const)
+ @brief
+ @param
+
+ @fn void t808Cowbell_free (t808Cowbell* const)
+ @brief
+ @param
+
+ @fn float t808Cowbell_tick (t808Cowbell* const)
+ @brief
+ @param
+
+ @fn void t808Cowbell_on (t808Cowbell* const, float vel)
+ @brief
+ @param
+
+ @fn void t808Cowbell_setDecay (t808Cowbell* const, float decay)
+ @brief
+ @param
+
+ @fn void t808Cowbell_setHighpassFreq (t808Cowbell* const, float freq)
+ @brief
+ @param
+
+ @fn void t808Cowbell_setBandpassFreq (t808Cowbell* const, float freq)
+ @brief
+ @param
+
+ @fn void t808Cowbell_setFreq (t808Cowbell* const, float freq)
+ @brief
+ @param
+
+ @fn void t808Cowbell_setOscMix (t808Cowbell* const, float oscMix)
+ @brief
+ @param
+
+ @fn void t808Cowbell_setStick (t808Cowbell* const, int useStick)
+ @brief
+ @param
+
+ @} */
+
typedef struct _t808Cowbell
{
tMempool mempool;
@@ -65,7 +116,74 @@
//==============================================================================
- // 808 Hihat
+ /*!
+ @defgroup t808hihat t808Hihat
+ @ingroup instruments
+ @brief
+ @{
+
+ @fn void t808Hihat_init (t808Hihat* const)
+ @brief
+ @param
+
+ @fn void t808Hihat_initToPool (t808Hihat* const, tMempool* const)
+ @brief
+ @param
+
+ @fn void t808Hihat_free (t808Hihat* const)
+ @brief
+ @param
+
+ @fn float t808Hihat_tick (t808Hihat* const)
+ @brief
+ @param
+
+ @fn void t808Hihat_on (t808Hihat* const, float vel)
+ @brief
+ @param
+
+ @fn void t808Hihat_setOscNoiseMix (t808Hihat* const, float oscNoiseMix)
+ @brief
+ @param
+
+ @fn void t808Hihat_setDecay (t808Hihat* const, float decay)
+ @brief
+ @param
+
+ @fn void t808Hihat_setHighpassFreq (t808Hihat* const, float freq)
+ @brief
+ @param
+
+ @fn void t808Hihat_setOscBandpassFreq (t808Hihat* const, float freq)
+ @brief
+ @param
+
+ @fn void t808Hihat_setOscBandpassQ (t808Hihat* const hihat, float Q)
+ @brief
+ @param
+
+ @fn void t808Hihat_setStickBandPassFreq (t808Hihat* const, float freq)
+ @brief
+ @param
+
+ @fn void t808Hihat_setStickBandPassQ (t808Hihat* const hihat, float Q)
+ @brief
+ @param
+
+ @fn void t808Hihat_setOscFreq (t808Hihat* const, float freq)
+ @brief
+ @param
+
+ @fn void t808Hihat_setStretch (t808Hihat* const hihat, float stretch)
+ @brief
+ @param
+
+ @fn void t808Hihat_setFM (t808Hihat* const hihat, float FM_amount)
+ @brief
+ @param
+
+ @} */
+
typedef struct _t808Hihat
{
tMempool mempool;
@@ -107,7 +225,66 @@
//==============================================================================
- // 808 Snare
+ /*!
+ @defgroup t808snare t808Snare
+ @ingroup instruments
+ @brief
+ @{
+
+ @fn void t808Snare_init (t808Snare* const)
+ @brief
+ @param
+
+ @fn void t808Snare_initToPool (t808Snare* const, tMempool* const)
+ @brief
+ @param
+
+ @fn void t808Snare_free (t808Snare* const)
+ @brief
+ @param
+
+ @fn float t808Snare_tick (t808Snare* const)
+ @brief
+ @param
+
+ @fn void t808Snare_on (t808Snare* const, float vel)
+ @brief
+ @param
+
+ @fn void t808Snare_setTone1Freq (t808Snare* const, float freq)
+ @brief
+ @param
+
+ @fn void t808Snare_setTone2Freq (t808Snare* const, float freq)
+ @brief
+ @param
+
+ @fn void t808Snare_setTone1Decay (t808Snare* const, float decay)
+ @brief
+ @param
+
+ @fn void t808Snare_setTone2Decay (t808Snare* const, float decay)
+ @brief
+ @param
+
+ @fn void t808Snare_setNoiseDecay (t808Snare* const, float decay)
+ @brief
+ @param
+
+ @fn void t808Snare_setToneNoiseMix (t808Snare* const, float toneNoiseMix)
+ @brief
+ @param
+
+ @fn void t808Snare_setNoiseFilterFreq (t808Snare* const, float noiseFilterFreq)
+ @brief
+ @param
+
+ @fn void t808Snare_setNoiseFilterQ (t808Snare* const, float noiseFilterQ)
+ @brief
+ @param
+
+ @} */
+
typedef struct _t808Snare
{
tMempool mempool;
@@ -151,7 +328,66 @@
//==============================================================================
- // 808 Kick
+ /*!
+ @defgroup t808kick t808Kick
+ @ingroup instruments
+ @brief
+ @{
+
+ @fn void t808Kick_init (t808Kick* const)
+ @brief
+ @param
+
+ @fn void t808Kick_initToPool (t808Kick* const, tMempool* const)
+ @brief
+ @param
+
+ @fn void t808Kick_free (t808Kick* const)
+ @brief
+ @param
+
+ @fn float t808Kick_tick (t808Kick* const)
+ @brief
+ @param
+
+ @fn void t808Kick_on (t808Kick* const, float vel)
+ @brief
+ @param
+
+ @fn void t808Kick_setToneFreq (t808Kick* const, float freq)
+ @brief
+ @param
+
+ @fn void t808Kick_setToneDecay (t808Kick* const, float decay)
+ @brief
+ @param
+
+ @fn void t808Kick_setNoiseDecay (t808Kick* const, float decay)
+ @brief
+ @param
+
+ @fn void t808Kick_setSighAmount (t808Kick* const, float sigh)
+ @brief
+ @param
+
+ @fn void t808Kick_setChirpAmount (t808Kick* const, float chirp)
+ @brief
+ @param
+
+ @fn void t808Kick_setToneNoiseMix (t808Kick* const, float toneNoiseMix)
+ @brief
+ @param
+
+ @fn void t808Kick_setNoiseFilterFreq (t808Kick* const, float noiseFilterFreq)
+ @brief
+ @param
+
+ @fn void t808Kick_setNoiseFilterQ (t808Kick* const, float noiseFilterQ)
+ @brief
+ @param
+
+ @} */
+
typedef struct _t808Kick
{
tMempool mempool;
--- a/leaf/Inc/leaf-math.h
+++ b/leaf/Inc/leaf-math.h
@@ -23,11 +23,10 @@
//==============================================================================
- typedef enum oBool
- {
- OTRUE = 1,
- OFALSE = 0
- }oBool;
+ /*!
+ @ingroup math
+ @{
+ */
// Allows for bitwise operations on floats
union unholy_t { /* a union between a float and an integer */
@@ -110,8 +109,8 @@
float LEAF_clip (float min, float val, float max);
int LEAF_clipInt (int min, int val, int max);
- float LEAF_softClip (float val, float thresh);
- oBool LEAF_isPrime (uint64_t number );
+ float LEAF_softClip (float val, float thresh);
+ int LEAF_isPrime (uint64_t number );
float LEAF_midiToFrequency (float f);
float LEAF_frequencyToMidi(float f);
@@ -219,6 +218,7 @@
float median3f(float a, float b, float c);
+ /*! @} */
//==============================================================================
--- a/leaf/Inc/leaf-mempool.h
+++ b/leaf/Inc/leaf-mempool.h
@@ -112,7 +112,8 @@
*/
void tMempool_freeFromPool (tMempool* const pool, tMempool* const poolFrom);
- /*! @} */
+ /*!
+ @} */
//==============================================================================
--- a/leaf/Inc/leaf-midi.h
+++ b/leaf/Inc/leaf-midi.h
@@ -31,15 +31,79 @@
//==============================================================================
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
-
+
/*!
- * @defgroup tstack tStack
- * @ingroup midi
- * @brief A basic stack of integers with a fixed max size of 128, used by tPoly to keep track of MIDI notes.
- * @{
- */
+ @defgroup tstack tStack
+ @ingroup midi
+ @brief A basic stack of integers with a fixed capacity of 128, used by tPoly to keep track of MIDI notes.
+ @{
+
+ @fn void tStack_init (tStack* const stack)
+ @brief Initialize a tStack to the default LEAF mempool.
+ @param stack A pointer to the tStack to be initialized.
+
+ @fn void tStack_initToPool (tStack* const stack, tMempool* const mempool)
+ @brief Initialize a tStack to a specified mempool.
+ @param stack A pointer to the tStack to be initialized.
+ @param mempool A pointer to the tMempool to which the tStack should be initialized.
+
+ @fn void tStack_free (tStack* const stack)
+ @brief Free a tStack from the default LEAF mempool.
+ @param stack A pointer to the tStack to be freed.
+
+ @fn void tStack_setCapacity (tStack* const stack, uint16_t cap)
+ @brief Set the capacity of the stack.
+ @param stack A pointer to the relevant tStack.
+ @param cap The new capacity.
+
+ @fn int tStack_addIfNotAlreadyThere (tStack* const stack, uint16_t item)
+ @brief Add a value to the stack only if that value is not already in the stack.
+ @param stack A pointer to the relevant tStack.
+ @param item The value to be added.
+
+ @fn void tStack_add (tStack* const stack, uint16_t item)
+ @brief Add a value to the stack.
+ @param stack A pointer to the relevant tStack.
+ @param item The value to be added.
+
+ @fn int tStack_remove (tStack* const stack, uint16_t item)
+ @brief Remove a single instance of a value from the stack.
+ @param stack A pointer to the relevant tStack.
+ @param item The value to be removed.
+
+ @fn void tStack_clear (tStack* const stack)
+ @brief Clear the stack.
+ @param stack A pointer to the relevant tStack.
+
+ @fn int tStack_first (tStack* const stack)
+ @brief Get the first value in the stack.
+ @param stack A pointer to the relevant tStack.
+ @return The first value in the stack.
+
+ @fn int tStack_getSize (tStack* const stack)
+ @brief Get the current size of the stack.
+ @param stack A pointer to the relevant tStack.
+ @return The current size of the stack.
+
+ @fn int tStack_contains (tStack* const stack, uint16_t item)
+ @brief Check if the stack contains a value, and if it does, get the index of that value.
+ @param stack A pointer to the relevant tStack.
+ @param item The value to check against the stack.
+ @return The index of the value or -1 if the stack does not contain the value.
+
+ @fn int tStack_next (tStack* const stack)
+ @brief Get the next value in the stack, starting from the earliest added values.
+ @param stack A pointer to the relevant tStack.
+ @return The next value in the stack or -1 if there are no values in the stack.
+
+ @fn int tStack_get (tStack* const stack, int index)
+ @brief Get the value at a given index of the stack.
+ @param stack A pointer to the relevant tStack.
+ @param index The index of the stack from which to get a value.
+ @return The value at the given index.
+
+ @} */
- // STACK implementation (fixed size)
#define STACK_SIZE 128
typedef struct _tStack
{
@@ -48,120 +112,139 @@
uint16_t pos;
uint16_t size;
uint16_t capacity;
- oBool ordered;
+ int ordered;
} _tStack;
typedef _tStack* tStack;
- //! Initialize a tStack to the default LEAF mempool.
- /*!
- @param stack A pointer to the tStack to be initialized.
- */
void tStack_init (tStack* const stack);
-
-
- //! Initialize a tStack to a specified mempool.
- /*!
- @param stack A pointer to the tStack to be initialized.
- @param pool A pointer to the tMempool to which the tStack should be initialized.
- */
void tStack_initToPool (tStack* const stack, tMempool* const pool);
-
-
- //! Free a tStack from the default LEAF mempool.
- /*!
- @param stack A pointer to the tStack to be freed.
- */
void tStack_free (tStack* const stack);
-
- //! Set the capacity of the stack.
- /*!
- @param stack A pointer to the relevant tStack.
- @param cap The new capacity.
- */
void tStack_setCapacity (tStack* const stack, uint16_t cap);
-
-
- //! Add a value to the stack only if that value is not already in the stack.
- /*!
- @param stack A pointer to the relevant tStack.
- @param item The value to be added.
- */
int tStack_addIfNotAlreadyThere (tStack* const stack, uint16_t item);
-
-
- //! Add a value to the stack.
- /*!
- @param stack A pointer to the relevant tStack.
- @param item The value to be added.
- */
void tStack_add (tStack* const stack, uint16_t item);
-
-
- //! Remove a single instance of a value from the stack.
- /*!
- @param stack A pointer to the relevant tStack.
- @param item The value to be removed.
- */
int tStack_remove (tStack* const stack, uint16_t item);
-
-
- //! Clear the stack.
- /*!
- @param stack A pointer to the relevant tStack.
- */
void tStack_clear (tStack* const stack);
-
-
- //! Get the first value in the stack.
- /*!
- @param stack A pointer to the relevant tStack.
- @return The first value in the stack.
- */
int tStack_first (tStack* const stack);
-
-
- //! Get the current size of the stack.
- /*!
- @param stack A pointer to the relevant tStack.
- @return The current size of the stack.
- */
int tStack_getSize (tStack* const stack);
-
- //! Check if the stack contains a value, and if it does, get the index of that value.
- /*!
- @param stack A pointer to the relevant tStack.
- @param item The value to check against the stack.
- @return The index of the value or -1 if the stack does not contain the value.
- */
int tStack_contains (tStack* const stack, uint16_t item);
-
- //! Get the next value in the stack, starting from the earliest added values.
- /*!
- @param stack A pointer to the relevant tStack.
- @return The next value in the stack or -1 if there are no values in the stack.
- */
int tStack_next (tStack* const stack);
-
- //! Get the value at a given index of the stack.
- /*!
- @param stack A pointer to the relevant tStack.
- @param index The index of the stack from which to get a value.
- @return The value at the given index.
- */
int tStack_get (tStack* const stack, int index);
- /*! @} */
-
- /*!
- * @defgroup tpoly tPoly
- * @ingroup midi
- * @brief An object for polyphonic handling.
- * @{
- */
-
- /* tPoly */
+ /*! @}
+ @defgroup tpoly tPoly
+ @ingroup midi
+ @brief An object for polyphonic handling.
+ @{
+
+ @fn void tPoly_init (tPoly* const poly, int maxNumVoices)
+ @brief Initialize a tPoly to the default LEAF mempool.
+ @param poly A pointer to the tPoly to be initialized.
+ @param maxNumVoices The maximum number of voices this tPoly can handle at once.
+
+ @fn void tPoly_initToPool (tPoly* const poly, int maxNumVoices, tMempool* const pool)
+ @brief Initialize a tPoly to a specified mempool.
+ @param poly A pointer to the tPoly to be initialized.
+ @param pool A pointer to the tMempool to which the tPoly should be initialized.
+
+ @fn void tPoly_free (tPoly* const poly)
+ @brief Free a tPoly from the default LEAF mempool.
+ @param poly A pointer to the tPoly to be freed.
+
+ @fn int tPoly_noteOn (tPoly* const poly, int note, uint8_t vel)
+ @brief Add a note with a given velocity to the poly handler.
+ @param poly A pointer to the relevant tPoly.
+ @param note The MIDI note number to add.
+ @param vel The MIDI velocity of the note to add.
+ @return The voice that will play the note.
+
+ @fn int tPoly_noteOff (tPoly* const poly, uint8_t note)
+ @brief Remove a note from the poly handler.
+ @param poly A pointer to the relevant tPoly.
+ @param note The MIDI note number to remove.
+ @return The voice that was playing the removed note.
+
+ @fn void tPoly_orderedAddToStack (tPoly* const poly, uint8_t note)
+ @brief
+ @param
+
+ @fn void tPoly_setNumVoices (tPoly* const poly, uint8_t numVoices)
+ @brief Set the number of voices available to play notes.
+ @param poly A pointer to the relevant tPoly.
+ @param numVoices The new number of available voices. Cannot be greater than the max number voices given in tPoly_init().
+
+ @fn void tPoly_setPitchGlideActive (tPoly* const poly, int isActive)
+ @brief Set whether pitch glide over note changes in voices is active.
+ @param poly A pointer to the relevant tPoly.
+ @param isActive Whether pitch glide should be active or not.
+
+ @fn void tPoly_setPitchGlideTime (tPoly* const poly, float t)
+ @brief Set how long pitch glide over note changes in voices takes.
+ @param poly A pointer to the relevant tPoly.
+ @param t The time to glide in milliseconds.
+
+ @fn void tPoly_setPitchBend (tPoly* const poly, float pitchBend)
+ @brief Set the amount of pitch bend
+ @param poly A pointer to the relevant tPoly.
+ @param pitchBend The new amount of pitch bend.
+
+ @fn void tPoly_setBendGlideTime (tPoly* const poly, float t)
+ @brief
+ @param
+
+ @fn void tPoly_setBendSamplesPerTick (tPoly* const poly, float t)
+ @brief
+ @param
+
+ @fn void tPoly_tickPitch (tPoly* const poly)
+ @brief Execute all tick-rate changes in the poly handler's pitch, including glide and bend.
+ @param poly A pointer to the relevant tPoly.
+
+ @fn void tPoly_tickPitchGlide (tPoly* const poly)
+ @brief Execute the tick-rate change of the poly handler's pitch glide.
+ @param poly A pointer to the relevant tPoly.
+
+ @fn void tPoly_tickPitchBend (tPoly* const poly)
+ @brief Execute the tick-rate change of the poly handler's pitch bend.
+ @param poly A pointer to the relevant tPoly.
+
+ @fn int tPoly_getNumVoices (tPoly* const poly)
+ @brief Get the current number of voices available to play notes.
+ @param poly A pointer to the relevant tPoly.
+ @return The current number of voices available to play notes.
+
+ @fn int tPoly_getNumActiveVoices (tPoly* const poly)
+ @brief Get the number of voices currently playing notes.
+ @param poly A pointer to the relevant tPoly.
+ @return The number of voices currently playing notes.
+
+ @fn float tPoly_getPitch (tPoly* const poly, uint8_t voice)
+ @brief Get the current pitch of a given voice.
+ @param poly A pointer to the relevant tPoly.
+ @param voice The voice to get the pitch of.
+ @return The current pitch of the given voice as a fractional MIDI note number.
+
+ @fn int tPoly_getKey (tPoly* const poly, uint8_t voice)
+ @brief Get the current MIDI note number of a given voice.
+ @param poly A pointer to the relevant tPoly.
+ @param voice The voice to get the MIDI note number of.
+ @return The MIDI note number of the given voice.
+
+ @fn int tPoly_getVelocity (tPoly* const poly, uint8_t voice)
+ @brief Get the current MIDI velocity of a given voice.
+ @param poly A pointer to the relevant tPoly.
+ @param voice The voice to get the MIDI velocity of.
+ @return The current MIDI velocity of the given voice.
+
+ @fn int tPoly_isOn (tPoly* const poly, uint8_t voice)
+ @brief Get the current play state of a given voice.
+ @param poly A pointer to the relevant tPoly.
+ @param voice The voice to get the state of.
+ @return The current play state of the given voice.
+
+ @} */
+
typedef struct _tPoly
{
tMempool mempool;
@@ -171,9 +254,9 @@
tRamp* ramps;
float* rampVals;
- oBool* firstReceived;
+ int* firstReceived;
float glideTime;
- oBool pitchGlideIsActive;
+ int pitchGlideIsActive;
int numVoices;
int maxNumVoices;
@@ -200,158 +283,113 @@
typedef _tPoly* tPoly;
- /* MPoly*/
- //! Initialize a tPoly to the default LEAF mempool.
- /*!
- @param poly A pointer to the tPoly to be initialized.
- @param maxNumVoices The maximum number of voices this tPoly can handle at once.
- */
void tPoly_init (tPoly* const poly, int maxNumVoices);
-
-
- //! Initialize a tPoly to a specified mempool.
- /*!
- @param poly A pointer to the tPoly to be initialized.
- @param pool A pointer to the tMempool to which the tPoly should be initialized.
- */
void tPoly_initToPool (tPoly* const poly, int maxNumVoices, tMempool* const pool);
-
-
- //! Free a tPoly from the default LEAF mempool.
- /*!
- @param poly A pointer to the tPoly to be freed.
- */
void tPoly_free (tPoly* const poly);
-
- //! Add a note with a given velocity to the poly handler.
- /*!
- @param poly A pointer to the relevant tPoly.
- @param note The MIDI note number to add.
- @param vel The MIDI velocity of the note to add.
- @return The voice that will play the note.
- */
int tPoly_noteOn (tPoly* const poly, int note, uint8_t vel);
-
-
- //! Remove a note from the poly handler.
- /*!
- @param poly A pointer to the relevant tPoly.
- @param note The MIDI note number to remove.
- @return The voice that was playing the removed note.
- */
int tPoly_noteOff (tPoly* const poly, uint8_t note);
-
void tPoly_orderedAddToStack (tPoly* const poly, uint8_t note);
-
-
- //! Set the number of voices available to play notes.
- /*!
- @param poly A pointer to the relevant tPoly.
- @param numVoices The new number of available voices. Cannot be greater than the max number voices given in tPoly_init().
- */
void tPoly_setNumVoices (tPoly* const poly, uint8_t numVoices);
-
- //! Set whether pitch glide over note changes in voices is active.
- /*!
- @param poly A pointer to the relevant tPoly.
- @param isActive Whether pitch glide should be active or not.
- */
- void tPoly_setPitchGlideActive (tPoly* const poly, oBool isActive);
-
- //! Set how long pitch glide over note changes in voices takes.
- /*!
- @param poly A pointer to the relevant tPoly.
- @param t The time to glide in milliseconds.
- */
+ void tPoly_setPitchGlideActive (tPoly* const poly, int isActive);
void tPoly_setPitchGlideTime (tPoly* const poly, float t);
-
- //! Set the amount of pitch bend
- /*!
- @param poly A pointer to the relevant tPoly.
- @param pitchBend The new amount of pitch bend.
- */
void tPoly_setPitchBend (tPoly* const poly, float pitchBend);
void tPoly_setBendGlideTime (tPoly* const poly, float t);
void tPoly_setBendSamplesPerTick (tPoly* const poly, float t);
+ void tPoly_tickPitch (tPoly* const poly);
+ void tPoly_tickPitchGlide (tPoly* const poly);
+ void tPoly_tickPitchBend (tPoly* const poly);
+ int tPoly_getNumVoices (tPoly* const poly);
+ int tPoly_getNumActiveVoices (tPoly* const poly);
+ float tPoly_getPitch (tPoly* const poly, uint8_t voice);
+ int tPoly_getKey (tPoly* const poly, uint8_t voice);
+ int tPoly_getVelocity (tPoly* const poly, uint8_t voice);
+ int tPoly_isOn (tPoly* const poly, uint8_t voice);
-
- //! Execute all tick-rate changes in the poly handler's pitch, including glide and bend.
- /*!
+ //==============================================================================
+
+ /*! @}
+ @defgroup tsimplepoly tSimplePoly
+ @ingroup midi
+ @brief An object for polyphonic handling.
+ @{
+
+ @fn void tSimplePoly_init (tSimplePoly* const poly, int maxNumVoices)
+ @brief Initialize a tPoly to the default LEAF mempool.
+ @param poly A pointer to the tPoly to be initialized.
+ @param maxNumVoices The maximum number of voices this tPoly can handle at once.
+
+ @fn void tSimplePoly_initToPool (tSimplePoly* const poly, int maxNumVoices, tMempool* const pool)
+ @brief Initialize a tPoly to a specified mempool.
+ @param poly A pointer to the tPoly to be initialized.
+ @param pool A pointer to the tMempool to which the tPoly should be initialized.
+
+ @fn void tSimplePoly_free (tSimplePoly* const poly)
+ @brief Free a tPoly from the default LEAF mempool.
+ @param poly A pointer to the tPoly to be freed.
+
+ @fn int tSimplePoly_noteOn (tSimplePoly* const poly, int note, uint8_t vel)
+ @brief Add a note with a given velocity to the poly handler.
@param poly A pointer to the relevant tPoly.
- */
- void tPoly_tickPitch (tPoly* const poly);
-
-
- //! Execute the tick-rate change of the poly handler's pitch glide.
- /*!
+ @param note The MIDI note number to add.
+ @param vel The MIDI velocity of the note to add.
+ @return The voice that will play the note.
+
+ @fn int tSimplePoly_noteOff (tSimplePoly* const poly, uint8_t note)
+ @brief Remove a note from the poly handler.
@param poly A pointer to the relevant tPoly.
- */
- void tPoly_tickPitchGlide (tPoly* const poly);
-
-
- //! Execute the tick-rate change of the poly handler's pitch bend.
- /*!
+ @param note The MIDI note number to remove.
+ @return The voice that was playing the removed note.
+
+ @fn void tSimplePoly_deactivateVoice(tSimplePoly* const polyh, uint8_t voice)
+ @brief
+ @param
+
+ @fn int tSimplePoly_markPendingNoteOff(tSimplePoly* const polyh, uint8_t note)
+ @brief
+ @param
+
+ @fn int tSimplePoly_findVoiceAssignedToNote(tSimplePoly* const polyh, uint8_t note)
+ @brief Find if there is a voice with that note -- useful for note offs where you want to wait to remove it from the poly until the release phase of the envelope is finished
+ @param
+
+ @fn void tSimplePoly_setNumVoices (tSimplePoly* const poly, uint8_t numVoices)
+ @brief Set the number of voices available to play notes.
@param poly A pointer to the relevant tPoly.
- */
- void tPoly_tickPitchBend (tPoly* const poly);
-
-
- //! Get the current number of voices available to play notes.
- /*!
+ @param numVoices The new number of available voices. Cannot be greater than the max number voices given in tPoly_init().
+
+ @fn int tSimplePoly_getNumVoices (tSimplePoly* const poly)
+ @brief Get the current number of voices available to play notes.
@param poly A pointer to the relevant tPoly.
@return The current number of voices available to play notes.
- */
- int tPoly_getNumVoices (tPoly* const poly);
-
- //! Get the number of voices currently playing notes.
- /*!
+
+ @fn int tSimplePoly_getNumActiveVoices (tSimplePoly* const poly)
+ @brief Get the number of voices currently playing notes.
@param poly A pointer to the relevant tPoly.
@return The number of voices currently playing notes.
- */
- int tPoly_getNumActiveVoices (tPoly* const poly);
-
- //! Get the current pitch of a given voice.
- /*!
+
+ @fn int tSimplePoly_getPitch (tSimplePoly* const poly, uint8_t voice)
+ @brief Get the current MIDI note number of a given voice.
@param poly A pointer to the relevant tPoly.
- @param voice The voice to get the pitch of.
- @return The current pitch of the given voice as a fractional MIDI note number.
- */
- float tPoly_getPitch (tPoly* const poly, uint8_t voice);
-
-
- //! Get the current MIDI note number of a given voice.
- /*!
- @param poly A pointer to the relevant tPoly.
@param voice The voice to get the MIDI note number of.
@return The MIDI note number of the given voice.
- */
- int tPoly_getKey (tPoly* const poly, uint8_t voice);
-
-
- //! Get the current MIDI velocity of a given voice.
- /*!
+
+ @fn int tSimplePoly_getPitchAndCheckActive(tSimplePoly* const polyh, uint8_t voice)
+ @brief Returns negative one if the voice is inactive
+
+ @fn int tSimplePoly_getVelocity (tSimplePoly* const poly, uint8_t voice)
+ @brief Get the current MIDI velocity of a given voice.
@param poly A pointer to the relevant tPoly.
@param voice The voice to get the MIDI velocity of.
@return The current MIDI velocity of the given voice.
- */
- int tPoly_getVelocity (tPoly* const poly, uint8_t voice);
-
-
- //! Get the current play state of a given voice.
- /*!
+
+ @fn int tSimplePoly_isOn (tSimplePoly* const poly, uint8_t voice)
+ @brief Get the current play state of a given voice.
@param poly A pointer to the relevant tPoly.
@param voice The voice to get the state of.
@return The current play state of the given voice.
- */
- int tPoly_isOn (tPoly* const poly, uint8_t voice);
-
- /*! @} */
-
- //==============================================================================
-
-
- /* tPoly */
+
+ @} */
typedef struct _tSimplePoly
{
tMempool mempool;
@@ -369,116 +407,23 @@
typedef _tSimplePoly* tSimplePoly;
- //! Initialize a tPoly to the default LEAF mempool.
- /*!
- @param poly A pointer to the tPoly to be initialized.
- @param maxNumVoices The maximum number of voices this tPoly can handle at once.
- */
void tSimplePoly_init (tSimplePoly* const poly, int maxNumVoices);
-
-
- //! Initialize a tPoly to a specified mempool.
- /*!
- @param poly A pointer to the tPoly to be initialized.
- @param pool A pointer to the tMempool to which the tPoly should be initialized.
- */
void tSimplePoly_initToPool (tSimplePoly* const poly, int maxNumVoices, tMempool* const pool);
-
-
- //! Free a tPoly from the default LEAF mempool.
- /*!
- @param poly A pointer to the tPoly to be freed.
- */
void tSimplePoly_free (tSimplePoly* const poly);
-
- //! Add a note with a given velocity to the poly handler.
- /*!
- @param poly A pointer to the relevant tPoly.
- @param note The MIDI note number to add.
- @param vel The MIDI velocity of the note to add.
- @return The voice that will play the note.
- */
int tSimplePoly_noteOn (tSimplePoly* const poly, int note, uint8_t vel);
-
-
- //! Remove a note from the poly handler.
- /*!
- @param poly A pointer to the relevant tPoly.
- @param note The MIDI note number to remove.
- @return The voice that was playing the removed note.
- */
int tSimplePoly_noteOff (tSimplePoly* const poly, uint8_t note);
-
-
-
- void tSimplePoly_deactivateVoice(tSimplePoly* const polyh, uint8_t voice);
-
- int tSimplePoly_markPendingNoteOff(tSimplePoly* const polyh, uint8_t note);
-
-
- //find if there is a voice with that note -- useful for note offs where you want to wait to remove it from the poly until the release phase of the envelope is finished
- int tSimplePoly_findVoiceAssignedToNote(tSimplePoly* const polyh, uint8_t note);
-
- //! Set the number of voices available to play notes.
- /*!
- @param poly A pointer to the relevant tPoly.
- @param numVoices The new number of available voices. Cannot be greater than the max number voices given in tPoly_init().
- */
+ void tSimplePoly_deactivateVoice (tSimplePoly* const polyh, uint8_t voice);
+ int tSimplePoly_markPendingNoteOff (tSimplePoly* const polyh, uint8_t note);
+ int tSimplePoly_findVoiceAssignedToNote (tSimplePoly* const polyh, uint8_t note);
void tSimplePoly_setNumVoices (tSimplePoly* const poly, uint8_t numVoices);
-
- //! Set whether pitch glide over note changes in voices is active.
- /*!
- @param poly A pointer to the relevant tPoly.
- @param isActive Whether pitch glide should be active or not.
- */
-
- //! Get the current number of voices available to play notes.
- /*!
- @param poly A pointer to the relevant tPoly.
- @return The current number of voices available to play notes.
- */
int tSimplePoly_getNumVoices (tSimplePoly* const poly);
-
- //! Get the number of voices currently playing notes.
- /*!
- @param poly A pointer to the relevant tPoly.
- @return The number of voices currently playing notes.
- */
int tSimplePoly_getNumActiveVoices (tSimplePoly* const poly);
-
- //! Get the current MIDI note number of a given voice.
- /*!
- @param poly A pointer to the relevant tPoly.
- @param voice The voice to get the MIDI note number of.
- @return The MIDI note number of the given voice.
- */
-
- int tSimplePoly_getPitch (tSimplePoly* const poly, uint8_t voice);
-
-
- //this one returns negative one if the voice is inactive
- int tSimplePoly_getPitchAndCheckActive(tSimplePoly* const polyh, uint8_t voice);
-
-
- //! Get the current MIDI velocity of a given voice.
- /*!
- @param poly A pointer to the relevant tPoly.
- @param voice The voice to get the MIDI velocity of.
- @return The current MIDI velocity of the given voice.
- */
+ int tSimplePoly_getPitch (tSimplePoly* const poly, uint8_t voice);
+ int tSimplePoly_getPitchAndCheckActive(tSimplePoly* const polyh, uint8_t voice);
int tSimplePoly_getVelocity (tSimplePoly* const poly, uint8_t voice);
-
-
- //! Get the current play state of a given voice.
- /*!
- @param poly A pointer to the relevant tPoly.
- @param voice The voice to get the state of.
- @return The current play state of the given voice.
- */
int tSimplePoly_isOn (tSimplePoly* const poly, uint8_t voice);
- /*! @} */
//==============================================================================
#ifdef __cplusplus
--- a/leaf/Inc/leaf-oscillators.h
+++ b/leaf/Inc/leaf-oscillators.h
@@ -33,43 +33,32 @@
@ingroup oscillators
@brief A general wavetable oscillator.
@{
- */
-
- /*!
- @fn void tTable_init (tTable* const osc)
+
+ @fn void tTable_init (tTable* const osc, float* waveTable, int size)
@brief Initialize a tTable to the default LEAF mempool.
@param osc A pointer to the tTable to be initialized.
- */
-
- /*!
- @fn void tTable_initToPool (tTable* const osc, tMempool* const mempool)
+
+ @fn void tTable_initToPool (tTable* const osc, float* waveTable, int size, tMempool* const mempool)
@brief Initialize a tTable to a specified mempool.
@param osc A pointer to the tTable to be initialized.
@param pool A pointer to the tMempool to which the tTable should be initialized.
- */
-
- /*!
+
@fn void tTable_free (tTable* const osc)
@brief Free a tTable from the default LEAF mempool.
@param osc A pointer to the tTable to be freed.
- */
-
- /*!
+
@fn float tTable_tick (tTable* const osc)
@brief Tick a tTable oscillator.
@param osc A pointer to the relevant tTable.
@return The ticked sample as a float from -1 to 1.
- */
-
- /*!
+
@fn void tTable_setFreq (tTable* const osc, float freq)
@brief Set the frequency of a tTable oscillator.
@param osc A pointer to the relevant tTable.
@param freq The frequency to set the oscillator to.
- */
+
+ @} */
- /*! @} */
-
typedef struct _tTable
{
tMempool mempool;
@@ -96,43 +85,33 @@
@ingroup oscillators
@brief A cycle/sine waveform oscillator. Uses wavetable synthesis.
@{
- */
-
- /*!
+
@fn void tCycle_init (tCycle* const osc)
@brief Initialize a tCycle to the default LEAF mempool.
@param osc A pointer to the tCycle to be initialized.
- */
-
- /*!
+
@fn void tCycle_initToPool (tCycle* const osc, tMempool* const pool)
@brief Initialize a tCycle to a specified mempool.
@param osc A pointer to the tCycle to be initialized.
@param pool A pointer to the tMempool to which the tCycle should be initialized.
- */
-
- /*!
+
@fn void tCycle_free (tCycle* const osc)
@brief Free a tCycle from the default LEAF mempool.
@param osc A pointer to the tCycle to be freed.
- */
-
- /*!
+
@fn float tCycle_tick (tCycle* const osc)
@brief Tick a tCycle oscillator.
@param osc A pointer to the relevant tCycle.
@return The ticked sample as a float from -1 to 1.
- */
-
- /*!
+
@fn void tCycle_setFreq (tCycle* const osc, float freq)
@brief Set the frequency of a tCycle oscillator.
@param osc A pointer to the relevant tCycle.
@param freq The frequency to set the oscillator to.
- */
+
+ 
+ @} */
- /*! @} */
-
typedef struct _tCycle
{
tMempool mempool;
@@ -157,42 +136,31 @@
@ingroup oscillators
@brief Anti-aliased Triangle waveform using wavetable interpolation. Wavetables constructed from sine components.
@{
- */
-
- /*!
+
@fn void tTriangle_init (tTriangle* const osc)
@brief Initialize a tTriangle to the default LEAF mempool.
@param osc A pointer to the tTriangle to be initialized.
- */
-
- /*!
+
@fn void tTriangle_initToPool (tTriangle* const osc, tMempool* const pool)
@brief Initialize a tTriangle to a specified mempool.
@param osc A pointer to the tTriangle to be initialized.
@param pool A pointer to the tMempool to which the tTriangle should be initialized.
- */
-
- /*!
+
@fn void tTriangle_free (tTriangle* const osc)
@brief Free a tTriangle from the default LEAF mempool.
@param osc A pointer to the tTriangle to be freed.
- */
-
- /*!
+
@fn float tTriangle_tick (tTriangle* const osc)
@brief Tick a tTriangle oscillator.
@param osc A pointer to the relevant tTriangle.
@return The ticked sample as a float from -1 to 1.
- */
-
- /*!
+
@fn void tTriangle_setFreq (tTriangle* const osc, float freq)
@brief Set the frequency of a tTriangle oscillator.
@param osc A pointer to the relevant tTriangle.
@param freq The frequency to set the oscillator to.
- */
-
- /*! @} */
+
+ @} */
typedef struct _tTriangle
{
@@ -221,43 +189,32 @@
@ingroup oscillators
@brief Anti-aliased Square waveform using wavetable interpolation. Wavetables constructed from sine components.
@{
- */
-
- /*!
+
@fn void tSquare_init (tSquare* const osc)
@brief Initialize a tSquare to the default LEAF mempool.
@param osc A pointer to the tSquare to be initialized.
- */
-
- /*!
+
@fn void tSquare_initToPool (tSquare* const osc, tMempool* const pool)
@brief Initialize a tSquare to a specified mempool.
@param osc A pointer to the tSquare to be initialized.
@param pool A pointer to the tMempool to which the tSquare should be initialized.
- */
-
- /*!
+
@fn void tSquare_free (tSquare* const osc)
@brief Free a tSquare from the default LEAF mempool.
@param osc A pointer to the tSquare to be freed.
- */
-
- /*!
+
@fn float tSquare_tick (tSquare* const osc)
@brief Tick a tSquare oscillator.
@param osc A pointer to the relevant tSquare.
@return The ticked sample as a float from -1 to 1.
- */
-
- /*!
+
@fn void tSquare_setFreq (tSquare* const osc, float freq)
@brief Set the frequency of a tSquare oscillator.
@param osc A pointer to the relevant tSquare.
@param freq The frequency to set the oscillator to.
- */
+ 
+ @} */
- /*! @} */
-
typedef struct _tSquare
{
tMempool mempool;
@@ -277,7 +234,8 @@
float tSquare_tick (tSquare* const osc);
void tSquare_setFreq (tSquare* const osc, float freq);
- /*! @} */
+ /*!
+ @} */
//==============================================================================
@@ -286,43 +244,32 @@
@ingroup oscillators
@brief Anti-aliased Square waveform using wavetable interpolation. Wavetables constructed from sine components.
@{
- */
-
- /*!
+
@fn void tSawtooth_init (tSawtooth* const osc)
@brief Initialize a tSawtooth to the default LEAF mempool.
@param osc A pointer to the tSawtooth to be initialized.
- */
-
- /*!
+
@fn void tSawtooth_initToPool (tSawtooth* const osc, tMempool* const pool)
@brief Initialize a tSawtooth to a specified mempool.
@param osc A pointer to the tSawtooth to be initialized.
@param pool A pointer to the tMempool to which the tSawtooth should be initialized.
- */
-
- /*!
+
@fn void tSawtooth_free (tSawtooth* const osc)
@brief Free a tSawtooth from the default LEAF mempool.
@param osc A pointer to the tSawtooth to be freed.
- */
-
- /*!
+
@fn float tSawtooth_tick (tSawtooth* const osc)
@brief Tick a tSawtooth oscillator.
@param osc A pointer to the relevant tSawtooth.
@return The ticked sample as a float from -1 to 1.
- */
-
- /*!
+
@fn void tSawtooth_setFreq (tSawtooth* const osc, float freq)
@brief Set the frequency of a tSawtooth oscillator.
@param osc A pointer to the relevant tSawtooth.
@param freq The frequency to set the oscillator to.
- */
+ 
+ @} */
- /*! @} */
-
typedef struct _tSawtooth
{
tMempool mempool;
@@ -344,72 +291,37 @@
//==============================================================================
-
- // TO BE REMOVED
- typedef struct _tSine
- {
- tMempool mempool;
- float* sine;
- int size;
- float phase;
- float inc,freq;
- } _tSine;
-
- typedef _tSine* tSine;
-
- void tSine_init (tSine* const osc, int size);
- void tSine_initToPool (tSine* const osc, int size, tMempool* const pool);
-
- void tSine_free (tSine* const osc);
- float tSine_tick (tSine* const osc);
- void tSine_setFreq (tSine* const osc, float freq);
-
- //==============================================================================
-
/*!
@defgroup ttri tTri
@ingroup oscillators
@brief
@{
- */
-
- /*!
+
@fn void tTri_init (tTri* const osc)
@brief
@param
- */
-
- /*!
+
@fn void tTri_initToPool (tTri* const osc, tMempool* const pool)
@brief
@param
- */
-
- /*!
+
@fn void tTri_free (tTri* const osc)
@brief
@param
- */
-
- /*!
+
@fn float tTri_tick (tTri* const osc)
@brief
@param
- */
-
- /*!
+
@fn void tTri_setFreq (tTri* const osc, float freq)
@brief
@param
- */
-
- /*!
+
@fn void tTri_setSkew (tTri* const osc, float skew)
@brief
@param
- */
-
- /*! @} */
+ 
+ @} */
typedef struct _tTri
{
@@ -437,46 +349,33 @@
@ingroup oscillators
@brief
@{
- */
-
- /*!
+
@fn void tPulse_init (tPulse* const osc)
@brief
@param
- */
-
- /*!
+
@fn void tPulse_initToPool (tPulse* const osc, tMempool* const)
@brief
@param
- */
-
- /*!
+
@fn void tPulse_free (tPulse* const osc)
@brief
@param
- */
-
- /*!
+
@fn float tPulse_tick (tPulse* const osc)
@brief
@param
- */
-
- /*!
+
@fn void tPulse_setFreq (tPulse* const osc, float freq)
@brief
@param
- */
-
- /*!
+
@fn void tPulse_setWidth (tPulse* const osc, float width)
@brief
@param
- */
+ 
+ @} */
- /*! @} */
-
typedef struct _tPulse
{
tMempool mempool;
@@ -502,40 +401,29 @@
@ingroup oscillators
@brief
@{
- */
-
- /*!
+
@fn void tSaw_init (tSaw* const osc)
@brief
@param
- */
- /*!
@fn void tSaw_initToPool (tSaw* const osc, tMempool* const pool)
@brief
@param
- */
-
- /*!
+
@fn void tSaw_free (tSaw* const osc)
@brief
@param
- */
-
- /*!
+
@fn float tSaw_tick (tSaw* const osc)
@brief
@param
- */
-
- /*!
+
@fn void tSaw_setFreq (tSaw* const osc, float freq)
@brief
@param
- */
+ 
+ @} */
- /*! @} */
-
typedef struct _tSaw
{
tMempool mempool;
@@ -559,40 +447,29 @@
@ingroup oscillators
@brief
@{
- */
-
- /*!
+
@fn void tPhasor_init (tPhasor* const osc)
@brief
@param
- */
-
- /*!
+
@fn void tPhasor_initToPool (tPhasor* const osc, tMempool* const)
@brief
@param
- */
-
- /*!
+
@fn void tPhasor_free (tPhasor* const osc)
@brief
@param
- */
-
- /*!
+
@fn float tPhasor_tick (tPhasor* const osc)
@brief
@param
- */
-
- /*!
+
@fn void tPhasor_setFreq (tPhasor* const osc, float freq)
@brief
@param
- */
+ 
+ @} */
- /*! @} */
-
typedef struct _tPhasor
{
tMempool mempool;
@@ -617,27 +494,19 @@
@ingroup oscillators
@brief
@{
- */
-
- /*!
+
@fn void tNoise_init (tNoise* const noise, NoiseType type)
@brief
@param
- */
-
- /*!
+
@fn void tNoise_initToPool (tNoise* const noise, NoiseType type, tMempool* const)
@brief
@param
- */
-
- /*!
+
@fn void tNoise_free (tNoise* const noise)
@brief
@param
- */
-
- /*!
+
@fn float tNoise_tick (tNoise* const noise)
@brief
@param
@@ -654,7 +523,7 @@
NoiseTypeNil,
};
- /*! @} */
+ /*! @} */
typedef enum NoiseType NoiseType;
@@ -681,111 +550,79 @@
@ingroup oscillators
@brief A model of a neuron, adapted to act as an oscillator.
@{
- */
-
- /*!
+
@fn void tNeuron_init (tNeuron* const neuron)
@brief Initialize a tNeuron to the default LEAF mempool.
@param neuron A pointer to the tNeuron to be initialized.
- */
-
- /*!
+
@fn void tNeuron_initToPool (tNeuron* const neuron, tMempool* const pool)
@brief Initialize a tNeuron to a specified mempool.
@param neuron A pointer to the tNeuron to be initialized.
@param pool A pointer to the tMempool to which the tNeuron should be initialized.
- */
-
- /*!
+
@fn void tNeuron_free (tNeuron* const neuron)
@brief Free a tNeuron from the default LEAF mempool.
@param neuron A pointer to the tNeuron to be freed.
- */
-
- /*!
+
@fn void tNeuron_reset (tNeuron* const neuron)
@brief Reset the neuron model.
@param neuron A pointer to the relevant tNeuron.
- */
-
- /*!
+
@fn float tNeuron_tick (tNeuron* const neuron)
@brief Tick a tNeuron oscillator.
@param neuron A pointer to the relevant tNeuron.
@return The ticked sample as a float from -1 to 1.
- */
-
- /*!
+
@fn void tNeuron_setMode (tNeuron* const neuron, NeuronMode mode)
@brief Set the tNeuron shaping mode.
@param neuron A pointer to the relevant tNeuron.
@param mode The mode to set the tNeuron to.
- */
-
- /*!
+
@fn void tNeuron_setCurrent (tNeuron* const neuron, float current)
@brief Set the current.
@param neuron A pointer to the relevant tNeuron.
@param current The new current.
- */
-
- /*!
+
@fn void tNeuron_setK (tNeuron* const neuron, float K)
@brief Set the potassium value.
@param neuron A pointer to the relevant tNeuron.
@param K The new potassium.
- */
-
- /*!
+
@fn void tNeuron_setL (tNeuron* const neuron, float L)
@brief Set the chloride value.
@param neuron A pointer to the relevant tNeuron.
@param L The new chloride value.
- */
-
- /*!
+
@fn void tNeuron_setN (tNeuron* const neuron, float N)
@brief Set the sodium value.
@param neuron A pointer to the relevant tNeuron.
@param N The new sodium value.
- */
-
- /*!
+
@fn void tNeuron_setC (tNeuron* const neuron, float C)
@brief Set the calcium value.
@param neuron A pointer to the relevant tNeuron.
@param C The new calcium.
- */
-
- /*!
+
@fn void tNeuron_setV1 (tNeuron* const neuron, float V1)
@brief Set the V1 value.
@param neuron A pointer to the relevant tNeuron.
@param V1 The new V1.
- */
-
- /*!
+
@fn void tNeuron_setV2 (tNeuron* const neuron, float V2)
@brief Set the V2 value.
@param neuron A pointer to the relevant tNeuron.
@param V2 The new V2.
- */
-
- /*!
+
@fn void tNeuron_setV3 (tNeuron* const neuron, float V3)
@brief Set the V3 value.
@param neuron A pointer to the relevant tNeuron.
@param V3 The new V3.
- */
-
- /*!
+
@fn void tNeuron_setTimeStep (tNeuron* const neuron, float timestep)
@brief Set the time step of the model.
@param neuron A pointer to the relevant tNeuron.
@param timestep The new time step.
- */
-
- /*!
+
@brief Shaping modes for tNeuron output.
*/
enum NeuronMode
@@ -796,7 +633,7 @@
NeuronModeNil
};
- /*! @} */
+ /*! @} */
typedef enum NeuronMode NeuronMode;
@@ -850,58 +687,41 @@
@ingroup oscillators
@brief
@{
- */
-
- /*!
+
@fn void tMBPulse_init(tMBPulse* const osc)
@brief
@param
- */
-
- /*!
+
@fn void tMBPulse_initToPool(tMBPulse* const osc, tMempool* const pool)
@brief
@param
- */
-
- /*!
+
@fn void tMBPulse_free(tMBPulse* const osc)
@brief
@param
- */
-
- /*!
+
@fn float tMBPulse_tick(tMBPulse* const osc)
@brief
@param
- */
-
- /*!
+
@fn void tMBPulse_setFreq(tMBPulse* const osc, float f)
@brief
@param
- */
-
- /*!
+
@fn void tMBPulse_setWidth(tMBPulse* const osc, float w)
@brief
@param
- */
-
- /*!
+
@fn void tMBPulse_syncIn(tMBPulse* const osc, float sync)
@brief
@param
- */
-
- /*!
+
@fn float tMBPulse_syncOut(tMBPulse* const osc)
@brief
@param
- */
+ 
+ @} */
- /*! @} */
-
typedef struct _tMBPulse
{
tMempool mempool;
@@ -935,58 +755,41 @@
@ingroup oscillators
@brief
@{
- */
-
- /*!
+
@fn void tMBTriangle_init(tMBTriangle* const osc)
@brief
@param
- */
-
- /*!
+
@fn void tMBTriangle_initToPool(tMBTriangle* const osc, tMempool* const pool)
@brief
@param
- */
-
- /*!
+
@fn void tMBTriangle_free(tMBTriangle* const osc)
@brief
@param
- */
-
- /*!
+
@fn float tMBTriangle_tick(tMBTriangle* const osc)
@brief
@param
- */
-
- /*!
+
@fn void tMBTriangle_setFreq(tMBTriangle* const osc, float f)
@brief
@param
- */
-
- /*!
+
@fn void tMBTriangle_setWidth(tMBTriangle* const osc, float w)
@brief
@param
- */
-
- /*!
+
@fn void tMBTriangle_syncIn(tMBTriangle* const osc, float sync)
@brief
@param
- */
-
- /*!
+
@fn float tMBTriangle_syncOut(tMBTriangle* const osc)
@brief
@param
- */
+ 
+ @} */
- /*! @} */
-
typedef struct _tMBTriangle
{
tMempool mempool;
@@ -1021,51 +824,36 @@
@ingroup oscillators
@brief
@{
- */
-
- /*!
+
@fn void tMBSaw_init(tMBSaw* const osc)
@brief
@param
- */
-
- /*!
+
@fn void tMBSaw_initToPool(tMBSaw* const osc, tMempool* const pool)
@brief
@param
- */
-
- /*!
+
@fn void tMBSaw_free(tMBSaw* const osc)
@brief
@param
- */
-
- /*!
+
@fn float tMBSaw_tick(tMBSaw* const osc)
@brief
@param
- */
-
- /*!
+
@fn void tMBSaw_setFreq(tMBSaw* const osc, float f)
@brief
@param
- */
-
- /*!
+
@fn void tMBSaw_syncIn(tMBSaw* const osc, float sync)
@brief
@param
- */
-
- /*!
+
@fn float tMBSaw_syncOut(tMBSaw* const osc)
@brief
@param
- */
-
- /*! @} */
+ 
+ @} */
typedef struct _tMBSaw
{
--- a/leaf/Inc/leaf-physical.h
+++ b/leaf/Inc/leaf-physical.h
@@ -36,7 +36,54 @@
//==============================================================================
- /* Karplus Strong model */
+ /*!
+ @defgroup tpluck tPluck
+ @ingroup physical
+ @brief Karplus-Strong model
+ @{
+
+ @fn void tPluck_init (tPluck* const, float lowestFrequency)
+ @brief
+ @param
+
+ @fn void tPluck_initToPool (tPluck* const, float lowestFrequency, tMempool* const)
+ @brief
+ @param
+
+ @fn void tPluck_free (tPluck* const)
+ @brief
+ @param
+
+ @fn float tPluck_tick (tPluck* const)
+ @brief
+ @param
+
+ @fn void tPluck_pluck (tPluck* const, float amplitude)
+ @brief Pluck the string.
+ @param
+
+ @fn void tPluck_noteOn (tPluck* const, float frequency, float amplitude )
+ @brief Start a note with the given frequency and amplitude.
+ @param
+
+ @fn void tPluck_noteOff (tPluck* const, float amplitude )
+ @brief Stop a note with the given amplitude (speed of decay)
+ @param
+
+ @fn void tPluck_setFrequency (tPluck* const, float frequency )
+ @brief Set instrument parameters for a particular frequency.
+ @param
+
+ @fn void tPluck_controlChange (tPluck* const, int number, float value)
+ @brief Perform the control change specified by \e number and \e value (0.0 - 128.0).
+ @param
+
+ @fn float tPluck_getLastOut (tPluck* const)
+ @brief
+ @param
+
+ @} */
+
typedef struct _tPluck
{
tMempool mempool;
@@ -59,28 +106,76 @@
void tPluck_initToPool (tPluck* const, float lowestFrequency, tMempool* const);
void tPluck_free (tPluck* const);
- float tPluck_tick (tPluck* const);
-
- // Pluck the string.
+ float tPluck_tick (tPluck* const);
void tPluck_pluck (tPluck* const, float amplitude);
-
- // Start a note with the given frequency and amplitude.;
void tPluck_noteOn (tPluck* const, float frequency, float amplitude );
-
- // Stop a note with the given amplitude (speed of decay).
void tPluck_noteOff (tPluck* const, float amplitude );
-
- // Set instrument parameters for a particular frequency.
void tPluck_setFrequency (tPluck* const, float frequency );
-
- // Perform the control change specified by \e number and \e value (0.0 - 128.0).
void tPluck_controlChange (tPluck* const, int number, float value);
-
- // tPluck Utilities.
float tPluck_getLastOut (tPluck* const);
//==============================================================================
+ /*!
+ @defgroup tkarplusstrong tKarplusStrong
+ @ingroup physical
+ @brief Stiff Karplus-Strong model
+ @{
+
+ @fn void tKarplusStrong_init (tKarplusStrong* const, float lowestFrequency)
+ @brief
+ @param
+
+ @fn void tKarplusStrong_initToPool (tKarplusStrong* const, float lowestFrequency, tMempool* const)
+ @brief
+ @param
+
+ @fn void tKarplusStrong_free (tKarplusStrong* const)
+ @brief
+ @param
+
+ @fn float tKarplusStrong_tick (tKarplusStrong* const)
+ @brief
+ @param
+
+ @fn void tKarplusStrong_pluck (tKarplusStrong* const, float amplitude)
+ @brief Pluck the string.
+ @param
+
+ @fn void tKarplusStrong_noteOn (tKarplusStrong* const, float frequency, float amplitude)
+ @brief Start a note with the given frequency and amplitude.
+ @param
+
+ @fn void tKarplusStrong_noteOff (tKarplusStrong* const, float amplitude)
+ @brief Stop a note with the given amplitude (speed of decay).
+ @param
+
+ @fn void tKarplusStrong_setFrequency (tKarplusStrong* const, float frequency)
+ @brief Set instrument parameters for a particular frequency.
+ @param
+
+ @fn void tKarplusStrong_controlChange (tKarplusStrong* const, SKControlType type, float value)
+ @brief Perform the control change specified by \e number and \e value (0.0 - 128.0). Use SKPickPosition, SKStringDamping, or SKDetune for type.
+ @param
+
+ @fn void tKarplusStrong_setStretch (tKarplusStrong* const, float stretch)
+ @brief Set the stretch "factor" of the string (0.0 - 1.0).
+ @param
+
+ @fn void tKarplusStrong_setPickupPosition (tKarplusStrong* const, float position)
+ @brief Set the pluck or "excitation" position along the string (0.0 - 1.0).
+ @param
+
+ @fn void tKarplusStrong_setBaseLoopGain (tKarplusStrong* const, float aGain )
+ @brief Set the base loop gain.
+ @param
+
+ @fn float tKarplusStrong_getLastOut (tKarplusStrong* const)
+ @brief
+ @param
+
+ @} */
+
typedef enum SKControlType
{
SKPickPosition = 0,
@@ -89,7 +184,6 @@
SKControlTypeNil
} SKControlType;
- /* Stif Karplus Strong model */
typedef struct _tKarplusStrong
{
tMempool mempool;
@@ -119,38 +213,78 @@
void tKarplusStrong_free (tKarplusStrong* const);
float tKarplusStrong_tick (tKarplusStrong* const);
-
- // Pluck the string.
void tKarplusStrong_pluck (tKarplusStrong* const, float amplitude);
-
- // Start a note with the given frequency and amplitude.;
void tKarplusStrong_noteOn (tKarplusStrong* const, float frequency, float amplitude );
-
- // Stop a note with the given amplitude (speed of decay).
void tKarplusStrong_noteOff (tKarplusStrong* const, float amplitude );
-
- // Set instrument parameters for a particular frequency.
void tKarplusStrong_setFrequency (tKarplusStrong* const, float frequency );
-
- // Perform the control change specified by \e number and \e value (0.0 - 128.0).
- // Use SKPickPosition, SKStringDamping, or SKDetune for type.
void tKarplusStrong_controlChange (tKarplusStrong* const, SKControlType type, float value);
-
- // Set the stretch "factor" of the string (0.0 - 1.0).
void tKarplusStrong_setStretch (tKarplusStrong* const, float stretch );
-
- // Set the pluck or "excitation" position along the string (0.0 - 1.0).
void tKarplusStrong_setPickupPosition (tKarplusStrong* const, float position );
-
- // Set the base loop gain.
void tKarplusStrong_setBaseLoopGain (tKarplusStrong* const, float aGain );
-
- // tKarplusStrong utilities.
float tKarplusStrong_getLastOut (tKarplusStrong* const);
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
- /* Simple Living String */
+ /*!
+ @defgroup tsimplelivingstring tSimpleLivingString
+ @ingroup physical
+ @brief
+ @{
+
+ @fn void tSimpleLivingString_init (tSimpleLivingString* const, float freq, float dampFreq, float decay, float targetLev, float levSmoothFactor, float levStrength, int levMode)
+ @brief
+ @param
+
+ @fn void tSimpleLivingString_initToPool (tSimpleLivingString* const, float freq, float dampFreq, float decay, float targetLev, float levSmoothFactor, float levStrength, int levMode, tMempool* const)
+ @brief
+ @param
+
+ @fn void tSimpleLivingString_free (tSimpleLivingString* const)
+ @brief
+ @param
+
+ @fn float tSimpleLivingString_tick (tSimpleLivingString* const, float input)
+ @brief
+ @param
+
+ @fn float tSimpleLivingString_sample (tSimpleLivingString* const)
+ @brief
+ @param
+
+ @fn void tSimpleLivingString_setFreq (tSimpleLivingString* const, float freq)
+ @brief
+ @param
+
+ @fn void tSimpleLivingString_setWaveLength (tSimpleLivingString* const, float waveLength)
+ @brief
+ @param
+
+ @fn void tSimpleLivingString_setDampFreq (tSimpleLivingString* const, float dampFreq)
+ @brief
+ @param
+
+ @fn void tSimpleLivingString_setDecay (tSimpleLivingString* const, float decay)
+ @brief
+ @param
+
+ @fn void tSimpleLivingString_setTargetLev (tSimpleLivingString* const, float targetLev)
+ @brief
+ @param
+
+ @fn void tSimpleLivingString_setLevSmoothFactor (tSimpleLivingString* const, float levSmoothFactor)
+ @brief
+ @param
+
+ @fn void tSimpleLivingString_setLevStrength (tSimpleLivingString* const, float levStrength)
+ @brief
+ @param
+
+ @fn void tSimpleLivingString_setLevMode (tSimpleLivingString* const, int levMode)
+ @brief
+ @param
+
+ @} */
+
typedef struct _tSimpleLivingString
{
tMempool mempool;
@@ -189,7 +323,74 @@
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
- /* Living String */
+ /*!
+ @defgroup tlivingstring tLivingString
+ @ingroup physical
+ @brief
+ @{
+
+ @fn void tLivingString_init (tLivingString* const, float freq, float pickPos, float prepIndex, float dampFreq, float decay, float targetLev, float levSmoothFactor, float levStrength, int levMode)
+ @brief
+ @param
+
+ @fn void tLivingString_initToPool (tLivingString* const, float freq, float pickPos, float prepIndex, float dampFreq, float decay, float targetLev, float levSmoothFactor, float levStrength, int levMode, tMempool* const)
+ @brief
+ @param
+
+ @fn void tLivingString_free (tLivingString* const)
+ @brief
+ @param
+
+ @fn float tLivingString_tick (tLivingString* const, float input)
+ @brief
+ @param
+
+ @fn float tLivingString_sample (tLivingString* const)
+ @brief
+ @param
+
+ @fn void tLivingString_setFreq (tLivingString* const, float freq)
+ @brief
+ @param
+
+ @fn void tLivingString_setWaveLength (tLivingString* const, float waveLength)
+ @brief
+ @param
+
+ @fn void tLivingString_setPickPos (tLivingString* const, float pickPos)
+ @brief
+ @param
+
+ @fn void tLivingString_setPrepIndex (tLivingString* const, float prepIndex)
+ @brief
+ @param
+
+ @fn void tLivingString_setDampFreq (tLivingString* const, float dampFreq)
+ @brief
+ @param
+
+ @fn void tLivingString_setDecay (tLivingString* const, float decay)
+ @brief
+ @param
+
+ @fn void tLivingString_setTargetLev (tLivingString* const, float targetLev)
+ @brief
+ @param
+
+ @fn void tLivingString_setLevSmoothFactor (tLivingString* const, float levSmoothFactor)
+ @brief
+ @param
+
+ @fn void tLivingString_setLevStrength (tLivingString* const, float levStrength)
+ @brief
+ @param
+
+ @fn void tLivingString_setLevMode (tLivingString* const, int levMode)
+ @brief
+ @param
+
+ @} */
+
typedef struct _tLivingString
{
tMempool mempool;
@@ -234,7 +435,78 @@
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
- /* Complex Living String */
+ /*!
+ @defgroup tcomplexlivingstring tComplexLivingString
+ @ingroup physical
+ @brief
+ @{
+
+ @fn void tComplexLivingString_init (tComplexLivingString* const, float freq, float pickPos, float prepPos, float prepIndex, float dampFreq, float decay, float targetLev, float levSmoothFactor, float levStrength, int levMode)
+ @brief
+ @param
+
+ @fn void tComplexLivingString_initToPool (tComplexLivingString* const, float freq, float pickPos, float prepPos, float prepIndex, float dampFreq, float decay, float targetLev, float levSmoothFactor, float levStrength, int levMode, tMempool* const)
+ @brief
+ @param
+
+ @fn void tComplexLivingString_free (tComplexLivingString* const)
+ @brief
+ @param
+
+ @fn float tComplexLivingString_tick (tComplexLivingString* const, float input)
+ @brief
+ @param
+
+ @fn float tComplexLivingString_sample (tComplexLivingString* const)
+ @brief
+ @param
+
+ @fn void tComplexLivingString_setFreq (tComplexLivingString* const, float freq)
+ @brief
+ @param
+
+ @fn void tComplexLivingString_setWaveLength (tComplexLivingString* const, float waveLength)
+ @brief
+ @param
+
+ @fn void tComplexLivingString_setPickPos (tComplexLivingString* const, float pickPos)
+ @brief
+ @param
+
+ @fn void tComplexLivingString_setPrepPos (tComplexLivingString* const, float prepPos)
+ @brief
+ @param
+
+ @fn void tComplexLivingString_setPrepIndex (tComplexLivingString* const, float prepIndex)
+ @brief
+ @param
+
+ @fn void tComplexLivingString_setDampFreq (tComplexLivingString* const, float dampFreq)
+ @brief
+ @param
+
+ @fn void tComplexLivingString_setDecay (tComplexLivingString* const, float decay)
+ @brief
+ @param
+
+ @fn void tComplexLivingString_setTargetLev (tComplexLivingString* const, float targetLev)
+ @brief
+ @param
+
+ @fn void tComplexLivingString_setLevSmoothFactor (tComplexLivingString* const, float levSmoothFactor)
+ @brief
+ @param
+
+ @fn void tComplexLivingString_setLevStrength (tComplexLivingString* const, float levStrength)
+ @brief
+ @param
+
+ @fn void tComplexLivingString_setLevMode (tComplexLivingString* const, int levMode)
+ @brief
+ @param
+
+ @} */
+
typedef struct _tComplexLivingString
{
tMempool mempool;
@@ -277,11 +549,46 @@
void tComplexLivingString_setLevSmoothFactor (tComplexLivingString* const, float levSmoothFactor);
void tComplexLivingString_setLevStrength (tComplexLivingString* const, float levStrength);
void tComplexLivingString_setLevMode (tComplexLivingString* const, int levMode);
+
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
-
- //Reed Table - borrowed from STK
+ /*!
+ @defgroup treedtable tReedTable
+ @ingroup physical
+ @brief Reed Table - borrowed from STK
+ @{
+
+ @fn void tReedTable_init (tReedTable* const, float offset, float slope)
+ @brief
+ @param
+
+ @fn void tReedTable_initToPool (tReedTable* const, float offset, float slope, tMempool* const)
+ @brief
+ @param
+
+ @fn void tReedTable_free (tReedTable* const)
+ @brief
+ @param
+
+ @fn float tReedTable_tick (tReedTable* const, float input)
+ @brief
+ @param
+
+ @fn float tReedTable_tanh_tick (tReedTable* const, float input)
+ @brief
+ @param
+
+ @fn void tReedTable_setOffset (tReedTable* const, float offset)
+ @brief
+ @param
+
+ @fn void tReedTable_setSlope (tReedTable* const, float slope)
+ @brief
+ @param
+
+ @} */
+
typedef struct _tReedTable
{
tMempool mempool;
--- a/leaf/Inc/leaf-reverb.h
+++ b/leaf/Inc/leaf-reverb.h
@@ -32,7 +32,42 @@
//==============================================================================
- /* PRCReverb: Reverb, reimplemented from STK (Cook and Scavone). */
+ /*!
+ @defgroup tprcreverb tPRCReverb
+ @ingroup reverb
+ @brief Reverb, reimplemented from STK (Cook and Scavone).
+ @{
+
+ @fn void tPRCReverb_init (tPRCReverb* const, float t60)
+ @brief
+ @param
+
+ @fn void tPRCReverb_initToPool (tPRCReverb* const, float t60, tMempool* const)
+ @brief
+ @param
+
+ @fn void tPRCReverb_free (tPRCReverb* const)
+ @brief
+ @param
+
+ @fn void tPRCReverb_clear (tPRCReverb* const)
+ @brief
+ @param
+
+ @fn float tPRCReverb_tick (tPRCReverb* const, float input)
+ @brief
+ @param
+
+ @fn void tPRCReverb_setT60 (tPRCReverb* const, float t60)
+ @brief Set reverb time in seconds.
+ @param
+
+ @fn void tPRCReverb_setMix (tPRCReverb* const, float mix)
+ @brief Set mix between dry input and wet output signal.
+ @param
+
+ @} */
+
typedef struct _tPRCReverb
{
tMempool mempool;
@@ -57,16 +92,51 @@
void tPRCReverb_clear (tPRCReverb* const);
float tPRCReverb_tick (tPRCReverb* const, float input);
-
- // Set reverb time in seconds.
void tPRCReverb_setT60 (tPRCReverb* const, float t60);
-
- // Set mix between dry input and wet output signal.
void tPRCReverb_setMix (tPRCReverb* const, float mix);
//==============================================================================
- /* NReverb: Reverb, reimplemented from STK (Cook and Scavone). */
+ /*!
+ @defgroup tnreverb tNReverb
+ @ingroup reverb
+ @brief Reverb, reimplemented from STK (Cook and Scavone).
+ @{
+
+ @fn void tNReverb_init (tNReverb* const, float t60)
+ @brief
+ @param
+
+ @fn void tNReverb_initToPool (tNReverb* const, float t60, tMempool* const)
+ @brief
+ @param
+
+ @fn void tNReverb_free (tNReverb* const)
+ @brief
+ @param
+
+ @fn void tNReverb_clear (tNReverb* const)
+ @brief
+ @param
+
+ @fn float tNReverb_tick (tNReverb* const, float input)
+ @brief
+ @param
+
+ @fn void tNReverb_tickStereo (tNReverb* const rev, float input, float* output)
+ @brief
+ @param
+
+ @fn void tNReverb_setT60 (tNReverb* const, float t60)
+ @brief Set reverb time in seconds.
+ @param
+
+ @fn void tNReverb_setMix (tNReverb* const, float mix)
+ @brief Set mix between dry input and wet output signal.
+ @param
+
+ @} */
+
typedef struct _tNReverb
{
tMempool mempool;
@@ -93,14 +163,74 @@
void tNReverb_clear (tNReverb* const);
float tNReverb_tick (tNReverb* const, float input);
void tNReverb_tickStereo (tNReverb* const rev, float input, float* output);
-
- // Set reverb time in seconds.
void tNReverb_setT60 (tNReverb* const, float t60);
-
- // Set mix between dry input and wet output signal.
void tNReverb_setMix (tNReverb* const, float mix);
//==============================================================================
+
+ /*!
+ @defgroup tdattorroreverb tDattorroReverb
+ @ingroup reverb
+ @brief
+ @{
+
+ @fn void tDattorroReverb_init (tDattorroReverb* const)
+ @brief
+ @param
+
+ @fn void tDattorroReverb_initToPool (tDattorroReverb* const, tMempool* const)
+ @brief
+ @param
+
+ @fn void tDattorroReverb_free (tDattorroReverb* const)
+ @brief
+ @param
+
+ @fn void tDattorroReverb_clear (tDattorroReverb* const)
+ @brief
+ @param
+
+ @fn float tDattorroReverb_tick (tDattorroReverb* const, float input)
+ @brief
+ @param
+
+ @fn void tDattorroReverb_tickStereo (tDattorroReverb* const rev, float input, float* output)
+ @brief
+ @param
+
+ @fn void tDattorroReverb_setMix (tDattorroReverb* const, float mix)
+ @brief
+ @param
+
+ @fn void tDattorroReverb_setFreeze (tDattorroReverb* const rev, uint32_t freeze)
+ @brief
+ @param
+
+ @fn void tDattorroReverb_setHP (tDattorroReverb* const, float freq)
+ @brief
+ @param
+
+ @fn void tDattorroReverb_setSize (tDattorroReverb* const, float size)
+ @brief
+ @param
+
+ @fn void tDattorroReverb_setInputDelay (tDattorroReverb* const, float preDelay)
+ @brief
+ @param
+
+ @fn void tDattorroReverb_setInputFilter (tDattorroReverb* const, float freq)
+ @brief
+ @param
+
+ @fn void tDattorroReverb_setFeedbackFilter (tDattorroReverb* const, float freq)
+ @brief
+ @param
+
+ @fn void tDattorroReverb_setFeedbackGain (tDattorroReverb* const, float gain)
+ @brief
+ @param
+
+ @} */
typedef struct _tDattorroReverb
{
--- a/leaf/Inc/leaf-sampling.h
+++ b/leaf/Inc/leaf-sampling.h
@@ -33,6 +33,78 @@
//==============================================================================
+ /*!
+ @defgroup tbuffer tBuffer
+ @ingroup sampling
+ @brief
+ @{
+
+ @fn void tBuffer_init (tBuffer* const, uint32_t length)
+ @brief
+ @param
+
+ @fn void tBuffer_initToPool (tBuffer* const, uint32_t length, tMempool* const)
+ @brief
+ @param
+
+ @fn void tBuffer_free (tBuffer* const)
+ @brief
+ @param
+
+ @fn void tBuffer_tick (tBuffer* const, float sample)
+ @brief
+ @param
+
+ @fn void tBuffer_read (tBuffer* const, float* buff, uint32_t len)
+ @brief
+ @param
+
+ @fn float tBuffer_get (tBuffer* const, int idx)
+ @brief
+ @param
+
+ @fn void tBuffer_record (tBuffer* const)
+ @brief
+ @param
+
+ @fn void tBuffer_stop (tBuffer* const)
+ @brief
+ @param
+
+ @fn int tBuffer_getRecordPosition (tBuffer* const)
+ @brief
+ @param
+
+ @fn void tBuffer_setRecordPosition (tBuffer* const, int pos)
+ @brief
+ @param
+
+ @fn void tBuffer_setRecordMode (tBuffer* const, RecordMode mode)
+ @brief
+ @param
+
+ @fn void tBuffer_clear (tBuffer* const)
+ @brief
+ @param
+
+ @fn uint32_t tBuffer_getBufferLength (tBuffer* const)
+ @brief
+ @param
+
+ @fn uint32_t tBuffer_getRecordedLength (tBuffer* const sb)
+ @brief
+ @param
+
+ @fn void tBuffer_setRecordedLength (tBuffer* const sb, int length)
+ @brief
+ @param
+
+ @fn int tBuffer_isActive (tBuffer* const sb)
+ @brief
+ @param
+
+ @} */
+
typedef enum RecordMode
{
RecordOneShot = 0,
@@ -61,20 +133,14 @@
void tBuffer_free (tBuffer* const);
void tBuffer_tick (tBuffer* const, float sample);
-
void tBuffer_read (tBuffer* const, float* buff, uint32_t len);
-
float tBuffer_get (tBuffer* const, int idx);
-
void tBuffer_record (tBuffer* const);
void tBuffer_stop (tBuffer* const);
int tBuffer_getRecordPosition (tBuffer* const);
- void tBuffer_setRecordPosition (tBuffer* const, int pos);
-
+ void tBuffer_setRecordPosition (tBuffer* const, int pos);
void tBuffer_setRecordMode (tBuffer* const, RecordMode mode);
-
void tBuffer_clear (tBuffer* const);
-
uint32_t tBuffer_getBufferLength (tBuffer* const);
uint32_t tBuffer_getRecordedLength (tBuffer* const sb);
void tBuffer_setRecordedLength (tBuffer* const sb, int length);
@@ -82,6 +148,66 @@
//==============================================================================
+ /*!
+ @defgroup tsampler tSampler
+ @ingroup sampling
+ @brief
+ @{
+
+ @fn void tSampler_init (tSampler* const, tBuffer* const)
+ @brief
+ @param
+
+ @fn void tSampler_initToPool (tSampler* const, tBuffer* const, tMempool* const)
+ @brief
+ @param
+
+ @fn void tSampler_free (tSampler* const)
+ @brief
+ @param
+
+ @fn float tSampler_tick (tSampler* const)
+ @brief
+ @param
+
+ @fn void tSampler_setSample (tSampler* const, tBuffer* const)
+ @brief
+ @param
+
+ @fn void tSampler_setMode (tSampler* const, PlayMode mode)
+ @brief
+ @param
+
+ @fn void tSampler_play (tSampler* const)
+ @brief
+ @param
+
+ @fn void tSampler_stop (tSampler* const)
+ @brief
+ @param
+
+ @fn void tSampler_setStart (tSampler* const, int32_t start)
+ @brief
+ @param
+
+ @fn void tSampler_setEnd (tSampler* const, int32_t end)
+ @brief
+ @param
+
+ @fn void tSampler_setLength (tSampler* const, int32_t length)
+ @brief
+ @param
+
+ @fn void tSampler_setCrossfadeLength (tSampler* const sp, uint32_t length)
+ @brief
+ @param
+
+ @fn void tSampler_setRate (tSampler* const, float rate)
+ @brief
+ @param
+
+ @} */
+
typedef enum PlayMode
{
PlayNormal,
@@ -130,24 +256,74 @@
void tSampler_free (tSampler* const);
float tSampler_tick (tSampler* const);
-
void tSampler_setSample (tSampler* const, tBuffer* const);
-
void tSampler_setMode (tSampler* const, PlayMode mode);
-
void tSampler_play (tSampler* const);
void tSampler_stop (tSampler* const);
-
void tSampler_setStart (tSampler* const, int32_t start);
void tSampler_setEnd (tSampler* const, int32_t end);
void tSampler_setLength (tSampler* const, int32_t length);
-
void tSampler_setCrossfadeLength (tSampler* const sp, uint32_t length);
-
void tSampler_setRate (tSampler* const, float rate);
//==============================================================================
+ /*!
+ @defgroup tautosampler tAutoSampler
+ @ingroup sampling
+ @brief
+ @{
+
+ @fn void tAutoSampler_init (tAutoSampler* const, tBuffer* const)
+ @brief
+ @param
+
+ @fn void tAutoSampler_initToPool (tAutoSampler* const, tBuffer* const, tMempool* const)
+ @brief
+ @param
+
+ @fn void tAutoSampler_free (tAutoSampler* const)
+ @brief
+ @param
+
+ @fn float tAutoSampler_tick (tAutoSampler* const, float input)
+ @brief
+ @param
+
+ @fn void tAutoSampler_setBuffer (tAutoSampler* const, tBuffer* const)
+ @brief
+ @param
+
+ @fn void tAutoSampler_setMode (tAutoSampler* const, PlayMode mode)
+ @brief
+ @param
+
+ @fn void tAutoSampler_play (tAutoSampler* const)
+ @brief
+ @param
+
+ @fn void tAutoSampler_stop (tAutoSampler* const)
+ @brief
+ @param
+
+ @fn void tAutoSampler_setThreshold (tAutoSampler* const, float thresh)
+ @brief
+ @param
+
+ @fn void tAutoSampler_setWindowSize (tAutoSampler* const, uint32_t size)
+ @brief
+ @param
+
+ @fn void tAutoSampler_setCrossfadeLength (tAutoSampler* const, uint32_t length)
+ @brief
+ @param
+
+ @fn void tAutoSampler_setRate (tAutoSampler* const, float rate)
+ @brief
+ @param
+
+ @} */
+
typedef struct _tAutoSampler
{
tMempool mempool;
@@ -168,18 +344,13 @@
void tAutoSampler_free (tAutoSampler* const);
float tAutoSampler_tick (tAutoSampler* const, float input);
-
void tAutoSampler_setBuffer (tAutoSampler* const, tBuffer* const);
-
void tAutoSampler_setMode (tAutoSampler* const, PlayMode mode);
-
void tAutoSampler_play (tAutoSampler* const);
void tAutoSampler_stop (tAutoSampler* const);
-
void tAutoSampler_setThreshold (tAutoSampler* const, float thresh);
void tAutoSampler_setWindowSize (tAutoSampler* const, uint32_t size);
void tAutoSampler_setCrossfadeLength (tAutoSampler* const, uint32_t length);
-
void tAutoSampler_setRate (tAutoSampler* const, float rate);
#ifdef __cplusplus
--- a/leaf/Inc/leaf-tables.h
+++ b/leaf/Inc/leaf-tables.h
@@ -25,6 +25,11 @@
#define USE_SHAPER_TABLE 1
#define DECAY_TABLES_USED 1
+ /*!
+ @ingroup tables
+ @{
+ */
+
#define SINE_TABLE_SIZE 2048
#define SAW_TABLE_SIZE 2048
#define SQR_TABLE_SIZE 2048
@@ -118,6 +123,8 @@
/* in minblep_tables.c: */
extern const float_value_delta step_dd_table[];
extern const float slope_dd_table[];
+
+ /*! @} */
//==============================================================================
--- a/leaf/Src/leaf-distortion.c
+++ b/leaf/Src/leaf-distortion.c
@@ -72,12 +72,12 @@
// Oversampler
//============================================================================================================
// Latency is equal to the phase length (numTaps / ratio)
-void tOversampler_init (tOversampler* const osr, int ratio, oBool extraQuality)
+void tOversampler_init (tOversampler* const osr, int ratio, int extraQuality)
{
tOversampler_initToPool(osr, ratio, extraQuality, &leaf.mempool);
}
-void tOversampler_initToPool (tOversampler* const osr, int ratio, oBool extraQuality, tMempool* const mp)
+void tOversampler_initToPool (tOversampler* const osr, int ratio, int extraQuality, tMempool* const mp)
{
_tMempool* m = *mp;
_tOversampler* os = *osr = (_tOversampler*) mpool_alloc(sizeof(_tOversampler), m);
--- a/leaf/Src/leaf-dynamics.c
+++ b/leaf/Src/leaf-dynamics.c
@@ -55,7 +55,7 @@
c->tauAttack = 100;
c->tauRelease = 100;
- c->isActive = OFALSE;
+ c->isActive = 0;
c->T = 0.0f; // Threshold
c->R = 0.5f; // compression Ratio
@@ -89,17 +89,17 @@
if (overshoot <= -(c->W * 0.5f))
{
out_db = in_db;
- c->isActive = OFALSE;
+ c->isActive = 0;
}
else if ((overshoot > -(c->W * 0.5f)) && (overshoot < (c->W * 0.5f)))
{
out_db = in_db + slope * (powf((overshoot + c->W*0.5f),2) / (2.0f * c->W)); // .^ 2 ???
- c->isActive = OTRUE;
+ c->isActive = 1;
}
else if (overshoot >= (c->W * 0.5f))
{
out_db = in_db + slope * overshoot;
- c->isActive = OTRUE;
+ c->isActive = 1;
}
--- a/leaf/Src/leaf-envelopes.c
+++ b/leaf/Src/leaf-envelopes.c
@@ -62,9 +62,9 @@
if (rampIndex < 0)
rampIndex = 0;
- env->inRamp = OFALSE;
- env->inAttack = OFALSE;
- env->inDecay = OFALSE;
+ env->inRamp = 0;
+ env->inAttack = 0;
+ env->inDecay = 0;
env->attackInc = env->inc_buff[attackIndex];
env->decayInc = env->inc_buff[decayIndex];
@@ -125,18 +125,18 @@
if (env->inAttack || env->inDecay) // In case envelope retriggered while it is still happening.
{
env->rampPhase = 0;
- env->inRamp = OTRUE;
+ env->inRamp = 1;
env->rampPeak = env->next;
}
else // Normal start.
{
- env->inAttack = OTRUE;
+ env->inAttack = 1;
}
env->attackPhase = 0;
env->decayPhase = 0;
- env->inDecay = OFALSE;
+ env->inDecay = 0;
env->gain = velocity;
}
@@ -148,8 +148,8 @@
{
if (env->rampPhase > UINT16_MAX)
{
- env->inRamp = OFALSE;
- env->inAttack = OTRUE;
+ env->inRamp = 0;
+ env->inAttack = 1;
env->next = 0.0f;
}
else
@@ -166,8 +166,8 @@
// If attack done, time to turn around.
if (env->attackPhase > UINT16_MAX)
{
- env->inDecay = OTRUE;
- env->inAttack = OFALSE;
+ env->inDecay = 1;
+ env->inAttack = 0;
env->next = env->gain * 1.0f;
}
else
@@ -187,13 +187,13 @@
// If decay done, finish.
if (env->decayPhase >= UINT16_MAX)
{
- env->inDecay = OFALSE;
+ env->inDecay = 0;
if (env->loop)
{
env->attackPhase = 0;
env->decayPhase = 0;
- env->inAttack = OTRUE;
+ env->inAttack = 1;
}
else
{
@@ -266,11 +266,11 @@
adsr->next = 0.0f;
- adsr->inRamp = OFALSE;
- adsr->inAttack = OFALSE;
- adsr->inDecay = OFALSE;
- adsr->inSustain = OFALSE;
- adsr->inRelease = OFALSE;
+ adsr->inRamp = 0;
+ adsr->inAttack = 0;
+ adsr->inDecay = 0;
+ adsr->inSustain = 0;
+ adsr->inRelease = 0;
adsr->sustain = sustain;
@@ -364,20 +364,20 @@
if ((adsr->inAttack || adsr->inDecay) || (adsr->inSustain || adsr->inRelease)) // In case ADSR retriggered while it is still happening.
{
adsr->rampPhase = 0;
- adsr->inRamp = OTRUE;
+ adsr->inRamp = 1;
adsr->rampPeak = adsr->next;
}
else // Normal start.
{
- adsr->inAttack = OTRUE;
+ adsr->inAttack = 1;
}
adsr->attackPhase = 0;
adsr->decayPhase = 0;
adsr->releasePhase = 0;
- adsr->inDecay = OFALSE;
- adsr->inSustain = OFALSE;
- adsr->inRelease = OFALSE;
+ adsr->inDecay = 0;
+ adsr->inSustain = 0;
+ adsr->inRelease = 0;
adsr->gain = velocity;
}
@@ -387,10 +387,10 @@
if (adsr->inRelease) return;
- adsr->inAttack = OFALSE;
- adsr->inDecay = OFALSE;
- adsr->inSustain = OFALSE;
- adsr->inRelease = OTRUE;
+ adsr->inAttack = 0;
+ adsr->inDecay = 0;
+ adsr->inSustain = 0;
+ adsr->inRelease = 1;
adsr->releasePeak = adsr->next;
}
@@ -404,8 +404,8 @@
{
if (adsr->rampPhase > UINT16_MAX)
{
- adsr->inRamp = OFALSE;
- adsr->inAttack = OTRUE;
+ adsr->inRamp = 0;
+ adsr->inAttack = 1;
adsr->next = 0.0f;
}
else
@@ -422,8 +422,8 @@
// If attack done, time to turn around.
if (adsr->attackPhase > UINT16_MAX)
{
- adsr->inDecay = OTRUE;
- adsr->inAttack = OFALSE;
+ adsr->inDecay = 1;
+ adsr->inAttack = 0;
adsr->next = adsr->gain * 1.0f;
}
else
@@ -443,8 +443,8 @@
// If decay done, sustain.
if (adsr->decayPhase >= UINT16_MAX)
{
- adsr->inDecay = OFALSE;
- adsr->inSustain = OTRUE;
+ adsr->inDecay = 0;
+ adsr->inSustain = 1;
adsr->next = adsr->gain * adsr->sustain;
}
@@ -467,7 +467,7 @@
// If release done, finish.
if (adsr->releasePhase >= UINT16_MAX)
{
- adsr->inRelease = OFALSE;
+ adsr->inRelease = 0;
adsr->next = 0.0f;
}
else {
--- a/leaf/Src/leaf-filters.c
+++ b/leaf/Src/leaf-filters.c
@@ -222,7 +222,7 @@
}
-void tTwoPole_setResonance(tTwoPole* const ft, float frequency, float radius, oBool normalize)
+void tTwoPole_setResonance(tTwoPole* const ft, float frequency, float radius, int normalize)
{
_tTwoPole* f = *ft;
@@ -636,7 +636,7 @@
return out;
}
-void tBiQuad_setResonance(tBiQuad* const ft, float freq, float radius, oBool normalize)
+void tBiQuad_setResonance(tBiQuad* const ft, float freq, float radius, int normalize)
{
_tBiQuad* f = *ft;
--- a/leaf/Src/leaf-instruments.c
+++ b/leaf/Src/leaf-instruments.c
@@ -41,9 +41,9 @@
tSVF_initToPool(&cowbell->bandpassStick, SVFTypeBandpass, 1800, 1.0f, mp);
- tEnvelope_initToPool(&cowbell->envGain, 5.0f, 100.0f, OFALSE, mp);
+ tEnvelope_initToPool(&cowbell->envGain, 5.0f, 100.0f, 0, mp);
- tEnvelope_initToPool(&cowbell->envFilter, 5.0, 100.0f, OFALSE, mp);
+ tEnvelope_initToPool(&cowbell->envFilter, 5.0, 100.0f, 0, mp);
tHighpass_initToPool(&cowbell->highpass, 1000.0f, mp);
@@ -166,8 +166,8 @@
tSVF_initToPool(&hihat->bandpassStick, SVFTypeBandpass,2500.0f,1.2f, mp);
tSVF_initToPool(&hihat->bandpassOsc, SVFTypeBandpass,3500.0f,0.3f, mp);
- tEnvelope_initToPool(&hihat->envGain, 0.0f, 50.0f, OFALSE, mp);
- tEnvelope_initToPool(&hihat->envStick, 0.0f, 7.0f, OFALSE, mp);
+ tEnvelope_initToPool(&hihat->envGain, 0.0f, 50.0f, 0, mp);
+ tEnvelope_initToPool(&hihat->envStick, 0.0f, 7.0f, 0, mp);
tHighpass_initToPool(&hihat->highpass, 7000.0f, mp);
@@ -329,9 +329,9 @@
tTriangle_setFreq(&snare->tone[i], ratio[i] * 400.0f);
tSVF_initToPool(&snare->toneLowpass[i], SVFTypeLowpass, 4000, 1.0f, mp);
- tEnvelope_initToPool(&snare->toneEnvOsc[i], 0.0f, 50.0f, OFALSE, mp);
- tEnvelope_initToPool(&snare->toneEnvGain[i], 1.0f, 150.0f, OFALSE, mp);
- tEnvelope_initToPool(&snare->toneEnvFilter[i], 1.0f, 2000.0f, OFALSE, mp);
+ tEnvelope_initToPool(&snare->toneEnvOsc[i], 0.0f, 50.0f, 0, mp);
+ tEnvelope_initToPool(&snare->toneEnvGain[i], 1.0f, 150.0f, 0, mp);
+ tEnvelope_initToPool(&snare->toneEnvFilter[i], 1.0f, 2000.0f, 0, mp);
snare->toneGain[i] = 0.5f;
}
@@ -341,8 +341,8 @@
snare->noiseFilterFreq = 3000.0f;
tNoise_initToPool(&snare->noiseOsc, WhiteNoise, mp);
tSVF_initToPool(&snare->noiseLowpass, SVFTypeLowpass, 12000.0f, 0.8f, mp);
- tEnvelope_initToPool(&snare->noiseEnvGain, 0.0f, 100.0f, OFALSE, mp);
- tEnvelope_initToPool(&snare->noiseEnvFilter, 0.0f, 1000.0f, OFALSE, mp);
+ tEnvelope_initToPool(&snare->noiseEnvGain, 0.0f, 100.0f, 0, mp);
+ tEnvelope_initToPool(&snare->noiseEnvFilter, 0.0f, 1000.0f, 0, mp);
snare->noiseGain = 1.0f;
}
@@ -475,11 +475,11 @@
kick->chirpRatioMinusOne = 3.3f;
tCycle_setFreq(&kick->tone, 50.0f);
tSVF_initToPool(&kick->toneLowpass, SVFTypeLowpass, 2000.0f, 0.5f, mp);
- tEnvelope_initToPool(&kick->toneEnvOscChirp, 0.0f, 20.0f, OFALSE, mp);
- tEnvelope_initToPool(&kick->toneEnvOscSigh, 0.0f, 2500.0f, OFALSE, mp);
- tEnvelope_initToPool(&kick->toneEnvGain, 0.0f, 800.0f, OFALSE, mp);
+ tEnvelope_initToPool(&kick->toneEnvOscChirp, 0.0f, 20.0f, 0, mp);
+ tEnvelope_initToPool(&kick->toneEnvOscSigh, 0.0f, 2500.0f, 0, mp);
+ tEnvelope_initToPool(&kick->toneEnvGain, 0.0f, 800.0f, 0, mp);
tNoise_initToPool(&kick->noiseOsc, PinkNoise, mp);
- tEnvelope_initToPool(&kick->noiseEnvGain, 0.0f, 1.0f, OFALSE, mp);
+ tEnvelope_initToPool(&kick->noiseEnvGain, 0.0f, 1.0f, 0, mp);
kick->noiseGain = 0.3f;
}
--- a/leaf/Src/leaf-math.c
+++ b/leaf/Src/leaf-math.c
@@ -361,15 +361,15 @@
}
}
-oBool LEAF_isPrime(uint64_t number )
+int LEAF_isPrime(uint64_t number )
{
- if ( number == 2 ) return OTRUE;
+ if ( number == 2 ) return 1;
if ( number & 1 ) {
for ( int i=3; i<(int)sqrt((double)number)+1; i+=2 )
- if ( (number % i) == 0 ) return OFALSE;
- return OTRUE; // prime
+ if ( (number % i) == 0 ) return 0;
+ return 1; // prime
}
- else return OFALSE; // even
+ else return 0; // even
}
// Adapted from MusicDSP: http://www.musicdsp.org/showone.php?id=238
--- a/leaf/Src/leaf-midi.c
+++ b/leaf/Src/leaf-midi.c
@@ -31,7 +31,7 @@
_tStack* ns = *stack = (_tStack*) mpool_alloc(sizeof(_tStack), m);
ns->mempool = m;
- ns->ordered = OFALSE;
+ ns->ordered = 0;
ns->size = 0;
ns->pos = 0;
ns->capacity = STACK_SIZE;
@@ -287,7 +287,7 @@
poly->ramps = (tRamp*) mpool_alloc(sizeof(tRamp) * poly->maxNumVoices, m);
poly->rampVals = (float*) mpool_alloc(sizeof(float) * poly->maxNumVoices, m);
- poly->firstReceived = (oBool*) mpool_alloc(sizeof(oBool) * poly->maxNumVoices, m);
+ poly->firstReceived = (int*) mpool_alloc(sizeof(int) * poly->maxNumVoices, m);
poly->voices = (int**) mpool_alloc(sizeof(int*) * poly->maxNumVoices, m);
for (int i = 0; i < poly->maxNumVoices; ++i)
@@ -294,7 +294,7 @@
{
poly->voices[i] = (int*) mpool_alloc(sizeof(int) * 2, m);
poly->voices[i][0] = -1;
- poly->firstReceived[i] = OFALSE;
+ poly->firstReceived[i] = 0;
tRamp_initToPool(&poly->ramps[i], poly->glideTime, 1, mp);
}
@@ -305,7 +305,7 @@
tStack_initToPool(&poly->stack, mp);
tStack_initToPool(&poly->orderStack, mp);
- poly->pitchGlideIsActive = OFALSE;
+ poly->pitchGlideIsActive = 0;
}
void tPoly_free (tPoly* const polyh)
@@ -369,7 +369,7 @@
tStack_add(&poly->stack, note);
int alteredVoice = -1;
- oBool found = OFALSE;
+ int found = 0;
for (int i = 0; i < poly->numVoices; i++)
{
if (poly->voices[i][0] < 0) // if inactive voice, give this note to voice
@@ -377,10 +377,10 @@
if (!poly->firstReceived[i] || !poly->pitchGlideIsActive)
{
tRamp_setVal(&poly->ramps[i], note);
- poly->firstReceived[i] = OTRUE;
+ poly->firstReceived[i] = 1;
}
- found = OTRUE;
+ found = 1;
poly->voices[i][0] = note;
poly->voices[i][1] = vel;
@@ -541,7 +541,7 @@
poly->numVoices = (numVoices > poly->maxNumVoices) ? poly->maxNumVoices : numVoices;
}
-void tPoly_setPitchGlideActive(tPoly* const polyh, oBool isActive)
+void tPoly_setPitchGlideActive(tPoly* const polyh, int isActive)
{
_tPoly* poly = *polyh;
poly->pitchGlideIsActive = isActive;
@@ -666,13 +666,13 @@
else
{
alteredVoice = -1;
- oBool found = OFALSE;
+ int found = 0;
for (int i = 0; i < poly->numVoices; i++)
{
if (poly->voices[i][0] == -1) // if inactive voice, give this note to voice
{
- found = OTRUE;
+ found = 1;
poly->voices[i][0] = note;
poly->voices[i][1] = vel;
@@ -693,7 +693,7 @@
if (poly->voices[i][0] == -2) // if voice is released but still sounding, take over this voice
{
- found = OTRUE;
+ found = 1;
poly->voices[i][0] = note;
poly->voices[i][1] = vel;
--- a/leaf/Src/leaf-oscillators.c
+++ b/leaf/Src/leaf-oscillators.c
@@ -354,76 +354,6 @@
c->inc = c->freq * leaf.invSampleRate;
}
-//========================================================================
-// Sine
-void tSine_init(tSine* const cy, int size)
-{
- tSine_initToPool(cy, size, &leaf.mempool);
-}
-
-void tSine_initToPool (tSine* const cy, int size, tMempool* const mp)
-{
- _tMempool* m = *mp;
- _tSine* c = *cy = (_tSine*) mpool_alloc(sizeof(_tSine), m);
- c->mempool = m;
-
- c->size = size;
- c->sine = (float*) mpool_alloc(sizeof(float) * c->size, m);
- LEAF_generate_sine(c->sine, size);
- c->inc = 0.0f;
- c->phase = 0.0f;
-}
-
-void tSine_free (tSine* const cy)
-{
- _tSine* c = *cy;
-
- mpool_free((char*)c->sine, c->mempool);
- mpool_free((char*)c, c->mempool);
-}
-
-void tSine_setFreq(tSine* const cy, float freq)
-{
- _tSine* c = *cy;
-
- c->freq = freq;
- c->inc = freq * leaf.invSampleRate;
-}
-
-float tSine_tick(tSine* const cy)
-{
- _tSine* c = *cy;
- float temp;
- int intPart;
- float fracPart;
- float samp0;
- float samp1;
-
- // Phasor increment
- c->phase += c->inc;
- while (c->phase >= 1.0f) c->phase -= 1.0f;
- while (c->phase < 0.0f) c->phase += 1.0f;
-
- // Wavetable synthesis
-
- temp = c->size * c->phase;
- intPart = (int)temp;
- fracPart = temp - (float)intPart;
- samp0 = c->sine[intPart];
- if (++intPart >= c->size) intPart = 0;
- samp1 = c->sine[intPart];
-
- return (samp0 + (samp1 - samp0) * fracPart);
-
-}
-
-void tSineSampleRateChanged (tSine* const cy)
-{
- _tSine* c = *cy;
-
- c->inc = c->freq * leaf.invSampleRate;
-}
-
//==============================================================================
/* tTri: Anti-aliased Triangle waveform. */
--- a/leaf/leaf.h
+++ b/leaf/leaf.h
@@ -75,15 +75,15 @@
#endif
-/*! \mainpage LEAF
+/*! @mainpage LEAF
*
- * \section intro_sec Introduction
+ * @section intro_sec Introduction
*
* This is the work in progress documentation of LEAF.
*
- * \section install_sec Installation
+ * @section install_sec Installation
*
- * \subsection step1 Step 1: Opening the box
+ * @subsection step1 Step 1: Opening the box
*
* etc...
*/
@@ -106,6 +106,7 @@
* @defgroup electrical Electrical Models
* @defgroup mempool Mempool
* @defgroup math Math
+ * @defgroup tables Tables
*/
#ifdef __cplusplus
@@ -113,8 +114,8 @@
#endif
/*!
- * @ingroup leaf
- * @{
+ @ingroup leaf
+ @{
*/
//! Initialize the LEAF instance.
@@ -143,9 +144,7 @@
// __attribute__((weak))
uint8_t LEAF_error(uint8_t whichone);
- /*!
- * @}
- */
+ /*! @} */
#ifdef __cplusplus
}