History

added comment blocks for all objects; removed tSine, now redundant to the more general tTable

Matthew Wang committed 6 years ago

Commit f9bde6c1 parent 65a3aed27 files · +3399 −1716Browse files

Unified · Split

27 files
  1. .gitignore +1 −1
  2. leaf/Inc/leaf-analysis.h +153 −169
  3. leaf/Inc/leaf-delay.h +120 −216
  4. leaf/Inc/leaf-distortion.h +36 −88
  5. leaf/Inc/leaf-dynamics.h +21 −62
  6. leaf/Inc/leaf-effects.h +450 −12
  7. leaf/Inc/leaf-electrical.h +60 −0
  8. leaf/Inc/leaf-envelopes.h +619 −222
  9. leaf/Inc/leaf-filters.h +540 −61
  10. leaf/Inc/leaf-instruments.h +240 −4
  11. leaf/Inc/leaf-math.h +7 −7
  12. leaf/Inc/leaf-mempool.h +2 −1
  13. leaf/Inc/leaf-midi.h +270 −325
  14. leaf/Inc/leaf-oscillators.h +120 −332
  15. leaf/Inc/leaf-physical.h +346 −39
  16. leaf/Inc/leaf-reverb.h +140 −10
  17. leaf/Inc/leaf-sampling.h +189 −18
  18. leaf/Inc/leaf-tables.h +7 −0
  19. leaf/Src/leaf-distortion.c +2 −2
  20. leaf/Src/leaf-dynamics.c +4 −4
  21. leaf/Src/leaf-envelopes.c +33 −33
  22. leaf/Src/leaf-filters.c +2 −2
  23. leaf/Src/leaf-instruments.c +13 −13
  24. leaf/Src/leaf-math.c +5 −5
  25. leaf/Src/leaf-midi.c +11 −11
  26. leaf/Src/leaf-oscillators.c +0 −70
  27. leaf/leaf.h +8 −9
