shithub: leaf

Download patch

ref: e3e22cb2750b7f17d360eba55c4a5ec6d16f2d6c
parent: 68a766939482cdcb4f3c3265b9eafd597c00f151
author: Matthew Wang <mjw7@princeton.edu>
date: Wed Jul 1 12:53:02 EDT 2020

starting to add skeleton for documentation comments

--- a/TestPlugin/LEAF.jucer
+++ b/TestPlugin/LEAF.jucer
@@ -129,9 +129,9 @@
         <MODULEPATH id="juce_audio_utils" path="../../../../JUCE/modules"/>
       </MODULEPATHS>
     </XCODE_MAC>
-    <XCODE_IPHONE targetFolder="Builds/iOS" iosScreenOrientation="portraitlandscape"
+    <XCODE_IPHONE targetFolder="Builds/iOS" iosScreenOrientation="UIInterfaceOrientationPortrait,UIInterfaceOrientationLandscapeLeft,UIInterfaceOrientationLandscapeRight"
                   iosDevelopmentTeamID="QY96HSP2FJ" microphonePermissionNeeded="1"
-                  iosBackgroundAudio="1" iPadScreenOrientation="portraitlandscape"
+                  iosBackgroundAudio="1" iPadScreenOrientation="UIInterfaceOrientationPortrait,UIInterfaceOrientationLandscapeLeft,UIInterfaceOrientationLandscapeRight"
                   iosDeviceFamily="1,2">
       <CONFIGURATIONS>
         <CONFIGURATION name="Debug" isDebug="1" optimisation="1" targetName="OOPS" enablePluginBinaryCopyStep="1"/>
--- a/leaf/Inc/leaf-filters.h
+++ b/leaf/Inc/leaf-filters.h
@@ -30,7 +30,15 @@
     
     //==============================================================================
     
