History

filling in docs, rename tZerocrossing to tZeroCrossingCounter

Matthew Wang committed 6 years ago

Commit 2e55e201 parent 327ba3d8 files · +173 −158Browse files

Unified · Split

8 files
  1. TestPlugin/Source/MyTest.cpp +3 −3
  2. leaf/Inc/leaf-analysis.h +89 −78
  3. leaf/Inc/leaf-envelopes.h +1 −1
  4. leaf/Inc/leaf-mempool.h +2 −2
  5. leaf/Inc/leaf-midi.h +19 −19
  6. leaf/Inc/leaf-oscillators.h +39 −35
  7. leaf/Src/leaf-analysis.c +14 −14
  8. leaf/Src/leaf-effects.c +6 −6
TestPlugin/Source/MyTest.cpp+3−3
@@ -37,7 +37,7 @@ tPitchDetector detector; · 36 unmodified lines
3737
3838 tPeriodDetection pd;
3939
40−tZeroCrossing zc;
40+tZeroCrossingCounter zc;
4141 tEnvelopeFollower ef;
4242
4343 float gain;
@@ -69,7 +69,7 @@ void LEAFTest_init (float sampleRate, int blockSize) · 25 unmodified lines
6969
7070 tPeriodDetection_init(&pd, bufIn, bufOut, 4096, 1024);
7171
72− tZeroCrossing_init(&zc, 128);
72+ tZeroCrossingCounter_init(&zc, 128);
7373 tEnvelopeFollower_init(&ef, 0.02f, 0.9999f);
7474 }
7575
@@ -107,7 +107,7 @@ float LEAFTest_tick (float input) · 31 unmodified lines
107107 freq = altFreq;
108108 }
109109
110− if (tZeroCrossing_tick(&zc, input) < 0.05 && freq > 0.0f)
110+ if (tZeroCrossingCounter_tick(&zc, input) < 0.05 && freq > 0.0f)
111111 {
112112 tMBTriangle_setFreq(&btri, freq);
113113 }
leaf/Inc/leaf-analysis.h+89−78
@@ -35,32 +35,40 @@ extern "C" { · 34 unmodified lines
3535 /*!
3636 @defgroup tenvelopefollower tEnvelopeFollower
3737 @ingroup analysis
38− @brief
38+ @brief Detects and returns the basic envelope of incoming audio data.
3939 @{
4040
41− @fn void tEnvelopeFollower_init (tEnvelopeFollower* const, float attackThreshold, float decayCoeff)
42− @brief
43− @param
44−
45− @fn void tEnvelopeFollower_initToPool (tEnvelopeFollower* const, float attackThreshold, float decayCoeff, tMempool* const)
46− @brief
47− @param
48−
49− @fn void tEnvelopeFollower_free (tEnvelopeFollower* const)
50− @brief
51− @param
52−
53− @fn float tEnvelopeFollower_tick (tEnvelopeFollower* const, float x)
54− @brief
55− @param
56−
57− @fn int tEnvelopeFollower_decayCoeff (tEnvelopeFollower* const, float decayCoeff)
58− @brief
59− @param
60−
61− @fn int tEnvelopeFollower_attackThresh (tEnvelopeFollower* const, float attackThresh)
62− @brief
63− @param
41+ @fn void tEnvelopeFollower_init (tEnvelopeFollower* const follower, float attackThreshold, float decayCoeff)
42+ @brief Initialize a tEnvelopeFollower to the default LEAF mempool.
43+ @param follower A pointer to the tEnvelopeFollower to be initialized.
44+ @param attackThreshold Amplitude threshold for determining an envelope onset. 0.0 to 1.0
45+ @param decayCoefficient Multiplier to determine the envelope rate of decay. 0.0 to 1.0, above 0.95 recommended.
46+
47+ @fn void tEnvelopeFollower_initToPool (tEnvelopeFollower* const follower, float attackThreshold, float decayCoeff, tMempool* const mempool)
48+ @brief Initialize a tEnvelopeFollower to a specified mempool.
49+ @param follower A pointer to the tEnvelopeFollower to be initialized.
50+ @param attackThreshold Amplitude threshold for determining an envelope onset. 0.0 to 1.0
51+ @param decayCoefficient Multiplier to determine the envelope rate of decay. 0.0 to 1.0, above 0.95 recommended.
52+ @param mempool A pointer to the tMempool to which the tEnvelopeFollower should be initialized.
53+
54+ @fn void tEnvelopeFollower_free (tEnvelopeFollower* const follower)
55+ @brief Free a tEnvelopeFollower from its mempool.
56+ @param follower A pointer to the tEnvelopeFollower to be freed.
57+
58+ @fn float tEnvelopeFollower_tick (tEnvelopeFollower* const follower, float input)
59+ @brief Tick the tEnvelopeFollower.
60+ @param follower A pointer to the relevant tEnvelopeFollower.
61+ @param input The input sample.
62+ @return The envelope value.
63+
64+ @fn void tEnvelopeFollower_setDecayCoefficient (tEnvelopeFollower* const follower, float decayCoeff)
65+ @brief Set the envelope decay coefficient.
66+ @param follower A pointer to the relevant tEnvelopeFollower.
67+ @param decayCoefficient Multiplier to determine the envelope rate of decay. 0.0 to 1.0, above 0.95 recommended.
68+
69+ @fn void tEnvelopeFollower_setAttackThreshold (tEnvelopeFollower* const follower, float attackThresh)
70+ @brief Set the envelope attack threshold.
71+ @param follower A pointer to the relevant tEnvelopeFollower.
6472 
6573 @} */
6674
@@ -75,46 +83,50 @@ extern "C" { · 8 unmodified lines
7583
7684 typedef _tEnvelopeFollower* tEnvelopeFollower;
7785
78− void tEnvelopeFollower_init (tEnvelopeFollower* const, float attackThreshold, float decayCoeff);
79− void tEnvelopeFollower_initToPool (tEnvelopeFollower* const, float attackThreshold, float decayCoeff, tMempool* const);
80− void tEnvelopeFollower_free (tEnvelopeFollower* const);
81−
82− float tEnvelopeFollower_tick (tEnvelopeFollower* const, float x);
83− int tEnvelopeFollower_decayCoeff (tEnvelopeFollower* const, float decayCoeff);
84− int tEnvelopeFollower_attackThresh (tEnvelopeFollower* const, float attackThresh);
86+ void tEnvelopeFollower_init (tEnvelopeFollower* const follower, float attackThreshold, float decayCoefficient);
87+ void tEnvelopeFollower_initToPool (tEnvelopeFollower* const follower, float attackThreshold, float decayCoefficient, tMempool* const mempool);
88+ void tEnvelopeFollower_free (tEnvelopeFollower* const follower);
8589
86− // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
90+ float tEnvelopeFollower_tick (tEnvelopeFollower* const follower, float sample);
91+ void tEnvelopeFollower_setDecayCoefficient (tEnvelopeFollower* const follower, float decayCoefficient);
92+ void tEnvelopeFollower_setAttackThreshold (tEnvelopeFollower* const follower, float attackThreshold);
8793
8894 /*!
89− @defgroup tzerocrossing tZeroCrossing
95+ @defgroup tzerocrossingcounter tZeroCrossingCounter
9096 @ingroup analysis
91− @brief
97+ @brief Counts the amount of zero crossings within a window of the input audio data
9298 @{
9399
94− @fn void tZeroCrossing_init (tZeroCrossing* const, int maxWindowSize)
95− @brief
96− @param
97−
98− @fn void tZeroCrossing_initToPool (tZeroCrossing* const, int maxWindowSize, tMempool* const)
99− @brief
100− @param
101−
102− @fn void tZeroCrossing_free (tZeroCrossing* const)
103− @brief
104− @param
105−
106− @fn float tZeroCrossing_tick (tZeroCrossing* const, float input)
107− @brief
108− @param
109−
110− @fn void tZeroCrossing_setWindow (tZeroCrossing* const, float windowSize)
111− @brief
112− @param
100+ @fn void tZeroCrossingCounter_init (tZeroCrossingCounter* const counter, int maxWindowSize)
101+ @brief Initialize a tZeroCrossingCounter to the default LEAF mempool.
102+ @param counter A pointer to the tZeroCrossingCounter to be initialized.
103+ @param maxWindowSize The max and initial size of the window.
104+
105+ @fn void tZeroCrossingCounter_initToPool (tZeroCrossingCounter* const counter, int maxWindowSize, tMempool* const mempool)
106+ @brief Initialize a tZeroCrossingCounter to a specified mempool.
107+ @param counter A pointer to the tZeroCrossingCounter to be initialized.
108+ @param maxWindowSize The max and initial size of the window.
109+ @param mempool A pointer to the tMempool to which the tZeroCrossingCounter should be initialized.
110+
111+ @fn void tZeroCrossingCounter_free (tZeroCrossingCounter* const counter)
112+ @brief Free a tZeroCrossingCounter from its mempool.
113+ @param counter A pointer to the tZeroCrossingCounter to be freed.
114+
115+ @fn float tZeroCrossingCounter_tick (tZeroCrossingCounter* const counter, float input)
116+ @brief Tick the tZeroCrossingCounter.
117+ @param counter A pointer to the relevant tZeroCrossingCounter.
118+ @param input The input sample.
119+ @return The amount of zero crossings as a proportion of the window.
120+
121+ @fn void tZeroCrossingCounter_setWindowSize (tZeroCrossingCounter* const counter, float windowSize)
122+ @brief Set the size of the window. Cannot be greater than the max size given on initialization.
123+ @param counter A pointer to the relevant tZeroCrossingCounter.
124+ @param windowSize The new window size.
113125 
114126 @} */
115127
116128 /* Zero Crossing Detector */
117− typedef struct _tZeroCrossing {
129+ typedef struct _tZeroCrossingCounter {
118130 tMempool mempool;
119131 int count;
120132 int maxWindowSize;
@@ -124,16 +136,16 @@ extern "C" { · 3 unmodified lines
124136 uint16_t* countBuffer;
125137 int prevPosition;
126138 int position;
127− } _tZeroCrossing;
139+ } _tZeroCrossingCounter;
128140
129− typedef _tZeroCrossing* tZeroCrossing;
141+ typedef _tZeroCrossingCounter* tZeroCrossingCounter;
130142
131− void tZeroCrossing_init (tZeroCrossing* const, int maxWindowSize);
132− void tZeroCrossing_initToPool (tZeroCrossing* const, int maxWindowSize, tMempool* const);
133− void tZeroCrossing_free (tZeroCrossing* const);
143+ void tZeroCrossingCounter_init (tZeroCrossingCounter* const, int maxWindowSize);
144+ void tZeroCrossingCounter_initToPool (tZeroCrossingCounter* const, int maxWindowSize, tMempool* const mempool);
145+ void tZeroCrossingCounter_free (tZeroCrossingCounter* const);
134146
135− float tZeroCrossing_tick (tZeroCrossing* const, float input);
136− void tZeroCrossing_setWindow (tZeroCrossing* const, float windowSize);
147+ float tZeroCrossingCounter_tick (tZeroCrossingCounter* const, float input);
148+ void tZeroCrossingCounter_setWindowSize (tZeroCrossingCounter* const, float windowSize);
137149
138150 // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
139151
@@ -144,11 +156,11 @@ extern "C" { · 4 unmodified lines
144156 @{
145157
146158 @fn void tPowerFollower_init (tPowerFollower* const, float factor)
147− @brief
159+ @brief Initialize a tPowerFollower to the default LEAF mempool.
148160 @param
149161
150162 @fn void tPowerFollower_initToPool (tPowerFollower* const, float factor, tMempool* const)
151− @brief
163+ @brief Initialize a tPowerFollower to a specified mempool.
152164 @param
153165
154166 @fn void tPowerFollower_free (tPowerFollower* const)
@@ -193,15 +205,15 @@ extern "C" { · 38 unmodified lines
193205 /*!
194206 @defgroup tenvpd tEnvPD
195207 @ingroup analysis
196− @brief
208+ @brief ENV~ from PD, modified for LEAF
197209 @{
198210
199211 @fn void tEnvPD_init (tEnvPD* const, int windowSize, int hopSize, int blockSize)
200− @brief
212+ @brief Initialize a tEnvPD to the default LEAF mempool.
201213 @param
202214
203215 @fn void tEnvPD_initToPool (tEnvPD* const, int windowSize, int hopSize, int blockSize, tMempool* const)
204− @brief
216+ @brief Initialize a tEnvPD to a specified mempool.
205217 @param
206218
207219 @fn void tEnvPD_free (tEnvPD* const)
@@ -218,7 +230,6 @@ extern "C" { · 10 unmodified lines
218230 
219231 @} */
220232
221− // ENV~ from PD, modified for LEAF
222233 #define MAXOVERLAP 32
223234 #define INITVSTAKEN 64
224235 #define ENV_WINDOW_SIZE 1024
@@ -257,11 +268,11 @@ extern "C" { · 32 unmodified lines
257268 @{
258269
259270 @fn void tAttackDetection_init (tAttackDetection* const, int blocksize, int atk, int rel)
260− @brief
271+ @brief Initialize a tAttackDetection to the default LEAF mempool.
261272 @param
262273
263274 @fn void tAttackDetection_initToPool (tAttackDetection* const, int blocksize, int atk, int rel, tMempool* const)
264− @brief
275+ @brief Initialize a tAttackDetection to a specified mempool.
265276 @param
266277
267278 @fn void tAttackDetection_free (tAttackDetection* const)
@@ -344,11 +355,11 @@ extern "C" { · 76 unmodified lines
344355 @{
345356
346357 @fn void tSNAC_init (tSNAC* const, int overlaparg)
347− @brief
358+ @brief Initialize a tSNAC to the default LEAF mempool.
348359 @param
349360
350361 @fn void tSNAC_initToPool (tSNAC* const, int overlaparg, tMempool* const)
351− @brief
362+ @brief Initialize a tSNAC to a specified mempool.
352363 @param
353364
354365 @fn void tSNAC_free (tSNAC* const)
@@ -433,11 +444,11 @@ extern "C" { · 78 unmodified lines
433444
434445 /*!
435446 @fn void tPeriodDetection_init (tPeriodDetection* const, float* in, float* out, int bufSize, int frameSize)
436− @brief
447+ @brief Initialize a tPeriodDetection to the default LEAF mempool.
437448 @param
438449
439− @fn void tPeriodDetection_initToPool (tPeriodDetection* const, float* in, float* out, int bufSize, int frameSize, tMempool* const)
440− @brief
450+ @fn void tPeriodDetection_initToPool (tPeriodDetection* const, float* in, float* out, int bufSize, int frameSize, tMempool* const)
451+ @brief Initialize a tPeriodDetection to a specified mempool.
441452 @param
442453
443454 @fn void tPeriodDetection_free (tPeriodDetection* const)
@@ -664,11 +675,11 @@ extern "C" { · 220 unmodified lines
664675 @{
665676
666677 @fn void tPeriodDetector_init (tPeriodDetector* const detector, float lowestFreq, float highestFreq, float hysteresis)
667− @brief
678+ @brief Initialize a tPeriodDetector to the default LEAF mempool.
668679 @param
669680
670681 @fn void tPeriodDetector_initToPool (tPeriodDetector* const detector, float lowestFreq, float highestFreq, float hysteresis, tMempool* const mempool)
671− @brief
682+ @brief Initialize a tPeriodDetector to a specified mempool.
672683 @param
673684
674685 @fn void tPeriodDetector_free (tPeriodDetector* const detector)
@@ -774,11 +785,11 @@ extern "C" { · 99 unmodified lines
774785 @{
775786
776787 @fn void tPitchDetector_init (tPitchDetector* const detector, float lowestFreq, float highestFreq, float hysteresis)
777− @brief
788+ @brief Initialize a tPitchDetector to the default LEAF mempool.
778789 @param
779790
780791 @fn void tPitchDetector_initToPool (tPitchDetector* const detector, float lowestFreq, float highestFreq, float hysteresis, tMempool* const mempool)
781− @brief
792+ @brief Initialize a tPitchDetector to a specified mempool.
782793 @param
783794
784795 @fn void tPitchDetector_free (tPitchDetector* const detector)
leaf/Inc/leaf-envelopes.h+1−1
@@ -37,7 +37,7 @@ extern "C" { · 36 unmodified lines
3737 /*!
3838 @defgroup tenvelope tEnvelope
3939 @ingroup envelopes
40− @brief Attack-decay envelope.
40+ @brief Basic attack-decay envelope.
4141 @{
4242
4343 @fn void tEnvelope_init (tEnvelope* const, float attack, float decay, int loop)
leaf/Inc/leaf-mempool.h+2−2
@@ -96,7 +96,7 @@ extern "C" { · 95 unmodified lines
9696 void tMempool_init (tMempool* const pool, char* memory, size_t size);
9797
9898
99− //! Free a tMempool from the default LEAF mempool.
99+ //! Free a tMempool from its mempool.
100100 /*!
101101 @param pool A pointer to the tMempool to be freed.
102102 */
@@ -115,7 +115,7 @@ extern "C" { · 12 unmodified lines
115115
116116 //! Free a tMempool from a specified mempool.
117117 /*!
118− @param pool A pointer to the tMempool to be freed from the default LEAF mempool.
118+ @param pool A pointer to the tMempool to be freed from its mempool.
119119 @param poolFrom A pointer to the tMempool from which a tMempool should be freed.
120120 */
121121 void tMempool_freeFromPool (tMempool* const pool, tMempool* const poolFrom);
leaf/Inc/leaf-midi.h+19−19
@@ -48,7 +48,7 @@ extern "C" { · 47 unmodified lines
4848 @param mempool A pointer to the tMempool to which the tStack should be initialized.
4949
5050 @fn void tStack_free (tStack* const stack)
51− @brief Free a tStack from the default LEAF mempool.
51+ @brief Free a tStack from its mempool.
5252 @param stack A pointer to the tStack to be freed.
5353
5454 @fn void tStack_setCapacity (tStack* const stack, uint16_t cap)
@@ -149,7 +149,7 @@ extern "C" { · 94 unmodified lines
149149 @param pool A pointer to the tMempool to which the tPoly should be initialized.
150150
151151 @fn void tPoly_free (tPoly* const poly)
152− @brief Free a tPoly from the default LEAF mempool.
152+ @brief Free a tPoly from its mempool.
153153 @param poly A pointer to the tPoly to be freed.
154154
155155 @fn int tPoly_noteOn (tPoly* const poly, int note, uint8_t vel)
@@ -315,29 +315,29 @@ extern "C" { · 159 unmodified lines
315315 @{
316316
317317 @fn void tSimplePoly_init (tSimplePoly* const poly, int maxNumVoices)
318− @brief Initialize a tPoly to the default LEAF mempool.
319− @param poly A pointer to the tPoly to be initialized.
320− @param maxNumVoices The maximum number of voices this tPoly can handle at once.
318+ @brief Initialize a tSimplePoly to the default LEAF mempool.
319+ @param poly A pointer to the tSimplePoly to be initialized.
320+ @param maxNumVoices The maximum number of voices this tSimplePoly can handle at once.
321321
322322 @fn void tSimplePoly_initToPool (tSimplePoly* const poly, int maxNumVoices, tMempool* const pool)
323− @brief Initialize a tPoly to a specified mempool.
324− @param poly A pointer to the tPoly to be initialized.
325− @param pool A pointer to the tMempool to which the tPoly should be initialized.
323+ @brief Initialize a tSimplePoly to a specified mempool.
324+ @param poly A pointer to the tSimplePoly to be initialized.
325+ @param pool A pointer to the tMempool to which the tSimplePoly should be initialized.
326326
327327 @fn void tSimplePoly_free (tSimplePoly* const poly)
328− @brief Free a tPoly from the default LEAF mempool.
329− @param poly A pointer to the tPoly to be freed.
328+ @brief Free a tSimplePoly from its mempool.
329+ @param poly A pointer to the tSimplePoly to be freed.
330330
331331 @fn int tSimplePoly_noteOn (tSimplePoly* const poly, int note, uint8_t vel)
332332 @brief Add a note with a given velocity to the poly handler.
333− @param poly A pointer to the relevant tPoly.
333+ @param poly A pointer to the relevant tSimplePoly.
334334 @param note The MIDI note number to add.
335335 @param vel The MIDI velocity of the note to add.
336336 @return The voice that will play the note.
337337
338338 @fn int tSimplePoly_noteOff (tSimplePoly* const poly, uint8_t note)
339339 @brief Remove a note from the poly handler.
340− @param poly A pointer to the relevant tPoly.
340+ @param poly A pointer to the relevant tSimplePoly.
341341 @param note The MIDI note number to remove.
342342 @return The voice that was playing the removed note.
343343
@@ -355,22 +355,22 @@ extern "C" { · 11 unmodified lines
355355
356356 @fn void tSimplePoly_setNumVoices (tSimplePoly* const poly, uint8_t numVoices)
357357 @brief Set the number of voices available to play notes.
358− @param poly A pointer to the relevant tPoly.
359− @param numVoices The new number of available voices. Cannot be greater than the max number voices given in tPoly_init().
358+ @param poly A pointer to the relevant tSimplePoly.
359+ @param numVoices The new number of available voices. Cannot be greater than the max number voices given on initialization.
360360
361361 @fn int tSimplePoly_getNumVoices (tSimplePoly* const poly)
362362 @brief Get the current number of voices available to play notes.
363− @param poly A pointer to the relevant tPoly.
363+ @param poly A pointer to the relevant tSimplePoly.
364364 @return The current number of voices available to play notes.
365365
366366 @fn int tSimplePoly_getNumActiveVoices (tSimplePoly* const poly)
367367 @brief Get the number of voices currently playing notes.
368− @param poly A pointer to the relevant tPoly.
368+ @param poly A pointer to the relevant tSimplePoly.
369369 @return The number of voices currently playing notes.
370370
371371 @fn int tSimplePoly_getPitch (tSimplePoly* const poly, uint8_t voice)
372372 @brief Get the current MIDI note number of a given voice.
373− @param poly A pointer to the relevant tPoly.
373+ @param poly A pointer to the relevant tSimplePoly.
374374 @param voice The voice to get the MIDI note number of.
375375 @return The MIDI note number of the given voice.
376376
@@ -379,13 +379,13 @@ extern "C" { · 2 unmodified lines
379379
380380 @fn int tSimplePoly_getVelocity (tSimplePoly* const poly, uint8_t voice)
381381 @brief Get the current MIDI velocity of a given voice.
382− @param poly A pointer to the relevant tPoly.
382+ @param poly A pointer to the relevant tSimplePoly.
383383 @param voice The voice to get the MIDI velocity of.
384384 @return The current MIDI velocity of the given voice.
385385
386386 @fn int tSimplePoly_isOn (tSimplePoly* const poly, uint8_t voice)
387387 @brief Get the current play state of a given voice.
388− @param poly A pointer to the relevant tPoly.
388+ @param poly A pointer to the relevant tSimplePoly.
389389 @param voice The voice to get the state of.
390390 @return The current play state of the given voice.
391391
leaf/Inc/leaf-oscillators.h+39−35
@@ -34,17 +34,21 @@ extern "C" { · 33 unmodified lines
3434 @brief A general wavetable oscillator.
3535 @{
3636
37− @fn void tTable_init (tTable* const osc, float* waveTable, int size)
37+ @fn void tTable_init (tTable* const osc, float* table, int size)
3838 @brief Initialize a tTable to the default LEAF mempool.
3939 @param osc A pointer to the tTable to be initialized.
40+ @param table A pointer to the wave table data.
41+ @param size The number of samples in the wave table.
4042
41− @fn void tTable_initToPool (tTable* const osc, float* waveTable, int size, tMempool* const mempool)
43+ @fn void tTable_initToPool (tTable* const osc, float* table, int size, tMempool* const mempool)
4244 @brief Initialize a tTable to a specified mempool.
4345 @param osc A pointer to the tTable to be initialized.
44− @param pool A pointer to the tMempool to which the tTable should be initialized.
46+ @param table A pointer to the wave table data.
47+ @param size The number of samples in the wave table.
48+ @param mempool A pointer to the tMempool to which the tTable should be initialized.
4549
4650 @fn void tTable_free (tTable* const osc)
47− @brief Free a tTable from the default LEAF mempool.
51+ @brief Free a tTable from its mempool.
4852 @param osc A pointer to the tTable to be freed.
4953
5054 @fn float tTable_tick (tTable* const osc)
@@ -71,8 +75,8 @@ extern "C" { · 20 unmodified lines
7175
7276 typedef _tTable* tTable;
7377
74− void tTable_init(tTable* const osc, float* waveTable, int size);
75− void tTable_initToPool(tTable* const osc, float* waveTable, int size, tMempool* const mempool);
78+ void tTable_init(tTable* const osc, float* table, int size);
79+ void tTable_initToPool(tTable* const osc, float* table, int size, tMempool* const mempool);
7680 void tTable_free(tTable* const osc);
7781
7882 float tTable_tick(tTable* const osc);
@@ -90,13 +94,13 @@ extern "C" { · 11 unmodified lines
9094 @brief Initialize a tCycle to the default LEAF mempool.
9195 @param osc A pointer to the tCycle to be initialized.
9296
93− @fn void tCycle_initToPool (tCycle* const osc, tMempool* const pool)
97+ @fn void tCycle_initToPool (tCycle* const osc, tMempool* const mempool)
9498 @brief Initialize a tCycle to a specified mempool.
9599 @param osc A pointer to the tCycle to be initialized.
96− @param pool A pointer to the tMempool to which the tCycle should be initialized.
100+ @param mempool A pointer to the tMempool to which the tCycle should be initialized.
97101
98102 @fn void tCycle_free (tCycle* const osc)
99− @brief Free a tCycle from the default LEAF mempool.
103+ @brief Free a tCycle from its mempool.
100104 @param osc A pointer to the tCycle to be freed.
101105
102106 @fn float tCycle_tick (tCycle* const osc)
@@ -123,7 +127,7 @@ extern "C" { · 20 unmodified lines
123127 typedef _tCycle* tCycle;
124128
125129 void tCycle_init (tCycle* const osc);
126− void tCycle_initToPool (tCycle* const osc, tMempool* const pool);
130+ void tCycle_initToPool (tCycle* const osc, tMempool* const mempool);
127131 void tCycle_free (tCycle* const osc);
128132
129133 float tCycle_tick (tCycle* const osc);
@@ -141,13 +145,13 @@ extern "C" { · 11 unmodified lines
141145 @brief Initialize a tTriangle to the default LEAF mempool.
142146 @param osc A pointer to the tTriangle to be initialized.
143147
144− @fn void tTriangle_initToPool (tTriangle* const osc, tMempool* const pool)
148+ @fn void tTriangle_initToPool (tTriangle* const osc, tMempool* const mempool)
145149 @brief Initialize a tTriangle to a specified mempool.
146150 @param osc A pointer to the tTriangle to be initialized.
147− @param pool A pointer to the tMempool to which the tTriangle should be initialized.
151+ @param mempool A pointer to the tMempool to which the tTriangle should be initialized.
148152
149153 @fn void tTriangle_free (tTriangle* const osc)
150− @brief Free a tTriangle from the default LEAF mempool.
154+ @brief Free a tTriangle from its mempool.
151155 @param osc A pointer to the tTriangle to be freed.
152156
153157 @fn float tTriangle_tick (tTriangle* const osc)
@@ -175,7 +179,7 @@ extern "C" { · 21 unmodified lines
175179 typedef _tTriangle* tTriangle;
176180
177181 void tTriangle_init (tTriangle* const osc);
178− void tTriangle_initToPool (tTriangle* const osc, tMempool* const pool);
182+ void tTriangle_initToPool (tTriangle* const osc, tMempool* const mempool);
179183 void tTriangle_free (tTriangle* const osc);
180184
181185 float tTriangle_tick (tTriangle* const osc);
@@ -194,13 +198,13 @@ extern "C" { · 12 unmodified lines
194198 @brief Initialize a tSquare to the default LEAF mempool.
195199 @param osc A pointer to the tSquare to be initialized.
196200
197− @fn void tSquare_initToPool (tSquare* const osc, tMempool* const pool)
201+ @fn void tSquare_initToPool (tSquare* const osc, tMempool* const mempool)
198202 @brief Initialize a tSquare to a specified mempool.
199203 @param osc A pointer to the tSquare to be initialized.
200− @param pool A pointer to the tMempool to which the tSquare should be initialized.
204+ @param mempool A pointer to the tMempool to which the tSquare should be initialized.
201205
202206 @fn void tSquare_free (tSquare* const osc)
203− @brief Free a tSquare from the default LEAF mempool.
207+ @brief Free a tSquare from its mempool.
204208 @param osc A pointer to the tSquare to be freed.
205209
206210 @fn float tSquare_tick (tSquare* const osc)
@@ -249,13 +253,13 @@ extern "C" { · 42 unmodified lines
249253 @brief Initialize a tSawtooth to the default LEAF mempool.
250254 @param osc A pointer to the tSawtooth to be initialized.
251255
252− @fn void tSawtooth_initToPool (tSawtooth* const osc, tMempool* const pool)
256+ @fn void tSawtooth_initToPool (tSawtooth* const osc, tMempool* const mempool)
253257 @brief Initialize a tSawtooth to a specified mempool.
254258 @param osc A pointer to the tSawtooth to be initialized.
255− @param pool A pointer to the tMempool to which the tSawtooth should be initialized.
259+ @param mempool A pointer to the tMempool to which the tSawtooth should be initialized.
256260
257261 @fn void tSawtooth_free (tSawtooth* const osc)
258− @brief Free a tSawtooth from the default LEAF mempool.
262+ @brief Free a tSawtooth from its mempool.
259263 @param osc A pointer to the tSawtooth to be freed.
260264
261265 @fn float tSawtooth_tick (tSawtooth* const osc)
@@ -283,7 +287,7 @@ extern "C" { · 21 unmodified lines
283287 typedef _tSawtooth* tSawtooth;
284288
285289 void tSawtooth_init (tSawtooth* const osc);
286− void tSawtooth_initToPool (tSawtooth* const osc, tMempool* const pool);
290+ void tSawtooth_initToPool (tSawtooth* const osc, tMempool* const mempool);
287291 void tSawtooth_free (tSawtooth* const osc);
288292
289293 float tSawtooth_tick (tSawtooth* const osc);
@@ -301,7 +305,7 @@ extern "C" { · 11 unmodified lines
301305 @brief
302306 @param
303307
304− @fn void tTri_initToPool (tTri* const osc, tMempool* const pool)
308+ @fn void tTri_initToPool (tTri* const osc, tMempool* const mempool)
305309 @brief
306310 @param
307311
@@ -335,7 +339,7 @@ extern "C" { · 27 unmodified lines
335339 typedef _tTri* tTri;
336340
337341 void tTri_init (tTri* const osc);
338− void tTri_initToPool (tTri* const osc, tMempool* const pool);
342+ void tTri_initToPool (tTri* const osc, tMempool* const mempool);
339343 void tTri_free (tTri* const osc);
340344
341345 float tTri_tick (tTri* const osc);
@@ -406,7 +410,7 @@ extern "C" { · 64 unmodified lines
406410 @brief
407411 @param
408412
409− @fn void tSaw_initToPool (tSaw* const osc, tMempool* const pool)
413+ @fn void tSaw_initToPool (tSaw* const osc, tMempool* const mempool)
410414 @brief
411415 @param
412416
@@ -434,7 +438,7 @@ extern "C" { · 21 unmodified lines
434438 typedef _tSaw* tSaw;
435439
436440 void tSaw_init (tSaw* const osc);
437− void tSaw_initToPool (tSaw* const osc, tMempool* const pool);
441+ void tSaw_initToPool (tSaw* const osc, tMempool* const mempool);
438442 void tSaw_free (tSaw* const osc);
439443
440444 float tSaw_tick (tSaw* const osc);
@@ -555,13 +559,13 @@ extern "C" { · 114 unmodified lines
555559 @brief Initialize a tNeuron to the default LEAF mempool.
556560 @param neuron A pointer to the tNeuron to be initialized.
557561
558− @fn void tNeuron_initToPool (tNeuron* const neuron, tMempool* const pool)
562+ @fn void tNeuron_initToPool (tNeuron* const neuron, tMempool* const mempool)
559563 @brief Initialize a tNeuron to a specified mempool.
560564 @param neuron A pointer to the tNeuron to be initialized.
561− @param pool A pointer to the tMempool to which the tNeuron should be initialized.
565+ @param mempool A pointer to the tMempool to which the tNeuron should be initialized.
562566
563567 @fn void tNeuron_free (tNeuron* const neuron)
564− @brief Free a tNeuron from the default LEAF mempool.
568+ @brief Free a tNeuron from its mempool.
565569 @param neuron A pointer to the tNeuron to be freed.
566570
567571 @fn void tNeuron_reset (tNeuron* const neuron)
@@ -659,7 +663,7 @@ extern "C" { · 91 unmodified lines
659663 typedef _tNeuron* tNeuron;
660664
661665 void tNeuron_init (tNeuron* const neuron);
662− void tNeuron_initToPool (tNeuron* const neuron, tMempool* const pool);
666+ void tNeuron_initToPool (tNeuron* const neuron, tMempool* const mempool);
663667 void tNeuron_free (tNeuron* const neuron);
664668
665669 void tNeuron_reset (tNeuron* const neuron);
@@ -692,7 +696,7 @@ extern "C" { · 26 unmodified lines
692696 @brief
693697 @param
694698
695− @fn void tMBPulse_initToPool(tMBPulse* const osc, tMempool* const pool)
699+ @fn void tMBPulse_initToPool(tMBPulse* const osc, tMempool* const mempool)
696700 @brief
697701 @param
698702
@@ -741,7 +745,7 @@ extern "C" { · 42 unmodified lines
741745 typedef _tMBPulse* tMBPulse;
742746
743747 void tMBPulse_init(tMBPulse* const osc);
744− void tMBPulse_initToPool(tMBPulse* const osc, tMempool* const pool);
748+ void tMBPulse_initToPool(tMBPulse* const osc, tMempool* const mempool);
745749 void tMBPulse_free(tMBPulse* const osc);
746750
747751 float tMBPulse_tick(tMBPulse* const osc);
@@ -760,7 +764,7 @@ extern "C" { · 12 unmodified lines
760764 @brief
761765 @param
762766
763− @fn void tMBTriangle_initToPool(tMBTriangle* const osc, tMempool* const pool)
767+ @fn void tMBTriangle_initToPool(tMBTriangle* const osc, tMempool* const mempool)
764768 @brief
765769 @param
766770
@@ -809,7 +813,7 @@ extern "C" { · 42 unmodified lines
809813 typedef _tMBTriangle* tMBTriangle;
810814
811815 void tMBTriangle_init(tMBTriangle* const osc);
812− void tMBTriangle_initToPool(tMBTriangle* const osc, tMempool* const pool);
816+ void tMBTriangle_initToPool(tMBTriangle* const osc, tMempool* const mempool);
813817 void tMBTriangle_free(tMBTriangle* const osc);
814818
815819 float tMBTriangle_tick(tMBTriangle* const osc);
@@ -829,7 +833,7 @@ extern "C" { · 13 unmodified lines
829833 @brief
830834 @param
831835
832− @fn void tMBSaw_initToPool(tMBSaw* const osc, tMempool* const pool)
836+ @fn void tMBSaw_initToPool(tMBSaw* const osc, tMempool* const mempool)
833837 @brief
834838 @param
835839
@@ -873,7 +877,7 @@ extern "C" { · 37 unmodified lines
873877 typedef _tMBSaw* tMBSaw;
874878
875879 void tMBSaw_init(tMBSaw* const osc);
876− void tMBSaw_initToPool(tMBSaw* const osc, tMempool* const pool);
880+ void tMBSaw_initToPool(tMBSaw* const osc, tMempool* const mempool);
877881 void tMBSaw_free(tMBSaw* const osc);
878882
879883 float tMBSaw_tick(tMBSaw* const osc);
leaf/Src/leaf-analysis.c+14−14
@@ -64,16 +64,16 @@ float tEnvelopeFollower_tick(tEnvelopeFollower* const ef, float x) · 63 unmodified lines
6464 return e->y;
6565 }
6666
67−int tEnvelopeFollower_decayCoeff(tEnvelopeFollower* const ef, float decayCoeff)
67+void tEnvelopeFollower_setDecayCoefficient(tEnvelopeFollower* const ef, float decayCoeff)
6868 {
6969 _tEnvelopeFollower* e = *ef;
70− return e->d_coeff = decayCoeff;
70+ e->d_coeff = decayCoeff;
7171 }
7272
73−int tEnvelopeFollower_attackThresh(tEnvelopeFollower* const ef, float attackThresh)
73+void tEnvelopeFollower_setAttackThreshold(tEnvelopeFollower* const ef, float attackThresh)
7474 {
7575 _tEnvelopeFollower* e = *ef;
76− return e->a_thresh = attackThresh;
76+ e->a_thresh = attackThresh;
7777 }
7878
7979
@@ -82,15 +82,15 @@ int tEnvelopeFollower_attackThresh(tEnvelopeFollower* const ef, float attack · 2 unmodified lines
8282
8383 // zero crossing detector
8484
85−void tZeroCrossing_init (tZeroCrossing* const zc, int maxWindowSize)
85+void tZeroCrossingCounter_init (tZeroCrossingCounter* const zc, int maxWindowSize)
8686 {
87− tZeroCrossing_initToPool (zc, maxWindowSize, &leaf.mempool);
87+ tZeroCrossingCounter_initToPool (zc, maxWindowSize, &leaf.mempool);
8888 }
8989
90−void tZeroCrossing_initToPool (tZeroCrossing* const zc, int maxWindowSize, tMempool* const mp)
90+void tZeroCrossingCounter_initToPool (tZeroCrossingCounter* const zc, int maxWindowSize, tMempool* const mp)
9191 {
9292 _tMempool* m = *mp;
93− _tZeroCrossing* z = *zc = (_tZeroCrossing*) mpool_alloc(sizeof(_tZeroCrossing), m);
93+ _tZeroCrossingCounter* z = *zc = (_tZeroCrossingCounter*) mpool_alloc(sizeof(_tZeroCrossing), m);
9494 z->mempool = m;
9595
9696 z->count = 0;
@@ -103,9 +103,9 @@ void tZeroCrossing_initToPool (tZeroCrossing* const zc, int maxWindowSize, · 6 unmodified lines
103103 z->countBuffer = (uint16_t*) mpool_calloc(sizeof(uint16_t) * maxWindowSize, m);
104104 }
105105
106−void tZeroCrossing_free (tZeroCrossing* const zc)
106+void tZeroCrossingCounter_free (tZeroCrossingCounter* const zc)
107107 {
108− _tZeroCrossing* z = *zc;
108+ _tZeroCrossingCounter* z = *zc;
109109
110110 mpool_free((char*)z->inBuffer, z->mempool);
111111 mpool_free((char*)z->countBuffer, z->mempool);
@@ -113,9 +113,9 @@ void tZeroCrossing_free (tZeroCrossing* const zc) · 1 unmodified line
113113 }
114114
115115 //returns proportion of zero crossings within window size (0.0 would be none in window, 1.0 would be all zero crossings)
116−float tZeroCrossing_tick (tZeroCrossing* const zc, float input)
116+float tZeroCrossingCounter_tick (tZeroCrossingCounter* const zc, float input)
117117 {
118− _tZeroCrossing* z = *zc;
118+ _tZeroCrossingCounter* z = *zc;
119119
120120 z->inBuffer[z->position] = input;
121121 int futurePosition = ((z->position + 1) % z->currentWindowSize);
@@ -152,9 +152,9 @@ float tZeroCrossing_tick (tZeroCrossing* const zc, float input) · 30 unmodified lines
152152 }
153153
154154
155−void tZeroCrossing_setWindow (tZeroCrossing* const zc, float windowSize)
155+void tZeroCrossingCounter_setWindowSize (tZeroCrossingCounter* const zc, float windowSize)
156156 {
157− _tZeroCrossing* z = *zc;
157+ _tZeroCrossingCounter* z = *zc;
158158 if (windowSize <= z->maxWindowSize)
159159 {
160160 z->currentWindowSize = windowSize;
leaf/Src/leaf-effects.c+6−6
@@ -285,11 +285,11 @@ void tTalkbox_lpc(float *buf, float *car, double* dl, double* Rt, int32_t n, int · 284 unmodified lines
285285 {
286286 if(r[0] < min)
287287 {
288− for(i=0; i<n; i++)
289− {
288+// for(i=0; i<n; i++)
289+// {
290290 buf[i] = 0.0f;
291291 return;
292− }
292+// }
293293 }
294294
295295 tTalkbox_lpcDurbin(r, o, k, G); //calc reflection coeffs
@@ -612,11 +612,11 @@ void tTalkboxFloat_lpc(float *buf, float *car, float* dl, float* Rt, int32_t n, · 316 unmodified lines
612612 {
613613 if(r[0] < min)
614614 {
615− for(i=0; i<n; i++)
616− {
615+// for(i=0; i<n; i++)
616+// {
617617 buf[i] = 0.0f;
618618 return;
619− }
619+// }
620620 }
621621
622622 tTalkbox_lpcDurbin(r, o, k, G); //calc reflection coeffs

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t