.gitignore+1−1
@@ -10,4 +10,4 @@ · 9 unmodified lines
1010 *.swp
1111 */Builds
1212 */JuceLibraryCode
13−doxygen/html
13+doxygen/leaf
leaf/Inc/leaf-analysis.h+153−169
@@ -37,45 +37,32 @@ extern "C" { · 36 unmodified lines
3737 @ingroup analysis
3838 @brief
3939 @{
40− */
41−
42− /*!
40+
4341 @fn void tEnvelopeFollower_init (tEnvelopeFollower* const, float attackThreshold, float decayCoeff)
4442 @brief
4543 @param
46− */
47−
48− /*!
44+
4945 @fn void tEnvelopeFollower_initToPool (tEnvelopeFollower* const, float attackThreshold, float decayCoeff, tMempool* const)
5046 @brief
5147 @param
52− */
53−
54− /*!
48+
5549 @fn void tEnvelopeFollower_free (tEnvelopeFollower* const)
5650 @brief
5751 @param
58− */
59−
60− /*!
52+
6153 @fn float tEnvelopeFollower_tick (tEnvelopeFollower* const, float x)
6254 @brief
6355 @param
64− */
65−
66− /*!
56+
6757 @fn int tEnvelopeFollower_decayCoeff (tEnvelopeFollower* const, float decayCoeff)
6858 @brief
6959 @param
70− */
71−
72− /*!
60+
7361 @fn int tEnvelopeFollower_attackThresh (tEnvelopeFollower* const, float attackThresh)
7462 @brief
7563 @param
76− */
77−
78− /*! @} */
64+ 
65+ @} */
7966
8067 typedef struct _tEnvelopeFollower
8168 {
@@ -103,39 +90,28 @@ extern "C" { · 21 unmodified lines
10390 @ingroup analysis
10491 @brief
10592 @{
106− */
107−
108− /*!
93+
10994 @fn void tZeroCrossing_init (tZeroCrossing* const, int maxWindowSize)
11095 @brief
11196 @param
112− */
113−
114− /*!
97+
11598 @fn void tZeroCrossing_initToPool (tZeroCrossing* const, int maxWindowSize, tMempool* const)
11699 @brief
117100 @param
118− */
119−
120− /*!
101+
121102 @fn void tZeroCrossing_free (tZeroCrossing* const)
122103 @brief
123104 @param
124− */
125−
126− /*!
105+
127106 @fn float tZeroCrossing_tick (tZeroCrossing* const, float input)
128107 @brief
129108 @param
130− */
131−
132− /*!
109+
133110 @fn void tZeroCrossing_setWindow (tZeroCrossing* const, float windowSize)
134111 @brief
135112 @param
136− */
137−
138− /*! @} */
113+ 
114+ @} */
139115
140116 /* Zero Crossing Detector */
141117 typedef struct _tZeroCrossing {
@@ -166,45 +142,32 @@ extern "C" { · 24 unmodified lines
166142 @ingroup analysis
167143 @brief
168144 @{
169− */
170−
171− /*!
145+
172146 @fn void tPowerFollower_init (tPowerFollower* const, float factor)
173147 @brief
174148 @param
175− */
176−
177− /*!
149+
178150 @fn void tPowerFollower_initToPool (tPowerFollower* const, float factor, tMempool* const)
179151 @brief
180152 @param
181− */
182−
183− /*!
153+
184154 @fn void tPowerFollower_free (tPowerFollower* const)
185155 @brief
186156 @param
187− */
188−
189− /*!
157+
190158 @fn float tPowerFollower_tick (tPowerFollower* const, float input)
191159 @brief
192160 @param
193− */
194−
195− /*!
161+
196162 @fn float tPowerFollower_sample (tPowerFollower* const)
197163 @brief
198164 @param
199− */
200−
201− /*!
165+
202166 @fn int tPowerFollower_setFactor (tPowerFollower* const, float factor)
203167 @brief
204168 @param
205− */
206−
207− /*! @} */
169+ 
170+ @} */
208171
209172 /* PowerEnvelopeFollower */
210173 typedef struct _tPowerFollower
@@ -232,40 +195,28 @@ extern "C" { · 21 unmodified lines
232195 @ingroup analysis
233196 @brief
234197 @{
235− */
236−
237− /*!
198+
238199 @fn void tEnvPD_init (tEnvPD* const, int windowSize, int hopSize, int blockSize)
239200 @brief
240201 @param
241− */
242−
243− /*!
202+
244203 @fn void tEnvPD_initToPool (tEnvPD* const, int windowSize, int hopSize, int blockSize, tMempool* const)
245204 @brief
246205 @param
247− */
248−
249− /*!
206+
250207 @fn void tEnvPD_free (tEnvPD* const)
251208 @brief
252209 @param
253− */
254−
255−
256− /*!
210+
257211 @fn float tEnvPD_tick (tEnvPD* const)
258212 @brief
259213 @param
260− */
261−
262− /*!
214+
263215 @fn void tEnvPD_processBlock (tEnvPD* const, float* in)
264216 @brief
265217 @param
266− */
267−
268− /*! @} */
218+ 
219+ @} */
269220
270221 // ENV~ from PD, modified for LEAF
271222 #define MAXOVERLAP 32
@@ -304,63 +255,44 @@ extern "C" { · 32 unmodified lines
304255 @ingroup analysis
305256 @brief
306257 @{
307− */
308−
309− /*!
258+
310259 @fn void tAttackDetection_init (tAttackDetection* const, int blocksize, int atk, int rel)
311260 @brief
312261 @param
313− */
314−
315− /*!
262+
316263 @fn void tAttackDetection_initToPool (tAttackDetection* const, int blocksize, int atk, int rel, tMempool* const)
317264 @brief
318265 @param
319− */
320−
321− /*!
266+
322267 @fn void tAttackDetection_free (tAttackDetection* const)
323268 @brief
324269 @param
325− */
326−
327− /*!
270+
328271 @fn void tAttackDetection_setBlocksize (tAttackDetection* const, int size)
329272 @brief Set expected input blocksize
330273 @param
331− */
332−
333− /*!
274+
334275 @fn void tAttackDetection_setSamplerate (tAttackDetection* const, int inRate)
335276 @brief Set attack detection sample rate
336277 @param
337− */
338−
339− /*!
278+
340279 @fn void tAttackDetection_setAttack (tAttackDetection* const, int inAtk)
341280 @brief Set attack time and coeff
342281 @param
343− */
344−
345− /*!
282+
346283 @fn void tAttackDetection_setRelease (tAttackDetection* const, int inRel)
347284 @brief Set release time and coeff
348285 @param
349− */
350−
351− /*!
286+
352287 @fn void tAttackDetection_setThreshold (tAttackDetection* const, float thres)
353288 @brief Set level above which values are identified as attacks
354289 @param
355− */
356−
357− /*!
290+
358291 @fn int tAttackDetection_detect (tAttackDetection* const, float *in)
359292 @brief Find the largest transient in input block, return index of attack
360293 @param
361− */
362−
363− /*! @} */
294+ 
295+ @} */
364296
365297 #define DEFBLOCKSIZE 1024
366298 #define DEFTHRESHOLD 6
@@ -410,63 +342,44 @@ extern "C" { · 43 unmodified lines
410342 @ingroup analysis
411343 @brief Period detection algorithm from Katja Vetters http://www.katjaas.nl/helmholtz/helmholtz.html
412344 @{
413− */
414−
415− /*!
345+
416346 @fn void tSNAC_init (tSNAC* const, int overlaparg)
417347 @brief
418348 @param
419− */
420−
421− /*!
349+
422350 @fn void tSNAC_initToPool (tSNAC* const, int overlaparg, tMempool* const)
423351 @brief
424352 @param
425− */
426−
427− /*!
353+
428354 @fn void tSNAC_free (tSNAC* const)
429355 @brief
430356 @param
431− */
432−
433− /*!
357+
434358 @fn void tSNAC_ioSamples (tSNAC *s, float *in, float *out, int size)
435359 @brief
436360 @param
437− */
438−
439− /*!
361+
440362 @fn void tSNAC_setOverlap (tSNAC *s, int lap)
441363 @brief
442364 @param
443− */
444−
445− /*!
365+
446366 @fn void tSNAC_setBias (tSNAC *s, float bias)
447367 @brief
448368 @param
449− */
450−
451− /*!
369+
452370 @fn void tSNAC_setMinRMS (tSNAC *s, float rms)
453371 @brief
454372 @param
455− */
456−
457− /*!
373+
458374 @fn float tSNAC_getPeriod (tSNAC *s)
459375 @brief
460376 @param
461− */
462−
463− /*!
377+
464378 @fn float tSNAC_getFidelity (tSNAC *s)
465379 @brief
466380 @param
467− */
468−
469− /*! @} */
381+ 
382+ @} */
470383
471384 #define SNAC_FRAME_SIZE 1024 // default analysis framesize // should be the same as (or smaller than?) PS_FRAME_SIZE
472385 #define DEFOVERLAP 1 // default overlap
@@ -522,63 +435,44 @@ extern "C" { · 49 unmodified lines
522435 @fn void tPeriodDetection_init (tPeriodDetection* const, float* in, float* out, int bufSize, int frameSize)
523436 @brief
524437 @param
525− */
526−
527− /*!
438+
528439 @fn void tPeriodDetection_initToPool (tPeriodDetection* const, float* in, float* out, int bufSize, int frameSize, tMempool* const)
529440 @brief
530441 @param
531− */
532−
533− /*!
442+
534443 @fn void tPeriodDetection_free (tPeriodDetection* const)
535444 @brief
536445 @param
537− */
538−
539− /*!
446+
540447 @fn float tPeriodDetection_tick (tPeriodDetection* const, float sample)
541448 @brief
542449 @param
543− */
544−
545− /*!
450+
546451 @fn float tPeriodDetection_getPeriod (tPeriodDetection* const)
547452 @brief
548453 @param
549− */
550−
551− /*!
454+
552455 @fn void tPeriodDetection_setHopSize (tPeriodDetection* const, int hs)
553456 @brief
554457 @param
555− */
556−
557− /*!
458+
558459 @fn void tPeriodDetection_setWindowSize (tPeriodDetection* const, int ws)
559460 @brief
560461 @param
561− */
562−
563− /*!
462+
564463 @fn void tPeriodDetection_setFidelityThreshold(tPeriodDetection* const, float threshold)
565464 @brief
566465 @param
567− */
568−
569− /*!
466+
570467 @fn void tPeriodDetection_setAlpha (tPeriodDetection* const, float alpha)
571468 @brief
572469 @param
573− */
574−
575− /*!
470+
576471 @fn void tPeriodDetection_setTolerance (tPeriodDetection* const, float tolerance)
577472 @brief
578473 @param
579− */
580−
581− /*! @} */
474+ 
475+ @} */
582476
583477 #define DEFPITCHRATIO 2.0f
584478 #define DEFTIMECONSTANT 100.0f
@@ -640,6 +534,8 @@ extern "C" { · 55 unmodified lines
640534
641535 //==============================================================================
642536
537+ // Maybe keep these up to PeriodDetector internal?
538+
643539 typedef struct _tZeroCrossing2
644540 {
645541 tMempool mempool;
@@ -761,6 +657,50 @@ extern "C" { · 115 unmodified lines
761657
762658 //==============================================================================
763659
660+ /*!
661+ @defgroup tperioddetector tPeriodDetector
662+ @ingroup analysis
663+ @brief
664+ @{
665+
666+ @fn void tPeriodDetector_init (tPeriodDetector* const detector, float lowestFreq, float highestFreq, float hysteresis)
667+ @brief
668+ @param
669+
670+ @fn void tPeriodDetector_initToPool (tPeriodDetector* const detector, float lowestFreq, float highestFreq, float hysteresis, tMempool* const mempool)
671+ @brief
672+ @param
673+
674+ @fn void tPeriodDetector_free (tPeriodDetector* const detector)
675+ @brief
676+ @param
677+
678+ @fn int tPeriodDetector_tick (tPeriodDetector* const detector, float sample)
679+ @brief
680+ @param
681+
682+ @fn float tPeriodDetector_getPeriod (tPeriodDetector* const detector)
683+ @brief Get the periodicity for a given harmonic of the detected pitch.
684+ @param
685+
686+ @fn float tPeriodDetector_getPeriodicity (tPeriodDetector* const detector)
687+ @brief
688+ @param
689+
690+ @fn float tPeriodDetector_harmonic (tPeriodDetector* const detector, int harmonicIndex)
691+ @brief
692+ @param
693+
694+ @fn float tPeriodDetector_predictPeriod (tPeriodDetector* const detector)
695+ @brief
696+ @param
697+
698+ @fn int tPeriodDetector_isReady (tPeriodDetector* const detector)
699+ @brief
700+ @param
701+ 
702+ @} */
703+
764704 #define PULSE_THRESHOLD 0.6f
765705 #define HARMONIC_PERIODICITY_FACTOR 16
766706 #define PERIODICITY_DIFF_FACTOR 0.008f
@@ -827,6 +767,50 @@ extern "C" { · 60 unmodified lines
827767
828768 //==============================================================================
829769
770+ /*!
771+ @defgroup tpitchdetector tPitchDetector
772+ @ingroup analysis
773+ @brief
774+ @{
775+
776+ @fn void tPitchDetector_init (tPitchDetector* const detector, float lowestFreq, float highestFreq, float hysteresis)
777+ @brief
778+ @param
779+
780+ @fn void tPitchDetector_initToPool (tPitchDetector* const detector, float lowestFreq, float highestFreq, float hysteresis, tMempool* const mempool)
781+ @brief
782+ @param
783+
784+ @fn void tPitchDetector_free (tPitchDetector* const detector)
785+ @brief
786+ @param
787+
788+ @fn int tPitchDetector_tick (tPitchDetector* const detector, float sample)
789+ @brief
790+ @param
791+
792+ @fn float tPitchDetector_getFrequency (tPitchDetector* const detector)
793+ @brief
794+ @param
795+
796+ @fn float tPitchDetector_getPeriodicity (tPitchDetector* const detector)
797+ @brief
798+ @param
799+
800+ @fn float tPitchDetector_harmonic (tPitchDetector* const detector, int harmonicIndex)
801+ @brief
802+ @param
803+
804+ @fn float tPitchDetector_predictFrequency (tPitchDetector* const detector, int init)
805+ @brief
806+ @param
807+
808+ @fn void tPitchDetector_reset (tPitchDetector* const detector)
809+ @brief
810+ @param
811+ 
812+ @} */
813+
830814 #define MAX_DEVIATION 0.9f
831815 #define MIN_PERIODICITY 0.8f
832816
leaf/Inc/leaf-delay.h+120−216
@@ -33,81 +33,56 @@ extern "C" { · 32 unmodified lines
3333 @ingroup delay
3434 @brief Non-interpolating delay, reimplemented from STK (Cook and Scavone).
3535 @{
36− */
37−
38− /*!
36+
3937 @fn void tDelay_init (tDelay* const, uint32_t delay, uint32_t maxDelay)
4038 @brief
4139 @param
42− */
43−
44− /*!
40+
4541 @fn void tDelay_initToPool (tDelay* const, uint32_t delay, uint32_t maxDelay, tMempool* const)
4642 @brief
4743 @param
48− */
49−
50− /*!
44+
5145 @fn void tDelay_free (tDelay* const)
5246 @brief
5347 @param
54− */
55−
56− /*!
48+
5749 @fn void tDelay_clear (tDelay* const)
5850 @brief
5951 @param
60− */
61−
62− /*!
52+
6353 @fn int tDelay_setDelay (tDelay* const, uint32_t delay)
6454 @brief
6555 @param
66− */
67−
68− /*!
56+
6957 @fn uint32_t tDelay_getDelay (tDelay* const)
7058 @brief
7159 @param
72− */
73−
74− /*!
60+
7561 @fn void tDelay_tapIn (tDelay* const, float in, uint32_t tapDelay)
7662 @brief
7763 @param
78− */
79−
80− /*!
64+
8165 @fn float tDelay_tapOut (tDelay* const, uint32_t tapDelay)
8266 @brief
8367 @param
84− */
85−
86− /*!
68+
8769 @fn float tDelay_addTo (tDelay* const, float value, uint32_t tapDelay)
8870 @brief
8971 @param
90− */
91−
92− /*!
72+
9373 @fn float tDelay_tick (tDelay* const, float sample)
9474 @brief
9575 @param
96− */
97−
98− /*!
76+
9977 @fn float tDelay_getLastOut (tDelay* const)
10078 @brief
10179 @param
102− */
103−
104− /*!
80+
10581 @fn float tDelay_getLastIn (tDelay* const)
10682 @brief
10783 @param
108− */
109−
110− /*! @} */
84+ 
85+ @} */
11186
11287 typedef struct _tDelay
11388 {
@@ -147,93 +122,64 @@ extern "C" { · 33 unmodified lines
147122 @ingroup delay
148123 @brief Linearly-interpolating delay, reimplemented from STK (Cook and Scavone).
149124 @{
150− */
151−
152− /*!
125+
153126 @fn void tLinearDelay_init (tLinearDelay* const, float delay, uint32_t maxDelay)
154127 @brief
155128 @param
156− */
157−
158− /*!
129+
159130 @fn void tLinearDelay_initToPool (tLinearDelay* const, float delay, uint32_t maxDelay, tMempool* const)
160131 @brief
161132 @param
162− */
163−
164− /*!
133+
165134 @fn void tLinearDelay_free (tLinearDelay* const)
166135 @brief
167136 @param
168− */
169−
170− /*!
137+
171138 @fn void tLinearDelay_clear (tLinearDelay* const dl)
172139 @brief
173140 @param
174− */
175−
176− /*!
141+
177142 @fn int tLinearDelay_setDelay (tLinearDelay* const, float delay)
178143 @brief
179144 @param
180− */
181−
182− /*!
145+
183146 @fn float tLinearDelay_getDelay (tLinearDelay* const)
184147 @brief
185148 @param
186− */
187−
188− /*!
149+
189150 @fn void tLinearDelay_tapIn (tLinearDelay* const, float in, uint32_t tapDelay)
190151 @brief
191152 @param
192− */
193−
194− /*!
153+
195154 @fn float tLinearDelay_tapOut (tLinearDelay* const, uint32_t tapDelay)
196155 @brief
197156 @param
198− */
199−
200− /*!
157+
201158 @fn float tLinearDelay_addTo (tLinearDelay* const, float value, uint32_t tapDelay)
202159 @brief
203160 @param
204− */
205−
206− /*!
161+
207162 @fn float tLinearDelay_tick (tLinearDelay* const, float sample)
208163 @brief
209164 @param
210− */
211−
212− /*!
165+
213166 @fn void tLinearDelay_tickIn (tLinearDelay* const, float input)
214167 @brief
215168 @param
216− */
217−
218− /*!
169+
219170 @fn float tLinearDelay_tickOut (tLinearDelay* const)
220171 @brief
221172 @param
222− */
223−
224− /*!
173+
225174 @fn float tLinearDelay_getLastOut (tLinearDelay* const)
226175 @brief
227176 @param
228− */
229−
230− /*!
177+
231178 @fn float tLinearDelay_getLastIn (tLinearDelay* const)
232179 @brief
233180 @param
234− */
235−
236− /*! @} */
181+ 
182+ @} */
237183
238184 typedef struct _tLinearDelay
239185 {
@@ -281,105 +227,72 @@ extern "C" { · 41 unmodified lines
281227 @ingroup delay
282228 @brief Hermite-interpolating delay, created by adapting STK linear delay with Hermite interpolation.
283229 @{
284− */
285−
286− /*!
230+
287231 @fn void tHermiteDelay_init (tHermiteDelay* const dl, float delay, uint32_t maxDelay)
288232 @brief
289233 @param
290− */
291−
292− /*!
234+
293235 @fn void tHermiteDelay_initToPool (tHermiteDelay* const dl, float delay, uint32_t maxDelay, tMempool* const mp)
294236 @brief
295237 @param
296− */
297−
298− /*!
238+
299239 @fn void tHermiteDelay_free (tHermiteDelay* const dl)
300240 @brief
301241 @param
302− */
303−
304− /*!
242+
305243 @fn void tHermiteDelay_clear (tHermiteDelay* const dl)
306244 @brief
307245 @param
308− */
309−
310− /*!
246+
311247 @fn float tHermiteDelay_tick (tHermiteDelay* const dl, float input)
312248 @brief
313249 @param
314− */
315−
316− /*!
250+
317251 @fn void tHermiteDelay_tickIn (tHermiteDelay* const dl, float input)
318252 @brief
319253 @param
320− */
321−
322− /*!
254+
323255 @fn float tHermiteDelay_tickOut (tHermiteDelay* const dl)
324256 @brief
325257 @param
326− */
327−
328− /*!
258+
329259 @fn int tHermiteDelay_setDelay (tHermiteDelay* const dl, float delay)
330260 @brief
331261 @param
332− */
333−
334− /*!
262+
335263 @fn float tHermiteDelay_tapOut (tHermiteDelay* const dl, uint32_t tapDelay)
336264 @brief
337265 @param
338− */
339−
340− /*!
266+
341267 @fn void tHermiteDelay_tapIn (tHermiteDelay* const dl, float value, uint32_t tapDelay)
342268 @brief
343269 @param
344− */
345−
346− /*!
270+
347271 @fn float tHermiteDelay_addTo (tHermiteDelay* const dl, float value, uint32_t tapDelay)
348272 @brief
349273 @param
350− */
351−
352− /*!
274+
353275 @fn float tHermiteDelay_getDelay (tHermiteDelay* const dl)
354276 @brief
355277 @param
356− */
357−
358− /*!
278+
359279 @fn float tHermiteDelay_getLastOut (tHermiteDelay* const dl)
360280 @brief
361281 @param
362− */
363−
364− /*!
282+
365283 @fn float tHermiteDelay_getLastIn (tHermiteDelay* const dl)
366284 @brief
367285 @param
368− */
369−
370− /*!
286+
371287 @fn void tHermiteDelay_setGain (tHermiteDelay* const dl, float gain)
372288 @brief
373289 @param
374− */
375−
376− /*!
290+
377291 @fn float tHermiteDelay_getGain (tHermiteDelay* const dl)
378292 @brief
379293 @param
380− */
381−
382− /*! @} */
294+ 
295+ @} */
383296
384297 typedef struct _tHermiteDelay
385298 {
@@ -427,81 +340,56 @@ extern "C" { · 41 unmodified lines
427340 @ingroup delay
428341 @brief Allpass-interpolating delay, reimplemented from STK (Cook and Scavone).
429342 @{
430− */
431−
432− /*!
343+
433344 @fn void tAllpassDelay_init (tAllpassDelay* const, float delay, uint32_t maxDelay)
434345 @brief
435346 @param
436− */
437−
438− /*!
347+
439348 @fn void tAllpassDelay_initToPool (tAllpassDelay* const, float delay, uint32_t maxDelay, tMempool* const)
440349 @brief
441350 @param
442− */
443−
444− /*!
351+
445352 @fn void tAllpassDelay_free (tAllpassDelay* const)
446353 @brief
447354 @param
448− */
449−
450− /*!
355+
451356 @fn void tAllpassDelay_clear (tAllpassDelay* const)
452357 @brief
453358 @param
454− */
455−
456− /*!
359+
457360 @fn int tAllpassDelay_setDelay (tAllpassDelay* const, float delay)
458361 @brief
459362 @param
460− */
461−
462− /*!
363+
463364 @fn float tAllpassDelay_getDelay (tAllpassDelay* const)
464365 @brief
465366 @param
466− */
467−
468− /*!
367+
469368 @fn void tAllpassDelay_tapIn (tAllpassDelay* const, float in, uint32_t tapDelay)
470369 @brief
471370 @param
472− */
473−
474− /*!
371+
475372 @fn float tAllpassDelay_tapOut (tAllpassDelay* const, uint32_t tapDelay)
476373 @brief
477374 @param
478− */
479−
480− /*!
375+
481376 @fn float tAllpassDelay_addTo (tAllpassDelay* const, float value, uint32_t tapDelay)
482377 @brief
483378 @param
484− */
485−
486− /*!
379+
487380 @fn float tAllpassDelay_tick (tAllpassDelay* const, float sample)
488381 @brief
489382 @param
490− */
491−
492− /*!
383+
493384 @fn float tAllpassDelay_getLastOut (tAllpassDelay* const)
494385 @brief
495386 @param
496− */
497−
498− /*!
387+
499388 @fn float tAllpassDelay_getLastIn (tAllpassDelay* const)
500389 @brief
501390 @param
502− */
503−
504− /*! @} */
391+ 
392+ @} */
505393
506394 typedef struct _tAllpassDelay
507395 {
@@ -547,87 +435,60 @@ extern "C" { · 39 unmodified lines
547435 @ingroup delay
548436 @brief Linear interpolating delay with fixed read and write pointers, variable rate.
549437 @{
550− */
551−
552− /*!
438+
553439 @fn void tTapeDelay_init (tTapeDelay* const, float delay, uint32_t maxDelay)
554440 @brief
555441 @param
556− */
557−
558− /*!
442+
559443 @fn void tTapeDelay_initToPool (tTapeDelay* const, float delay, uint32_t maxDelay, tMempool* const)
560444 @brief
561445 @param
562− */
563−
564− /*!
446+
565447 @fn void tTapeDelay_free (tTapeDelay* const)
566448 @brief
567449 @param
568− */
569−
570− /*!
450+
571451 @fn void tTapeDelay_clear (tTapeDelay* const)
572452 @brief
573453 @param
574− */
575−
576− /*!
454+
577455 @fn void tTapeDelay_setDelay (tTapeDelay* const, float delay)
578456 @brief
579457 @param
580− */
581−
582− /*!
458+
583459 @fn float tTapeDelay_getDelay (tTapeDelay* const)
584460 @brief
585461 @param
586− */
587−
588− /*!
462+
589463 @fn void tTapeDelay_tapIn (tTapeDelay* const, float in, uint32_t tapDelay)
590464 @brief
591465 @param
592− */
593−
594− /*!
466+
595467 @fn float tTapeDelay_tapOut (tTapeDelay* const d, float tapDelay)
596468 @brief
597469 @param
598− */
599−
600− /*!
470+
601471 @fn float tTapeDelay_addTo (tTapeDelay* const, float value, uint32_t tapDelay)
602472 @brief
603473 @param
604− */
605−
606− /*!
474+
607475 @fn float tTapeDelay_tick (tTapeDelay* const, float sample)
608476 @brief
609477 @param
610− */
611−
612− /*!
478+
613479 @fn void tTapeDelay_incrementInPoint(tTapeDelay* const dl)
614480 @brief
615481 @param
616− */
617−
618− /*!
482+
619483 @fn float tTapeDelay_getLastOut (tTapeDelay* const)
620484 @brief
621485 @param
622− */
623−
624− /*!
486+
625487 @fn float tTapeDelay_getLastIn (tTapeDelay* const)
626488 @brief
627489 @param
628− */
629−
630− /*! @} */
490+ 
491+ @} */
631492
632493 typedef struct _tTapeDelay
633494 {
@@ -667,6 +528,49 @@ extern "C" { · 33 unmodified lines
667528
668529 //==============================================================================
669530
531+ /*!
532+ @defgroup tringbuffer tRingBuffer
533+ @ingroup delay
534+ @brief
535+ @{
536+
537+ @fn void tRingBuffer_init (tRingBuffer* const ring, int size)
538+ @brief
539+ @param
540+
541+ @fn void tRingBuffer_initToPool (tRingBuffer* const ring, int size, tMempool* const mempool)
542+ @brief
543+ @param
544+
545+ @fn void tRingBuffer_free (tRingBuffer* const ring)
546+ @brief
547+ @param
548+
549+ @fn void tRingBuffer_push (tRingBuffer* const ring, float val)
550+ @brief
551+ @param
552+
553+ @fn float tRingBuffer_getNewest (tRingBuffer* const ring)
554+ @brief
555+ @param
556+
557+ @fn float tRingBuffer_getOldest (tRingBuffer* const ring)
558+ @brief
559+ @param
560+
561+ @fn float tRingBuffer_get (tRingBuffer* const ring, int index)
562+ @brief
563+ @param
564+
565+ @fn float tRingBuffer_clear (tRingBuffer* const ring)
566+ @brief
567+ @param
568+
569+ @fn int tRingBuffer_getSize (tRingBuffer* const ring)
570+ @brief
571+ @param
572+ 
573+ @} */
670574 typedef struct _tRingBuffer
671575 {
672576 tMempool mempool;
leaf/Inc/leaf-distortion.h+36−88
@@ -34,39 +34,28 @@ extern "C" { · 33 unmodified lines
3434 @ingroup distortion
3535 @brief
3636 @{
37− */
38−
39− /*!
37+
4038 @fn void tSampleReducer_init (tSampleReducer* const)
4139 @brief
4240 @param
43− */
44−
45− /*!
41+
4642 @fn void tSampleReducer_initToPool (tSampleReducer* const, tMempool* const)
4743 @brief
4844 @param
49− */
50−
51− /*!
45+
5246 @fn void tSampleReducer_free (tSampleReducer* const)
5347 @brief
5448 @param
55− */
56−
57− /*!
49+
5850 @fn float tSampleReducer_tick (tSampleReducer* const, float input)
5951 @brief
6052 @param
61− */
62−
63− /*!
53+
6454 @fn void tSampleReducer_setRatio (tSampleReducer* const, float ratio)
6555 @brief
6656 @param
67− */
68−
69− /*! @} */
57+ 
58+ @} */
7059
7160 typedef struct _tSampleReducer
7261 {
@@ -92,51 +81,36 @@ extern "C" { · 19 unmodified lines
9281 @ingroup distortion
9382 @brief
9483 @{
95− */
96−
97− /*!
98− @fn void tOversampler_init (tOversampler* const, int order, oBool extraQuality)
84+
85+ @fn void tOversampler_init (tOversampler* const, int order, int extraQuality)
9986 @brief
10087 @param
101− */
102−
103− /*!
104− @fn void tOversampler_initToPool (tOversampler* const, int order, oBool extraQuality, tMempool* const)
88+
89+ @fn void tOversampler_initToPool (tOversampler* const, int order, int extraQuality, tMempool* const)
10590 @brief
10691 @param
107− */
108−
109− /*!
92+
11093 @fn void tOversampler_free (tOversampler* const)
11194 @brief
11295 @param
113− */
114−
115− /*!
96+
11697 @fn void tOversampler_upsample (tOversampler* const, float input, float* output)
11798 @brief
11899 @param
119− */
120−
121− /*!
100+
122101 @fn float tOversampler_downsample (tOversampler* const os, float* input)
123102 @brief
124103 @param
125− */
126−
127− /*!
104+
128105 @fn float tOversampler_tick (tOversampler* const, float input, float* oversample, float (*effectTick)(float))
129106 @brief
130107 @param
131− */
132−
133− /*!
108+
134109 @fn int tOversampler_getLatency (tOversampler* const os)
135110 @brief
136111 @param
137− */
138−
139− /*! @} */
112+ 
113+ @} */
140114
141115 typedef struct _tOversampler
142116 {
@@ -151,8 +125,8 @@ extern "C" { · 8 unmodified lines
151125
152126 typedef _tOversampler* tOversampler;
153127
154− void tOversampler_init (tOversampler* const, int order, oBool extraQuality);
155− void tOversampler_initToPool (tOversampler* const, int order, oBool extraQuality, tMempool* const);
128+ void tOversampler_init (tOversampler* const, int order, int extraQuality);
129+ void tOversampler_initToPool (tOversampler* const, int order, int extraQuality, tMempool* const);
156130 void tOversampler_free (tOversampler* const);
157131
158132 void tOversampler_upsample (tOversampler* const, float input, float* output);
@@ -167,33 +141,24 @@ extern "C" { · 8 unmodified lines
167141 @ingroup distortion
168142 @brief
169143 @{
170− */
171−
172− /*!
144+
173145 @fn void tLockhartWavefolder_init (tLockhartWavefolder* const)
174146 @brief
175147 @param
176− */
177−
178− /*!
148+
179149 @fn void tLockhartWavefolder_initToPool (tLockhartWavefolder* const, tMempool* const)
180150 @brief
181151 @param
182− */
183−
184− /*!
152+
185153 @fn void tLockhartWavefolder_free (tLockhartWavefolder* const)
186154 @brief
187155 @param
188− */
189−
190− /*!
156+
191157 @fn float tLockhartWavefolder_tick (tLockhartWavefolder* const, float samp)
192158 @brief
193159 @param
194− */
195−
196− /*! @} */
160+ 
161+ @} */
197162
198163 typedef struct _tLockhartWavefolder
199164 {
@@ -241,57 +206,40 @@ extern "C" { · 41 unmodified lines
241206 @ingroup distortion
242207 @brief
243208 @{
244− */
245−
246− /*!
209+
247210 @fn void tCrusher_init (tCrusher* const)
248211 @brief
249212 @param
250− */
251−
252− /*!
213+
253214 @fn void tCrusher_initToPool (tCrusher* const, tMempool* const)
254215 @brief
255216 @param
256− */
257−
258− /*!
217+
259218 @fn void tCrusher_free (tCrusher* const)
260219 @brief
261220 @param
262− */
263−
264− /*!
221+
265222 @fn float tCrusher_tick (tCrusher* const, float input)
266223 @brief
267224 @param
268− */
269−
270− /*!
225+
271226 @fn void tCrusher_setOperation (tCrusher* const, float op)
272227 @brief
273228 @param 0.0 - 1.0
274− */
275−
276− /*!
229+
277230 @fn void tCrusher_setQuality (tCrusher* const, float val)
278231 @brief
279232 @param 0.0 - 1.0
280− */
281−
282− /*!
233+
283234 @fn void tCrusher_setRound (tCrusher* const, float rnd)
284235 @brief
285236 @param what division to round to
286− */
287−
288− /*!
237+
289238 @fn void tCrusher_setSamplingRatio (tCrusher* const, float ratio)
290239 @brief
291240 @param sampling ratio
292− */
293−
294− /*! @} */
241+ 
242+ @} */
295243
296244 typedef struct _tCrusher
297245 {
leaf/Inc/leaf-dynamics.h+21−62
@@ -36,33 +36,24 @@ extern "C" { · 35 unmodified lines
3636 @ingroup dynamics
3737 @brief
3838 @{
39− */
40−
41− /*!
39+
4240 @fn void tCompressor_init (tCompressor* const)
4341 @brief
4442 @param
45− */
4643
47− /*!
4844 @fn void tCompressor_initToPool (tCompressor* const, tMempool* const)
4945 @brief
5046 @param
51− */
5247
53− /*!
5448 @fn void tCompressor_free (tCompressor* const)
5549 @brief
5650 @param
57− */
58−
59− /*!
51+
6052 @fn float tCompressor_tick (tCompressor* const, float input)
6153 @brief
6254 @param
63− */
64−
65− /*! @} */
55+ 
56+ @} */
6657
6758 typedef struct _tCompressor
6859 {
@@ -73,7 +64,7 @@ extern "C" { · 4 unmodified lines
7364
7465 float x_G[2], y_G[2], x_T[2], y_T[2];
7566
76− oBool isActive;
67+ int isActive;
7768
7869 } _tCompressor;
7970
@@ -89,66 +80,47 @@ extern "C" { · 9 unmodified lines
8980 /*!
9081 @defgroup tfeedbackleveler tFeedbackLeveler
9182 @ingroup dynamics
92− @brief
83+ @brief An auto VCA that you put into a feedback circuit to make it stay at the same level.
9384 @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.
9485 @{
95− */
96−
97− /*!
86+
9887 @fn void tFeedbackLeveler_init (tFeedbackLeveler* const, float targetLevel, float factor, float strength, int mode)
9988 @brief
10089 @param
101− */
102−
103− /*!
90+
10491 @fn void tFeedbackLeveler_initToPool (tFeedbackLeveler* const, float targetLevel, float factor, float strength, int mode, tMempool* const)
10592 @brief
10693 @param
107− */
108−
109− /*!
94+
11095 @fn void tFeedbackLeveler_free (tFeedbackLeveler* const)
11196 @brief
11297 @param
113− */
114−
115− /*!
98+
11699 @fn float tFeedbackLeveler_tick (tFeedbackLeveler* const, float input)
117100 @brief
118101 @param
119− */
120−
121− /*!
102+
122103 @fn float tFeedbackLeveler_sample (tFeedbackLeveler* const)
123104 @brief
124105 @param
125− */
126−
127− /*!
106+
128107 @fn void tFeedbackLeveler_setTargetLevel (tFeedbackLeveler* const, float TargetLevel)
129108 @brief
130109 @param
131− */
132−
133− /*!
110+
134111 @fn void tFeedbackLeveler_setFactor (tFeedbackLeveler* const, float factor)
135112 @brief
136113 @param
137− */
138−
139− /*!
114+
140115 @fn void tFeedbackLeveler_setMode (tFeedbackLeveler* const, int mode)
141116 @brief
142− @param
143− */ // 0 for upwards limiting only, 1 for biderctional limiting
117+ @param 0 for upwards limiting only, 1 for biderctional limiting
144118
145− /*!
146119 @fn void tFeedbackLeveler_setStrength (tFeedbackLeveler* const, float strength)
147120 @brief
148121 @param
149− */
150−
151− /*! @} */
122+ 
123+ @} */
152124
153125 typedef struct _tFeedbackLeveler
154126 {
@@ -183,45 +155,32 @@ extern "C" { · 28 unmodified lines
183155 @ingroup dynamics
184156 @brief Threshold with hysteresis (like Max/MSP thresh~ object)
185157 @{
186− */
187−
188− /*!
158+
189159 @fn void tThreshold_init (tThreshold* const, float low, float high)
190160 @brief
191161 @param
192− */
193162
194− /*!
195163 @fn void tThreshold_initToPool (tThreshold* const, float low, float high, tMempool* const)
196164 @brief
197165 @param
198− */
199166
200− /*!
201167 @fn void tThreshold_free (tThreshold* const)
202168 @brief
203169 @param
204− */
205−
206− /*!
170+
207171 @fn int tThreshold_tick (tThreshold* const, float input)
208172 @brief
209173 @param
210− */
211174
212− /*!
213175 @fn void tThreshold_setLow (tThreshold* const, float low)
214176 @brief
215177 @param
216− */
217178
218− /*!
219179 @fn void tThreshold_setHigh (tThreshold* const, float high)
220180 @brief
221181 @param
222− */
223−
224− /*! @} */
182+
183+ @} */
225184
226185 typedef struct _tThreshold
227186 {
leaf/Inc/leaf-effects.h+450−12
@@ -24,7 +24,70 @@ extern "C" { · 23 unmodified lines
2424
2525 //==============================================================================
2626
27− /* tTalkbox */
27+ /*!
28+ @defgroup ttalkbox tTalkbox
29+ @ingroup effects
30+ @brief
31+ @{
32+
33+ @fn void tTalkbox_init (tTalkbox* const, int bufsize)
34+ @brief
35+ @param
36+
37+ @fn void tTalkbox_initToPool (tTalkbox* const, int bufsize, tMempool* const)
38+ @brief
39+ @param
40+
41+ @fn void tTalkbox_free (tTalkbox* const)
42+ @brief
43+ @param
44+
45+ @fn float tTalkbox_tick (tTalkbox* const, float synth, float voice)
46+ @brief
47+ @param
48+
49+ @fn float tTalkbox_tickFrozen (tTalkbox* const voc, float synth, float voice)
50+ @brief
51+ @param
52+
53+ @fn void tTalkbox_update (tTalkbox* const)
54+ @brief
55+ @param
56+
57+ @fn void tTalkbox_suspend (tTalkbox* const)
58+ @brief
59+ @param
60+
61+ @fn void tTalkbox_lpcDurbin (float *r, int p, float *k, float *g)
62+ @brief
63+ @param
64+
65+ @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)
66+ @brief
67+ @param
68+
69+ @fn void tTalkbox_setQuality (tTalkbox* const, float quality)
70+ @brief
71+ @param
72+
73+ @fn void tTalkbox_setWarpFactor (tTalkbox* const voc, float warp)
74+ @brief
75+ @param
76+
77+ @fn void tTalkbox_setWarpOn (tTalkbox* const voc, float warpOn)
78+ @brief
79+ @param
80+
81+ @fn void tTalkbox_setFreeze (tTalkbox* const voc, float freeze)
82+ @brief
83+ @param
84+
85+ @fn void tTalkbox_warpedAutocorrelate (float * x, double* dl, double* Rt, unsigned int L, float * R, unsigned int P, float lambda)
86+ @brief
87+ @param
88+
89+ @} */
90+
2891 #define NUM_TALKBOX_PARAM 4
2992
3093 typedef struct _tTalkbox
@@ -72,10 +135,74 @@ extern "C" { · 41 unmodified lines
72135 void tTalkbox_setWarpOn (tTalkbox* const voc, float warpOn);
73136 void tTalkbox_setFreeze (tTalkbox* const voc, float freeze);
74137 void tTalkbox_warpedAutocorrelate (float * x, double* dl, double* Rt, unsigned int L, float * R, unsigned int P, float lambda);
138+
139+
75140 //==============================================================================
76141
77142
78− ///////
143+ /*!
144+ @defgroup ttalkboxfloat tTalkboxFloat
145+ @ingroup effects
146+ @brief
147+ @{
148+
149+ @fn void tTalkboxFloat_init (tTalkboxFloat* const, int bufsize)
150+ @brief
151+ @param
152+
153+ @fn void tTalkboxFloat_initToPool (tTalkboxFloat* const, int bufsize, tMempool* const)
154+ @brief
155+ @param
156+
157+ @fn void tTalkboxFloat_free (tTalkboxFloat* const)
158+ @brief
159+ @param
160+
161+ @fn float tTalkboxFloat_tick (tTalkboxFloat* const, float synth, float voice)
162+ @brief
163+ @param
164+
165+ @fn float tTalkboxFloat_tickFrozen (tTalkboxFloat* const voc, float synth, float voice)
166+ @brief
167+ @param
168+
169+ @fn void tTalkboxFloat_update (tTalkboxFloat* const)
170+ @brief
171+ @param
172+
173+ @fn void tTalkboxFloat_suspend (tTalkboxFloat* const)
174+ @brief
175+ @param
176+
177+ @fn void tTalkboxFloat_lpcDurbin (float *r, int p, float *k, float *g)
178+ @brief
179+ @param
180+
181+ @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)
182+ @brief
183+ @param
184+
185+ @fn void tTalkboxFloat_setQuality (tTalkboxFloat* const, float quality)
186+ @brief
187+ @param
188+
189+ @fn void tTalkboxFloat_setWarpFactor (tTalkboxFloat* const voc, float warp)
190+ @brief
191+ @param
192+
193+ @fn void tTalkboxFloat_setWarpOn (tTalkboxFloat* const voc, float warpOn)
194+ @brief
195+ @param
196+
197+ @fn void tTalkboxFloat_setFreeze (tTalkboxFloat* const voc, float freeze)
198+ @brief
199+ @param
200+
201+ @fn void tTalkboxFloat_warpedAutocorrelate (float * x, float* dl, float* Rt, unsigned int L, float * R, unsigned int P, float lambda)
202+ @brief
203+ @param
204+
205+ @} */
79206
80207 typedef struct _tTalkboxFloat
81208 {
@@ -102,7 +229,6 @@ extern "C" { · 20 unmodified lines
102229 float* dl;
103230 float* Rt;
104231
105−
106232 } _tTalkboxFloat;
107233
108234 typedef _tTalkboxFloat* tTalkboxFloat;
@@ -125,8 +251,38 @@ extern "C" { · 16 unmodified lines
125251 //==============================================================================
126252
127253
128−
129− /* tVocoder */
254+ /*!
255+ @defgroup tvocoder tVocoder
256+ @ingroup effects
257+ @brief
258+ @{
259+
260+ @fn void tVocoder_init (tVocoder* const)
261+ @brief
262+ @param
263+
264+ @fn void tVocoder_initToPool (tVocoder* const, tMempool* const)
265+ @brief
266+ @param
267+
268+ @fn void tVocoder_free (tVocoder* const)
269+ @brief
270+ @param
271+
272+ @fn float tVocoder_tick (tVocoder* const, float synth, float voice)
273+ @brief
274+ @param
275+
276+ @fn void tVocoder_update (tVocoder* const)
277+ @brief
278+ @param
279+
280+ @fn void tVocoder_suspend (tVocoder* const)
281+ @brief
282+ @param
283+
284+ @} */
285+
130286 #define NUM_VOCODER_PARAM 8
131287 #define NBANDS 16
132288
@@ -159,7 +315,49 @@ extern "C" { · 26 unmodified lines
159315
160316 //==============================================================================
161317
162− // tRosenbergGlottalPulse
318+ /*!
319+ @defgroup trosenbergglottalpulse tRosenbergGlottalPulse
320+ @ingroup effects
321+ @brief
322+ @{
323+
324+ @fn void tRosenbergGlottalPulse_init (tRosenbergGlottalPulse* const)
325+ @brief
326+ @param
327+
328+ @fn void tRosenbergGlottalPulse_initToPool (tRosenbergGlottalPulse* const, tMempool* const)
329+ @brief
330+ @param
331+
332+ @fn void tRosenbergGlottalPulse_free (tRosenbergGlottalPulse* const)
333+ @brief
334+ @param
335+
336+ @fn float tRosenbergGlottalPulse_tick (tRosenbergGlottalPulse* const)
337+ @brief
338+ @param
339+
340+ @fn float tRosenbergGlottalPulse_tickHQ (tRosenbergGlottalPulse* const gp)
341+ @brief
342+ @param
343+
344+ @fn void tRosenbergGlottalPulse_setFreq (tRosenbergGlottalPulse* const, float freq)
345+ @brief
346+ @param
347+
348+ @fn void tRosenbergGlottalPulse_setOpenLength (tRosenbergGlottalPulse* const, float openLength)
349+ @brief
350+ @param
351+
352+ @fn void tRosenbergGlottalPulse_setPulseLength (tRosenbergGlottalPulse* const, float pulseLength)
353+ @brief
354+ @param
355+
356+ @fn void tRosenbergGlottalPulse_setOpenLengthAndPulseLength (tRosenbergGlottalPulse* const gp, float openLength, float pulseLength)
357+ @brief
358+ @param
359+
360+ @} */
163361
164362 typedef struct _tRosenbergGlottalPulse
165363 {
@@ -188,10 +386,46 @@ extern "C" { · 22 unmodified lines
188386 void tRosenbergGlottalPulse_setOpenLengthAndPulseLength (tRosenbergGlottalPulse* const gp, float openLength, float pulseLength);
189387 //==============================================================================
190388
191− // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
389+ /*!
390+ @defgroup tsolad tSOLAD
391+ @ingroup effects
392+ @brief pitch shifting algorithm that underlies tRetune etc from Katja Vetters http://www.katjaas.nl/pitchshiftlowlatency/pitchshiftlowlatency.html
393+ @{
394+
395+ @fn void tSOLAD_init (tSOLAD* const)
396+ @brief
397+ @param
398+
399+ @fn void tSOLAD_initToPool (tSOLAD* const, tMempool* const)
400+ @brief
401+ @param
402+
403+ @fn void tSOLAD_free (tSOLAD* const)
404+ @brief
405+ @param
406+
407+ @fn void tSOLAD_ioSamples (tSOLAD *w, float* in, float* out, int blocksize)
408+ @brief send one block of input samples, receive one block of output samples
409+ @param
410+
411+ @fn void tSOLAD_setPeriod (tSOLAD *w, float period)
412+ @brief set periodicity analysis data
413+ @param
414+
415+ @fn void tSOLAD_setPitchFactor (tSOLAD *w, float pitchfactor)
416+ @brief set pitch factor between 0.25 and 4
417+ @param
418+
419+ @fn void tSOLAD_setReadLag (tSOLAD *w, float readlag)
420+ @brief force readpointer lag
421+ @param
422+
423+ @fn void tSOLAD_resetState (tSOLAD *w)
424+ @brief reset state variables
425+ @param
426+
427+ @} */
192428
193− /* tSOLAD : pitch shifting algorithm that underlies tRetune etc */
194− // from Katja Vetters http://www.katjaas.nl/pitchshiftlowlatency/pitchshiftlowlatency.html
195429 #define LOOPSIZE (2048*2) // (4096*2) // loop size must be power of two
196430 #define LOOPMASK (LOOPSIZE - 1)
197431 #define PITCHFACTORDEFAULT 1.0f
@@ -233,7 +467,42 @@ extern "C" { · 35 unmodified lines
233467 // reset state variables
234468 void tSOLAD_resetState (tSOLAD *w);
235469
236− // Pitch shift
470+ /*!
471+ @defgroup tpitchshift tPitchShift
472+ @ingroup effects
473+ @brief
474+ @{
475+
476+ @fn void tPitchShift_init (tPitchShift* const, tPeriodDetection* const, float* out, int bufSize)
477+ @brief
478+ @param
479+
480+ @fn void tPitchShift_initToPool (tPitchShift* const, tPeriodDetection* const, float* out, int bufSize, tMempool* const)
481+ @brief
482+ @param
483+
484+ @fn void tPitchShift_free (tPitchShift* const)
485+ @brief
486+ @param
487+
488+ @fn float tPitchShift_shift (tPitchShift* const)
489+ @brief
490+ @param
491+
492+ @fn float tPitchShift_shiftToFunc (tPitchShift* const, float (*fun)(float))
493+ @brief
494+ @param
495+
496+ @fn float tPitchShift_shiftToFreq (tPitchShift* const, float freq)
497+ @brief
498+ @param
499+
500+ @fn void tPitchShift_setPitchFactor (tPitchShift* const, float pf)
501+ @brief
502+ @param
503+
504+ @} */
505+
237506 typedef struct _tPitchShift
238507 {
239508 tMempool mempool;
@@ -267,7 +536,66 @@ extern "C" { · 27 unmodified lines
267536 float tPitchShift_shiftToFreq (tPitchShift* const, float freq);
268537 void tPitchShift_setPitchFactor (tPitchShift* const, float pf);
269538
270− // Retune
539+ /*!
540+ @defgroup tretune tRetune
541+ @ingroup effects
542+ @brief
543+ @{
544+
545+ @fn void tRetune_init (tRetune* const, int numVoices, int bufSize, int frameSize)
546+ @brief
547+ @param
548+
549+ @fn void tRetune_initToPool (tRetune* const, int numVoices, int bufSize, int frameSize, tMempool* const)
550+ @brief
551+ @param
552+
553+ @fn void tRetune_free (tRetune* const)
554+ @brief
555+ @param
556+
557+ @fn float* tRetune_tick (tRetune* const, float sample)
558+ @brief
559+ @param
560+
561+ @fn void tRetune_setNumVoices (tRetune* const, int numVoices)
562+ @brief
563+ @param
564+
565+ @fn void tRetune_setPitchFactors (tRetune* const, float pf)
566+ @brief
567+ @param
568+
569+ @fn void tRetune_setPitchFactor (tRetune* const, float pf, int voice)
570+ @brief
571+ @param
572+
573+ @fn void tRetune_setTimeConstant (tRetune* const, float tc)
574+ @brief
575+ @param
576+
577+ @fn void tRetune_setHopSize (tRetune* const, int hs)
578+ @brief
579+ @param
580+
581+ @fn void tRetune_setWindowSize (tRetune* const, int ws)
582+ @brief
583+ @param
584+
585+ @fn void tRetune_setFidelityThreshold(tRetune* const, float threshold)
586+ @brief
587+ @param
588+
589+ @fn float tRetune_getInputPeriod (tRetune* const)
590+ @brief
591+ @param
592+
593+ @fn float tRetune_getInputFreq (tRetune* const)
594+ @brief
595+ @param
596+
597+ @} */
598+
271599 typedef struct _tRetune
272600 {
273601 tMempool mempool;
@@ -311,7 +639,74 @@ extern "C" { · 37 unmodified lines
311639 float tRetune_getInputPeriod (tRetune* const);
312640 float tRetune_getInputFreq (tRetune* const);
313641
314− // Autotune
642+ /*!
643+ @defgroup tautotune tAutotune
644+ @ingroup effects
645+ @brief
646+ @{
647+
648+ @fn void tAutotune_init (tAutotune* const, int numVoices, int bufSize, int frameSize)
649+ @brief
650+ @param
651+
652+ @fn void tAutotune_initToPool (tAutotune* const, int numVoices, int bufSize, int frameSize, tMempool* const)
653+ @brief
654+ @param
655+
656+ @fn void tAutotune_free (tAutotune* const)
657+ @brief
658+ @param
659+
660+ @fn float* tAutotune_tick (tAutotune* const, float sample)
661+ @brief
662+ @param
663+
664+ @fn void tAutotune_setNumVoices (tAutotune* const, int numVoices)
665+ @brief
666+ @param
667+
668+ @fn void tAutotune_setFreqs (tAutotune* const, float f)
669+ @brief
670+ @param
671+
672+ @fn void tAutotune_setFreq (tAutotune* const, float f, int voice)
673+ @brief
674+ @param
675+
676+ @fn void tAutotune_setTimeConstant (tAutotune* const, float tc)
677+ @brief
678+ @param
679+
680+ @fn void tAutotune_setHopSize (tAutotune* const, int hs)
681+ @brief
682+ @param
683+
684+ @fn void tAutotune_setWindowSize (tAutotune* const, int ws)
685+ @brief
686+ @param
687+
688+ @fn void tAutotune_setFidelityThreshold (tAutotune* const, float threshold)
689+ @brief
690+ @param
691+
692+ @fn void tAutotune_setAlpha (tAutotune* const, float alpha)
693+ @brief
694+ @param
695+
696+ @fn void tAutotune_setTolerance (tAutotune* const, float tolerance)
697+ @brief
698+ @param
699+
700+ @fn float tAutotune_getInputPeriod (tAutotune* const)
701+ @brief
702+ @param
703+
704+ @fn float tAutotune_getInputFreq (tAutotune* const)
705+ @brief
706+ @param
707+
708+ @} */
709+
315710 typedef struct _tAutotune
316711 {
317712 tMempool mempool;
@@ -359,6 +754,49 @@ extern "C" { · 41 unmodified lines
359754
360755 //==============================================================================
361756
757+ /*!
758+ @defgroup tformantshifter tFormantShifter
759+ @ingroup effects
760+ @brief
761+ @{
762+
763+ @fn void tFormantShifter_init (tFormantShifter* const, int order)
764+ @brief
765+ @param
766+
767+ @fn void tFormantShifter_initToPool (tFormantShifter* const, int order, tMempool* const)
768+ @brief
769+ @param
770+
771+ @fn void tFormantShifter_free (tFormantShifter* const)
772+ @brief
773+ @param
774+
775+ @fn float tFormantShifter_tick (tFormantShifter* const, float input)
776+ @brief
777+ @param
778+
779+ @fn float tFormantShifter_remove (tFormantShifter* const, float input)
780+ @brief
781+ @param
782+
783+ @fn float tFormantShifter_add (tFormantShifter* const, float input)
784+ @brief
785+ @param
786+
787+ @fn void tFormantShifter_ioSamples (tFormantShifter* const, float* in, float* out, int size, float fwarp)
788+ @brief
789+ @param
790+
791+ @fn void tFormantShifter_setShiftFactor (tFormantShifter* const, float shiftFactor)
792+ @brief
793+ @param
794+
795+ @fn void tFormantShifter_setIntensity (tFormantShifter* const, float intensity)
796+ @brief
797+ @param
798+
799+ @} */
362800
363801 typedef struct _tFormantShifter
364802 {
leaf/Inc/leaf-electrical.h+60−0
@@ -28,6 +28,66 @@ extern "C" { · 27 unmodified lines
2828
2929 //==============================================================================
3030
31+ /*!
32+ @defgroup twdf tWDF
33+ @ingroup electrical
34+ @brief
35+ @{
36+
37+ @fn void tWDF_init (tWDF* const, WDFComponentType type, float value, tWDF* const rL, tWDF* const rR)
38+ @brief
39+ @param
40+
41+ @fn void tWDF_initToPool (tWDF* const, WDFComponentType type, float value, tWDF* const rL, tWDF* const rR, tMempool* const)
42+ @brief
43+ @param
44+
45+ @fn void tWDF_free (tWDF* const)
46+ @brief
47+ @param
48+
49+ @fn float tWDF_tick (tWDF* const, float sample, tWDF* const outputPoint, uint8_t paramsChanged)
50+ @brief
51+ @param
52+
53+ @fn void tWDF_setValue (tWDF* const, float value)
54+ @brief
55+ @param
56+
57+ @fn void tWDF_setSampleRate (tWDF* const, float sample_rate)
58+ @brief
59+ @param
60+
61+ @fn uint8_t tWDF_isLeaf (tWDF* const)
62+ @brief
63+ @param
64+
65+ @fn float tWDF_getPortResistance (tWDF* const)
66+ @brief
67+ @param
68+
69+ @fn float tWDF_getReflectedWaveUp (tWDF* const, float input)
70+ @brief
71+ @param
72+
73+ @fn float tWDF_getReflectedWaveDown (tWDF* const, float input, float incident_wave)
74+ @brief
75+ @param
76+
77+ @fn void tWDF_setIncidentWave (tWDF* const, float incident_wave, float input)
78+ @brief
79+ @param
80+
81+ @fn float tWDF_getVoltage (tWDF* const)
82+ @brief
83+ @param
84+
85+ @fn float tWDF_getCurrent (tWDF* const)
86+ @brief
87+ @param
88+
89+ @} */
90+
3191 typedef enum WDFComponentType
3292 {
3393 SeriesAdaptor = 0,
leaf/Inc/leaf-envelopes.h+619−222
@@ -31,10 +31,49 @@ extern "C" { · 30 unmodified lines
3131 * @example basic-oscillators.c
3232 * An example.
3333 */
34−
34+
3535 // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
3636
37− /* Attack-Decay envelope */
37+ /*!
38+ @defgroup tenvelope tEnvelope
39+ @ingroup envelopes
40+ @brief Attack-decay envelope.
41+ @{
42+
43+ @fn void tEnvelope_init (tEnvelope* const, float attack, float decay, int loop)
44+ @brief
45+ @param
46+
47+ @fn void tEnvelope_initToPool (tEnvelope* const, float attack, float decay, int loop, tMempool* const)
48+ @brief
49+ @param
50+
51+ @fn void tEnvelope_free (tEnvelope* const)
52+ @brief
53+ @param
54+
55+ @fn float tEnvelope_tick (tEnvelope* const)
56+ @brief
57+ @param
58+
59+ @fn void tEnvelope_setAttack (tEnvelope* const, float attack)
60+ @brief
61+ @param
62+
63+ @fn void tEnvelope_setDecay (tEnvelope* const, float decay)
64+ @brief
65+ @param
66+
67+ @fn void tEnvelope_loop (tEnvelope* const, int loop)
68+ @brief
69+ @param
70+
71+ @fn void tEnvelope_on (tEnvelope* const, float velocity)
72+ @brief
73+ @param
74+
75+ @} */
76+
3877 typedef struct _tEnvelope
3978 {
4079 tMempool mempool;
@@ -71,216 +110,498 @@ extern "C" { · 30 unmodified lines
71110
72111 // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
73112
74−
75−
76− /* Exponential Smoother */
113+
114+ /*!
115+ @defgroup texpsmooth tExpSmooth
116+ @ingroup envelopes
117+ @brief
118+ @{
119+
120+ @fn void tExpSmooth_init (tExpSmooth* const, float val, float factor)
121+ @brief
122+ @param
123+
124+ @fn void tExpSmooth_initToPool (tExpSmooth* const, float val, float factor, tMempool* const)
125+ @brief
126+ @param
127+
128+ @fn void tExpSmooth_free (tExpSmooth* const)
129+ @brief
130+ @param
131+
132+ @fn float tExpSmooth_tick (tExpSmooth* const)
133+ @brief
134+ @param
135+
136+ @fn float tExpSmooth_sample (tExpSmooth* const)
137+ @brief
138+ @param
139+
140+ @fn void tExpSmooth_setFactor (tExpSmooth* const, float factor)
141+ @brief
142+ @param
143+
144+ @fn void tExpSmooth_setDest (tExpSmooth* const, float dest)
145+ @brief
146+ @param
147+
148+ @fn void tExpSmooth_setVal (tExpSmooth* const, float val)
149+ @brief
150+ @param
151+
152+ @fn void tExpSmooth_setValAndDest(tExpSmooth* const expsmooth, float val)
153+ @brief
154+ @param
155+
156+ @} */
157+
77158 typedef struct _tExpSmooth
78159 {
79160 tMempool mempool;
80161 float factor, oneminusfactor;
81162 float curr,dest;
82163 } _tExpSmooth;
83−
164+
84165 typedef _tExpSmooth* tExpSmooth;
85−
166+
86167 void tExpSmooth_init (tExpSmooth* const, float val, float factor);
87168 void tExpSmooth_initToPool (tExpSmooth* const, float val, float factor, tMempool* const);
88169 void tExpSmooth_free (tExpSmooth* const);
89−
170+
90171 float tExpSmooth_tick (tExpSmooth* const);
91172 float tExpSmooth_sample (tExpSmooth* const);
92173 void tExpSmooth_setFactor (tExpSmooth* const, float factor);
93174 void tExpSmooth_setDest (tExpSmooth* const, float dest);
94175 void tExpSmooth_setVal (tExpSmooth* const, float val);
95176 void tExpSmooth_setValAndDest(tExpSmooth* const expsmooth, float val);
96−
177+
97178 // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
98−
99−
179+
180+
100181 // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
101−
102−
182+
183+ /*!
184+ @defgroup tadsr tADSR
185+ @ingroup envelopes
186+ @brief
187+ @{
188+
189+ @fn void tADSR_init (tADSR* const adsrenv, float attack, float decay, float sustain, float release)
190+ @brief
191+ @param
192+
193+ @fn void tADSR_initToPool (tADSR* const adsrenv, float attack, float decay, float sustain, float release, tMempool* const mp)
194+ @brief
195+ @param
196+
197+ @fn void tADSR_free (tADSR* const)
198+ @brief
199+ @param
200+
201+ @fn float tADSR_tick (tADSR* const)
202+ @brief
203+ @param
204+
205+ @fn void tADSR_setAttack (tADSR* const, float attack)
206+ @brief
207+ @param
208+
209+ @fn void tADSR_setDecay (tADSR* const, float decay)
210+ @brief
211+ @param
212+
213+ @fn void tADSR_setSustain (tADSR* const, float sustain)
214+ @brief
215+ @param
216+
217+ @fn void tADSR_setRelease (tADSR* const, float release)
218+ @brief
219+ @param
220+
221+ @fn void tADSR_setLeakFactor (tADSR* const, float leakFactor)
222+ @brief
223+ @param
224+
225+ @fn void tADSR_on (tADSR* const, float velocity)
226+ @brief
227+ @param
228+
229+ @fn void tADSR_off (tADSR* const)
230+ @brief
231+ @param
232+
233+ @} */
234+
103235 /* ADSR */
104− typedef struct _tADSR
105− {
106− tMempool mempool;
107−
108− const float *exp_buff;
109− const float *inc_buff;
110− uint32_t buff_size;
111−
112− float next;
113−
114− float attackInc, decayInc, releaseInc, rampInc;
115−
116− oBool inAttack, inDecay, inSustain, inRelease, inRamp;
117−
118− float sustain, gain, rampPeak, releasePeak;
119−
120− float attackPhase, decayPhase, releasePhase, rampPhase;
121−
122− float leakFactor;
123− } _tADSR;
124−
125− typedef _tADSR* tADSR;
126−
127− void tADSR_init (tADSR* const adsrenv, float attack, float decay, float sustain, float release);
128− void tADSR_initToPool (tADSR* const adsrenv, float attack, float decay, float sustain, float release, tMempool* const mp);
129− void tADSR_free (tADSR* const);
130−
131− float tADSR_tick (tADSR* const);
132− void tADSR_setAttack (tADSR* const, float attack);
133− void tADSR_setDecay (tADSR* const, float decay);
134− void tADSR_setSustain (tADSR* const, float sustain);
135− void tADSR_setRelease (tADSR* const, float release);
136− void tADSR_setLeakFactor (tADSR* const, float leakFactor);
137− void tADSR_on (tADSR* const, float velocity);
138− void tADSR_off (tADSR* const);
139−
140−
236+ typedef struct _tADSR
237+ {
238+ tMempool mempool;
239+
240+ const float *exp_buff;
241+ const float *inc_buff;
242+ uint32_t buff_size;
243+
244+ float next;
245+
246+ float attackInc, decayInc, releaseInc, rampInc;
247+
248+ int inAttack, inDecay, inSustain, inRelease, inRamp;
249+
250+ float sustain, gain, rampPeak, releasePeak;
251+
252+ float attackPhase, decayPhase, releasePhase, rampPhase;
253+
254+ float leakFactor;
255+ } _tADSR;
141256
257+ typedef _tADSR* tADSR;
258+
259+ void tADSR_init (tADSR* const adsrenv, float attack, float decay, float sustain, float release);
260+ void tADSR_initToPool (tADSR* const adsrenv, float attack, float decay, float sustain, float release, tMempool* const mp);
261+ void tADSR_free (tADSR* const);
262+
263+ float tADSR_tick (tADSR* const);
264+ void tADSR_setAttack (tADSR* const, float attack);
265+ void tADSR_setDecay (tADSR* const, float decay);
266+ void tADSR_setSustain (tADSR* const, float sustain);
267+ void tADSR_setRelease (tADSR* const, float release);
268+ void tADSR_setLeakFactor (tADSR* const, float leakFactor);
269+ void tADSR_on (tADSR* const, float velocity);
270+ void tADSR_off (tADSR* const);
142271
143272 // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
144273
145−
146−
147− /* ADSR2 */
148− typedef struct _tADSR2
149− {
150− tMempool mempool;
151− float sampleRateInMs;
152− float attack;
153− float decay;
154− float release;
155− float attackLambda;
156− float decayLambda;
157− float releaseLambda;
158− float sustain;
159− float leakGain;
160− float leakFactor;
161− float targetGainSquared;
162− float factor;
163− float oneMinusFactor;
164− float gain;
165− uint8_t attacking;
166− uint8_t gate;
167− float env;
168− float envTarget;
169− } _tADSR2;
170−
171− typedef _tADSR2* tADSR2;
172−
173− void tADSR2_init (tADSR2* const, float attack, float decay, float sustain, float release);
174− void tADSR2_initToPool (tADSR2* const, float attack, float decay, float sustain, float release, tMempool* const);
175− void tADSR2_free (tADSR2* const);
176−
177− float tADSR2_tick (tADSR2* const);
178− void tADSR2_setAttack (tADSR2* const, float attack);
179− void tADSR2_setDecay (tADSR2* const, float decay);
180− void tADSR2_setSustain (tADSR2* const, float sustain);
181− void tADSR2_setRelease (tADSR2* const, float release);
182− void tADSR2_setLeakFactor (tADSR2* const, float leakFactor);
183− void tADSR2_on (tADSR2* const, float velocity);
184− void tADSR2_off (tADSR2* const);
185−
186−
187− // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
188−
189− // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
190− enum envState {
191− env_idle = 0,
192− env_attack,
193− env_decay,
194− env_sustain,
195− env_release,
196− env_ramp
197− };
198−
199− /* ADSR3 */
200− typedef struct _tADSR3
201− {
202− tMempool mempool;
203− float sampleRateInMs;
204− int state;
205− float output;
206− float attackRate;
207− float decayRate;
208− float releaseRate;
209− float attackCoef;
210− float decayCoef;
211− float releaseCoef;
212− float sustainLevel;
213− float targetRatioA;
214− float targetRatioDR;
215− float attackBase;
216− float decayBase;
217− float releaseBase;
218− float leakFactor;
219− float targetGainSquared;
220− float factor;
221− float oneMinusFactor;
222− float gain;
223−
224− } _tADSR3;
225−
226− typedef _tADSR3* tADSR3;
227−
228− void tADSR3_init (tADSR3* const, float attack, float decay, float sustain, float release);
229− void tADSR3_initToPool (tADSR3* const, float attack, float decay, float sustain, float release, tMempool* const);
230− void tADSR3_free (tADSR3* const);
231−
232− float tADSR3_tick (tADSR3* const);
233− void tADSR3_setAttack (tADSR3* const, float attack);
234− void tADSR3_setDecay (tADSR3* const, float decay);
235− void tADSR3_setSustain (tADSR3* const, float sustain);
236− void tADSR3_setRelease (tADSR3* const, float release);
237− void tADSR3_setLeakFactor (tADSR3* const, float leakFactor);
238− void tADSR3_on (tADSR3* const, float velocity);
239− void tADSR3_off (tADSR3* const);
240−
274+ /*!
275+ @defgroup tasdr2 tADSR2
276+ @ingroup envelopes
277+ @brief
278+ @{
279+
280+ @fn void tADSR2_init (tADSR2* const, float attack, float decay, float sustain, float release)
281+ @brief
282+ @param
283+
284+ @fn void tADSR2_initToPool (tADSR2* const, float attack, float decay, float sustain, float release, tMempool* const)
285+ @brief
286+ @param
287+
288+ @fn void tADSR2_free (tADSR2* const)
289+ @brief
290+ @param
291+
292+ @fn float tADSR2_tick (tADSR2* const)
293+ @brief
294+ @param
295+
296+ @fn void tADSR2_setAttack (tADSR2* const, float attack)
297+ @brief
298+ @param
299+
300+ @fn void tADSR2_setDecay (tADSR2* const, float decay)
301+ @brief
302+ @param
303+
304+ @fn void tADSR2_setSustain (tADSR2* const, float sustain)
305+ @brief
306+ @param
307+
308+ @fn void tADSR2_setRelease (tADSR2* const, float release)
309+ @brief
310+ @param
311+
312+ @fn void tADSR2_setLeakFactor (tADSR2* const, float leakFactor)
313+ @brief
314+ @param
315+
316+ @fn void tADSR2_on (tADSR2* const, float velocity)
317+ @brief
318+ @param
319+
320+ @fn void tADSR2_off (tADSR2* const)
321+ @brief
322+ @param
323+
324+ @} */
325+
326+ typedef struct _tADSR2
327+ {
328+ tMempool mempool;
329+ float sampleRateInMs;
330+ float attack;
331+ float decay;
332+ float release;
333+ float attackLambda;
334+ float decayLambda;
335+ float releaseLambda;
336+ float sustain;
337+ float leakGain;
338+ float leakFactor;
339+ float targetGainSquared;
340+ float factor;
341+ float oneMinusFactor;
342+ float gain;
343+ uint8_t attacking;
344+ uint8_t gate;
345+ float env;
346+ float envTarget;
347+ } _tADSR2;
348+
349+ typedef _tADSR2* tADSR2;
350+
351+ void tADSR2_init (tADSR2* const, float attack, float decay, float sustain, float release);
352+ void tADSR2_initToPool (tADSR2* const, float attack, float decay, float sustain, float release, tMempool* const);
353+ void tADSR2_free (tADSR2* const);
354+
355+ float tADSR2_tick (tADSR2* const);
356+ void tADSR2_setAttack (tADSR2* const, float attack);
357+ void tADSR2_setDecay (tADSR2* const, float decay);
358+ void tADSR2_setSustain (tADSR2* const, float sustain);
359+ void tADSR2_setRelease (tADSR2* const, float release);
360+ void tADSR2_setLeakFactor (tADSR2* const, float leakFactor);
361+ void tADSR2_on (tADSR2* const, float velocity);
362+ void tADSR2_off (tADSR2* const);
363+
364+
241365 // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
242366
243− //ADSR4
244−
367+ /*!
368+ @defgroup tadsr3 tADSR3
369+ @ingroup envelopes
370+ @brief
371+ @{
245372
246− typedef struct _tADSR4
247− {
248− tMempool mempool;
249− const float *exp_buff;
250− uint32_t buff_size;
251− uint32_t buff_sizeMinusOne;
252− float bufferSizeDividedBySampleRateInMs;
253− float next;
254−
255− float attackInc, decayInc, releaseInc, rampInc;
256−
257− uint32_t whichStage;
258−
259− float sustain, gain, rampPeak, releasePeak;
260−
261− float attackPhase, decayPhase, releasePhase, rampPhase;
262−
263− float leakFactor;
264− } _tADSR4;
265−
266− typedef _tADSR4* tADSR4;
267−
268− void tADSR4_init (tADSR4* const, float attack, float decay, float sustain, float release, float* expBuffer, int bufferSize);
269− void tADSR4_initToPool (tADSR4* const, float attack, float decay, float sustain, float release, float* expBuffer, int bufferSize, tMempool* const);
270− void tADSR4_free (tADSR4* const);
271−
272− float tADSR4_tick (tADSR4* const);
273− float tADSR4_tickNoInterp (tADSR4* const adsrenv);
274− void tADSR4_setAttack (tADSR4* const, float attack);
275− void tADSR4_setDecay (tADSR4* const, float decay);
276− void tADSR4_setSustain (tADSR4* const, float sustain);
277− void tADSR4_setRelease (tADSR4* const, float release);
278− void tADSR4_setLeakFactor (tADSR4* const, float leakFactor);
279− void tADSR4_on (tADSR4* const, float velocity);
280− void tADSR4_off (tADSR4* const);
281− // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
282−
283− /* Ramp */
373+ @fn void tADSR3_init (tADSR3* const, float attack, float decay, float sustain, float release)
374+ @brief
375+ @param
376+
377+ @fn void tADSR3_initToPool (tADSR3* const, float attack, float decay, float sustain, float release, tMempool* const)
378+ @brief
379+ @param
380+
381+ @fn void tADSR3_free (tADSR3* const)
382+ @brief
383+ @param
384+
385+ @fn float tADSR3_tick (tADSR3* const)
386+ @brief
387+ @param
388+
389+ @fn void tADSR3_setAttack (tADSR3* const, float attack)
390+ @brief
391+ @param
392+
393+ @fn void tADSR3_setDecay (tADSR3* const, float decay)
394+ @brief
395+ @param
396+
397+ @fn void tADSR3_setSustain (tADSR3* const, float sustain)
398+ @brief
399+ @param
400+
401+ @fn void tADSR3_setRelease (tADSR3* const, float release)
402+ @brief
403+ @param
404+
405+ @fn void tADSR3_setLeakFactor (tADSR3* const, float leakFactor)
406+ @brief
407+ @param
408+
409+ @fn void tADSR3_on (tADSR3* const, float velocity)
410+ @brief
411+ @param
412+
413+ @fn void tADSR3_off (tADSR3* const)
414+ @brief
415+ @param
416+
417+ @} */
418+
419+ enum envState {
420+ env_idle = 0,
421+ env_attack,
422+ env_decay,
423+ env_sustain,
424+ env_release,
425+ env_ramp
426+ };
427+
428+ typedef struct _tADSR3
429+ {
430+ tMempool mempool;
431+ float sampleRateInMs;
432+ int state;
433+ float output;
434+ float attackRate;
435+ float decayRate;
436+ float releaseRate;
437+ float attackCoef;
438+ float decayCoef;
439+ float releaseCoef;
440+ float sustainLevel;
441+ float targetRatioA;
442+ float targetRatioDR;
443+ float attackBase;
444+ float decayBase;
445+ float releaseBase;
446+ float leakFactor;
447+ float targetGainSquared;
448+ float factor;
449+ float oneMinusFactor;
450+ float gain;
451+
452+ } _tADSR3;
453+
454+ typedef _tADSR3* tADSR3;
455+
456+ void tADSR3_init (tADSR3* const, float attack, float decay, float sustain, float release);
457+ void tADSR3_initToPool (tADSR3* const, float attack, float decay, float sustain, float release, tMempool* const);
458+ void tADSR3_free (tADSR3* const);
459+
460+ float tADSR3_tick (tADSR3* const);
461+ void tADSR3_setAttack (tADSR3* const, float attack);
462+ void tADSR3_setDecay (tADSR3* const, float decay);
463+ void tADSR3_setSustain (tADSR3* const, float sustain);
464+ void tADSR3_setRelease (tADSR3* const, float release);
465+ void tADSR3_setLeakFactor (tADSR3* const, float leakFactor);
466+ void tADSR3_on (tADSR3* const, float velocity);
467+ void tADSR3_off (tADSR3* const);
468+
469+ // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
470+
471+ /*!
472+ @defgroup tadsr4 tADSR4
473+ @ingroup envelopes
474+ @brief
475+ @{
476+
477+ @fn void tADSR4_init (tADSR4* const, float attack, float decay, float sustain, float release, float* expBuffer, int bufferSize)
478+ @brief
479+ @param
480+
481+ @fn void tADSR4_initToPool (tADSR4* const, float attack, float decay, float sustain, float release, float* expBuffer, int bufferSize, tMempool* const)
482+ @brief
483+ @param
484+
485+ @fn void tADSR4_free (tADSR4* const)
486+ @brief
487+ @param
488+
489+ @fn float tADSR4_tick (tADSR4* const)
490+ @brief
491+ @param
492+
493+ @fn float tADSR4_tickNoInterp (tADSR4* const adsrenv)
494+ @brief
495+ @param
496+
497+ @fn void tADSR4_setAttack (tADSR4* const, float attack)
498+ @brief
499+ @param
500+
501+ @fn void tADSR4_setDecay (tADSR4* const, float decay)
502+ @brief
503+ @param
504+
505+ @fn void tADSR4_setSustain (tADSR4* const, float sustain)
506+ @brief
507+ @param
508+
509+ @fn void tADSR4_setRelease (tADSR4* const, float release)
510+ @brief
511+ @param
512+
513+ @fn void tADSR4_setLeakFactor (tADSR4* const, float leakFactor)
514+ @brief
515+ @param
516+
517+ @fn void tADSR4_on (tADSR4* const, float velocity)
518+ @brief
519+ @param
520+
521+ @fn void tADSR4_off (tADSR4* const)
522+ @brief
523+ @param
524+
525+ @} */
526+
527+ typedef struct _tADSR4
528+ {
529+ tMempool mempool;
530+ const float *exp_buff;
531+ uint32_t buff_size;
532+ uint32_t buff_sizeMinusOne;
533+ float bufferSizeDividedBySampleRateInMs;
534+ float next;
535+
536+ float attackInc, decayInc, releaseInc, rampInc;
537+
538+ uint32_t whichStage;
539+
540+ float sustain, gain, rampPeak, releasePeak;
541+
542+ float attackPhase, decayPhase, releasePhase, rampPhase;
543+
544+ float leakFactor;
545+ } _tADSR4;
546+
547+ typedef _tADSR4* tADSR4;
548+
549+ void tADSR4_init (tADSR4* const, float attack, float decay, float sustain, float release, float* expBuffer, int bufferSize);
550+ void tADSR4_initToPool (tADSR4* const, float attack, float decay, float sustain, float release, float* expBuffer, int bufferSize, tMempool* const);
551+ void tADSR4_free (tADSR4* const);
552+
553+ float tADSR4_tick (tADSR4* const);
554+ float tADSR4_tickNoInterp (tADSR4* const adsrenv);
555+ void tADSR4_setAttack (tADSR4* const, float attack);
556+ void tADSR4_setDecay (tADSR4* const, float decay);
557+ void tADSR4_setSustain (tADSR4* const, float sustain);
558+ void tADSR4_setRelease (tADSR4* const, float release);
559+ void tADSR4_setLeakFactor (tADSR4* const, float leakFactor);
560+ void tADSR4_on (tADSR4* const, float velocity);
561+ void tADSR4_off (tADSR4* const);
562+
563+ // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
564+
565+ /*!
566+ @defgroup tramp tRamp
567+ @ingroup envelopes
568+ @brief
569+ @{
570+
571+ @fn void tRamp_init (tRamp* const, float time, int samplesPerTick)
572+ @brief
573+ @param
574+
575+ @fn void tRamp_initToPool (tRamp* const, float time, int samplesPerTick, tMempool* const)
576+ @brief
577+ @param
578+
579+ @fn void tRamp_free (tRamp* const)
580+ @brief
581+ @param
582+
583+ @fn float tRamp_tick (tRamp* const)
584+ @brief
585+ @param
586+
587+ @fn float tRamp_sample (tRamp* const)
588+ @brief
589+ @param
590+
591+ @fn void tRamp_setTime (tRamp* const, float time)
592+ @brief
593+ @param
594+
595+ @fn void tRamp_setDest (tRamp* const, float dest)
596+ @brief
597+ @param
598+
599+ @fn void tRamp_setVal (tRamp* const, float val)
600+ @brief
601+ @param
602+
603+ @} */
604+
284605 typedef struct _tRamp
285606 {
286607 tMempool mempool;
@@ -304,9 +625,51 @@ extern "C" { · 17 unmodified lines
304625 void tRamp_setTime (tRamp* const, float time);
305626 void tRamp_setDest (tRamp* const, float dest);
306627 void tRamp_setVal (tRamp* const, float val);
307−
308− ///=============
309− /* Ramp Updown*/
628+
629+ /*!
630+ @defgroup trampupdown tRampUpDown
631+ @ingroup envelopes
632+ @brief
633+ @{
634+
635+ @fn void tRampUpDown_init (tRampUpDown* const, float upTime, float downTime, int samplesPerTick)
636+ @brief
637+ @param
638+
639+ @fn void tRampUpDown_initToPool (tRampUpDown* const, float upTime, float downTime, int samplesPerTick, tMempool* const)
640+ @brief
641+ @param
642+
643+ @fn void tRampUpDown_free (tRampUpDown* const)
644+ @brief
645+ @param
646+
647+ @fn float tRampUpDown_tick (tRampUpDown* const)
648+ @brief
649+ @param
650+
651+ @fn float tRampUpDown_sample (tRampUpDown* const)
652+ @brief
653+ @param
654+
655+ @fn void tRampUpDown_setUpTime (tRampUpDown* const, float upTime)
656+ @brief
657+ @param
658+
659+ @fn void tRampUpDown_setDownTime (tRampUpDown* const, float downTime)
660+ @brief
661+ @param
662+
663+ @fn void tRampUpDown_setDest (tRampUpDown* const, float dest)
664+ @brief
665+ @param
666+
667+ @fn void tRampUpDown_setVal (tRampUpDown* const, float val)
668+ @brief
669+ @param
670+
671+ @} */
672+
310673 typedef struct _tRampUpDown
311674 {
312675 tMempool mempool;
@@ -319,9 +682,9 @@ extern "C" { · 6 unmodified lines
319682 float downTime;
320683 int samples_per_tick;
321684 } _tRampUpDown;
322−
685+
323686 typedef _tRampUpDown* tRampUpDown;
324−
687+
325688 void tRampUpDown_init (tRampUpDown* const, float upTime, float downTime, int samplesPerTick);
326689 void tRampUpDown_initToPool (tRampUpDown* const, float upTime, float downTime, int samplesPerTick, tMempool* const);
327690 void tRampUpDown_free (tRampUpDown* const);
@@ -332,39 +695,72 @@ extern "C" { · 4 unmodified lines
332695 void tRampUpDown_setDownTime (tRampUpDown* const, float downTime);
333696 void tRampUpDown_setDest (tRampUpDown* const, float dest);
334697 void tRampUpDown_setVal (tRampUpDown* const, float val);
335−
336−
337− ///=========================
338− //Slide (based on Max/MSP's slide~)
339− typedef struct _tSlide
698+
699+
700+
701+ /*!
702+ @defgroup tslide tSlide
703+ @ingroup envelopes
704+ @brief based on Max/MSP's slide~
705+ @{
706+
707+ @fn void tSlide_init (tSlide* const, float upSlide, float downSlide)
708+ @brief
709+ @param
710+
711+ @fn void tSlide_initToPool (tSlide* const, float upSlide, float downSlide, tMempool* const)
712+ @brief
713+ @param
714+
715+ @fn void tSlide_free (tSlide* const)
716+ @brief
717+ @param
718+
719+ @fn float tSlide_tick (tSlide* const, float in)
720+ @brief
721+ @param
722+
723+ @fn float tSlide_tickNoInput (tSlide* const sl)
724+ @brief
725+ @param
726+
727+ @fn void tSlide_setUpSlide (tSlide* const sl, float upSlide)
728+ @brief
729+ @param
730+
731+ @fn void tSlide_setDownSlide (tSlide* const sl, float downSlide)
732+ @brief
733+ @param
734+
735+ @fn void tSlide_setDest (tSlide* const sl, float dest)
736+ @brief
737+ @param
738+
739+ @} */
740+
741+ typedef struct _tSlide
340742 {
341743 tMempool mempool;
342− float prevOut;
343− float currentOut;
344− float prevIn;
345− float invUpSlide;
346− float invDownSlide;
347− float dest;
348− } _tSlide;
349−
350− typedef _tSlide* tSlide;
351−
352− void tSlide_init (tSlide* const, float upSlide, float downSlide);
353− void tSlide_initToPool (tSlide* const, float upSlide, float downSlide, tMempool* const);
354− void tSlide_free (tSlide* const);
355−
356− void tSlide_setUpSlide (tSlide* const sl, float upSlide);
357−
358− void tSlide_setDownSlide (tSlide* const sl, float downSlide);
359−
360−
361− void tSlide_setDest (tSlide* const sl, float dest);
362−
363−
364− float tSlide_tickNoInput (tSlide* const sl);
365−
366− float tSlide_tick (tSlide* const, float in);
367−
744+ float prevOut;
745+ float currentOut;
746+ float prevIn;
747+ float invUpSlide;
748+ float invDownSlide;
749+ float dest;
750+ } _tSlide;
751+
752+ typedef _tSlide* tSlide;
753+
754+ void tSlide_init (tSlide* const, float upSlide, float downSlide);
755+ void tSlide_initToPool (tSlide* const, float upSlide, float downSlide, tMempool* const);
756+ void tSlide_free (tSlide* const);
757+
758+ float tSlide_tick (tSlide* const, float in);
759+ float tSlide_tickNoInput (tSlide* const sl);
760+ void tSlide_setUpSlide (tSlide* const sl, float upSlide);
761+ void tSlide_setDownSlide (tSlide* const sl, float downSlide);
762+ void tSlide_setDest (tSlide* const sl, float dest);
763+
368764 #ifdef __cplusplus
369765 }
370766 #endif
@@ -373,3 +769,4 @@ extern "C" { · 2 unmodified lines
373769
374770
375771
772+
leaf/Inc/leaf-filters.h+540−61
@@ -35,9 +35,32 @@ extern "C" { · 34 unmodified lines
3535 @ingroup filters
3636 @brief Schroeder allpass. Comb-filter with feedforward and feedback.
3737 @{
38− */
39−
40− /*! @} */
38+
39+ @fn void tAllpass_init (tAllpass* const, float initDelay, uint32_t maxDelay)
40+ @brief
41+ @param
42+
43+ @fn void tAllpass_initToPool (tAllpass* const, float initDelay, uint32_t maxDelay, tMempool* const)
44+ @brief
45+ @param
46+
47+ @fn void tAllpass_free (tAllpass* const)
48+ @brief
49+ @param
50+
51+ @fn float tAllpass_tick (tAllpass* const, float input)
52+ @brief
53+ @param
54+
55+ @fn void tAllpass_setGain (tAllpass* const, float gain)
56+ @brief
57+ @param
58+
59+ @fn void tAllpass_setDelay (tAllpass* const, float delay)
60+ @brief
61+ @param
62+ 
63+ @} */
4164
4265 typedef struct _tAllpass
4366 {
@@ -68,9 +91,48 @@ extern "C" { · 24 unmodified lines
6891 @ingroup filters
6992 @brief OnePole filter, reimplemented from STK (Cook and Scavone).
7093 @{
71− */
72−
73− /*! @} */
94+
95+ @fn void tOnePole_init (tOnePole* const, float thePole)
96+ @brief
97+ @param
98+
99+ @fn void tOnePole_initToPool (tOnePole* const, float thePole, tMempool* const)
100+ @brief
101+ @param
102+
103+ @fn void tOnePole_free (tOnePole* const)
104+ @brief
105+ @param
106+
107+ @fn float tOnePole_tick (tOnePole* const, float input)
108+ @brief
109+ @param
110+
111+ @fn void tOnePole_setB0 (tOnePole* const, float b0)
112+ @brief
113+ @param
114+
115+ @fn void tOnePole_setA1 (tOnePole* const, float a1)
116+ @brief
117+ @param
118+
119+ @fn void tOnePole_setPole (tOnePole* const, float thePole)
120+ @brief
121+ @param
122+
123+ @fn void tOnePole_setFreq (tOnePole* const, float freq)
124+ @brief
125+ @param
126+
127+ @fn void tOnePole_setCoefficients(tOnePole* const, float b0, float a1)
128+ @brief
129+ @param
130+
131+ @fn void tOnePole_setGain (tOnePole* const, float gain)
132+ @brief
133+ @param
134+ 
135+ @} */
74136
75137 typedef struct _tOnePole
76138 {
@@ -102,9 +164,48 @@ extern "C" { · 25 unmodified lines
102164 @ingroup filters
103165 @brief TwoPole filter, reimplemented from STK (Cook and Scavone).
104166 @{
105− */
106−
107− /*! @} */
167+
168+ @fn void tTwoPole_init (tTwoPole* const)
169+ @brief
170+ @param
171+
172+ @fn void tTwoPole_initToPool (tTwoPole* const, tMempool* const)
173+ @brief
174+ @param
175+
176+ @fn void tTwoPole_free (tTwoPole* const)
177+ @brief
178+ @param
179+
180+ @fn float tTwoPole_tick (tTwoPole* const, float input)
181+ @brief
182+ @param
183+
184+ @fn void tTwoPole_setB0 (tTwoPole* const, float b0)
185+ @brief
186+ @param
187+
188+ @fn void tTwoPole_setA1 (tTwoPole* const, float a1)
189+ @brief
190+ @param
191+
192+ @fn void tTwoPole_setA2 (tTwoPole* const, float a2)
193+ @brief
194+ @param
195+
196+ @fn void tTwoPole_setResonance (tTwoPole* const, float freq, float radius, int normalize)
197+ @brief
198+ @param
199+
200+ @fn void tTwoPole_setCoefficients(tTwoPole* const, float b0, float a1, float a2)
201+ @brief
202+ @param
203+
204+ @fn void tTwoPole_setGain (tTwoPole* const, float gain)
205+ @brief
206+ @param
207+ 
208+ @} */
108209
109210 typedef struct _tTwoPole
110211 {
@@ -115,7 +216,7 @@ extern "C" { · 4 unmodified lines
115216 float b0;
116217
117218 float radius, frequency;
118− oBool normalize;
219+ int normalize;
119220
120221 float lastOut[2];
121222 } _tTwoPole;
@@ -130,7 +231,7 @@ extern "C" { · 8 unmodified lines
130231 void tTwoPole_setB0 (tTwoPole* const, float b0);
131232 void tTwoPole_setA1 (tTwoPole* const, float a1);
132233 void tTwoPole_setA2 (tTwoPole* const, float a2);
133− void tTwoPole_setResonance (tTwoPole* const, float freq, float radius, oBool normalize);
234+ void tTwoPole_setResonance (tTwoPole* const, float freq, float radius, int normalize);
134235 void tTwoPole_setCoefficients(tTwoPole* const, float b0, float a1, float a2);
135236 void tTwoPole_setGain (tTwoPole* const, float gain);
136237
@@ -141,9 +242,48 @@ extern "C" { · 4 unmodified lines
141242 @ingroup filters
142243 @brief OneZero filter, reimplemented from STK (Cook and Scavone).
143244 @{
144− */
145−
146− /*! @} */
245+
246+ @fn void tOneZero_init (tOneZero* const, float theZero)
247+ @brief
248+ @param
249+
250+ @fn void tOneZero_initToPool (tOneZero* const, float theZero, tMempool* const)
251+ @brief
252+ @param
253+
254+ @fn void tOneZero_free (tOneZero* const)
255+ @brief
256+ @param
257+
258+ @fn float tOneZero_tick (tOneZero* const, float input)
259+ @brief
260+ @param
261+
262+ @fn void tOneZero_setB0 (tOneZero* const, float b0)
263+ @brief
264+ @param
265+
266+ @fn void tOneZero_setB1 (tOneZero* const, float b1)
267+ @brief
268+ @param
269+
270+ @fn void tOneZero_setZero (tOneZero* const, float theZero)
271+ @brief
272+ @param
273+
274+ @fn void tOneZero_setCoefficients(tOneZero* const, float b0, float b1)
275+ @brief
276+ @param
277+
278+ @fn void tOneZero_setGain (tOneZero* const, float gain)
279+ @brief
280+ @param
281+
282+ @fn float tOneZero_getPhaseDelay (tOneZero *f, float frequency)
283+ @brief
284+ @param
285+ 
286+ @} */
147287
148288 typedef struct _tOneZero
149289 {
@@ -165,7 +305,7 @@ extern "C" { · 15 unmodified lines
165305 void tOneZero_setZero (tOneZero* const, float theZero);
166306 void tOneZero_setCoefficients(tOneZero* const, float b0, float b1);
167307 void tOneZero_setGain (tOneZero* const, float gain);
168− float tOneZero_getPhaseDelay (tOneZero *f, float frequency );
308+ float tOneZero_getPhaseDelay (tOneZero *f, float frequency);
169309
170310 //==============================================================================
171311
@@ -174,9 +314,49 @@ extern "C" { · 2 unmodified lines
174314 @ingroup filters
175315 @brief TwoZero filter, reimplemented from STK (Cook and Scavone).
176316 @{
177− */
178−
179− /*! @} */
317+
318+ @fn void tTwoZero_init (tTwoZero* const)
319+ @brief
320+ @param
321+
322+ @fn void tTwoZero_initToPool (tTwoZero* const, tMempool* const)
323+ @brief
324+ @param
325+
326+ @fn void tTwoZero_free (tTwoZero* const)
327+ @brief
328+ @param
329+
330+ @fn float tTwoZero_tick (tTwoZero* const, float input)
331+ @brief
332+ @param
333+
334+ @fn void tTwoZero_setB0 (tTwoZero* const, float b0)
335+ @brief
336+ @param
337+
338+ @fn void tTwoZero_setB1 (tTwoZero* const, float b1)
339+ @brief
340+ @param
341+
342+ @fn void tTwoZero_setB2 (tTwoZero* const, float b2)
343+ @brief
344+ @param
345+
346+ @fn void tTwoZero_setNotch (tTwoZero* const, float frequency, float radius)
347+ @brief
348+ @param
349+
350+ @fn void tTwoZero_setCoefficients(tTwoZero* const, float b0, float b1, float b2)
351+ @brief
352+ @param
353+
354+ @fn void tTwoZero_setGain (tTwoZero* const, float gain)
355+ @brief
356+ @param
357+
358+ 
359+ @} */
180360
181361 typedef struct _tTwoZero
182362 {
@@ -211,9 +391,54 @@ extern "C" { · 28 unmodified lines
211391 @ingroup filters
212392 @brief PoleZero filter, reimplemented from STK (Cook and Scavone).
213393 @{
214− */
215−
216− /*! @} */
394+
395+ @fn void tPoleZero_init (tPoleZero* const)
396+ @brief
397+ @param
398+
399+ @fn void tPoleZero_initToPool (tPoleZero* const, tMempool* const)
400+ @brief
401+ @param
402+
403+ @fn void tPoleZero_free (tPoleZero* const)
404+ @brief
405+ @param
406+
407+
408+ @fn float tPoleZero_tick (tPoleZero* const, float input)
409+ @brief
410+ @param
411+
412+ @fn void tPoleZero_setB0 (tPoleZero* const, float b0)
413+ @brief
414+ @param
415+
416+ @fn void tPoleZero_setB1 (tPoleZero* const, float b1)
417+ @brief
418+ @param
419+
420+ @fn void tPoleZero_setA1 (tPoleZero* const, float a1)
421+ @brief
422+ @param
423+
424+ @fn void tPoleZero_setCoefficients (tPoleZero* const, float b0, float b1, float a1)
425+ @brief
426+ @param
427+
428+ @fn void tPoleZero_setAllpass (tPoleZero* const, float coeff)
429+ @brief
430+ @param
431+
432+ @fn void tPoleZero_setBlockZero (tPoleZero* const, float thePole)
433+ @brief
434+ @param
435+
436+ @fn void tPoleZero_setGain (tPoleZero* const, float gain)
437+ @brief
438+ @param
439+
440+ 
441+ @} */
217442
218443 typedef struct _tPoleZero
219444 {
@@ -248,9 +473,62 @@ extern "C" { · 28 unmodified lines
248473 @ingroup filters
249474 @brief BiQuad filter, reimplemented from STK (Cook and Scavone).
250475 @{
251− */
252−
253− /*! @} */
476+
477+ @fn void tBiQuad_init (tBiQuad* const)
478+ @brief
479+ @param
480+
481+ @fn void tBiQuad_initToPool (tBiQuad* const, tMempool* const)
482+ @brief
483+ @param
484+
485+ @fn void tBiQuad_free (tBiQuad* const)
486+ @brief
487+ @param
488+
489+
490+ @fn float tBiQuad_tick (tBiQuad* const, float input)
491+ @brief
492+ @param
493+
494+ @fn void tBiQuad_setB0 (tBiQuad* const, float b0)
495+ @brief
496+ @param
497+
498+ @fn void tBiQuad_setB1 (tBiQuad* const, float b1)
499+ @brief
500+ @param
501+
502+ @fn void tBiQuad_setB2 (tBiQuad* const, float b2)
503+ @brief
504+ @param
505+
506+ @fn void tBiQuad_setA1 (tBiQuad* const, float a1)
507+ @brief
508+ @param
509+
510+ @fn void tBiQuad_setA2 (tBiQuad* const, float a2)
511+ @brief
512+ @param
513+
514+ @fn void tBiQuad_setNotch (tBiQuad* const, float freq, float radius)
515+ @brief
516+ @param
517+
518+ @fn void tBiQuad_setResonance (tBiQuad* const, float freq, float radius, int normalize)
519+ @brief
520+ @param
521+
522+ @fn void tBiQuad_setCoefficients(tBiQuad* const, float b0, float b1, float b2, float a1, float a2)
523+ @brief
524+ @param
525+
526+ @fn void tBiQuad_setGain (tBiQuad* const, float gain)
527+ @brief
528+ @param
529+
530+ 
531+ @} */
254532
255533 typedef struct _tBiQuad
256534 {
@@ -264,7 +542,7 @@ extern "C" { · 7 unmodified lines
264542 float lastOut[2];
265543
266544 float frequency, radius;
267− oBool normalize;
545+ int normalize;
268546 } _tBiQuad;
269547
270548 typedef _tBiQuad* tBiQuad;
@@ -280,7 +558,7 @@ extern "C" { · 9 unmodified lines
280558 void tBiQuad_setA1 (tBiQuad* const, float a1);
281559 void tBiQuad_setA2 (tBiQuad* const, float a2);
282560 void tBiQuad_setNotch (tBiQuad* const, float freq, float radius);
283− void tBiQuad_setResonance (tBiQuad* const, float freq, float radius, oBool normalize);
561+ void tBiQuad_setResonance (tBiQuad* const, float freq, float radius, int normalize);
284562 void tBiQuad_setCoefficients(tBiQuad* const, float b0, float b1, float b2, float a1, float a2);
285563 void tBiQuad_setGain (tBiQuad* const, float gain);
286564
@@ -291,9 +569,36 @@ extern "C" { · 4 unmodified lines
291569 @ingroup filters
292570 @brief State Variable Filter, algorithm from Andy Simper.
293571 @{
294− */
295−
296− /*! @} */
572+
573+ @fn void tSVF_init (tSVF* const, SVFType type, float freq, float Q)
574+ @brief
575+ @param
576+
577+ @fn void tSVF_initToPool (tSVF* const, SVFType type, float freq, float Q, tMempool* const)
578+ @brief
579+ @param
580+
581+ @fn void tSVF_free (tSVF* const)
582+ @brief
583+ @param
584+
585+ @fn float tSVF_tick (tSVF* const, float v0)
586+
587+ @brief
588+ @param
589+ @fn void tSVF_setFreq (tSVF* const, float freq)
590+ @brief
591+ @param
592+
593+ @fn void tSVF_setQ (tSVF* const, float Q)
594+ @brief
595+ @param
596+
597+ @fn void tSVF_setFreqAndQ (tSVF* const svff, float freq, float Q)
598+ @brief
599+ @param
600+ 
601+ @} */
297602
298603 typedef enum SVFType
299604 {
@@ -325,6 +630,7 @@ extern "C" { · 25 unmodified lines
325630 void tSVF_setFreq (tSVF* const, float freq);
326631 void tSVF_setQ (tSVF* const, float Q);
327632 void tSVF_setFreqAndQ (tSVF* const svff, float freq, float Q);
633+
328634 //==============================================================================
329635
330636 /*!
@@ -332,9 +638,32 @@ extern "C" { · 1 unmodified line
332638 @ingroup filters
333639 @brief Efficient State Variable Filter for 14-bit control input, [0, 4096).
334640 @{
335− */
336−
337− /*! @} */
641+
642+ @fn void tEfficientSVF_init (tEfficientSVF* const, SVFType type, uint16_t input, float Q)
643+ @brief
644+ @param
645+
646+ @fn void tEfficientSVF_initToPool (tEfficientSVF* const, SVFType type, uint16_t input, float Q, tMempool* const)
647+ @brief
648+ @param
649+
650+ @fn void tEfficientSVF_free (tEfficientSVF* const)
651+ @brief
652+ @param
653+
654+ @fn float tEfficientSVF_tick (tEfficientSVF* const, float v0)
655+ @brief
656+ @param
657+
658+ @fn void tEfficientSVF_setFreq (tEfficientSVF* const, uint16_t controlFreq)
659+ @brief
660+ @param
661+
662+ @fn void tEfficientSVF_setQ (tEfficientSVF* const, float Q)
663+ @brief
664+ @param
665+ 
666+ @} */
338667
339668 typedef struct _tEfficientSVF
340669 {
@@ -362,9 +691,32 @@ extern "C" { · 21 unmodified lines
362691 @ingroup filters
363692 @brief Simple Highpass filter.
364693 @{
365− */
366−
367− /*! @} */
694+
695+ @fn void tHighpass_init (tHighpass* const, float freq)
696+ @brief
697+ @param
698+
699+ @fn void tHighpass_initToPool (tHighpass* const, float freq, tMempool* const)
700+ @brief
701+ @param
702+
703+ @fn void tHighpass_free (tHighpass* const)
704+ @brief
705+ @param
706+
707+ @fn float tHighpass_tick (tHighpass* const, float x)
708+ @brief
709+ @param
710+
711+ @fn void tHighpass_setFreq (tHighpass* const, float freq)
712+ @brief
713+ @param
714+
715+ @fn float tHighpass_getFreq (tHighpass* const)
716+ @brief
717+ @param
718+ 
719+ @} */
368720
369721 typedef struct _tHighpass
370722 {
@@ -390,9 +742,36 @@ extern "C" { · 19 unmodified lines
390742 @ingroup filters
391743 @brief
392744 @{
393− */
394−
395− /*! @} */
745+
746+ @fn void tButterworth_init (tButterworth* const, int N, float f1, float f2)
747+ @brief
748+ @param
749+
750+ @fn void tButterworth_initToPool (tButterworth* const, int N, float f1, float f2, tMempool* const)
751+ @brief
752+ @param
753+
754+ @fn void tButterworth_free (tButterworth* const)
755+ @brief
756+ @param
757+
758+ @fn float tButterworth_tick (tButterworth* const, float input)
759+ @brief
760+ @param
761+
762+ @fn void tButterworth_setF1 (tButterworth* const, float in)
763+ @brief
764+ @param
765+
766+ @fn void tButterworth_setF2 (tButterworth* const, float in)
767+ @brief
768+ @param
769+
770+ @fn void tButterworth_setFreqs (tButterworth* const, float f1, float f2)
771+ @brief
772+ @param
773+ 
774+ @} */
396775
397776 #define NUM_SVF_BW 16
398777 typedef struct _tButterworth
@@ -427,9 +806,24 @@ extern "C" { · 28 unmodified lines
427806 @ingroup filters
428807 @brief
429808 @{
430− */
431−
432− /*! @} */
809+
810+ @fn void tFIR_init (tFIR* const, float* coeffs, int numTaps)
811+ @brief
812+ @param
813+
814+ @fn void tFIR_initToPool (tFIR* const, float* coeffs, int numTaps, tMempool* const)
815+ @brief
816+ @param
817+
818+ @fn void tFIR_free (tFIR* const)
819+ @brief
820+ @param
821+
822+ @fn float tFIR_tick (tFIR* const, float input)
823+ @brief
824+ @param
825+ 
826+ @} */
433827
434828 typedef struct _tFIR
435829 {
@@ -455,9 +849,24 @@ extern "C" { · 19 unmodified lines
455849 @ingroup filters
456850 @brief
457851 @{
458− */
459−
460− /*! @} */
852+
853+ @fn void tMedianFilter_init (tMedianFilter* const, int size)
854+ @brief
855+ @param
856+
857+ @fn void tMedianFilter_initToPool (tMedianFilter* const, int size, tMempool* const)
858+ @brief
859+ @param
860+
861+ @fn void tMedianFilter_free (tMedianFilter* const)
862+ @brief
863+ @param
864+
865+ @fn float tMedianFilter_tick (tMedianFilter* const, float input)
866+ @brief
867+ @param
868+ 
869+ @} */
461870
462871 typedef struct _tMedianFilter
463872 {
@@ -483,13 +892,60 @@ extern "C" { · 19 unmodified lines
483892 /*!
484893 @defgroup tvzfilter tVZFilter
485894 @ingroup filters
486− @brief
895+ @brief Vadim Zavalishin style from VA book (from implementation in RSlib posted to kvr forum)
487896 @{
488− */
489−
490− /*! @} */
491−
492− //Vadim Zavalishin style from VA book (from implementation in RSlib posted to kvr forum)
897+
898+ @fn void tVZFilter_init (tVZFilter* const, VZFilterType type, float freq, float Q)
899+ @brief
900+ @param
901+
902+ @fn void tVZFilter_initToPool (tVZFilter* const, VZFilterType type, float freq, float Q, tMempool* const)
903+ @brief
904+ @param
905+
906+ @fn void tVZFilter_free (tVZFilter* const)
907+ @brief
908+ @param
909+
910+ @fn void tVZFilter_setSampleRate (tVZFilter* const, float sampleRate)
911+ @brief
912+ @param
913+
914+ @fn float tVZFilter_tick (tVZFilter* const, float input)
915+ @brief
916+ @param
917+
918+ @fn float tVZFilter_tickEfficient (tVZFilter* const vf, float in)
919+ @brief
920+ @param
921+
922+ @fn void tVZFilter_calcCoeffs (tVZFilter* const)
923+ @brief
924+ @param
925+
926+ @fn void tVZFilter_setBandwidth (tVZFilter* const, float bandWidth)
927+ @brief
928+ @param
929+
930+ @fn void tVZFilter_setFreq (tVZFilter* const, float freq)
931+ @brief
932+ @param
933+
934+ @fn void tVZFilter_setFreqAndBandwidth (tVZFilter* const vf, float freq, float bw)
935+ @brief
936+ @param
937+ @fn void tVZFilter_setGain (tVZFilter* const, float gain)
938+ @brief
939+ @param
940+ @fn void tVZFilter_setType (tVZFilter* const, VZFilterType type)
941+ @brief
942+ @param
943+
944+ @fn float tVZFilter_BandwidthToR (tVZFilter* const vf, float B)
945+ @brief
946+ @param
947+ 
948+ @} */
493949
494950 typedef enum VZFilterType
495951 {
@@ -538,16 +994,16 @@ extern "C" { · 42 unmodified lines
538994 void tVZFilter_initToPool (tVZFilter* const, VZFilterType type, float freq, float Q, tMempool* const);
539995 void tVZFilter_free (tVZFilter* const);
540996
541− void tVZFilter_setSampleRate (tVZFilter* const, float sampleRate);
997+ void tVZFilter_setSampleRate (tVZFilter* const, float sampleRate);
542998 float tVZFilter_tick (tVZFilter* const, float input);
543999 float tVZFilter_tickEfficient (tVZFilter* const vf, float in);
544− void tVZFilter_calcCoeffs (tVZFilter* const);
545− void tVZFilter_setBandwidth (tVZFilter* const, float bandWidth);
546− void tVZFilter_setFreq (tVZFilter* const, float freq);
547− void tVZFilter_setFreqAndBandwidth (tVZFilter* const vf, float freq, float bw);
548− void tVZFilter_setGain (tVZFilter* const, float gain);
549− void tVZFilter_setType (tVZFilter* const, VZFilterType type);
550− float tVZFilter_BandwidthToR (tVZFilter* const vf, float B);
1000+ void tVZFilter_calcCoeffs (tVZFilter* const);
1001+ void tVZFilter_setBandwidth (tVZFilter* const, float bandWidth);
1002+ void tVZFilter_setFreq (tVZFilter* const, float freq);
1003+ void tVZFilter_setFreqAndBandwidth (tVZFilter* const vf, float freq, float bw);
1004+ void tVZFilter_setGain (tVZFilter* const, float gain);
1005+ void tVZFilter_setType (tVZFilter* const, VZFilterType type);
1006+ float tVZFilter_BandwidthToR (tVZFilter* const vf, float B);
5511007
5521008
5531009 /*!
@@ -555,9 +1011,32 @@ extern "C" { · 1 unmodified line
5551011 @ingroup filters
5561012 @brief
5571013 @{
558− */
559−
560− /*! @} */
1014+
1015+ @fn void tDiodeFilter_init (tDiodeFilter* const, float freq, float Q)
1016+ @brief
1017+ @param
1018+
1019+ @fn void tDiodeFilter_initToPool (tDiodeFilter* const, float freq, float Q, tMempool* const)
1020+ @brief
1021+ @param
1022+
1023+ @fn void tDiodeFilter_free (tDiodeFilter* const)
1024+ @brief
1025+ @param
1026+
1027+ @fn float tDiodeFilter_tick (tDiodeFilter* const, float input)
1028+ @brief
1029+ @param
1030+
1031+ @fn void tDiodeFilter_setFreq (tDiodeFilter* const vf, float cutoff)
1032+ @brief
1033+ @param
1034+
1035+ @fn void tDiodeFilter_setQ (tDiodeFilter* const vf, float resonance)
1036+ @brief
1037+ @param
1038+ 
1039+ @} */
5611040
5621041 //diode ladder filter
5631042 typedef struct _tDiodeFilter
leaf/Inc/leaf-instruments.h+240−4
@@ -31,7 +31,58 @@ extern "C" { · 30 unmodified lines
3131
3232 //==============================================================================
3333
34− // 808 Cowbell
34+ /*!
35+ @defgroup t808cowbell t808Cowbell
36+ @ingroup instruments
37+ @brief
38+ @{
39+
40+ @fn void t808Cowbell_init (t808Cowbell* const, int useStick)
41+ @brief
42+ @param
43+
44+ @fn void t808Cowbell_initToPool (t808Cowbell* const, int useStick, tMempool* const)
45+ @brief
46+ @param
47+
48+ @fn void t808Cowbell_free (t808Cowbell* const)
49+ @brief
50+ @param
51+
52+ @fn float t808Cowbell_tick (t808Cowbell* const)
53+ @brief
54+ @param
55+
56+ @fn void t808Cowbell_on (t808Cowbell* const, float vel)
57+ @brief
58+ @param
59+
60+ @fn void t808Cowbell_setDecay (t808Cowbell* const, float decay)
61+ @brief
62+ @param
63+
64+ @fn void t808Cowbell_setHighpassFreq (t808Cowbell* const, float freq)
65+ @brief
66+ @param
67+
68+ @fn void t808Cowbell_setBandpassFreq (t808Cowbell* const, float freq)
69+ @brief
70+ @param
71+
72+ @fn void t808Cowbell_setFreq (t808Cowbell* const, float freq)
73+ @brief
74+ @param
75+
76+ @fn void t808Cowbell_setOscMix (t808Cowbell* const, float oscMix)
77+ @brief
78+ @param
79+
80+ @fn void t808Cowbell_setStick (t808Cowbell* const, int useStick)
81+ @brief
82+ @param
83+
84+ @} */
85+
3586 typedef struct _t808Cowbell
3687 {
3788 tMempool mempool;
@@ -65,7 +116,74 @@ extern "C" { · 27 unmodified lines
65116
66117 //==============================================================================
67118
68− // 808 Hihat
119+ /*!
120+ @defgroup t808hihat t808Hihat
121+ @ingroup instruments
122+ @brief
123+ @{
124+
125+ @fn void t808Hihat_init (t808Hihat* const)
126+ @brief
127+ @param
128+
129+ @fn void t808Hihat_initToPool (t808Hihat* const, tMempool* const)
130+ @brief
131+ @param
132+
133+ @fn void t808Hihat_free (t808Hihat* const)
134+ @brief
135+ @param
136+
137+ @fn float t808Hihat_tick (t808Hihat* const)
138+ @brief
139+ @param
140+
141+ @fn void t808Hihat_on (t808Hihat* const, float vel)
142+ @brief
143+ @param
144+
145+ @fn void t808Hihat_setOscNoiseMix (t808Hihat* const, float oscNoiseMix)
146+ @brief
147+ @param
148+
149+ @fn void t808Hihat_setDecay (t808Hihat* const, float decay)
150+ @brief
151+ @param
152+
153+ @fn void t808Hihat_setHighpassFreq (t808Hihat* const, float freq)
154+ @brief
155+ @param
156+
157+ @fn void t808Hihat_setOscBandpassFreq (t808Hihat* const, float freq)
158+ @brief
159+ @param
160+
161+ @fn void t808Hihat_setOscBandpassQ (t808Hihat* const hihat, float Q)
162+ @brief
163+ @param
164+
165+ @fn void t808Hihat_setStickBandPassFreq (t808Hihat* const, float freq)
166+ @brief
167+ @param
168+
169+ @fn void t808Hihat_setStickBandPassQ (t808Hihat* const hihat, float Q)
170+ @brief
171+ @param
172+
173+ @fn void t808Hihat_setOscFreq (t808Hihat* const, float freq)
174+ @brief
175+ @param
176+
177+ @fn void t808Hihat_setStretch (t808Hihat* const hihat, float stretch)
178+ @brief
179+ @param
180+
181+ @fn void t808Hihat_setFM (t808Hihat* const hihat, float FM_amount)
182+ @brief
183+ @param
184+
185+ @} */
186+
69187 typedef struct _t808Hihat
70188 {
71189 tMempool mempool;
@@ -107,7 +225,66 @@ extern "C" { · 35 unmodified lines
107225
108226 //==============================================================================
109227
110− // 808 Snare
228+ /*!
229+ @defgroup t808snare t808Snare
230+ @ingroup instruments
231+ @brief
232+ @{
233+
234+ @fn void t808Snare_init (t808Snare* const)
235+ @brief
236+ @param
237+
238+ @fn void t808Snare_initToPool (t808Snare* const, tMempool* const)
239+ @brief
240+ @param
241+
242+ @fn void t808Snare_free (t808Snare* const)
243+ @brief
244+ @param
245+
246+ @fn float t808Snare_tick (t808Snare* const)
247+ @brief
248+ @param
249+
250+ @fn void t808Snare_on (t808Snare* const, float vel)
251+ @brief
252+ @param
253+
254+ @fn void t808Snare_setTone1Freq (t808Snare* const, float freq)
255+ @brief
256+ @param
257+
258+ @fn void t808Snare_setTone2Freq (t808Snare* const, float freq)
259+ @brief
260+ @param
261+
262+ @fn void t808Snare_setTone1Decay (t808Snare* const, float decay)
263+ @brief
264+ @param
265+
266+ @fn void t808Snare_setTone2Decay (t808Snare* const, float decay)
267+ @brief
268+ @param
269+
270+ @fn void t808Snare_setNoiseDecay (t808Snare* const, float decay)
271+ @brief
272+ @param
273+
274+ @fn void t808Snare_setToneNoiseMix (t808Snare* const, float toneNoiseMix)
275+ @brief
276+ @param
277+
278+ @fn void t808Snare_setNoiseFilterFreq (t808Snare* const, float noiseFilterFreq)
279+ @brief
280+ @param
281+
282+ @fn void t808Snare_setNoiseFilterQ (t808Snare* const, float noiseFilterQ)
283+ @brief
284+ @param
285+
286+ @} */
287+
111288 typedef struct _t808Snare
112289 {
113290 tMempool mempool;
@@ -151,7 +328,66 @@ extern "C" { · 37 unmodified lines
151328
152329 //==============================================================================
153330
154− // 808 Kick
331+ /*!
332+ @defgroup t808kick t808Kick
333+ @ingroup instruments
334+ @brief
335+ @{
336+
337+ @fn void t808Kick_init (t808Kick* const)
338+ @brief
339+ @param
340+
341+ @fn void t808Kick_initToPool (t808Kick* const, tMempool* const)
342+ @brief
343+ @param
344+
345+ @fn void t808Kick_free (t808Kick* const)
346+ @brief
347+ @param
348+
349+ @fn float t808Kick_tick (t808Kick* const)
350+ @brief
351+ @param
352+
353+ @fn void t808Kick_on (t808Kick* const, float vel)
354+ @brief
355+ @param
356+
357+ @fn void t808Kick_setToneFreq (t808Kick* const, float freq)
358+ @brief
359+ @param
360+
361+ @fn void t808Kick_setToneDecay (t808Kick* const, float decay)
362+ @brief
363+ @param
364+
365+ @fn void t808Kick_setNoiseDecay (t808Kick* const, float decay)
366+ @brief
367+ @param
368+
369+ @fn void t808Kick_setSighAmount (t808Kick* const, float sigh)
370+ @brief
371+ @param
372+
373+ @fn void t808Kick_setChirpAmount (t808Kick* const, float chirp)
374+ @brief
375+ @param
376+
377+ @fn void t808Kick_setToneNoiseMix (t808Kick* const, float toneNoiseMix)
378+ @brief
379+ @param
380+
381+ @fn void t808Kick_setNoiseFilterFreq (t808Kick* const, float noiseFilterFreq)
382+ @brief
383+ @param
384+
385+ @fn void t808Kick_setNoiseFilterQ (t808Kick* const, float noiseFilterQ)
386+ @brief
387+ @param
388+
389+ @} */
390+
155391 typedef struct _t808Kick
156392 {
157393 tMempool mempool;
leaf/Inc/leaf-math.h+7−7
@@ -23,11 +23,10 @@ extern "C" { · 22 unmodified lines
2323
2424 //==============================================================================
2525
26− typedef enum oBool
27− {
28− OTRUE = 1,
29− OFALSE = 0
30− }oBool;
26+ /*!
27+ @ingroup math
28+ @{
29+ */
3130
3231 // Allows for bitwise operations on floats
3332 union unholy_t { /* a union between a float and an integer */
@@ -110,8 +109,8 @@ extern "C" { · 76 unmodified lines
110109
111110 float LEAF_clip (float min, float val, float max);
112111 int LEAF_clipInt (int min, int val, int max);
113− float LEAF_softClip (float val, float thresh);
114− oBool LEAF_isPrime (uint64_t number );
112+ float LEAF_softClip (float val, float thresh);
113+ int LEAF_isPrime (uint64_t number );
115114
116115 float LEAF_midiToFrequency (float f);
117116 float LEAF_frequencyToMidi(float f);
@@ -219,6 +218,7 @@ extern "C" { · 101 unmodified lines
219218
220219 float median3f(float a, float b, float c);
221220
221+ /*! @} */
222222
223223 //==============================================================================
224224
leaf/Inc/leaf-mempool.h+2−1
@@ -112,7 +112,8 @@ extern "C" { · 111 unmodified lines
112112 */
113113 void tMempool_freeFromPool (tMempool* const pool, tMempool* const poolFrom);
114114
115− /*! @} */
115+ /*!
116+ @} */
116117
117118 //==============================================================================
118119
leaf/Inc/leaf-midi.h+270−325
@@ -31,15 +31,79 @@ extern "C" { · 30 unmodified lines
3131 //==============================================================================
3232
3333 // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
34−
34+
3535 /*!
36− * @defgroup tstack tStack
37− * @ingroup midi
38− * @brief A basic stack of integers with a fixed max size of 128, used by tPoly to keep track of MIDI notes.
39− * @{
40− */
36+ @defgroup tstack tStack
37+ @ingroup midi
38+ @brief A basic stack of integers with a fixed capacity of 128, used by tPoly to keep track of MIDI notes.
39+ @{
40+
41+ @fn void tStack_init (tStack* const stack)
42+ @brief Initialize a tStack to the default LEAF mempool.
43+ @param stack A pointer to the tStack to be initialized.
44+
45+ @fn void tStack_initToPool (tStack* const stack, tMempool* const mempool)
46+ @brief Initialize a tStack to a specified mempool.
47+ @param stack A pointer to the tStack to be initialized.
48+ @param mempool A pointer to the tMempool to which the tStack should be initialized.
49+
50+ @fn void tStack_free (tStack* const stack)
51+ @brief Free a tStack from the default LEAF mempool.
52+ @param stack A pointer to the tStack to be freed.
53+
54+ @fn void tStack_setCapacity (tStack* const stack, uint16_t cap)
55+ @brief Set the capacity of the stack.
56+ @param stack A pointer to the relevant tStack.
57+ @param cap The new capacity.
58+
59+ @fn int tStack_addIfNotAlreadyThere (tStack* const stack, uint16_t item)
60+ @brief Add a value to the stack only if that value is not already in the stack.
61+ @param stack A pointer to the relevant tStack.
62+ @param item The value to be added.
63+
64+ @fn void tStack_add (tStack* const stack, uint16_t item)
65+ @brief Add a value to the stack.
66+ @param stack A pointer to the relevant tStack.
67+ @param item The value to be added.
68+
69+ @fn int tStack_remove (tStack* const stack, uint16_t item)
70+ @brief Remove a single instance of a value from the stack.
71+ @param stack A pointer to the relevant tStack.
72+ @param item The value to be removed.
73+
74+ @fn void tStack_clear (tStack* const stack)
75+ @brief Clear the stack.
76+ @param stack A pointer to the relevant tStack.
77+
78+ @fn int tStack_first (tStack* const stack)
79+ @brief Get the first value in the stack.
80+ @param stack A pointer to the relevant tStack.
81+ @return The first value in the stack.
82+
83+ @fn int tStack_getSize (tStack* const stack)
84+ @brief Get the current size of the stack.
85+ @param stack A pointer to the relevant tStack.
86+ @return The current size of the stack.
87+
88+ @fn int tStack_contains (tStack* const stack, uint16_t item)
89+ @brief Check if the stack contains a value, and if it does, get the index of that value.
90+ @param stack A pointer to the relevant tStack.
91+ @param item The value to check against the stack.
92+ @return The index of the value or -1 if the stack does not contain the value.
93+
94+ @fn int tStack_next (tStack* const stack)
95+ @brief Get the next value in the stack, starting from the earliest added values.
96+ @param stack A pointer to the relevant tStack.
97+ @return The next value in the stack or -1 if there are no values in the stack.
98+
99+ @fn int tStack_get (tStack* const stack, int index)
100+ @brief Get the value at a given index of the stack.
101+ @param stack A pointer to the relevant tStack.
102+ @param index The index of the stack from which to get a value.
103+ @return The value at the given index.
104+
105+ @} */
41106
42− // STACK implementation (fixed size)
43107 #define STACK_SIZE 128
44108 typedef struct _tStack
45109 {
@@ -48,120 +112,139 @@ extern "C" { · 2 unmodified lines
48112 uint16_t pos;
49113 uint16_t size;
50114 uint16_t capacity;
51− oBool ordered;
115+ int ordered;
52116 } _tStack;
53117
54118 typedef _tStack* tStack;
55119
56− //! Initialize a tStack to the default LEAF mempool.
57− /*!
58− @param stack A pointer to the tStack to be initialized.
59− */
60120 void tStack_init (tStack* const stack);
61−
62−
63− //! Initialize a tStack to a specified mempool.
64− /*!
65− @param stack A pointer to the tStack to be initialized.
66− @param pool A pointer to the tMempool to which the tStack should be initialized.
67− */
68121 void tStack_initToPool (tStack* const stack, tMempool* const pool);
69−
70−
71− //! Free a tStack from the default LEAF mempool.
72− /*!
73− @param stack A pointer to the tStack to be freed.
74− */
75122 void tStack_free (tStack* const stack);
76123
77−
78− //! Set the capacity of the stack.
79− /*!
80− @param stack A pointer to the relevant tStack.
81− @param cap The new capacity.
82− */
83124 void tStack_setCapacity (tStack* const stack, uint16_t cap);
84−
85−
86− //! Add a value to the stack only if that value is not already in the stack.
87− /*!
88− @param stack A pointer to the relevant tStack.
89− @param item The value to be added.
90− */
91125 int tStack_addIfNotAlreadyThere (tStack* const stack, uint16_t item);
92−
93−
94− //! Add a value to the stack.
95− /*!
96− @param stack A pointer to the relevant tStack.
97− @param item The value to be added.
98− */
99126 void tStack_add (tStack* const stack, uint16_t item);
100−
101−
102− //! Remove a single instance of a value from the stack.
103− /*!
104− @param stack A pointer to the relevant tStack.
105− @param item The value to be removed.
106− */
107127 int tStack_remove (tStack* const stack, uint16_t item);
108−
109−
110− //! Clear the stack.
111− /*!
112− @param stack A pointer to the relevant tStack.
113− */
114128 void tStack_clear (tStack* const stack);
115−
116−
117− //! Get the first value in the stack.
118− /*!
119− @param stack A pointer to the relevant tStack.
120− @return The first value in the stack.
121− */
122129 int tStack_first (tStack* const stack);
123−
124−
125− //! Get the current size of the stack.
126− /*!
127− @param stack A pointer to the relevant tStack.
128− @return The current size of the stack.
129− */
130130 int tStack_getSize (tStack* const stack);
131−
132− //! Check if the stack contains a value, and if it does, get the index of that value.
133− /*!
134− @param stack A pointer to the relevant tStack.
135− @param item The value to check against the stack.
136− @return The index of the value or -1 if the stack does not contain the value.
137− */
138131 int tStack_contains (tStack* const stack, uint16_t item);
139−
140− //! Get the next value in the stack, starting from the earliest added values.
141− /*!
142− @param stack A pointer to the relevant tStack.
143− @return The next value in the stack or -1 if there are no values in the stack.
144− */
145132 int tStack_next (tStack* const stack);
146−
147− //! Get the value at a given index of the stack.
148− /*!
149− @param stack A pointer to the relevant tStack.
150− @param index The index of the stack from which to get a value.
151− @return The value at the given index.
152− */
153133 int tStack_get (tStack* const stack, int index);
154134
155− /*! @} */
156−
157− /*!
158− * @defgroup tpoly tPoly
159− * @ingroup midi
160− * @brief An object for polyphonic handling.
161− * @{
162− */
163−
164− /* tPoly */
135+ /*! @}
136+ @defgroup tpoly tPoly
137+ @ingroup midi
138+ @brief An object for polyphonic handling.
139+ @{
140+
141+ @fn void tPoly_init (tPoly* const poly, int maxNumVoices)
142+ @brief Initialize a tPoly to the default LEAF mempool.
143+ @param poly A pointer to the tPoly to be initialized.
144+ @param maxNumVoices The maximum number of voices this tPoly can handle at once.
145+
146+ @fn void tPoly_initToPool (tPoly* const poly, int maxNumVoices, tMempool* const pool)
147+ @brief Initialize a tPoly to a specified mempool.
148+ @param poly A pointer to the tPoly to be initialized.
149+ @param pool A pointer to the tMempool to which the tPoly should be initialized.
150+
151+ @fn void tPoly_free (tPoly* const poly)
152+ @brief Free a tPoly from the default LEAF mempool.
153+ @param poly A pointer to the tPoly to be freed.
154+
155+ @fn int tPoly_noteOn (tPoly* const poly, int note, uint8_t vel)
156+ @brief Add a note with a given velocity to the poly handler.
157+ @param poly A pointer to the relevant tPoly.
158+ @param note The MIDI note number to add.
159+ @param vel The MIDI velocity of the note to add.
160+ @return The voice that will play the note.
161+
162+ @fn int tPoly_noteOff (tPoly* const poly, uint8_t note)
163+ @brief Remove a note from the poly handler.
164+ @param poly A pointer to the relevant tPoly.
165+ @param note The MIDI note number to remove.
166+ @return The voice that was playing the removed note.
167+
168+ @fn void tPoly_orderedAddToStack (tPoly* const poly, uint8_t note)
169+ @brief
170+ @param
171+
172+ @fn void tPoly_setNumVoices (tPoly* const poly, uint8_t numVoices)
173+ @brief Set the number of voices available to play notes.
174+ @param poly A pointer to the relevant tPoly.
175+ @param numVoices The new number of available voices. Cannot be greater than the max number voices given in tPoly_init().
176+
177+ @fn void tPoly_setPitchGlideActive (tPoly* const poly, int isActive)
178+ @brief Set whether pitch glide over note changes in voices is active.
179+ @param poly A pointer to the relevant tPoly.
180+ @param isActive Whether pitch glide should be active or not.
181+
182+ @fn void tPoly_setPitchGlideTime (tPoly* const poly, float t)
183+ @brief Set how long pitch glide over note changes in voices takes.
184+ @param poly A pointer to the relevant tPoly.
185+ @param t The time to glide in milliseconds.
186+
187+ @fn void tPoly_setPitchBend (tPoly* const poly, float pitchBend)
188+ @brief Set the amount of pitch bend
189+ @param poly A pointer to the relevant tPoly.
190+ @param pitchBend The new amount of pitch bend.
191+
192+ @fn void tPoly_setBendGlideTime (tPoly* const poly, float t)
193+ @brief
194+ @param
195+
196+ @fn void tPoly_setBendSamplesPerTick (tPoly* const poly, float t)
197+ @brief
198+ @param
199+
200+ @fn void tPoly_tickPitch (tPoly* const poly)
201+ @brief Execute all tick-rate changes in the poly handler's pitch, including glide and bend.
202+ @param poly A pointer to the relevant tPoly.
203+
204+ @fn void tPoly_tickPitchGlide (tPoly* const poly)
205+ @brief Execute the tick-rate change of the poly handler's pitch glide.
206+ @param poly A pointer to the relevant tPoly.
207+
208+ @fn void tPoly_tickPitchBend (tPoly* const poly)
209+ @brief Execute the tick-rate change of the poly handler's pitch bend.
210+ @param poly A pointer to the relevant tPoly.
211+
212+ @fn int tPoly_getNumVoices (tPoly* const poly)
213+ @brief Get the current number of voices available to play notes.
214+ @param poly A pointer to the relevant tPoly.
215+ @return The current number of voices available to play notes.
216+
217+ @fn int tPoly_getNumActiveVoices (tPoly* const poly)
218+ @brief Get the number of voices currently playing notes.
219+ @param poly A pointer to the relevant tPoly.
220+ @return The number of voices currently playing notes.
221+
222+ @fn float tPoly_getPitch (tPoly* const poly, uint8_t voice)
223+ @brief Get the current pitch of a given voice.
224+ @param poly A pointer to the relevant tPoly.
225+ @param voice The voice to get the pitch of.
226+ @return The current pitch of the given voice as a fractional MIDI note number.
227+
228+ @fn int tPoly_getKey (tPoly* const poly, uint8_t voice)
229+ @brief Get the current MIDI note number of a given voice.
230+ @param poly A pointer to the relevant tPoly.
231+ @param voice The voice to get the MIDI note number of.
232+ @return The MIDI note number of the given voice.
233+
234+ @fn int tPoly_getVelocity (tPoly* const poly, uint8_t voice)
235+ @brief Get the current MIDI velocity of a given voice.
236+ @param poly A pointer to the relevant tPoly.
237+ @param voice The voice to get the MIDI velocity of.
238+ @return The current MIDI velocity of the given voice.
239+
240+ @fn int tPoly_isOn (tPoly* const poly, uint8_t voice)
241+ @brief Get the current play state of a given voice.
242+ @param poly A pointer to the relevant tPoly.
243+ @param voice The voice to get the state of.
244+ @return The current play state of the given voice.
245+
246+ @} */
247+
165248 typedef struct _tPoly
166249 {
167250 tMempool mempool;
@@ -171,9 +254,9 @@ extern "C" { · 3 unmodified lines
171254
172255 tRamp* ramps;
173256 float* rampVals;
174− oBool* firstReceived;
257+ int* firstReceived;
175258 float glideTime;
176− oBool pitchGlideIsActive;
259+ int pitchGlideIsActive;
177260
178261 int numVoices;
179262 int maxNumVoices;
@@ -200,158 +283,113 @@ extern "C" { · 20 unmodified lines
200283
201284 typedef _tPoly* tPoly;
202285
203− /* MPoly*/
204− //! Initialize a tPoly to the default LEAF mempool.
205− /*!
206− @param poly A pointer to the tPoly to be initialized.
207− @param maxNumVoices The maximum number of voices this tPoly can handle at once.
208− */
209286 void tPoly_init (tPoly* const poly, int maxNumVoices);
210−
211−
212− //! Initialize a tPoly to a specified mempool.
213− /*!
214− @param poly A pointer to the tPoly to be initialized.
215− @param pool A pointer to the tMempool to which the tPoly should be initialized.
216− */
217287 void tPoly_initToPool (tPoly* const poly, int maxNumVoices, tMempool* const pool);
218−
219−
220− //! Free a tPoly from the default LEAF mempool.
221− /*!
222− @param poly A pointer to the tPoly to be freed.
223− */
224288 void tPoly_free (tPoly* const poly);
225289
226−
227− //! Add a note with a given velocity to the poly handler.
228− /*!
229− @param poly A pointer to the relevant tPoly.
230− @param note The MIDI note number to add.
231− @param vel The MIDI velocity of the note to add.
232− @return The voice that will play the note.
233− */
234290 int tPoly_noteOn (tPoly* const poly, int note, uint8_t vel);
235−
236−
237− //! Remove a note from the poly handler.
238− /*!
239− @param poly A pointer to the relevant tPoly.
240− @param note The MIDI note number to remove.
241− @return The voice that was playing the removed note.
242− */
243291 int tPoly_noteOff (tPoly* const poly, uint8_t note);
244−
245292 void tPoly_orderedAddToStack (tPoly* const poly, uint8_t note);
246−
247−
248− //! Set the number of voices available to play notes.
249− /*!
250− @param poly A pointer to the relevant tPoly.
251− @param numVoices The new number of available voices. Cannot be greater than the max number voices given in tPoly_init().
252− */
253293 void tPoly_setNumVoices (tPoly* const poly, uint8_t numVoices);
254−
255− //! Set whether pitch glide over note changes in voices is active.
256− /*!
257− @param poly A pointer to the relevant tPoly.
258− @param isActive Whether pitch glide should be active or not.
259− */
260− void tPoly_setPitchGlideActive (tPoly* const poly, oBool isActive);
261−
262− //! Set how long pitch glide over note changes in voices takes.
263− /*!
264− @param poly A pointer to the relevant tPoly.
265− @param t The time to glide in milliseconds.
266− */
294+ void tPoly_setPitchGlideActive (tPoly* const poly, int isActive);
267295 void tPoly_setPitchGlideTime (tPoly* const poly, float t);
268−
269− //! Set the amount of pitch bend
270− /*!
271− @param poly A pointer to the relevant tPoly.
272− @param pitchBend The new amount of pitch bend.
273− */
274296 void tPoly_setPitchBend (tPoly* const poly, float pitchBend);
275297 void tPoly_setBendGlideTime (tPoly* const poly, float t);
276298 void tPoly_setBendSamplesPerTick (tPoly* const poly, float t);
299+ void tPoly_tickPitch (tPoly* const poly);
300+ void tPoly_tickPitchGlide (tPoly* const poly);
301+ void tPoly_tickPitchBend (tPoly* const poly);
302+ int tPoly_getNumVoices (tPoly* const poly);
303+ int tPoly_getNumActiveVoices (tPoly* const poly);
304+ float tPoly_getPitch (tPoly* const poly, uint8_t voice);
305+ int tPoly_getKey (tPoly* const poly, uint8_t voice);
306+ int tPoly_getVelocity (tPoly* const poly, uint8_t voice);
307+ int tPoly_isOn (tPoly* const poly, uint8_t voice);
277308
278−
279− //! Execute all tick-rate changes in the poly handler's pitch, including glide and bend.
280− /*!
309+ //==============================================================================
310+
311+ /*! @}
312+ @defgroup tsimplepoly tSimplePoly
313+ @ingroup midi
314+ @brief An object for polyphonic handling.
315+ @{
316+
317+ @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.
321+
322+ @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.
326+
327+ @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.
330+
331+ @fn int tSimplePoly_noteOn (tSimplePoly* const poly, int note, uint8_t vel)
332+ @brief Add a note with a given velocity to the poly handler.
281333 @param poly A pointer to the relevant tPoly.
282− */
283− void tPoly_tickPitch (tPoly* const poly);
284−
285−
286− //! Execute the tick-rate change of the poly handler's pitch glide.
287− /*!
334+ @param note The MIDI note number to add.
335+ @param vel The MIDI velocity of the note to add.
336+ @return The voice that will play the note.
337+
338+ @fn int tSimplePoly_noteOff (tSimplePoly* const poly, uint8_t note)
339+ @brief Remove a note from the poly handler.
288340 @param poly A pointer to the relevant tPoly.
289− */
290− void tPoly_tickPitchGlide (tPoly* const poly);
291−
292−
293− //! Execute the tick-rate change of the poly handler's pitch bend.
294− /*!
341+ @param note The MIDI note number to remove.
342+ @return The voice that was playing the removed note.
343+
344+ @fn void tSimplePoly_deactivateVoice(tSimplePoly* const polyh, uint8_t voice)
345+ @brief
346+ @param
347+
348+ @fn int tSimplePoly_markPendingNoteOff(tSimplePoly* const polyh, uint8_t note)
349+ @brief
350+ @param
351+
352+ @fn int tSimplePoly_findVoiceAssignedToNote(tSimplePoly* const polyh, uint8_t note)
353+ @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
354+ @param
355+
356+ @fn void tSimplePoly_setNumVoices (tSimplePoly* const poly, uint8_t numVoices)
357+ @brief Set the number of voices available to play notes.
295358 @param poly A pointer to the relevant tPoly.
296− */
297− void tPoly_tickPitchBend (tPoly* const poly);
298−
299−
300− //! Get the current number of voices available to play notes.
301− /*!
359+ @param numVoices The new number of available voices. Cannot be greater than the max number voices given in tPoly_init().
360+
361+ @fn int tSimplePoly_getNumVoices (tSimplePoly* const poly)
362+ @brief Get the current number of voices available to play notes.
302363 @param poly A pointer to the relevant tPoly.
303364 @return The current number of voices available to play notes.
304− */
305− int tPoly_getNumVoices (tPoly* const poly);
306−
307− //! Get the number of voices currently playing notes.
308− /*!
365+
366+ @fn int tSimplePoly_getNumActiveVoices (tSimplePoly* const poly)
367+ @brief Get the number of voices currently playing notes.
309368 @param poly A pointer to the relevant tPoly.
310369 @return The number of voices currently playing notes.
311− */
312− int tPoly_getNumActiveVoices (tPoly* const poly);
313−
314− //! Get the current pitch of a given voice.
315− /*!
316− @param poly A pointer to the relevant tPoly.
317− @param voice The voice to get the pitch of.
318− @return The current pitch of the given voice as a fractional MIDI note number.
319− */
320− float tPoly_getPitch (tPoly* const poly, uint8_t voice);
321−
322−
323− //! Get the current MIDI note number of a given voice.
324− /*!
370+
371+ @fn int tSimplePoly_getPitch (tSimplePoly* const poly, uint8_t voice)
372+ @brief Get the current MIDI note number of a given voice.
325373 @param poly A pointer to the relevant tPoly.
326374 @param voice The voice to get the MIDI note number of.
327375 @return The MIDI note number of the given voice.
328− */
329− int tPoly_getKey (tPoly* const poly, uint8_t voice);
330−
331−
332− //! Get the current MIDI velocity of a given voice.
333− /*!
376+
377+ @fn int tSimplePoly_getPitchAndCheckActive(tSimplePoly* const polyh, uint8_t voice)
378+ @brief Returns negative one if the voice is inactive
379+
380+ @fn int tSimplePoly_getVelocity (tSimplePoly* const poly, uint8_t voice)
381+ @brief Get the current MIDI velocity of a given voice.
334382 @param poly A pointer to the relevant tPoly.
335383 @param voice The voice to get the MIDI velocity of.
336384 @return The current MIDI velocity of the given voice.
337− */
338− int tPoly_getVelocity (tPoly* const poly, uint8_t voice);
339−
340−
341− //! Get the current play state of a given voice.
342− /*!
385+
386+ @fn int tSimplePoly_isOn (tSimplePoly* const poly, uint8_t voice)
387+ @brief Get the current play state of a given voice.
343388 @param poly A pointer to the relevant tPoly.
344389 @param voice The voice to get the state of.
345390 @return The current play state of the given voice.
346− */
347− int tPoly_isOn (tPoly* const poly, uint8_t voice);
348−
349− /*! @} */
350−
351− //==============================================================================
352−
353−
354− /* tPoly */
391+
392+ @} */
355393 typedef struct _tSimplePoly
356394 {
357395 tMempool mempool;
@@ -369,116 +407,23 @@ extern "C" { · 11 unmodified lines
369407
370408 typedef _tSimplePoly* tSimplePoly;
371409
372− //! Initialize a tPoly to the default LEAF mempool.
373− /*!
374− @param poly A pointer to the tPoly to be initialized.
375− @param maxNumVoices The maximum number of voices this tPoly can handle at once.
376− */
377410 void tSimplePoly_init (tSimplePoly* const poly, int maxNumVoices);
378−
379−
380− //! Initialize a tPoly to a specified mempool.
381− /*!
382− @param poly A pointer to the tPoly to be initialized.
383− @param pool A pointer to the tMempool to which the tPoly should be initialized.
384− */
385411 void tSimplePoly_initToPool (tSimplePoly* const poly, int maxNumVoices, tMempool* const pool);
386−
387−
388− //! Free a tPoly from the default LEAF mempool.
389− /*!
390− @param poly A pointer to the tPoly to be freed.
391− */
392412 void tSimplePoly_free (tSimplePoly* const poly);
393413
394−
395− //! Add a note with a given velocity to the poly handler.
396− /*!
397− @param poly A pointer to the relevant tPoly.
398− @param note The MIDI note number to add.
399− @param vel The MIDI velocity of the note to add.
400− @return The voice that will play the note.
401− */
402414 int tSimplePoly_noteOn (tSimplePoly* const poly, int note, uint8_t vel);
403−
404−
405− //! Remove a note from the poly handler.
406− /*!
407− @param poly A pointer to the relevant tPoly.
408− @param note The MIDI note number to remove.
409− @return The voice that was playing the removed note.
410− */
411415 int tSimplePoly_noteOff (tSimplePoly* const poly, uint8_t note);
412−
413−
414−
415− void tSimplePoly_deactivateVoice(tSimplePoly* const polyh, uint8_t voice);
416−
417− int tSimplePoly_markPendingNoteOff(tSimplePoly* const polyh, uint8_t note);
418−
419−
420− //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
421− int tSimplePoly_findVoiceAssignedToNote(tSimplePoly* const polyh, uint8_t note);
422−
423− //! Set the number of voices available to play notes.
424− /*!
425− @param poly A pointer to the relevant tPoly.
426− @param numVoices The new number of available voices. Cannot be greater than the max number voices given in tPoly_init().
427− */
416+ void tSimplePoly_deactivateVoice (tSimplePoly* const polyh, uint8_t voice);
417+ int tSimplePoly_markPendingNoteOff (tSimplePoly* const polyh, uint8_t note);
418+ int tSimplePoly_findVoiceAssignedToNote (tSimplePoly* const polyh, uint8_t note);
428419 void tSimplePoly_setNumVoices (tSimplePoly* const poly, uint8_t numVoices);
429−
430− //! Set whether pitch glide over note changes in voices is active.
431− /*!
432− @param poly A pointer to the relevant tPoly.
433− @param isActive Whether pitch glide should be active or not.
434− */
435−
436− //! Get the current number of voices available to play notes.
437− /*!
438− @param poly A pointer to the relevant tPoly.
439− @return The current number of voices available to play notes.
440− */
441420 int tSimplePoly_getNumVoices (tSimplePoly* const poly);
442−
443− //! Get the number of voices currently playing notes.
444− /*!
445− @param poly A pointer to the relevant tPoly.
446− @return The number of voices currently playing notes.
447− */
448421 int tSimplePoly_getNumActiveVoices (tSimplePoly* const poly);
449−
450− //! Get the current MIDI note number of a given voice.
451− /*!
452− @param poly A pointer to the relevant tPoly.
453− @param voice The voice to get the MIDI note number of.
454− @return The MIDI note number of the given voice.
455− */
456−
457− int tSimplePoly_getPitch (tSimplePoly* const poly, uint8_t voice);
458−
459−
460− //this one returns negative one if the voice is inactive
461− int tSimplePoly_getPitchAndCheckActive(tSimplePoly* const polyh, uint8_t voice);
462−
463−
464− //! Get the current MIDI velocity of a given voice.
465− /*!
466− @param poly A pointer to the relevant tPoly.
467− @param voice The voice to get the MIDI velocity of.
468− @return The current MIDI velocity of the given voice.
469− */
422+ int tSimplePoly_getPitch (tSimplePoly* const poly, uint8_t voice);
423+ int tSimplePoly_getPitchAndCheckActive(tSimplePoly* const polyh, uint8_t voice);
470424 int tSimplePoly_getVelocity (tSimplePoly* const poly, uint8_t voice);
471−
472−
473− //! Get the current play state of a given voice.
474− /*!
475− @param poly A pointer to the relevant tPoly.
476− @param voice The voice to get the state of.
477− @return The current play state of the given voice.
478− */
479425 int tSimplePoly_isOn (tSimplePoly* const poly, uint8_t voice);
480426
481− /*! @} */
482427 //==============================================================================
483428
484429 #ifdef __cplusplus
leaf/Inc/leaf-oscillators.h+120−332
@@ -33,42 +33,31 @@ extern "C" { · 32 unmodified lines
3333 @ingroup oscillators
3434 @brief A general wavetable oscillator.
3535 @{
36− */
37−
38− /*!
39− @fn void tTable_init (tTable* const osc)
36+
37+ @fn void tTable_init (tTable* const osc, float* waveTable, int size)
4038 @brief Initialize a tTable to the default LEAF mempool.
4139 @param osc A pointer to the tTable to be initialized.
42− */
43−
44− /*!
45− @fn void tTable_initToPool (tTable* const osc, tMempool* const mempool)
40+
41+ @fn void tTable_initToPool (tTable* const osc, float* waveTable, int size, tMempool* const mempool)
4642 @brief Initialize a tTable to a specified mempool.
4743 @param osc A pointer to the tTable to be initialized.
4844 @param pool A pointer to the tMempool to which the tTable should be initialized.
49− */
50−
51− /*!
45+
5246 @fn void tTable_free (tTable* const osc)
5347 @brief Free a tTable from the default LEAF mempool.
5448 @param osc A pointer to the tTable to be freed.
55− */
56−
57− /*!
49+
5850 @fn float tTable_tick (tTable* const osc)
5951 @brief Tick a tTable oscillator.
6052 @param osc A pointer to the relevant tTable.
6153 @return The ticked sample as a float from -1 to 1.
62− */
63−
64− /*!
54+
6555 @fn void tTable_setFreq (tTable* const osc, float freq)
6656 @brief Set the frequency of a tTable oscillator.
6757 @param osc A pointer to the relevant tTable.
6858 @param freq The frequency to set the oscillator to.
69− */
70−
71− /*! @} */
59+
60+ @} */
7261
7362 typedef struct _tTable
7463 {
@@ -96,42 +85,32 @@ extern "C" { · 21 unmodified lines
9685 @ingroup oscillators
9786 @brief A cycle/sine waveform oscillator. Uses wavetable synthesis.
9887 @{
99− */
100−
101− /*!
88+
10289 @fn void tCycle_init (tCycle* const osc)
10390 @brief Initialize a tCycle to the default LEAF mempool.
10491 @param osc A pointer to the tCycle to be initialized.
105− */
106−
107− /*!
92+
10893 @fn void tCycle_initToPool (tCycle* const osc, tMempool* const pool)
10994 @brief Initialize a tCycle to a specified mempool.
11095 @param osc A pointer to the tCycle to be initialized.
11196 @param pool A pointer to the tMempool to which the tCycle should be initialized.
112− */
113−
114− /*!
97+
11598 @fn void tCycle_free (tCycle* const osc)
11699 @brief Free a tCycle from the default LEAF mempool.
117100 @param osc A pointer to the tCycle to be freed.
118− */
119−
120− /*!
101+
121102 @fn float tCycle_tick (tCycle* const osc)
122103 @brief Tick a tCycle oscillator.
123104 @param osc A pointer to the relevant tCycle.
124105 @return The ticked sample as a float from -1 to 1.
125− */
126−
127− /*!
106+
128107 @fn void tCycle_setFreq (tCycle* const osc, float freq)
129108 @brief Set the frequency of a tCycle oscillator.
130109 @param osc A pointer to the relevant tCycle.
131110 @param freq The frequency to set the oscillator to.
132− */
133−
134− /*! @} */
111+
112+ 
113+ @} */
135114
136115 typedef struct _tCycle
137116 {
@@ -157,42 +136,31 @@ extern "C" { · 19 unmodified lines
157136 @ingroup oscillators
158137 @brief Anti-aliased Triangle waveform using wavetable interpolation. Wavetables constructed from sine components.
159138 @{
160− */
161−
162− /*!
139+
163140 @fn void tTriangle_init (tTriangle* const osc)
164141 @brief Initialize a tTriangle to the default LEAF mempool.
165142 @param osc A pointer to the tTriangle to be initialized.
166− */
167−
168− /*!
143+
169144 @fn void tTriangle_initToPool (tTriangle* const osc, tMempool* const pool)
170145 @brief Initialize a tTriangle to a specified mempool.
171146 @param osc A pointer to the tTriangle to be initialized.
172147 @param pool A pointer to the tMempool to which the tTriangle should be initialized.
173− */
174−
175− /*!
148+
176149 @fn void tTriangle_free (tTriangle* const osc)
177150 @brief Free a tTriangle from the default LEAF mempool.
178151 @param osc A pointer to the tTriangle to be freed.
179− */
180−
181− /*!
152+
182153 @fn float tTriangle_tick (tTriangle* const osc)
183154 @brief Tick a tTriangle oscillator.
184155 @param osc A pointer to the relevant tTriangle.
185156 @return The ticked sample as a float from -1 to 1.
186− */
187−
188− /*!
157+
189158 @fn void tTriangle_setFreq (tTriangle* const osc, float freq)
190159 @brief Set the frequency of a tTriangle oscillator.
191160 @param osc A pointer to the relevant tTriangle.
192161 @param freq The frequency to set the oscillator to.
193− */
194−
195− /*! @} */
162+
163+ @} */
196164
197165 typedef struct _tTriangle
198166 {
@@ -221,42 +189,31 @@ extern "C" { · 22 unmodified lines
221189 @ingroup oscillators
222190 @brief Anti-aliased Square waveform using wavetable interpolation. Wavetables constructed from sine components.
223191 @{
224− */
225−
226− /*!
192+
227193 @fn void tSquare_init (tSquare* const osc)
228194 @brief Initialize a tSquare to the default LEAF mempool.
229195 @param osc A pointer to the tSquare to be initialized.
230− */
231−
232− /*!
196+
233197 @fn void tSquare_initToPool (tSquare* const osc, tMempool* const pool)
234198 @brief Initialize a tSquare to a specified mempool.
235199 @param osc A pointer to the tSquare to be initialized.
236200 @param pool A pointer to the tMempool to which the tSquare should be initialized.
237− */
238−
239− /*!
201+
240202 @fn void tSquare_free (tSquare* const osc)
241203 @brief Free a tSquare from the default LEAF mempool.
242204 @param osc A pointer to the tSquare to be freed.
243− */
244−
245− /*!
205+
246206 @fn float tSquare_tick (tSquare* const osc)
247207 @brief Tick a tSquare oscillator.
248208 @param osc A pointer to the relevant tSquare.
249209 @return The ticked sample as a float from -1 to 1.
250− */
251−
252− /*!
210+
253211 @fn void tSquare_setFreq (tSquare* const osc, float freq)
254212 @brief Set the frequency of a tSquare oscillator.
255213 @param osc A pointer to the relevant tSquare.
256214 @param freq The frequency to set the oscillator to.
257− */
258−
259− /*! @} */
215+ 
216+ @} */
260217
261218 typedef struct _tSquare
262219 {
@@ -277,7 +234,8 @@ extern "C" { · 14 unmodified lines
277234 float tSquare_tick (tSquare* const osc);
278235 void tSquare_setFreq (tSquare* const osc, float freq);
279236
280− /*! @} */
237+ /*!
238+ @} */
281239
282240 //==============================================================================
283241
@@ -286,42 +244,31 @@ extern "C" { · 2 unmodified lines
286244 @ingroup oscillators
287245 @brief Anti-aliased Square waveform using wavetable interpolation. Wavetables constructed from sine components.
288246 @{
289− */
290−
291− /*!
247+
292248 @fn void tSawtooth_init (tSawtooth* const osc)
293249 @brief Initialize a tSawtooth to the default LEAF mempool.
294250 @param osc A pointer to the tSawtooth to be initialized.
295− */
296−
297− /*!
251+
298252 @fn void tSawtooth_initToPool (tSawtooth* const osc, tMempool* const pool)
299253 @brief Initialize a tSawtooth to a specified mempool.
300254 @param osc A pointer to the tSawtooth to be initialized.
301255 @param pool A pointer to the tMempool to which the tSawtooth should be initialized.
302− */
303−
304− /*!
256+
305257 @fn void tSawtooth_free (tSawtooth* const osc)
306258 @brief Free a tSawtooth from the default LEAF mempool.
307259 @param osc A pointer to the tSawtooth to be freed.
308− */
309−
310− /*!
260+
311261 @fn float tSawtooth_tick (tSawtooth* const osc)
312262 @brief Tick a tSawtooth oscillator.
313263 @param osc A pointer to the relevant tSawtooth.
314264 @return The ticked sample as a float from -1 to 1.
315− */
316−
317− /*!
265+
318266 @fn void tSawtooth_setFreq (tSawtooth* const osc, float freq)
319267 @brief Set the frequency of a tSawtooth oscillator.
320268 @param osc A pointer to the relevant tSawtooth.
321269 @param freq The frequency to set the oscillator to.
322− */
323−
324− /*! @} */
270+ 
271+ @} */
325272
326273 typedef struct _tSawtooth
327274 {
@@ -344,72 +291,37 @@ extern "C" { · 16 unmodified lines
344291
345292 //==============================================================================
346293
347−
348− // TO BE REMOVED
349− typedef struct _tSine
350− {
351− tMempool mempool;
352− float* sine;
353− int size;
354− float phase;
355− float inc,freq;
356− } _tSine;
357−
358− typedef _tSine* tSine;
359−
360− void tSine_init (tSine* const osc, int size);
361− void tSine_initToPool (tSine* const osc, int size, tMempool* const pool);
362−
363− void tSine_free (tSine* const osc);
364− float tSine_tick (tSine* const osc);
365− void tSine_setFreq (tSine* const osc, float freq);
366−
367− //==============================================================================
368−
369294 /*!
370295 @defgroup ttri tTri
371296 @ingroup oscillators
372297 @brief
373298 @{
374− */
375−
376− /*!
299+
377300 @fn void tTri_init (tTri* const osc)
378301 @brief
379302 @param
380− */
381−
382− /*!
303+
383304 @fn void tTri_initToPool (tTri* const osc, tMempool* const pool)
384305 @brief
385306 @param
386− */
387−
388− /*!
307+
389308 @fn void tTri_free (tTri* const osc)
390309 @brief
391310 @param
392− */
393−
394− /*!
311+
395312 @fn float tTri_tick (tTri* const osc)
396313 @brief
397314 @param
398− */
399−
400− /*!
315+
401316 @fn void tTri_setFreq (tTri* const osc, float freq)
402317 @brief
403318 @param
404− */
405−
406− /*!
319+
407320 @fn void tTri_setSkew (tTri* const osc, float skew)
408321 @brief
409322 @param
410− */
411−
412− /*! @} */
323+ 
324+ @} */
413325
414326 typedef struct _tTri
415327 {
@@ -437,45 +349,32 @@ extern "C" { · 21 unmodified lines
437349 @ingroup oscillators
438350 @brief
439351 @{
440− */
441−
442− /*!
352+
443353 @fn void tPulse_init (tPulse* const osc)
444354 @brief
445355 @param
446− */
447−
448− /*!
356+
449357 @fn void tPulse_initToPool (tPulse* const osc, tMempool* const)
450358 @brief
451359 @param
452− */
453−
454− /*!
360+
455361 @fn void tPulse_free (tPulse* const osc)
456362 @brief
457363 @param
458− */
459−
460− /*!
364+
461365 @fn float tPulse_tick (tPulse* const osc)
462366 @brief
463367 @param
464− */
465−
466− /*!
368+
467369 @fn void tPulse_setFreq (tPulse* const osc, float freq)
468370 @brief
469371 @param
470− */
471−
472− /*!
372+
473373 @fn void tPulse_setWidth (tPulse* const osc, float width)
474374 @brief
475375 @param
476− */
477−
478− /*! @} */
376+ 
377+ @} */
479378
480379 typedef struct _tPulse
481380 {
@@ -502,39 +401,28 @@ extern "C" { · 20 unmodified lines
502401 @ingroup oscillators
503402 @brief
504403 @{
505− */
506−
507− /*!
404+
508405 @fn void tSaw_init (tSaw* const osc)
509406 @brief
510407 @param
511− */
512408
513− /*!
514409 @fn void tSaw_initToPool (tSaw* const osc, tMempool* const pool)
515410 @brief
516411 @param
517− */
518−
519− /*!
412+
520413 @fn void tSaw_free (tSaw* const osc)
521414 @brief
522415 @param
523− */
524−
525− /*!
416+
526417 @fn float tSaw_tick (tSaw* const osc)
527418 @brief
528419 @param
529− */
530−
531− /*!
420+
532421 @fn void tSaw_setFreq (tSaw* const osc, float freq)
533422 @brief
534423 @param
535− */
536−
537− /*! @} */
424+ 
425+ @} */
538426
539427 typedef struct _tSaw
540428 {
@@ -559,39 +447,28 @@ extern "C" { · 18 unmodified lines
559447 @ingroup oscillators
560448 @brief
561449 @{
562− */
563−
564− /*!
450+
565451 @fn void tPhasor_init (tPhasor* const osc)
566452 @brief
567453 @param
568− */
569−
570− /*!
454+
571455 @fn void tPhasor_initToPool (tPhasor* const osc, tMempool* const)
572456 @brief
573457 @param
574− */
575−
576− /*!
458+
577459 @fn void tPhasor_free (tPhasor* const osc)
578460 @brief
579461 @param
580− */
581−
582− /*!
462+
583463 @fn float tPhasor_tick (tPhasor* const osc)
584464 @brief
585465 @param
586− */
587−
588− /*!
466+
589467 @fn void tPhasor_setFreq (tPhasor* const osc, float freq)
590468 @brief
591469 @param
592− */
593−
594− /*! @} */
470+ 
471+ @} */
595472
596473 typedef struct _tPhasor
597474 {
@@ -617,27 +494,19 @@ extern "C" { · 19 unmodified lines
617494 @ingroup oscillators
618495 @brief
619496 @{
620− */
621−
622− /*!
497+
623498 @fn void tNoise_init (tNoise* const noise, NoiseType type)
624499 @brief
625500 @param
626− */
627−
628− /*!
501+
629502 @fn void tNoise_initToPool (tNoise* const noise, NoiseType type, tMempool* const)
630503 @brief
631504 @param
632− */
633−
634− /*!
505+
635506 @fn void tNoise_free (tNoise* const noise)
636507 @brief
637508 @param
638− */
639−
640− /*!
509+
641510 @fn float tNoise_tick (tNoise* const noise)
642511 @brief
643512 @param
@@ -654,7 +523,7 @@ extern "C" { · 10 unmodified lines
654523 NoiseTypeNil,
655524 };
656525
657− /*! @} */
526+ /*! @} */
658527
659528 typedef enum NoiseType NoiseType;
660529
@@ -681,111 +550,79 @@ extern "C" { · 20 unmodified lines
681550 @ingroup oscillators
682551 @brief A model of a neuron, adapted to act as an oscillator.
683552 @{
684− */
685−
686− /*!
553+
687554 @fn void tNeuron_init (tNeuron* const neuron)
688555 @brief Initialize a tNeuron to the default LEAF mempool.
689556 @param neuron A pointer to the tNeuron to be initialized.
690− */
691−
692− /*!
557+
693558 @fn void tNeuron_initToPool (tNeuron* const neuron, tMempool* const pool)
694559 @brief Initialize a tNeuron to a specified mempool.
695560 @param neuron A pointer to the tNeuron to be initialized.
696561 @param pool A pointer to the tMempool to which the tNeuron should be initialized.
697− */
698−
699− /*!
562+
700563 @fn void tNeuron_free (tNeuron* const neuron)
701564 @brief Free a tNeuron from the default LEAF mempool.
702565 @param neuron A pointer to the tNeuron to be freed.
703− */
704−
705− /*!
566+
706567 @fn void tNeuron_reset (tNeuron* const neuron)
707568 @brief Reset the neuron model.
708569 @param neuron A pointer to the relevant tNeuron.
709− */
710−
711− /*!
570+
712571 @fn float tNeuron_tick (tNeuron* const neuron)
713572 @brief Tick a tNeuron oscillator.
714573 @param neuron A pointer to the relevant tNeuron.
715574 @return The ticked sample as a float from -1 to 1.
716− */
717−
718− /*!
575+
719576 @fn void tNeuron_setMode (tNeuron* const neuron, NeuronMode mode)
720577 @brief Set the tNeuron shaping mode.
721578 @param neuron A pointer to the relevant tNeuron.
722579 @param mode The mode to set the tNeuron to.
723− */
724−
725− /*!
580+
726581 @fn void tNeuron_setCurrent (tNeuron* const neuron, float current)
727582 @brief Set the current.
728583 @param neuron A pointer to the relevant tNeuron.
729584 @param current The new current.
730− */
731−
732− /*!
585+
733586 @fn void tNeuron_setK (tNeuron* const neuron, float K)
734587 @brief Set the potassium value.
735588 @param neuron A pointer to the relevant tNeuron.
736589 @param K The new potassium.
737− */
738−
739− /*!
590+
740591 @fn void tNeuron_setL (tNeuron* const neuron, float L)
741592 @brief Set the chloride value.
742593 @param neuron A pointer to the relevant tNeuron.
743594 @param L The new chloride value.
744− */
745−
746− /*!
595+
747596 @fn void tNeuron_setN (tNeuron* const neuron, float N)
748597 @brief Set the sodium value.
749598 @param neuron A pointer to the relevant tNeuron.
750599 @param N The new sodium value.
751− */
752−
753− /*!
600+
754601 @fn void tNeuron_setC (tNeuron* const neuron, float C)
755602 @brief Set the calcium value.
756603 @param neuron A pointer to the relevant tNeuron.
757604 @param C The new calcium.
758− */
759−
760− /*!
605+
761606 @fn void tNeuron_setV1 (tNeuron* const neuron, float V1)
762607 @brief Set the V1 value.
763608 @param neuron A pointer to the relevant tNeuron.
764609 @param V1 The new V1.
765− */
766−
767− /*!
610+
768611 @fn void tNeuron_setV2 (tNeuron* const neuron, float V2)
769612 @brief Set the V2 value.
770613 @param neuron A pointer to the relevant tNeuron.
771614 @param V2 The new V2.
772− */
773−
774− /*!
615+
775616 @fn void tNeuron_setV3 (tNeuron* const neuron, float V3)
776617 @brief Set the V3 value.
777618 @param neuron A pointer to the relevant tNeuron.
778619 @param V3 The new V3.
779− */
780−
781− /*!
620+
782621 @fn void tNeuron_setTimeStep (tNeuron* const neuron, float timestep)
783622 @brief Set the time step of the model.
784623 @param neuron A pointer to the relevant tNeuron.
785624 @param timestep The new time step.
786− */
787−
788− /*!
625+
789626 @brief Shaping modes for tNeuron output.
790627 */
791628 enum NeuronMode
@@ -796,7 +633,7 @@ extern "C" { · 4 unmodified lines
796633 NeuronModeNil
797634 };
798635
799− /*! @} */
636+ /*! @} */
800637
801638 typedef enum NeuronMode NeuronMode;
802639
@@ -850,57 +687,40 @@ extern "C" { · 47 unmodified lines
850687 @ingroup oscillators
851688 @brief
852689 @{
853− */
854−
855− /*!
690+
856691 @fn void tMBPulse_init(tMBPulse* const osc)
857692 @brief
858693 @param
859− */
860−
861− /*!
694+
862695 @fn void tMBPulse_initToPool(tMBPulse* const osc, tMempool* const pool)
863696 @brief
864697 @param
865− */
866−
867− /*!
698+
868699 @fn void tMBPulse_free(tMBPulse* const osc)
869700 @brief
870701 @param
871− */
872−
873− /*!
702+
874703 @fn float tMBPulse_tick(tMBPulse* const osc)
875704 @brief
876705 @param
877− */
878−
879− /*!
706+
880707 @fn void tMBPulse_setFreq(tMBPulse* const osc, float f)
881708 @brief
882709 @param
883− */
884−
885− /*!
710+
886711 @fn void tMBPulse_setWidth(tMBPulse* const osc, float w)
887712 @brief
888713 @param
889− */
890−
891− /*!
714+
892715 @fn void tMBPulse_syncIn(tMBPulse* const osc, float sync)
893716 @brief
894717 @param
895− */
896−
897− /*!
718+
898719 @fn float tMBPulse_syncOut(tMBPulse* const osc)
899720 @brief
900721 @param
901− */
902−
903− /*! @} */
722+ 
723+ @} */
904724
905725 typedef struct _tMBPulse
906726 {
@@ -935,57 +755,40 @@ extern "C" { · 28 unmodified lines
935755 @ingroup oscillators
936756 @brief
937757 @{
938− */
939−
940− /*!
758+
941759 @fn void tMBTriangle_init(tMBTriangle* const osc)
942760 @brief
943761 @param
944− */
945−
946− /*!
762+
947763 @fn void tMBTriangle_initToPool(tMBTriangle* const osc, tMempool* const pool)
948764 @brief
949765 @param
950− */
951−
952− /*!
766+
953767 @fn void tMBTriangle_free(tMBTriangle* const osc)
954768 @brief
955769 @param
956− */
957−
958− /*!
770+
959771 @fn float tMBTriangle_tick(tMBTriangle* const osc)
960772 @brief
961773 @param
962− */
963−
964− /*!
774+
965775 @fn void tMBTriangle_setFreq(tMBTriangle* const osc, float f)
966776 @brief
967777 @param
968− */
969−
970− /*!
778+
971779 @fn void tMBTriangle_setWidth(tMBTriangle* const osc, float w)
972780 @brief
973781 @param
974− */
975−
976− /*!
782+
977783 @fn void tMBTriangle_syncIn(tMBTriangle* const osc, float sync)
978784 @brief
979785 @param
980− */
981−
982− /*!
786+
983787 @fn float tMBTriangle_syncOut(tMBTriangle* const osc)
984788 @brief
985789 @param
986− */
987−
988− /*! @} */
790+ 
791+ @} */
989792
990793 typedef struct _tMBTriangle
991794 {
@@ -1021,51 +824,36 @@ extern "C" { · 29 unmodified lines
1021824 @ingroup oscillators
1022825 @brief
1023826 @{
1024− */
1025−
1026− /*!
827+
1027828 @fn void tMBSaw_init(tMBSaw* const osc)
1028829 @brief
1029830 @param
1030− */
1031−
1032− /*!
831+
1033832 @fn void tMBSaw_initToPool(tMBSaw* const osc, tMempool* const pool)
1034833 @brief
1035834 @param
1036− */
1037−
1038− /*!
835+
1039836 @fn void tMBSaw_free(tMBSaw* const osc)
1040837 @brief
1041838 @param
1042− */
1043−
1044− /*!
839+
1045840 @fn float tMBSaw_tick(tMBSaw* const osc)
1046841 @brief
1047842 @param
1048− */
1049−
1050− /*!
843+
1051844 @fn void tMBSaw_setFreq(tMBSaw* const osc, float f)
1052845 @brief
1053846 @param
1054− */
1055−
1056− /*!
847+
1057848 @fn void tMBSaw_syncIn(tMBSaw* const osc, float sync)
1058849 @brief
1059850 @param
1060− */
1061−
1062− /*!
851+
1063852 @fn float tMBSaw_syncOut(tMBSaw* const osc)
1064853 @brief
1065854 @param
1066− */
1067−
1068− /*! @} */
855+ 
856+ @} */
1069857
1070858 typedef struct _tMBSaw
1071859 {
leaf/Inc/leaf-physical.h+346−39
@@ -36,7 +36,54 @@ extern "C" { · 35 unmodified lines
3636
3737 //==============================================================================
3838
39− /* Karplus Strong model */
39+ /*!
40+ @defgroup tpluck tPluck
41+ @ingroup physical
42+ @brief Karplus-Strong model
43+ @{
44+
45+ @fn void tPluck_init (tPluck* const, float lowestFrequency)
46+ @brief
47+ @param
48+
49+ @fn void tPluck_initToPool (tPluck* const, float lowestFrequency, tMempool* const)
50+ @brief
51+ @param
52+
53+ @fn void tPluck_free (tPluck* const)
54+ @brief
55+ @param
56+
57+ @fn float tPluck_tick (tPluck* const)
58+ @brief
59+ @param
60+
61+ @fn void tPluck_pluck (tPluck* const, float amplitude)
62+ @brief Pluck the string.
63+ @param
64+
65+ @fn void tPluck_noteOn (tPluck* const, float frequency, float amplitude )
66+ @brief Start a note with the given frequency and amplitude.
67+ @param
68+
69+ @fn void tPluck_noteOff (tPluck* const, float amplitude )
70+ @brief Stop a note with the given amplitude (speed of decay)
71+ @param
72+
73+ @fn void tPluck_setFrequency (tPluck* const, float frequency )
74+ @brief Set instrument parameters for a particular frequency.
75+ @param
76+
77+ @fn void tPluck_controlChange (tPluck* const, int number, float value)
78+ @brief Perform the control change specified by \e number and \e value (0.0 - 128.0).
79+ @param
80+
81+ @fn float tPluck_getLastOut (tPluck* const)
82+ @brief
83+ @param
84+
85+ @} */
86+
4087 typedef struct _tPluck
4188 {
4289 tMempool mempool;
@@ -59,28 +106,76 @@ extern "C" { · 16 unmodified lines
59106 void tPluck_initToPool (tPluck* const, float lowestFrequency, tMempool* const);
60107 void tPluck_free (tPluck* const);
61108
62− float tPluck_tick (tPluck* const);
63−
64− // Pluck the string.
109+ float tPluck_tick (tPluck* const);
65110 void tPluck_pluck (tPluck* const, float amplitude);
66−
67− // Start a note with the given frequency and amplitude.;
68111 void tPluck_noteOn (tPluck* const, float frequency, float amplitude );
69−
70− // Stop a note with the given amplitude (speed of decay).
71112 void tPluck_noteOff (tPluck* const, float amplitude );
72−
73− // Set instrument parameters for a particular frequency.
74113 void tPluck_setFrequency (tPluck* const, float frequency );
75−
76− // Perform the control change specified by \e number and \e value (0.0 - 128.0).
77114 void tPluck_controlChange (tPluck* const, int number, float value);
78−
79− // tPluck Utilities.
80115 float tPluck_getLastOut (tPluck* const);
81116
82117 //==============================================================================
83118
119+ /*!
120+ @defgroup tkarplusstrong tKarplusStrong
121+ @ingroup physical
122+ @brief Stiff Karplus-Strong model
123+ @{
124+
125+ @fn void tKarplusStrong_init (tKarplusStrong* const, float lowestFrequency)
126+ @brief
127+ @param
128+
129+ @fn void tKarplusStrong_initToPool (tKarplusStrong* const, float lowestFrequency, tMempool* const)
130+ @brief
131+ @param
132+
133+ @fn void tKarplusStrong_free (tKarplusStrong* const)
134+ @brief
135+ @param
136+
137+ @fn float tKarplusStrong_tick (tKarplusStrong* const)
138+ @brief
139+ @param
140+
141+ @fn void tKarplusStrong_pluck (tKarplusStrong* const, float amplitude)
142+ @brief Pluck the string.
143+ @param
144+
145+ @fn void tKarplusStrong_noteOn (tKarplusStrong* const, float frequency, float amplitude)
146+ @brief Start a note with the given frequency and amplitude.
147+ @param
148+
149+ @fn void tKarplusStrong_noteOff (tKarplusStrong* const, float amplitude)
150+ @brief Stop a note with the given amplitude (speed of decay).
151+ @param
152+
153+ @fn void tKarplusStrong_setFrequency (tKarplusStrong* const, float frequency)
154+ @brief Set instrument parameters for a particular frequency.
155+ @param
156+
157+ @fn void tKarplusStrong_controlChange (tKarplusStrong* const, SKControlType type, float value)
158+ @brief Perform the control change specified by \e number and \e value (0.0 - 128.0). Use SKPickPosition, SKStringDamping, or SKDetune for type.
159+ @param
160+
161+ @fn void tKarplusStrong_setStretch (tKarplusStrong* const, float stretch)
162+ @brief Set the stretch "factor" of the string (0.0 - 1.0).
163+ @param
164+
165+ @fn void tKarplusStrong_setPickupPosition (tKarplusStrong* const, float position)
166+ @brief Set the pluck or "excitation" position along the string (0.0 - 1.0).
167+ @param
168+
169+ @fn void tKarplusStrong_setBaseLoopGain (tKarplusStrong* const, float aGain )
170+ @brief Set the base loop gain.
171+ @param
172+
173+ @fn float tKarplusStrong_getLastOut (tKarplusStrong* const)
174+ @brief
175+ @param
176+
177+ @} */
178+
84179 typedef enum SKControlType
85180 {
86181 SKPickPosition = 0,
@@ -89,7 +184,6 @@ extern "C" { · 2 unmodified lines
89184 SKControlTypeNil
90185 } SKControlType;
91186
92− /* Stif Karplus Strong model */
93187 typedef struct _tKarplusStrong
94188 {
95189 tMempool mempool;
@@ -119,38 +213,78 @@ extern "C" { · 23 unmodified lines
119213 void tKarplusStrong_free (tKarplusStrong* const);
120214
121215 float tKarplusStrong_tick (tKarplusStrong* const);
122−
123− // Pluck the string.
124216 void tKarplusStrong_pluck (tKarplusStrong* const, float amplitude);
125−
126− // Start a note with the given frequency and amplitude.;
127217 void tKarplusStrong_noteOn (tKarplusStrong* const, float frequency, float amplitude );
128−
129− // Stop a note with the given amplitude (speed of decay).
130218 void tKarplusStrong_noteOff (tKarplusStrong* const, float amplitude );
131−
132− // Set instrument parameters for a particular frequency.
133219 void tKarplusStrong_setFrequency (tKarplusStrong* const, float frequency );
134−
135− // Perform the control change specified by \e number and \e value (0.0 - 128.0).
136− // Use SKPickPosition, SKStringDamping, or SKDetune for type.
137220 void tKarplusStrong_controlChange (tKarplusStrong* const, SKControlType type, float value);
138−
139− // Set the stretch "factor" of the string (0.0 - 1.0).
140221 void tKarplusStrong_setStretch (tKarplusStrong* const, float stretch );
141−
142− // Set the pluck or "excitation" position along the string (0.0 - 1.0).
143222 void tKarplusStrong_setPickupPosition (tKarplusStrong* const, float position );
144−
145− // Set the base loop gain.
146223 void tKarplusStrong_setBaseLoopGain (tKarplusStrong* const, float aGain );
147−
148− // tKarplusStrong utilities.
149224 float tKarplusStrong_getLastOut (tKarplusStrong* const);
150225
151226 // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
152227
153− /* Simple Living String */
228+ /*!
229+ @defgroup tsimplelivingstring tSimpleLivingString
230+ @ingroup physical
231+ @brief
232+ @{
233+
234+ @fn void tSimpleLivingString_init (tSimpleLivingString* const, float freq, float dampFreq, float decay, float targetLev, float levSmoothFactor, float levStrength, int levMode)
235+ @brief
236+ @param
237+
238+ @fn void tSimpleLivingString_initToPool (tSimpleLivingString* const, float freq, float dampFreq, float decay, float targetLev, float levSmoothFactor, float levStrength, int levMode, tMempool* const)
239+ @brief
240+ @param
241+
242+ @fn void tSimpleLivingString_free (tSimpleLivingString* const)
243+ @brief
244+ @param
245+
246+ @fn float tSimpleLivingString_tick (tSimpleLivingString* const, float input)
247+ @brief
248+ @param
249+
250+ @fn float tSimpleLivingString_sample (tSimpleLivingString* const)
251+ @brief
252+ @param
253+
254+ @fn void tSimpleLivingString_setFreq (tSimpleLivingString* const, float freq)
255+ @brief
256+ @param
257+
258+ @fn void tSimpleLivingString_setWaveLength (tSimpleLivingString* const, float waveLength)
259+ @brief
260+ @param
261+
262+ @fn void tSimpleLivingString_setDampFreq (tSimpleLivingString* const, float dampFreq)
263+ @brief
264+ @param
265+
266+ @fn void tSimpleLivingString_setDecay (tSimpleLivingString* const, float decay)
267+ @brief
268+ @param
269+
270+ @fn void tSimpleLivingString_setTargetLev (tSimpleLivingString* const, float targetLev)
271+ @brief
272+ @param
273+
274+ @fn void tSimpleLivingString_setLevSmoothFactor (tSimpleLivingString* const, float levSmoothFactor)
275+ @brief
276+ @param
277+
278+ @fn void tSimpleLivingString_setLevStrength (tSimpleLivingString* const, float levStrength)
279+ @brief
280+ @param
281+
282+ @fn void tSimpleLivingString_setLevMode (tSimpleLivingString* const, int levMode)
283+ @brief
284+ @param
285+
286+ @} */
287+
154288 typedef struct _tSimpleLivingString
155289 {
156290 tMempool mempool;
@@ -189,7 +323,74 @@ extern "C" { · 32 unmodified lines
189323
190324 // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
191325
192− /* Living String */
326+ /*!
327+ @defgroup tlivingstring tLivingString
328+ @ingroup physical
329+ @brief
330+ @{
331+
332+ @fn void tLivingString_init (tLivingString* const, float freq, float pickPos, float prepIndex, float dampFreq, float decay, float targetLev, float levSmoothFactor, float levStrength, int levMode)
333+ @brief
334+ @param
335+
336+ @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)
337+ @brief
338+ @param
339+
340+ @fn void tLivingString_free (tLivingString* const)
341+ @brief
342+ @param
343+
344+ @fn float tLivingString_tick (tLivingString* const, float input)
345+ @brief
346+ @param
347+
348+ @fn float tLivingString_sample (tLivingString* const)
349+ @brief
350+ @param
351+
352+ @fn void tLivingString_setFreq (tLivingString* const, float freq)
353+ @brief
354+ @param
355+
356+ @fn void tLivingString_setWaveLength (tLivingString* const, float waveLength)
357+ @brief
358+ @param
359+
360+ @fn void tLivingString_setPickPos (tLivingString* const, float pickPos)
361+ @brief
362+ @param
363+
364+ @fn void tLivingString_setPrepIndex (tLivingString* const, float prepIndex)
365+ @brief
366+ @param
367+
368+ @fn void tLivingString_setDampFreq (tLivingString* const, float dampFreq)
369+ @brief
370+ @param
371+
372+ @fn void tLivingString_setDecay (tLivingString* const, float decay)
373+ @brief
374+ @param
375+
376+ @fn void tLivingString_setTargetLev (tLivingString* const, float targetLev)
377+ @brief
378+ @param
379+
380+ @fn void tLivingString_setLevSmoothFactor (tLivingString* const, float levSmoothFactor)
381+ @brief
382+ @param
383+
384+ @fn void tLivingString_setLevStrength (tLivingString* const, float levStrength)
385+ @brief
386+ @param
387+
388+ @fn void tLivingString_setLevMode (tLivingString* const, int levMode)
389+ @brief
390+ @param
391+
392+ @} */
393+
193394 typedef struct _tLivingString
194395 {
195396 tMempool mempool;
@@ -234,7 +435,78 @@ extern "C" { · 38 unmodified lines
234435
235436 // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
236437
237− /* Complex Living String */
438+ /*!
439+ @defgroup tcomplexlivingstring tComplexLivingString
440+ @ingroup physical
441+ @brief
442+ @{
443+
444+ @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)
445+ @brief
446+ @param
447+
448+ @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)
449+ @brief
450+ @param
451+
452+ @fn void tComplexLivingString_free (tComplexLivingString* const)
453+ @brief
454+ @param
455+
456+ @fn float tComplexLivingString_tick (tComplexLivingString* const, float input)
457+ @brief
458+ @param
459+
460+ @fn float tComplexLivingString_sample (tComplexLivingString* const)
461+ @brief
462+ @param
463+
464+ @fn void tComplexLivingString_setFreq (tComplexLivingString* const, float freq)
465+ @brief
466+ @param
467+
468+ @fn void tComplexLivingString_setWaveLength (tComplexLivingString* const, float waveLength)
469+ @brief
470+ @param
471+
472+ @fn void tComplexLivingString_setPickPos (tComplexLivingString* const, float pickPos)
473+ @brief
474+ @param
475+
476+ @fn void tComplexLivingString_setPrepPos (tComplexLivingString* const, float prepPos)
477+ @brief
478+ @param
479+
480+ @fn void tComplexLivingString_setPrepIndex (tComplexLivingString* const, float prepIndex)
481+ @brief
482+ @param
483+
484+ @fn void tComplexLivingString_setDampFreq (tComplexLivingString* const, float dampFreq)
485+ @brief
486+ @param
487+
488+ @fn void tComplexLivingString_setDecay (tComplexLivingString* const, float decay)
489+ @brief
490+ @param
491+
492+ @fn void tComplexLivingString_setTargetLev (tComplexLivingString* const, float targetLev)
493+ @brief
494+ @param
495+
496+ @fn void tComplexLivingString_setLevSmoothFactor (tComplexLivingString* const, float levSmoothFactor)
497+ @brief
498+ @param
499+
500+ @fn void tComplexLivingString_setLevStrength (tComplexLivingString* const, float levStrength)
501+ @brief
502+ @param
503+
504+ @fn void tComplexLivingString_setLevMode (tComplexLivingString* const, int levMode)
505+ @brief
506+ @param
507+
508+ @} */
509+
238510 typedef struct _tComplexLivingString
239511 {
240512 tMempool mempool;
@@ -277,11 +549,46 @@ extern "C" { · 36 unmodified lines
277549 void tComplexLivingString_setLevSmoothFactor (tComplexLivingString* const, float levSmoothFactor);
278550 void tComplexLivingString_setLevStrength (tComplexLivingString* const, float levStrength);
279551 void tComplexLivingString_setLevMode (tComplexLivingString* const, int levMode);
552+
280553 // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
281554
282555
283−
284− //Reed Table - borrowed from STK
556+ /*!
557+ @defgroup treedtable tReedTable
558+ @ingroup physical
559+ @brief Reed Table - borrowed from STK
560+ @{
561+
562+ @fn void tReedTable_init (tReedTable* const, float offset, float slope)
563+ @brief
564+ @param
565+
566+ @fn void tReedTable_initToPool (tReedTable* const, float offset, float slope, tMempool* const)
567+ @brief
568+ @param
569+
570+ @fn void tReedTable_free (tReedTable* const)
571+ @brief
572+ @param
573+
574+ @fn float tReedTable_tick (tReedTable* const, float input)
575+ @brief
576+ @param
577+
578+ @fn float tReedTable_tanh_tick (tReedTable* const, float input)
579+ @brief
580+ @param
581+
582+ @fn void tReedTable_setOffset (tReedTable* const, float offset)
583+ @brief
584+ @param
585+
586+ @fn void tReedTable_setSlope (tReedTable* const, float slope)
587+ @brief
588+ @param
589+
590+ @} */
591+
285592 typedef struct _tReedTable
286593 {
287594 tMempool mempool;
leaf/Inc/leaf-reverb.h+140−10
@@ -32,7 +32,42 @@ extern "C" { · 31 unmodified lines
3232
3333 //==============================================================================
3434
35− /* PRCReverb: Reverb, reimplemented from STK (Cook and Scavone). */
35+ /*!
36+ @defgroup tprcreverb tPRCReverb
37+ @ingroup reverb
38+ @brief Reverb, reimplemented from STK (Cook and Scavone).
39+ @{
40+
41+ @fn void tPRCReverb_init (tPRCReverb* const, float t60)
42+ @brief
43+ @param
44+
45+ @fn void tPRCReverb_initToPool (tPRCReverb* const, float t60, tMempool* const)
46+ @brief
47+ @param
48+
49+ @fn void tPRCReverb_free (tPRCReverb* const)
50+ @brief
51+ @param
52+
53+ @fn void tPRCReverb_clear (tPRCReverb* const)
54+ @brief
55+ @param
56+
57+ @fn float tPRCReverb_tick (tPRCReverb* const, float input)
58+ @brief
59+ @param
60+
61+ @fn void tPRCReverb_setT60 (tPRCReverb* const, float t60)
62+ @brief Set reverb time in seconds.
63+ @param
64+
65+ @fn void tPRCReverb_setMix (tPRCReverb* const, float mix)
66+ @brief Set mix between dry input and wet output signal.
67+ @param
68+
69+ @} */
70+
3671 typedef struct _tPRCReverb
3772 {
3873 tMempool mempool;
@@ -57,16 +92,51 @@ extern "C" { · 18 unmodified lines
5792
5893 void tPRCReverb_clear (tPRCReverb* const);
5994 float tPRCReverb_tick (tPRCReverb* const, float input);
60−
61− // Set reverb time in seconds.
6295 void tPRCReverb_setT60 (tPRCReverb* const, float t60);
63−
64− // Set mix between dry input and wet output signal.
6596 void tPRCReverb_setMix (tPRCReverb* const, float mix);
6697
6798 //==============================================================================
6899
69− /* NReverb: Reverb, reimplemented from STK (Cook and Scavone). */
100+ /*!
101+ @defgroup tnreverb tNReverb
102+ @ingroup reverb
103+ @brief Reverb, reimplemented from STK (Cook and Scavone).
104+ @{
105+
106+ @fn void tNReverb_init (tNReverb* const, float t60)
107+ @brief
108+ @param
109+
110+ @fn void tNReverb_initToPool (tNReverb* const, float t60, tMempool* const)
111+ @brief
112+ @param
113+
114+ @fn void tNReverb_free (tNReverb* const)
115+ @brief
116+ @param
117+
118+ @fn void tNReverb_clear (tNReverb* const)
119+ @brief
120+ @param
121+
122+ @fn float tNReverb_tick (tNReverb* const, float input)
123+ @brief
124+ @param
125+
126+ @fn void tNReverb_tickStereo (tNReverb* const rev, float input, float* output)
127+ @brief
128+ @param
129+
130+ @fn void tNReverb_setT60 (tNReverb* const, float t60)
131+ @brief Set reverb time in seconds.
132+ @param
133+
134+ @fn void tNReverb_setMix (tNReverb* const, float mix)
135+ @brief Set mix between dry input and wet output signal.
136+ @param
137+
138+ @} */
139+
70140 typedef struct _tNReverb
71141 {
72142 tMempool mempool;
@@ -93,15 +163,75 @@ extern "C" { · 20 unmodified lines
93163 void tNReverb_clear (tNReverb* const);
94164 float tNReverb_tick (tNReverb* const, float input);
95165 void tNReverb_tickStereo (tNReverb* const rev, float input, float* output);
96−
97− // Set reverb time in seconds.
98166 void tNReverb_setT60 (tNReverb* const, float t60);
99−
100− // Set mix between dry input and wet output signal.
101167 void tNReverb_setMix (tNReverb* const, float mix);
102168
103169 //==============================================================================
104170
171+ /*!
172+ @defgroup tdattorroreverb tDattorroReverb
173+ @ingroup reverb
174+ @brief
175+ @{
176+
177+ @fn void tDattorroReverb_init (tDattorroReverb* const)
178+ @brief
179+ @param
180+
181+ @fn void tDattorroReverb_initToPool (tDattorroReverb* const, tMempool* const)
182+ @brief
183+ @param
184+
185+ @fn void tDattorroReverb_free (tDattorroReverb* const)
186+ @brief
187+ @param
188+
189+ @fn void tDattorroReverb_clear (tDattorroReverb* const)
190+ @brief
191+ @param
192+
193+ @fn float tDattorroReverb_tick (tDattorroReverb* const, float input)
194+ @brief
195+ @param
196+
197+ @fn void tDattorroReverb_tickStereo (tDattorroReverb* const rev, float input, float* output)
198+ @brief
199+ @param
200+
201+ @fn void tDattorroReverb_setMix (tDattorroReverb* const, float mix)
202+ @brief
203+ @param
204+
205+ @fn void tDattorroReverb_setFreeze (tDattorroReverb* const rev, uint32_t freeze)
206+ @brief
207+ @param
208+
209+ @fn void tDattorroReverb_setHP (tDattorroReverb* const, float freq)
210+ @brief
211+ @param
212+
213+ @fn void tDattorroReverb_setSize (tDattorroReverb* const, float size)
214+ @brief
215+ @param
216+
217+ @fn void tDattorroReverb_setInputDelay (tDattorroReverb* const, float preDelay)
218+ @brief
219+ @param
220+
221+ @fn void tDattorroReverb_setInputFilter (tDattorroReverb* const, float freq)
222+ @brief
223+ @param
224+
225+ @fn void tDattorroReverb_setFeedbackFilter (tDattorroReverb* const, float freq)
226+ @brief
227+ @param
228+
229+ @fn void tDattorroReverb_setFeedbackGain (tDattorroReverb* const, float gain)
230+ @brief
231+ @param
232+
233+ @} */
234+
105235 typedef struct _tDattorroReverb
106236 {
107237 tMempool mempool;
leaf/Inc/leaf-sampling.h+189−18
@@ -33,6 +33,78 @@ extern "C" { · 32 unmodified lines
3333
3434 //==============================================================================
3535
36+ /*!
37+ @defgroup tbuffer tBuffer
38+ @ingroup sampling
39+ @brief
40+ @{
41+
42+ @fn void tBuffer_init (tBuffer* const, uint32_t length)
43+ @brief
44+ @param
45+
46+ @fn void tBuffer_initToPool (tBuffer* const, uint32_t length, tMempool* const)
47+ @brief
48+ @param
49+
50+ @fn void tBuffer_free (tBuffer* const)
51+ @brief
52+ @param
53+
54+ @fn void tBuffer_tick (tBuffer* const, float sample)
55+ @brief
56+ @param
57+
58+ @fn void tBuffer_read (tBuffer* const, float* buff, uint32_t len)
59+ @brief
60+ @param
61+
62+ @fn float tBuffer_get (tBuffer* const, int idx)
63+ @brief
64+ @param
65+
66+ @fn void tBuffer_record (tBuffer* const)
67+ @brief
68+ @param
69+
70+ @fn void tBuffer_stop (tBuffer* const)
71+ @brief
72+ @param
73+
74+ @fn int tBuffer_getRecordPosition (tBuffer* const)
75+ @brief
76+ @param
77+
78+ @fn void tBuffer_setRecordPosition (tBuffer* const, int pos)
79+ @brief
80+ @param
81+
82+ @fn void tBuffer_setRecordMode (tBuffer* const, RecordMode mode)
83+ @brief
84+ @param
85+
86+ @fn void tBuffer_clear (tBuffer* const)
87+ @brief
88+ @param
89+
90+ @fn uint32_t tBuffer_getBufferLength (tBuffer* const)
91+ @brief
92+ @param
93+
94+ @fn uint32_t tBuffer_getRecordedLength (tBuffer* const sb)
95+ @brief
96+ @param
97+
98+ @fn void tBuffer_setRecordedLength (tBuffer* const sb, int length)
99+ @brief
100+ @param
101+
102+ @fn int tBuffer_isActive (tBuffer* const sb)
103+ @brief
104+ @param
105+
106+ @} */
107+
36108 typedef enum RecordMode
37109 {
38110 RecordOneShot = 0,
@@ -61,20 +133,14 @@ extern "C" { · 22 unmodified lines
61133 void tBuffer_free (tBuffer* const);
62134
63135 void tBuffer_tick (tBuffer* const, float sample);
64−
65136 void tBuffer_read (tBuffer* const, float* buff, uint32_t len);
66−
67137 float tBuffer_get (tBuffer* const, int idx);
68−
69138 void tBuffer_record (tBuffer* const);
70139 void tBuffer_stop (tBuffer* const);
71140 int tBuffer_getRecordPosition (tBuffer* const);
72− void tBuffer_setRecordPosition (tBuffer* const, int pos);
73−
141+ void tBuffer_setRecordPosition (tBuffer* const, int pos);
74142 void tBuffer_setRecordMode (tBuffer* const, RecordMode mode);
75−
76143 void tBuffer_clear (tBuffer* const);
77−
78144 uint32_t tBuffer_getBufferLength (tBuffer* const);
79145 uint32_t tBuffer_getRecordedLength (tBuffer* const sb);
80146 void tBuffer_setRecordedLength (tBuffer* const sb, int length);
@@ -82,6 +148,66 @@ extern "C" { · 1 unmodified line
82148
83149 //==============================================================================
84150
151+ /*!
152+ @defgroup tsampler tSampler
153+ @ingroup sampling
154+ @brief
155+ @{
156+
157+ @fn void tSampler_init (tSampler* const, tBuffer* const)
158+ @brief
159+ @param
160+
161+ @fn void tSampler_initToPool (tSampler* const, tBuffer* const, tMempool* const)
162+ @brief
163+ @param
164+
165+ @fn void tSampler_free (tSampler* const)
166+ @brief
167+ @param
168+
169+ @fn float tSampler_tick (tSampler* const)
170+ @brief
171+ @param
172+
173+ @fn void tSampler_setSample (tSampler* const, tBuffer* const)
174+ @brief
175+ @param
176+
177+ @fn void tSampler_setMode (tSampler* const, PlayMode mode)
178+ @brief
179+ @param
180+
181+ @fn void tSampler_play (tSampler* const)
182+ @brief
183+ @param
184+
185+ @fn void tSampler_stop (tSampler* const)
186+ @brief
187+ @param
188+
189+ @fn void tSampler_setStart (tSampler* const, int32_t start)
190+ @brief
191+ @param
192+
193+ @fn void tSampler_setEnd (tSampler* const, int32_t end)
194+ @brief
195+ @param
196+
197+ @fn void tSampler_setLength (tSampler* const, int32_t length)
198+ @brief
199+ @param
200+
201+ @fn void tSampler_setCrossfadeLength (tSampler* const sp, uint32_t length)
202+ @brief
203+ @param
204+
205+ @fn void tSampler_setRate (tSampler* const, float rate)
206+ @brief
207+ @param
208+
209+ @} */
210+
85211 typedef enum PlayMode
86212 {
87213 PlayNormal,
@@ -130,24 +256,74 @@ extern "C" { · 42 unmodified lines
130256 void tSampler_free (tSampler* const);
131257
132258 float tSampler_tick (tSampler* const);
133−
134259 void tSampler_setSample (tSampler* const, tBuffer* const);
135−
136260 void tSampler_setMode (tSampler* const, PlayMode mode);
137−
138261 void tSampler_play (tSampler* const);
139262 void tSampler_stop (tSampler* const);
140−
141263 void tSampler_setStart (tSampler* const, int32_t start);
142264 void tSampler_setEnd (tSampler* const, int32_t end);
143265 void tSampler_setLength (tSampler* const, int32_t length);
144−
145266 void tSampler_setCrossfadeLength (tSampler* const sp, uint32_t length);
146−
147267 void tSampler_setRate (tSampler* const, float rate);
148268
149269 //==============================================================================
150270
271+ /*!
272+ @defgroup tautosampler tAutoSampler
273+ @ingroup sampling
274+ @brief
275+ @{
276+
277+ @fn void tAutoSampler_init (tAutoSampler* const, tBuffer* const)
278+ @brief
279+ @param
280+
281+ @fn void tAutoSampler_initToPool (tAutoSampler* const, tBuffer* const, tMempool* const)
282+ @brief
283+ @param
284+
285+ @fn void tAutoSampler_free (tAutoSampler* const)
286+ @brief
287+ @param
288+
289+ @fn float tAutoSampler_tick (tAutoSampler* const, float input)
290+ @brief
291+ @param
292+
293+ @fn void tAutoSampler_setBuffer (tAutoSampler* const, tBuffer* const)
294+ @brief
295+ @param
296+
297+ @fn void tAutoSampler_setMode (tAutoSampler* const, PlayMode mode)
298+ @brief
299+ @param
300+
301+ @fn void tAutoSampler_play (tAutoSampler* const)
302+ @brief
303+ @param
304+
305+ @fn void tAutoSampler_stop (tAutoSampler* const)
306+ @brief
307+ @param
308+
309+ @fn void tAutoSampler_setThreshold (tAutoSampler* const, float thresh)
310+ @brief
311+ @param
312+
313+ @fn void tAutoSampler_setWindowSize (tAutoSampler* const, uint32_t size)
314+ @brief
315+ @param
316+
317+ @fn void tAutoSampler_setCrossfadeLength (tAutoSampler* const, uint32_t length)
318+ @brief
319+ @param
320+
321+ @fn void tAutoSampler_setRate (tAutoSampler* const, float rate)
322+ @brief
323+ @param
324+
325+ @} */
326+
151327 typedef struct _tAutoSampler
152328 {
153329 tMempool mempool;
@@ -168,18 +344,13 @@ extern "C" { · 14 unmodified lines
168344 void tAutoSampler_free (tAutoSampler* const);
169345
170346 float tAutoSampler_tick (tAutoSampler* const, float input);
171−
172347 void tAutoSampler_setBuffer (tAutoSampler* const, tBuffer* const);
173−
174348 void tAutoSampler_setMode (tAutoSampler* const, PlayMode mode);
175−
176349 void tAutoSampler_play (tAutoSampler* const);
177350 void tAutoSampler_stop (tAutoSampler* const);
178−
179351 void tAutoSampler_setThreshold (tAutoSampler* const, float thresh);
180352 void tAutoSampler_setWindowSize (tAutoSampler* const, uint32_t size);
181353 void tAutoSampler_setCrossfadeLength (tAutoSampler* const, uint32_t length);
182−
183354 void tAutoSampler_setRate (tAutoSampler* const, float rate);
184355
185356 #ifdef __cplusplus
leaf/Inc/leaf-tables.h+7−0
@@ -25,6 +25,11 @@ extern "C" { · 24 unmodified lines
2525 #define USE_SHAPER_TABLE 1
2626 #define DECAY_TABLES_USED 1
2727
28+ /*!
29+ @ingroup tables
30+ @{
31+ */
32+
2833 #define SINE_TABLE_SIZE 2048
2934 #define SAW_TABLE_SIZE 2048
3035 #define SQR_TABLE_SIZE 2048
@@ -119,6 +124,8 @@ extern "C" { · 88 unmodified lines
119124 extern const float_value_delta step_dd_table[];
120125 extern const float slope_dd_table[];
121126
127+ /*! @} */
128+
122129 //==============================================================================
123130
124131 #ifdef __cplusplus
leaf/Src/leaf-distortion.c+2−2
@@ -72,12 +72,12 @@ void tSampleReducer_setRatio(tSampleReducer* const sr, float ratio) · 71 unmodified lines
7272 // Oversampler
7373 //============================================================================================================
7474 // Latency is equal to the phase length (numTaps / ratio)
75−void tOversampler_init (tOversampler* const osr, int ratio, oBool extraQuality)
75+void tOversampler_init (tOversampler* const osr, int ratio, int extraQuality)
7676 {
7777 tOversampler_initToPool(osr, ratio, extraQuality, &leaf.mempool);
7878 }
7979
80−void tOversampler_initToPool (tOversampler* const osr, int ratio, oBool extraQuality, tMempool* const mp)
80+void tOversampler_initToPool (tOversampler* const osr, int ratio, int extraQuality, tMempool* const mp)
8181 {
8282 _tMempool* m = *mp;
8383 _tOversampler* os = *osr = (_tOversampler*) mpool_alloc(sizeof(_tOversampler), m);
leaf/Src/leaf-dynamics.c+4−4
@@ -55,7 +55,7 @@ void tCompressor_initToPool (tCompressor* const comp, tMempool* const mp) · 54 unmodified lines
5555 c->tauAttack = 100;
5656 c->tauRelease = 100;
5757
58− c->isActive = OFALSE;
58+ c->isActive = 0;
5959
6060 c->T = 0.0f; // Threshold
6161 c->R = 0.5f; // compression Ratio
@@ -89,17 +89,17 @@ float tCompressor_tick(tCompressor* const comp, float in) · 27 unmodified lines
8989 if (overshoot <= -(c->W * 0.5f))
9090 {
9191 out_db = in_db;
92− c->isActive = OFALSE;
92+ c->isActive = 0;
9393 }
9494 else if ((overshoot > -(c->W * 0.5f)) && (overshoot < (c->W * 0.5f)))
9595 {
9696 out_db = in_db + slope * (powf((overshoot + c->W*0.5f),2) / (2.0f * c->W)); // .^ 2 ???
97− c->isActive = OTRUE;
97+ c->isActive = 1;
9898 }
9999 else if (overshoot >= (c->W * 0.5f))
100100 {
101101 out_db = in_db + slope * overshoot;
102− c->isActive = OTRUE;
102+ c->isActive = 1;
103103 }
104104
105105
leaf/Src/leaf-envelopes.c+33−33
@@ -62,9 +62,9 @@ void tEnvelope_initToPool (tEnvelope* const envlp, float attack, float dec · 61 unmodified lines
6262 if (rampIndex < 0)
6363 rampIndex = 0;
6464
65− env->inRamp = OFALSE;
66− env->inAttack = OFALSE;
67− env->inDecay = OFALSE;
65+ env->inRamp = 0;
66+ env->inAttack = 0;
67+ env->inDecay = 0;
6868
6969 env->attackInc = env->inc_buff[attackIndex];
7070 env->decayInc = env->inc_buff[decayIndex];
@@ -125,18 +125,18 @@ void tEnvelope_on(tEnvelope* const envlp, float velocity) · 54 unmodified lines
125125 if (env->inAttack || env->inDecay) // In case envelope retriggered while it is still happening.
126126 {
127127 env->rampPhase = 0;
128− env->inRamp = OTRUE;
128+ env->inRamp = 1;
129129 env->rampPeak = env->next;
130130 }
131131 else // Normal start.
132132 {
133− env->inAttack = OTRUE;
133+ env->inAttack = 1;
134134 }
135135
136136
137137 env->attackPhase = 0;
138138 env->decayPhase = 0;
139− env->inDecay = OFALSE;
139+ env->inDecay = 0;
140140 env->gain = velocity;
141141 }
142142
@@ -148,8 +148,8 @@ float tEnvelope_tick(tEnvelope* const envlp) · 5 unmodified lines
148148 {
149149 if (env->rampPhase > UINT16_MAX)
150150 {
151− env->inRamp = OFALSE;
152− env->inAttack = OTRUE;
151+ env->inRamp = 0;
152+ env->inAttack = 1;
153153 env->next = 0.0f;
154154 }
155155 else
@@ -166,8 +166,8 @@ float tEnvelope_tick(tEnvelope* const envlp) · 10 unmodified lines
166166 // If attack done, time to turn around.
167167 if (env->attackPhase > UINT16_MAX)
168168 {
169− env->inDecay = OTRUE;
170− env->inAttack = OFALSE;
169+ env->inDecay = 1;
170+ env->inAttack = 0;
171171 env->next = env->gain * 1.0f;
172172 }
173173 else
@@ -187,13 +187,13 @@ float tEnvelope_tick(tEnvelope* const envlp) · 13 unmodified lines
187187 // If decay done, finish.
188188 if (env->decayPhase >= UINT16_MAX)
189189 {
190− env->inDecay = OFALSE;
190+ env->inDecay = 0;
191191
192192 if (env->loop)
193193 {
194194 env->attackPhase = 0;
195195 env->decayPhase = 0;
196− env->inAttack = OTRUE;
196+ env->inAttack = 1;
197197 }
198198 else
199199 {
@@ -266,11 +266,11 @@ void tADSR_initToPool (tADSR* const adsrenv, float attack, float decay, fl · 66 unmodified lines
266266
267267 adsr->next = 0.0f;
268268
269− adsr->inRamp = OFALSE;
270− adsr->inAttack = OFALSE;
271− adsr->inDecay = OFALSE;
272− adsr->inSustain = OFALSE;
273− adsr->inRelease = OFALSE;
269+ adsr->inRamp = 0;
270+ adsr->inAttack = 0;
271+ adsr->inDecay = 0;
272+ adsr->inSustain = 0;
273+ adsr->inRelease = 0;
274274
275275 adsr->sustain = sustain;
276276
@@ -364,20 +364,20 @@ void tADSR_on(tADSR* const adsrenv, float velocity) · 87 unmodified lines
364364 if ((adsr->inAttack || adsr->inDecay) || (adsr->inSustain || adsr->inRelease)) // In case ADSR retriggered while it is still happening.
365365 {
366366 adsr->rampPhase = 0;
367− adsr->inRamp = OTRUE;
367+ adsr->inRamp = 1;
368368 adsr->rampPeak = adsr->next;
369369 }
370370 else // Normal start.
371371 {
372− adsr->inAttack = OTRUE;
372+ adsr->inAttack = 1;
373373 }
374374
375375 adsr->attackPhase = 0;
376376 adsr->decayPhase = 0;
377377 adsr->releasePhase = 0;
378− adsr->inDecay = OFALSE;
379− adsr->inSustain = OFALSE;
380− adsr->inRelease = OFALSE;
378+ adsr->inDecay = 0;
379+ adsr->inSustain = 0;
380+ adsr->inRelease = 0;
381381 adsr->gain = velocity;
382382 }
383383
@@ -387,10 +387,10 @@ void tADSR_off(tADSR* const adsrenv) · 3 unmodified lines
387387
388388 if (adsr->inRelease) return;
389389
390− adsr->inAttack = OFALSE;
391− adsr->inDecay = OFALSE;
392− adsr->inSustain = OFALSE;
393− adsr->inRelease = OTRUE;
390+ adsr->inAttack = 0;
391+ adsr->inDecay = 0;
392+ adsr->inSustain = 0;
393+ adsr->inRelease = 1;
394394
395395 adsr->releasePeak = adsr->next;
396396 }
@@ -404,8 +404,8 @@ float tADSR_tick(tADSR* const adsrenv) · 7 unmodified lines
404404 {
405405 if (adsr->rampPhase > UINT16_MAX)
406406 {
407− adsr->inRamp = OFALSE;
408− adsr->inAttack = OTRUE;
407+ adsr->inRamp = 0;
408+ adsr->inAttack = 1;
409409 adsr->next = 0.0f;
410410 }
411411 else
@@ -422,8 +422,8 @@ float tADSR_tick(tADSR* const adsrenv) · 10 unmodified lines
422422 // If attack done, time to turn around.
423423 if (adsr->attackPhase > UINT16_MAX)
424424 {
425− adsr->inDecay = OTRUE;
426− adsr->inAttack = OFALSE;
425+ adsr->inDecay = 1;
426+ adsr->inAttack = 0;
427427 adsr->next = adsr->gain * 1.0f;
428428 }
429429 else
@@ -443,8 +443,8 @@ float tADSR_tick(tADSR* const adsrenv) · 13 unmodified lines
443443 // If decay done, sustain.
444444 if (adsr->decayPhase >= UINT16_MAX)
445445 {
446− adsr->inDecay = OFALSE;
447− adsr->inSustain = OTRUE;
446+ adsr->inDecay = 0;
447+ adsr->inSustain = 1;
448448 adsr->next = adsr->gain * adsr->sustain;
449449 }
450450
@@ -467,7 +467,7 @@ float tADSR_tick(tADSR* const adsrenv) · 16 unmodified lines
467467 // If release done, finish.
468468 if (adsr->releasePhase >= UINT16_MAX)
469469 {
470− adsr->inRelease = OFALSE;
470+ adsr->inRelease = 0;
471471 adsr->next = 0.0f;
472472 }
473473 else {
leaf/Src/leaf-filters.c+2−2
@@ -222,7 +222,7 @@ void tTwoPole_setA2(tTwoPole* const ft, float a2) · 221 unmodified lines
222222 }
223223
224224
225−void tTwoPole_setResonance(tTwoPole* const ft, float frequency, float radius, oBool normalize)
225+void tTwoPole_setResonance(tTwoPole* const ft, float frequency, float radius, int normalize)
226226 {
227227 _tTwoPole* f = *ft;
228228
@@ -636,7 +636,7 @@ float tBiQuad_tick(tBiQuad* const ft, float input) · 407 unmodified lines
636636 return out;
637637 }
638638
639−void tBiQuad_setResonance(tBiQuad* const ft, float freq, float radius, oBool normalize)
639+void tBiQuad_setResonance(tBiQuad* const ft, float freq, float radius, int normalize)
640640 {
641641 _tBiQuad* f = *ft;
642642
leaf/Src/leaf-instruments.c+13−13
@@ -41,9 +41,9 @@ void t808Cowbell_initToPool (t808Cowbell* const cowbellInst, int use · 40 unmodified lines
4141
4242 tSVF_initToPool(&cowbell->bandpassStick, SVFTypeBandpass, 1800, 1.0f, mp);
4343
44− tEnvelope_initToPool(&cowbell->envGain, 5.0f, 100.0f, OFALSE, mp);
44+ tEnvelope_initToPool(&cowbell->envGain, 5.0f, 100.0f, 0, mp);
4545
46− tEnvelope_initToPool(&cowbell->envFilter, 5.0, 100.0f, OFALSE, mp);
46+ tEnvelope_initToPool(&cowbell->envFilter, 5.0, 100.0f, 0, mp);
4747
4848 tHighpass_initToPool(&cowbell->highpass, 1000.0f, mp);
4949
@@ -166,8 +166,8 @@ void t808Hihat_initToPool (t808Hihat* const hihatInst, tMempool* const mp) · 116 unmodified lines
166166 tSVF_initToPool(&hihat->bandpassStick, SVFTypeBandpass,2500.0f,1.2f, mp);
167167 tSVF_initToPool(&hihat->bandpassOsc, SVFTypeBandpass,3500.0f,0.3f, mp);
168168
169− tEnvelope_initToPool(&hihat->envGain, 0.0f, 50.0f, OFALSE, mp);
170− tEnvelope_initToPool(&hihat->envStick, 0.0f, 7.0f, OFALSE, mp);
169+ tEnvelope_initToPool(&hihat->envGain, 0.0f, 50.0f, 0, mp);
170+ tEnvelope_initToPool(&hihat->envStick, 0.0f, 7.0f, 0, mp);
171171
172172
173173 tHighpass_initToPool(&hihat->highpass, 7000.0f, mp);
@@ -329,9 +329,9 @@ void t808Snare_initToPool (t808Snare* const snareInst, tMempool* const mp) · 155 unmodified lines
329329
330330 tTriangle_setFreq(&snare->tone[i], ratio[i] * 400.0f);
331331 tSVF_initToPool(&snare->toneLowpass[i], SVFTypeLowpass, 4000, 1.0f, mp);
332− tEnvelope_initToPool(&snare->toneEnvOsc[i], 0.0f, 50.0f, OFALSE, mp);
333− tEnvelope_initToPool(&snare->toneEnvGain[i], 1.0f, 150.0f, OFALSE, mp);
334− tEnvelope_initToPool(&snare->toneEnvFilter[i], 1.0f, 2000.0f, OFALSE, mp);
332+ tEnvelope_initToPool(&snare->toneEnvOsc[i], 0.0f, 50.0f, 0, mp);
333+ tEnvelope_initToPool(&snare->toneEnvGain[i], 1.0f, 150.0f, 0, mp);
334+ tEnvelope_initToPool(&snare->toneEnvFilter[i], 1.0f, 2000.0f, 0, mp);
335335
336336 snare->toneGain[i] = 0.5f;
337337 }
@@ -341,8 +341,8 @@ void t808Snare_initToPool (t808Snare* const snareInst, tMempool* const mp) · 3 unmodified lines
341341 snare->noiseFilterFreq = 3000.0f;
342342 tNoise_initToPool(&snare->noiseOsc, WhiteNoise, mp);
343343 tSVF_initToPool(&snare->noiseLowpass, SVFTypeLowpass, 12000.0f, 0.8f, mp);
344− tEnvelope_initToPool(&snare->noiseEnvGain, 0.0f, 100.0f, OFALSE, mp);
345− tEnvelope_initToPool(&snare->noiseEnvFilter, 0.0f, 1000.0f, OFALSE, mp);
344+ tEnvelope_initToPool(&snare->noiseEnvGain, 0.0f, 100.0f, 0, mp);
345+ tEnvelope_initToPool(&snare->noiseEnvFilter, 0.0f, 1000.0f, 0, mp);
346346 snare->noiseGain = 1.0f;
347347 }
348348
@@ -475,11 +475,11 @@ void t808Kick_initToPool (t808Kick* const kickInst, tMempool* const mp) · 126 unmodified lines
475475 kick->chirpRatioMinusOne = 3.3f;
476476 tCycle_setFreq(&kick->tone, 50.0f);
477477 tSVF_initToPool(&kick->toneLowpass, SVFTypeLowpass, 2000.0f, 0.5f, mp);
478− tEnvelope_initToPool(&kick->toneEnvOscChirp, 0.0f, 20.0f, OFALSE, mp);
479− tEnvelope_initToPool(&kick->toneEnvOscSigh, 0.0f, 2500.0f, OFALSE, mp);
480− tEnvelope_initToPool(&kick->toneEnvGain, 0.0f, 800.0f, OFALSE, mp);
478+ tEnvelope_initToPool(&kick->toneEnvOscChirp, 0.0f, 20.0f, 0, mp);
479+ tEnvelope_initToPool(&kick->toneEnvOscSigh, 0.0f, 2500.0f, 0, mp);
480+ tEnvelope_initToPool(&kick->toneEnvGain, 0.0f, 800.0f, 0, mp);
481481 tNoise_initToPool(&kick->noiseOsc, PinkNoise, mp);
482− tEnvelope_initToPool(&kick->noiseEnvGain, 0.0f, 1.0f, OFALSE, mp);
482+ tEnvelope_initToPool(&kick->noiseEnvGain, 0.0f, 1.0f, 0, mp);
483483 kick->noiseGain = 0.3f;
484484 }
485485
leaf/Src/leaf-math.c+5−5
@@ -361,15 +361,15 @@ int LEAF_clipInt(int min, int val, int max) · 360 unmodified lines
361361 }
362362 }
363363
364−oBool LEAF_isPrime(uint64_t number )
364+int LEAF_isPrime(uint64_t number )
365365 {
366− if ( number == 2 ) return OTRUE;
366+ if ( number == 2 ) return 1;
367367 if ( number & 1 ) {
368368 for ( int i=3; i<(int)sqrt((double)number)+1; i+=2 )
369− if ( (number % i) == 0 ) return OFALSE;
370− return OTRUE; // prime
369+ if ( (number % i) == 0 ) return 0;
370+ return 1; // prime
371371 }
372− else return OFALSE; // even
372+ else return 0; // even
373373 }
374374
375375 // Adapted from MusicDSP: http://www.musicdsp.org/showone.php?id=238
leaf/Src/leaf-midi.c+11−11
@@ -31,7 +31,7 @@ void tStack_initToPool (tStack* const stack, tMempool* const mp) · 30 unmodified lines
3131 _tStack* ns = *stack = (_tStack*) mpool_alloc(sizeof(_tStack), m);
3232 ns->mempool = m;
3333
34− ns->ordered = OFALSE;
34+ ns->ordered = 0;
3535 ns->size = 0;
3636 ns->pos = 0;
3737 ns->capacity = STACK_SIZE;
@@ -287,14 +287,14 @@ void tPoly_initToPool (tPoly* const polyh, int maxNumVoices, tMemp · 249 unmodified lines
287287
288288 poly->ramps = (tRamp*) mpool_alloc(sizeof(tRamp) * poly->maxNumVoices, m);
289289 poly->rampVals = (float*) mpool_alloc(sizeof(float) * poly->maxNumVoices, m);
290− poly->firstReceived = (oBool*) mpool_alloc(sizeof(oBool) * poly->maxNumVoices, m);
290+ poly->firstReceived = (int*) mpool_alloc(sizeof(int) * poly->maxNumVoices, m);
291291 poly->voices = (int**) mpool_alloc(sizeof(int*) * poly->maxNumVoices, m);
292292
293293 for (int i = 0; i < poly->maxNumVoices; ++i)
294294 {
295295 poly->voices[i] = (int*) mpool_alloc(sizeof(int) * 2, m);
296296 poly->voices[i][0] = -1;
297− poly->firstReceived[i] = OFALSE;
297+ poly->firstReceived[i] = 0;
298298
299299 tRamp_initToPool(&poly->ramps[i], poly->glideTime, 1, mp);
300300 }
@@ -305,7 +305,7 @@ void tPoly_initToPool (tPoly* const polyh, int maxNumVoices, tMemp · 4 unmodified lines
305305 tStack_initToPool(&poly->stack, mp);
306306 tStack_initToPool(&poly->orderStack, mp);
307307
308− poly->pitchGlideIsActive = OFALSE;
308+ poly->pitchGlideIsActive = 0;
309309 }
310310
311311 void tPoly_free (tPoly* const polyh)
@@ -369,7 +369,7 @@ int tPoly_noteOn(tPoly* const polyh, int note, uint8_t vel) · 57 unmodified lines
369369 tStack_add(&poly->stack, note);
370370
371371 int alteredVoice = -1;
372− oBool found = OFALSE;
372+ int found = 0;
373373 for (int i = 0; i < poly->numVoices; i++)
374374 {
375375 if (poly->voices[i][0] < 0) // if inactive voice, give this note to voice
@@ -377,10 +377,10 @@ int tPoly_noteOn(tPoly* const polyh, int note, uint8_t vel) · 1 unmodified line
377377 if (!poly->firstReceived[i] || !poly->pitchGlideIsActive)
378378 {
379379 tRamp_setVal(&poly->ramps[i], note);
380− poly->firstReceived[i] = OTRUE;
380+ poly->firstReceived[i] = 1;
381381 }
382382
383− found = OTRUE;
383+ found = 1;
384384
385385 poly->voices[i][0] = note;
386386 poly->voices[i][1] = vel;
@@ -541,7 +541,7 @@ void tPoly_setNumVoices(tPoly* const polyh, uint8_t numVoices) · 154 unmodified lines
541541 poly->numVoices = (numVoices > poly->maxNumVoices) ? poly->maxNumVoices : numVoices;
542542 }
543543
544−void tPoly_setPitchGlideActive(tPoly* const polyh, oBool isActive)
544+void tPoly_setPitchGlideActive(tPoly* const polyh, int isActive)
545545 {
546546 _tPoly* poly = *polyh;
547547 poly->pitchGlideIsActive = isActive;
@@ -666,13 +666,13 @@ int tSimplePoly_noteOn(tSimplePoly* const polyh, int note, uint8_t vel) · 118 unmodified lines
666666 else
667667 {
668668 alteredVoice = -1;
669− oBool found = OFALSE;
669+ int found = 0;
670670 for (int i = 0; i < poly->numVoices; i++)
671671 {
672672 if (poly->voices[i][0] == -1) // if inactive voice, give this note to voice
673673 {
674674
675− found = OTRUE;
675+ found = 1;
676676
677677 poly->voices[i][0] = note;
678678 poly->voices[i][1] = vel;
@@ -693,7 +693,7 @@ int tSimplePoly_noteOn(tSimplePoly* const polyh, int note, uint8_t vel) · 14 unmodified lines
693693 if (poly->voices[i][0] == -2) // if voice is released but still sounding, take over this voice
694694 {
695695
696− found = OTRUE;
696+ found = 1;
697697
698698 poly->voices[i][0] = note;
699699 poly->voices[i][1] = vel;
leaf/Src/leaf-oscillators.c+0−70
@@ -354,76 +354,6 @@ void tSawtoothSampleRateChanged (tSawtooth* const cy) · 353 unmodified lines
354354 c->inc = c->freq * leaf.invSampleRate;
355355 }
356356
357−//========================================================================
358−// Sine
359−void tSine_init(tSine* const cy, int size)
360−{
361− tSine_initToPool(cy, size, &leaf.mempool);
362−}
363−
364−void tSine_initToPool (tSine* const cy, int size, tMempool* const mp)
365−{
366− _tMempool* m = *mp;
367− _tSine* c = *cy = (_tSine*) mpool_alloc(sizeof(_tSine), m);
368− c->mempool = m;
369−
370− c->size = size;
371− c->sine = (float*) mpool_alloc(sizeof(float) * c->size, m);
372− LEAF_generate_sine(c->sine, size);
373− c->inc = 0.0f;
374− c->phase = 0.0f;
375−}
376−
377−void tSine_free (tSine* const cy)
378−{
379− _tSine* c = *cy;
380−
381− mpool_free((char*)c->sine, c->mempool);
382− mpool_free((char*)c, c->mempool);
383−}
384−
385−void tSine_setFreq(tSine* const cy, float freq)
386−{
387− _tSine* c = *cy;
388−
389− c->freq = freq;
390− c->inc = freq * leaf.invSampleRate;
391−}
392−
393−float tSine_tick(tSine* const cy)
394−{
395− _tSine* c = *cy;
396− float temp;
397− int intPart;
398− float fracPart;
399− float samp0;
400− float samp1;
401−
402− // Phasor increment
403− c->phase += c->inc;
404− while (c->phase >= 1.0f) c->phase -= 1.0f;
405− while (c->phase < 0.0f) c->phase += 1.0f;
406−
407− // Wavetable synthesis
408−
409− temp = c->size * c->phase;
410− intPart = (int)temp;
411− fracPart = temp - (float)intPart;
412− samp0 = c->sine[intPart];
413− if (++intPart >= c->size) intPart = 0;
414− samp1 = c->sine[intPart];
415−
416− return (samp0 + (samp1 - samp0) * fracPart);
417−
418−}
419−
420−void tSineSampleRateChanged (tSine* const cy)
421−{
422− _tSine* c = *cy;
423−
424− c->inc = c->freq * leaf.invSampleRate;
425−}
426−
427357 //==============================================================================
428358
429359 /* tTri: Anti-aliased Triangle waveform. */
leaf/leaf.h+8−9
@@ -75,15 +75,15 @@ · 74 unmodified lines
7575
7676 #endif
7777
78−/*! \mainpage LEAF
78+/*! @mainpage LEAF
7979 *
80− * \section intro_sec Introduction
80+ * @section intro_sec Introduction
8181 *
8282 * This is the work in progress documentation of LEAF.
8383 *
84− * \section install_sec Installation
84+ * @section install_sec Installation
8585 *
86− * \subsection step1 Step 1: Opening the box
86+ * @subsection step1 Step 1: Opening the box
8787 *
8888 * etc...
8989 */
@@ -106,6 +106,7 @@ · 16 unmodified lines
106106 * @defgroup electrical Electrical Models
107107 * @defgroup mempool Mempool
108108 * @defgroup math Math
109+ * @defgroup tables Tables
109110 */
110111
111112 #ifdef __cplusplus
@@ -113,8 +114,8 @@ extern "C" { · 1 unmodified line
113114 #endif
114115
115116 /*!
116− * @ingroup leaf
117− * @{
117+ @ingroup leaf
118+ @{
118119 */
119120
120121 //! Initialize the LEAF instance.
@@ -143,9 +144,7 @@ extern "C" { · 22 unmodified lines
143144 // __attribute__((weak))
144145 uint8_t LEAF_error(uint8_t whichone);
145146
146− /*!
147− * @}
148− */
147+ /*! @} */
149148
150149 #ifdef __cplusplus
151150 }

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