-    /* tAllpass: Schroeder allpass. Comb-filter with feedforward and feedback. */
+    /*!
+     @defgroup tallpass tAllpass
+     @ingroup filters
+     @brief Schroeder allpass. Comb-filter with feedforward and feedback.
+     @{
+     */
+    
+    /*! @} */
+    
     typedef struct _tAllpass
     {
         tMempool mempool;
@@ -55,7 +63,15 @@
     
     //==============================================================================
     
-    /* tOnePole: OnePole filter, reimplemented from STK (Cook and Scavone). */
+    /*!
+     @defgroup tonepole tOnePole
+     @ingroup filters
+     @brief OnePole filter, reimplemented from STK (Cook and Scavone).
+     @{
+     */
+    
+    /*! @} */
+    
     typedef struct _tOnePole
     {
         tMempool mempool;
@@ -81,7 +97,15 @@
     
     //==============================================================================
     
-    /* TwoPole filter, reimplemented from STK (Cook and Scavone). */
+    /*!
+     @defgroup ttwopole tTwoPole
+     @ingroup filters
+     @brief TwoPole filter, reimplemented from STK (Cook and Scavone).
+     @{
+     */
+    
+    /*! @} */
+
     typedef struct _tTwoPole
     {
         tMempool mempool;
@@ -92,7 +116,7 @@
         
         float radius, frequency;
         oBool normalize;
-
+        
         float lastOut[2];
     } _tTwoPole;
     
@@ -112,7 +136,15 @@
     
     //==============================================================================
     
-    /* OneZero filter, reimplemented from STK (Cook and Scavone). */
+    /*!
+     @defgroup tonezero tOneZero
+     @ingroup filters
+     @brief OneZero filter, reimplemented from STK (Cook and Scavone).
+     @{
+     */
+    
+    /*! @} */
+    
     typedef struct _tOneZero
     {
         tMempool mempool;
@@ -137,7 +169,15 @@
     
     //==============================================================================
     
-    /* TwoZero filter, reimplemented from STK (Cook and Scavone). */
+    /*!
+     @defgroup ttwozero tTwoZero
+     @ingroup filters
+     @brief TwoZero filter, reimplemented from STK (Cook and Scavone).
+     @{
+     */
+    
+    /*! @} */
+
     typedef struct _tTwoZero
     {
         tMempool mempool;
@@ -166,7 +206,15 @@
     
     //==============================================================================
     
-    /* PoleZero filter, reimplemented from STK (Cook and Scavone). */
+    /*!
+     @defgroup tpolezero tPoleZero
+     @ingroup filters
+     @brief PoleZero filter, reimplemented from STK (Cook and Scavone).
+     @{
+     */
+    
+    /*! @} */
+    
     typedef struct _tPoleZero
     {
         tMempool mempool;
@@ -195,7 +243,15 @@
     
     //==============================================================================
     
-    /* BiQuad filter, reimplemented from STK (Cook and Scavone). */
+    /*!
+     @defgroup tbiquad tBiQuad
+     @ingroup filters
+     @brief BiQuad filter, reimplemented from STK (Cook and Scavone).
+     @{
+     */
+    
+    /*! @} */
+    
     typedef struct _tBiQuad
     {
         tMempool mempool;
@@ -230,7 +286,15 @@
     
     //==============================================================================
     
-/* State Variable Filter, algorithm from Andy Simper. */
+    /*!
+     @defgroup tsvf tSVF
+     @ingroup filters
+     @brief State Variable Filter, algorithm from Andy Simper.
+     @{
+     */
+    
+    /*! @} */
+    
     typedef enum SVFType
     {
         SVFTypeHighpass = 0,
@@ -263,7 +327,15 @@
     void    tSVF_setFreqAndQ    (tSVF* const svff, float freq, float Q);
     //==============================================================================
     
-    /* Efficient State Variable Filter for 14-bit control input, [0, 4096). */
+    /*!
+     @defgroup tefficientsvf tEfficientSVF
+     @ingroup filters
+     @brief Efficient State Variable Filter for 14-bit control input, [0, 4096).
+     @{
+     */
+    
+    /*! @} */
+    
     typedef struct _tEfficientSVF
     {
         tMempool mempool;
@@ -285,7 +357,15 @@
     
     //==============================================================================
     
-    /* Simple Highpass filter. */
+    /*!
+     @defgroup thighpass tHighpass
+     @ingroup filters
+     @brief Simple Highpass filter.
+     @{
+     */
+    
+    /*! @} */
+    
     typedef struct _tHighpass
     {
         tMempool mempool;
@@ -305,7 +385,15 @@
     
     //==============================================================================
     
-    // Butterworth Filter
+    /*!
+     @defgroup tbutterworth tButterworth
+     @ingroup filters
+     @brief
+     @{
+     */
+    
+    /*! @} */
+    
 #define NUM_SVF_BW 16
     typedef struct _tButterworth
     {
@@ -334,6 +422,15 @@
     
     //==============================================================================
     
+    /*!
+     @defgroup tfir tFIR
+     @ingroup filters
+     @brief
+     @{
+     */
+    
+    /*! @} */
+    
     typedef struct _tFIR
     {
         tMempool mempool;
@@ -349,125 +446,146 @@
     void    tFIR_free           (tFIR* const);
     
     float   tFIR_tick           (tFIR* const, float input);
-
     
+    
     //==============================================================================
     
-
+    /*!
+     @defgroup tmedianfilter tMedianFilter
+     @ingroup filters
+     @brief
+     @{
+     */
+    
+    /*! @} */
+    
     typedef struct _tMedianFilter
     {
         tMempool mempool;
-    	float* val;
-    	int* age;
-    	int m;
-    	int size;
-    	int middlePosition;
-    	int last;
-    	int pos;
+        float* val;
+        int* age;
+        int m;
+        int size;
+        int middlePosition;
+        int last;
+        int pos;
     } _tMedianFilter;
-
+    
     typedef _tMedianFilter* tMedianFilter;
-
+    
     void    tMedianFilter_init           (tMedianFilter* const, int size);
-	void    tMedianFilter_initToPool     (tMedianFilter* const, int size, tMempool* const);
-	void    tMedianFilter_free           (tMedianFilter* const);
-
-	float   tMedianFilter_tick           (tMedianFilter* const, float input);
-
-
-
-
-
-	//Vadim Zavalishin style from VA book (from implementation in RSlib posted to kvr forum)
-
+    void    tMedianFilter_initToPool     (tMedianFilter* const, int size, tMempool* const);
+    void    tMedianFilter_free           (tMedianFilter* const);
+    
+    float   tMedianFilter_tick           (tMedianFilter* const, float input);
+    
+    
+    /*!
+     @defgroup tvzfilter tVZFilter
+     @ingroup filters
+     @brief
+     @{
+     */
+    
+    /*! @} */
+    
+    //Vadim Zavalishin style from VA book (from implementation in RSlib posted to kvr forum)
+    
     typedef enum VZFilterType
     {
-    	Highpass = 0,
+        Highpass = 0,
         Lowpass,
         BandpassSkirt,
-		BandpassPeak,
-		BandReject,
+        BandpassPeak,
+        BandReject,
         Bell,
-		Lowshelf,
-		Highshelf,
-		Morph,
-		Bypass,
-		Allpass
+        Lowshelf,
+        Highshelf,
+        Morph,
+        Bypass,
+        Allpass
     } VZFilterType;
-
-
-	typedef struct _tVZFilter
-	    {
-            tMempool mempool;
-            
-			VZFilterType type;
-			// state:
-			float s1, s2;
-
-			// filter coefficients:
-			float g;          // embedded integrator gain
-			float R2;         // twice the damping coefficient (R2 == 2*R == 1/Q)
-			float h;          // factor for feedback (== 1/(1+2*R*g+g*g))
-			float cL, cB, cH; // coefficients for low-, band-, and highpass signals
-
-			// parameters:
-			float fc;    // characteristic frequency
-			float G;     // gain
-			float invG;		//1/gain
-			float B;     // bandwidth (in octaves)
-			float m;     // morph parameter (0...1)
-
-			float sr;    //local sampling rate of filter (may be different from leaf sr if oversampled)
-			float inv_sr;
-	    } _tVZFilter;
-
-	    typedef _tVZFilter* tVZFilter;
-
-	    void    tVZFilter_init           (tVZFilter* const, VZFilterType type, float freq, float Q);
-		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);
-		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);
-
-
-
-
-		//diode ladder filter
-		typedef struct _tDiodeFilter
-		    {
-                tMempool mempool;
-                float f;
-                float r;
-                float Vt;
-                float n;
-                float gamma;
-                float zi;
-                float g0inv;
-                float g1inv;
-                float g2inv;
-                float s0, s1, s2, s3;
-		    } _tDiodeFilter;
-
-		    typedef _tDiodeFilter* tDiodeFilter;
-
-		    void    tDiodeFilter_init           (tDiodeFilter* const, float freq, float Q);
-			void    tDiodeFilter_initToPool     (tDiodeFilter* const, float freq, float Q, tMempool* const);
-			void    tDiodeFilter_free           (tDiodeFilter* const);
-
-			float   tDiodeFilter_tick           	(tDiodeFilter* const, float input);
-			void    tDiodeFilter_setFreq     (tDiodeFilter* const vf, float cutoff);
-			void    tDiodeFilter_setQ     (tDiodeFilter* const vf, float resonance);
-
-
+    
+    typedef struct _tVZFilter
+    {
+        tMempool mempool;
+        
+        VZFilterType type;
+        // state:
+        float s1, s2;
+        
+        // filter coefficients:
+        float g;          // embedded integrator gain
+        float R2;         // twice the damping coefficient (R2 == 2*R == 1/Q)
+        float h;          // factor for feedback (== 1/(1+2*R*g+g*g))
+        float cL, cB, cH; // coefficients for low-, band-, and highpass signals
+        
+        // parameters:
+        float fc;    // characteristic frequency
+        float G;     // gain
+        float invG;        //1/gain
+        float B;     // bandwidth (in octaves)
+        float m;     // morph parameter (0...1)
+        
+        float sr;    //local sampling rate of filter (may be different from leaf sr if oversampled)
+        float inv_sr;
+    } _tVZFilter;
+    
+    typedef _tVZFilter* tVZFilter;
+    
+    void    tVZFilter_init           (tVZFilter* const, VZFilterType type, float freq, float Q);
+    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);
+    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);
+    
+    
+    /*!
+     @defgroup tdiodefilter tDiodeFilter
+     @ingroup filters
+     @brief
+     @{
+     */
+    
+    /*! @} */
+    
+    //diode ladder filter
+    typedef struct _tDiodeFilter
+    {
+        tMempool mempool;
+        float f;
+        float r;
+        float Vt;
+        float n;
+        float gamma;
+        float zi;
+        float g0inv;
+        float g1inv;
+        float g2inv;
+        float s0, s1, s2, s3;
+    } _tDiodeFilter;
+    
+    typedef _tDiodeFilter* tDiodeFilter;
+    
+    void    tDiodeFilter_init           (tDiodeFilter* const, float freq, float Q);
+    void    tDiodeFilter_initToPool     (tDiodeFilter* const, float freq, float Q, tMempool* const);
+    void    tDiodeFilter_free           (tDiodeFilter* const);
+    
+    float   tDiodeFilter_tick               (tDiodeFilter* const, float input);
+    void    tDiodeFilter_setFreq     (tDiodeFilter* const vf, float cutoff);
+    void    tDiodeFilter_setQ     (tDiodeFilter* const vf, float resonance);
+    
+    
 #ifdef __cplusplus
 }
 #endif
@@ -475,4 +593,5 @@
 #endif  // LEAF_FILTERS_H_INCLUDED
 
 //==============================================================================
+
 
--- a/leaf/Inc/leaf-oscillators.h
+++ b/leaf/Inc/leaf-oscillators.h
@@ -303,6 +303,51 @@
     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
     {
@@ -323,10 +368,53 @@
     void    tTri_setFreq       (tTri* const osc, float freq);
     void    tTri_setSkew       (tTri* const osc, float skew);
     
-    /*! @} */
-    
     //==============================================================================
     
+    /*!
+     @defgroup tpulse tPulse
+     @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;
@@ -347,6 +435,45 @@
     
     //==============================================================================
     
+    /*!
+     @defgroup tsaw tSaw
+     @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;
@@ -365,6 +492,45 @@
     
     //==============================================================================
     
+    /*!
+     @defgroup tphasor tPhasor
+     @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;
@@ -384,6 +550,37 @@
     
     //==============================================================================
     
+    /*!
+     @defgroup tnoise tNoise
+     @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
+     */
+    
     /* tNoise. WhiteNoise, PinkNoise. */
     /*!
      * Noise types
@@ -395,6 +592,8 @@
         NoiseTypeNil,
     };
     
+     /*! @} */
+    
     typedef enum NoiseType NoiseType;
     
     typedef struct _tNoise
@@ -581,8 +780,66 @@
     
     //==============================================================================
     
+    
 #define FILLEN 256
     
+    /*!
+     @defgroup tmbpulse tMBPulse
+     @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;
@@ -611,7 +868,63 @@
     void tMBPulse_syncIn(tMBPulse* const osc, float sync);
     float tMBPulse_syncOut(tMBPulse* const osc);
     
+    /*!
+     @defgroup tmbtriangle tMBTriangle
+     @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;
@@ -641,6 +954,56 @@
     float tMBTriangle_syncOut(tMBTriangle* const osc);
     
     
+    /*!
+     @defgroup tmbsaw tMBSaw
+     @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
     {