History

add config file; filling out docs

Matthew Wang committed 5 years ago

Commit 196bc7b1 parent 53eedc912 files · +156 −74Browse files

Unified · Split

12 files
  1. TestPlugin/LEAF.jucer +1 −0
  2. leaf/Inc/leaf-analysis.h +15 −12
  3. leaf/Inc/leaf-delay.h +93 −45
  4. leaf/Src/leaf-analysis.c +3 −3
  5. leaf/Src/leaf-delay.c +3 −5
  6. leaf/Src/leaf-distortion.c +2 −1
  7. leaf/Src/leaf-envelopes.c +4 −3
  8. leaf/Src/leaf-filters.c +2 −0
  9. leaf/Src/leaf-math.c +2 −3
  10. leaf/Src/leaf-oscillators.c +8 −0
  11. leaf/Src/leaf-tables.c +9 −2
  12. leaf/leaf-config.h +14 −0
TestPlugin/LEAF.jucer+1−0
@@ -76,6 +76,7 @@ · 75 unmodified lines
7676 <FILE id="VTmuyj" name="leaf-tables.c" compile="1" resource="0" file="../leaf/Src/leaf-tables.c"/>
7777 <FILE id="HKEtqp" name="leaf.c" compile="1" resource="0" file="../leaf/Src/leaf.c"/>
7878 </GROUP>
79+ <FILE id="a85MuA" name="leaf-config.h" compile="0" resource="0" file="../leaf/leaf-config.h"/>
7980 <FILE id="a1IWV9" name="leaf.cpp" compile="1" resource="0" file="../leaf/leaf.cpp"/>
8081 <FILE id="TzDyuj" name="leaf.h" compile="0" resource="0" file="../leaf/leaf.h"/>
8182 </GROUP>
leaf/Inc/leaf-analysis.h+15−12
@@ -159,19 +159,19 @@ extern "C" { · 158 unmodified lines
159159 /*!
160160 @defgroup tpowerfollower tPowerFollower
161161 @ingroup analysis
162− @brief Measure and output the power of an input signal.
162+ @brief Measure and follow the power of an input signal using an exponential moving average of power.
163163 @{
164164
165165 @fn void tPowerFollower_init (tPowerFollower* const, float factor, LEAF* const leaf)
166166 @brief Initialize a tPowerFollower to the default mempool of a LEAF instance.
167167 @param follower A pointer to the tPowerFollower to initialize.
168− @param factor
168+ @param factor Smoothing factor of the moving average. 0.0-1.0, with a higher value discounting older inputs more quickly.
169169 @param leaf A pointer to the leaf instance.
170170
171171 @fn void tPowerFollower_initToPool (tPowerFollower* const, float factor, tMempool* const)
172172 @brief Initialize a tPowerFollower to a specified mempool.
173173 @param follower A pointer to the tPowerFollower to initialize.
174− @param factor
174+ @param factor Smoothing factor of the moving average. 0.0-1.0, with a higher value discounting older inputs more quickly.
175175 @param mempool A pointer to the tMempool to use.
176176
177177 @fn void tPowerFollower_free (tPowerFollower* const)
@@ -179,17 +179,20 @@ extern "C" { · 1 unmodified line
179179 @param follower A pointer to the tPowerFollower to free.
180180
181181 @fn float tPowerFollower_tick (tPowerFollower* const, float input)
182− @brief
182+ @brief Pass a sample into the power follower and return the current power.
183183 @param follower A pointer to the relevant tPowerFollower.
184184 @param input The input sample
185+ @return The current power.
185186
186− @fn float tPowerFollower_sample (tPowerFollower* const)
187− @brief
187+ @fn float tPowerFollower_getPower (tPowerFollower* const)
188+ @brief Get the current power.
188189 @param follower A pointer to the relevant tPowerFollower.
190+ @return The current power.
189191
190192 @fn int tPowerFollower_setFactor (tPowerFollower* const, float factor)
191− @brief
193+ @brief Set the smoothing factor for the moving average.
192194 @param follower A pointer to the relevant tPowerFollower.
195+ @param factor Smoothing factor of the moving average. 0.0-1.0, with a higher value discounting older inputs more quickly.
193196 
194197 @} */
195198
@@ -210,8 +213,8 @@ extern "C" { · 14 unmodified lines
210213 void tPowerFollower_free (tPowerFollower* const);
211214
212215 float tPowerFollower_tick (tPowerFollower* const, float input);
213− float tPowerFollower_sample (tPowerFollower* const);
214− int tPowerFollower_setFactor (tPowerFollower* const, float factor);
216+ float tPowerFollower_getPower (tPowerFollower* const);
217+ void tPowerFollower_setFactor (tPowerFollower* const, float factor);
215218
216219 // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
217220
@@ -248,7 +251,7 @@ extern "C" { · 30 unmodified lines
248251 @fn void tEnvPD_processBlock (tEnvPD* const, float* in)
249252 @brief
250253 @param env
251− @param input
254+ @param inputBlock
252255 
253256 @} */
254257
@@ -338,7 +341,8 @@ extern "C" { · 83 unmodified lines
338341 @fn int tAttackDetection_detect (tAttackDetection* const, float *in)
339342 @brief Find the largest transient in input block, return index of attack
340343 @param detection A pointer to the relevant tAttackDetection.
341− @param input
344+ @param inputBlock
345+ @return Index of the largest transient in the input.
342346 
343347 @} */
344348
@@ -508,7 +512,6 @@ extern "C" { · 163 unmodified lines
508512 @fn void tPeriodDetection_free (tPeriodDetection* const)
509513 @brief Free a tPeriodDetection from its mempool.
510514 @param detection A pointer to the tPeriodDetection to free.
511− @param
512515
513516 @fn float tPeriodDetection_tick (tPeriodDetection* const, float sample)
514517 @brief
leaf/Inc/leaf-delay.h+93−45
@@ -56,10 +56,10 @@ extern "C" { · 55 unmodified lines
5656 @brief
5757 @param delay A pointer to the relevant tDelay.
5858
59− @fn int tDelay_setDelay (tDelay* const, uint32_t delay)
59+ @fn void tDelay_setDelay (tDelay* const, uint32_t delay)
6060 @brief
6161 @param delay A pointer to the relevant tDelay.
62− @param delayLength
62+ @param delayLength The new delay length in samples. Cannot be greater than the max delay length given on initialization.
6363
6464 @fn uint32_t tDelay_getDelay (tDelay* const)
6565 @brief
@@ -125,7 +125,7 @@ extern "C" { · 59 unmodified lines
125125 void tDelay_free (tDelay* const);
126126
127127 void tDelay_clear (tDelay* const);
128− int tDelay_setDelay (tDelay* const, uint32_t delay);
128+ void tDelay_setDelay (tDelay* const, uint32_t delay);
129129 uint32_t tDelay_getDelay (tDelay* const);
130130 void tDelay_tapIn (tDelay* const, float in, uint32_t tapDelay);
131131 float tDelay_tapOut (tDelay* const, uint32_t tapDelay);
@@ -167,7 +167,7 @@ extern "C" { · 35 unmodified lines
167167 @fn void tLinearDelay_setDelay (tLinearDelay* const, float delay)
168168 @brief
169169 @param delay A pointer to the relevant tLinearDelay.
170− @param delayLength
170+ @param delayLength The new delay length in samples. Cannot be greater than the max delay length given on initialization.
171171
172172 @fn float tLinearDelay_getDelay (tLinearDelay* const)
173173 @brief
@@ -177,34 +177,47 @@ extern "C" { · 3 unmodified lines
177177 @fn void tLinearDelay_tapIn (tLinearDelay* const, float in, uint32_t tapDelay)
178178 @brief
179179 @param delay A pointer to the relevant tLinearDelay.
180+ @param input
181+ @param position
180182
181183 @fn float tLinearDelay_tapOut (tLinearDelay* const, uint32_t tapDelay)
182184 @brief
183185 @param delay A pointer to the relevant tLinearDelay.
186+ @param position
187+ @return
184188
185189 @fn float tLinearDelay_addTo (tLinearDelay* const, float value, uint32_t tapDelay)
186190 @brief
187191 @param delay A pointer to the relevant tLinearDelay.
192+ @param input
193+ @param position
194+ @return
188195
189196 @fn float tLinearDelay_tick (tLinearDelay* const, float sample)
190197 @brief
191198 @param delay A pointer to the relevant tLinearDelay.
199+ @param input
200+ @return
192201
193202 @fn void tLinearDelay_tickIn (tLinearDelay* const, float input)
194203 @brief
195204 @param delay A pointer to the relevant tLinearDelay.
205+ @param input
196206
197207 @fn float tLinearDelay_tickOut (tLinearDelay* const)
198208 @brief
199209 @param delay A pointer to the relevant tLinearDelay.
210+ @return
200211
201212 @fn float tLinearDelay_getLastOut (tLinearDelay* const)
202213 @brief
203214 @param delay A pointer to the relevant tLinearDelay.
215+ @return
204216
205217 @fn float tLinearDelay_getLastIn (tLinearDelay* const)
206218 @brief
207219 @param delay A pointer to the relevant tLinearDelay.
220+ @return
208221 
209222 @} */
210223
@@ -293,10 +306,10 @@ extern "C" { · 82 unmodified lines
293306 @param delay A pointer to the relevant tHermiteDelay.
294307 @return
295308
296− @fn int tHermiteDelay_setDelay (tHermiteDelay* const dl, float delay)
309+ @fn void tHermiteDelay_setDelay (tHermiteDelay* const dl, float delay)
297310 @brief
298311 @param delay A pointer to the relevant tHermiteDelay.
299− @param delayLength
312+ @param delayLength The new delay length in samples. Cannot be greater than the max delay length given on initialization.
300313
301314 @fn float tHermiteDelay_tapOut (tHermiteDelay* const dl, uint32_t tapDelay)
302315 @brief
@@ -346,7 +359,6 @@ extern "C" { · 43 unmodified lines
346359
347360 typedef struct _tHermiteDelay
348361 {
349−
350362 tMempool mempool;
351363
352364 float gain;
@@ -365,23 +377,23 @@ extern "C" { · 12 unmodified lines
365377
366378 typedef _tHermiteDelay* tHermiteDelay;
367379
368− void tHermiteDelay_init (tHermiteDelay* const dl, float delay, uint32_t maxDelay, LEAF* const leaf);
369− void tHermiteDelay_initToPool (tHermiteDelay* const dl, float delay, uint32_t maxDelay, tMempool* const mp);
370− void tHermiteDelay_free (tHermiteDelay* const dl);
371−
372− void tHermiteDelay_clear (tHermiteDelay* const dl);
373− float tHermiteDelay_tick (tHermiteDelay* const dl, float input);
374− void tHermiteDelay_tickIn (tHermiteDelay* const dl, float input);
375− float tHermiteDelay_tickOut (tHermiteDelay* const dl);
376− int tHermiteDelay_setDelay (tHermiteDelay* const dl, float delay);
377− float tHermiteDelay_tapOut (tHermiteDelay* const dl, uint32_t tapDelay);
378− void tHermiteDelay_tapIn (tHermiteDelay* const dl, float value, uint32_t tapDelay);
379− float tHermiteDelay_addTo (tHermiteDelay* const dl, float value, uint32_t tapDelay);
380− float tHermiteDelay_getDelay (tHermiteDelay* const dl);
381− float tHermiteDelay_getLastOut (tHermiteDelay* const dl);
380+ void tHermiteDelay_init (tHermiteDelay* const dl, float delay, uint32_t maxDelay, LEAF* const leaf);
381+ void tHermiteDelay_initToPool (tHermiteDelay* const dl, float delay, uint32_t maxDelay, tMempool* const mp);
382+ void tHermiteDelay_free (tHermiteDelay* const dl);
383+
384+ void tHermiteDelay_clear (tHermiteDelay* const dl);
385+ float tHermiteDelay_tick (tHermiteDelay* const dl, float input);
386+ void tHermiteDelay_tickIn (tHermiteDelay* const dl, float input);
387+ float tHermiteDelay_tickOut (tHermiteDelay* const dl);
388+ void tHermiteDelay_setDelay (tHermiteDelay* const dl, float delay);
389+ float tHermiteDelay_tapOut (tHermiteDelay* const dl, uint32_t tapDelay);
390+ void tHermiteDelay_tapIn (tHermiteDelay* const dl, float value, uint32_t tapDelay);
391+ float tHermiteDelay_addTo (tHermiteDelay* const dl, float value, uint32_t tapDelay);
392+ float tHermiteDelay_getDelay (tHermiteDelay* const dl);
393+ float tHermiteDelay_getLastOut (tHermiteDelay* const dl);
382394 float tHermiteDelay_getLastIn (tHermiteDelay* const dl);
383− void tHermiteDelay_setGain (tHermiteDelay* const dl, float gain);
384− float tHermiteDelay_getGain (tHermiteDelay* const dl);
395+ void tHermiteDelay_setGain (tHermiteDelay* const dl, float gain);
396+ float tHermiteDelay_getGain (tHermiteDelay* const dl);
385397
386398
387399 //==============================================================================
@@ -395,11 +407,15 @@ extern "C" { · 7 unmodified lines
395407 @fn void tAllpassDelay_init (tAllpassDelay* const, float delay, uint32_t maxDelay, LEAF* const leaf)
396408 @brief Initialize a tAllpassDelay to the default mempool of a LEAF instance.
397409 @param delay A pointer to the tAllpassDelay to initialize.
410+ @param initialLength
411+ @param maxLength
398412 @param leaf A pointer to the leaf instance.
399413
400414 @fn void tAllpassDelay_initToPool (tAllpassDelay* const, float delay, uint32_t maxDelay, tMempool* const)
401415 @brief Initialize a tAllpassDelay to a specified mempool.
402416 @param delay A pointer to the tAllpassDelay to initialize.
417+ @param initialLength
418+ @param maxLength
403419 @param mempool A pointer to the tMempool to use.
404420
405421 @fn void tAllpassDelay_free (tAllpassDelay* const)
@@ -410,43 +426,55 @@ extern "C" { · 4 unmodified lines
410426 @brief
411427 @param delay A pointer to the relevant tAllpassDelay.
412428
413− @fn int tAllpassDelay_setDelay (tAllpassDelay* const, float delay)
429+ @fn void tAllpassDelay_setDelay (tAllpassDelay* const, float delay)
414430 @brief
415431 @param delay A pointer to the relevant tAllpassDelay.
432+ @param delayLength The new delay length in samples. Cannot be greater than the max delay length given on initialization.
416433
417434 @fn float tAllpassDelay_getDelay (tAllpassDelay* const)
418435 @brief
419436 @param delay A pointer to the relevant tAllpassDelay.
437+ @return The current delay length in samples.
420438
421439 @fn void tAllpassDelay_tapIn (tAllpassDelay* const, float in, uint32_t tapDelay)
422440 @brief
423441 @param delay A pointer to the relevant tAllpassDelay.
442+ @param inptu
443+ @param position
424444
425445 @fn float tAllpassDelay_tapOut (tAllpassDelay* const, uint32_t tapDelay)
426446 @brief
427447 @param delay A pointer to the relevant tAllpassDelay.
448+ @param position
449+ @return
428450
429451 @fn float tAllpassDelay_addTo (tAllpassDelay* const, float value, uint32_t tapDelay)
430452 @brief
431453 @param delay A pointer to the relevant tAllpassDelay.
454+ @param input
455+ @param position
456+ @return
432457
433458 @fn float tAllpassDelay_tick (tAllpassDelay* const, float sample)
434459 @brief
435460 @param delay A pointer to the relevant tAllpassDelay.
461+ @param input
462+ @return
436463
437464 @fn float tAllpassDelay_getLastOut (tAllpassDelay* const)
438465 @brief
439466 @param delay A pointer to the relevant tAllpassDelay.
467+ @return
440468
441469 @fn float tAllpassDelay_getLastIn (tAllpassDelay* const)
442470 @brief
443471 @param delay A pointer to the relevant tAllpassDelay.
472+ @return
444473 
445474 @} */
446475
447476 typedef struct _tAllpassDelay
448477 {
449−
450478 tMempool mempool;
451479
452480 float gain;
@@ -473,7 +501,7 @@ extern "C" { · 20 unmodified lines
473501 void tAllpassDelay_free (tAllpassDelay* const);
474502
475503 void tAllpassDelay_clear (tAllpassDelay* const);
476− int tAllpassDelay_setDelay (tAllpassDelay* const, float delay);
504+ void tAllpassDelay_setDelay (tAllpassDelay* const, float delay);
477505 float tAllpassDelay_getDelay (tAllpassDelay* const);
478506 void tAllpassDelay_tapIn (tAllpassDelay* const, float in, uint32_t tapDelay);
479507 float tAllpassDelay_tapOut (tAllpassDelay* const, uint32_t tapDelay);
@@ -493,11 +521,15 @@ extern "C" { · 13 unmodified lines
493521 @fn void tTapeDelay_init (tTapeDelay* const, float delay, uint32_t maxDelay, LEAF* const leaf)
494522 @brief Initialize a tTapeDelay to the default mempool of a LEAF instance.
495523 @param delay A pointer to the tTapeDelay to initialize.
524+ @param initialLength
525+ @param maxLength
496526 @param leaf A pointer to the leaf instance.
497527
498528 @fn void tTapeDelay_initToPool (tTapeDelay* const, float delay, uint32_t maxDelay, tMempool* const)
499529 @brief Initialize a tTapeDelay to a specified mempool.
500530 @param delay A pointer to the tTapeDelay to initialize.
531+ @param initialLength
532+ @param maxLength
501533 @param mempool A pointer to the tMempool to use.
502534
503535 @fn void tTapeDelay_free (tTapeDelay* const)
@@ -511,26 +543,37 @@ extern "C" { · 7 unmodified lines
511543 @fn void tTapeDelay_setDelay (tTapeDelay* const, float delay)
512544 @brief
513545 @param delay A pointer to the relevant tTapeDelay.
546+ @param delayLength The new delay length in samples. Cannot be greater than the max delay length given on initialization.
514547
515548 @fn float tTapeDelay_getDelay (tTapeDelay* const)
516549 @brief
517550 @param delay A pointer to the relevant tTapeDelay.
551+ @return
518552
519553 @fn void tTapeDelay_tapIn (tTapeDelay* const, float in, uint32_t tapDelay)
520554 @brief
521555 @param delay A pointer to the relevant tTapeDelay.
556+ @param input
557+ @param position
522558
523559 @fn float tTapeDelay_tapOut (tTapeDelay* const d, float tapDelay)
524560 @brief
525561 @param delay A pointer to the relevant tTapeDelay.
562+ @param position
563+ @return
526564
527565 @fn float tTapeDelay_addTo (tTapeDelay* const, float value, uint32_t tapDelay)
528566 @brief
529567 @param delay A pointer to the relevant tTapeDelay.
568+ @param input
569+ @param position
570+ @return
530571
531572 @fn float tTapeDelay_tick (tTapeDelay* const, float sample)
532573 @brief
533574 @param delay A pointer to the relevant tTapeDelay.
575+ @param input
576+ @return
534577
535578 @fn void tTapeDelay_incrementInPoint(tTapeDelay* const dl)
536579 @brief
@@ -539,10 +582,12 @@ extern "C" { · 2 unmodified lines
539582 @fn float tTapeDelay_getLastOut (tTapeDelay* const)
540583 @brief
541584 @param delay A pointer to the relevant tTapeDelay.
585+ @return
542586
543587 @fn float tTapeDelay_getLastIn (tTapeDelay* const)
544588 @brief
545589 @param delay A pointer to the relevant tTapeDelay.
590+ @return
546591 
547592 @} */
548593
@@ -592,41 +637,45 @@ extern "C" { · 43 unmodified lines
592637
593638 @fn void tRingBuffer_init (tRingBuffer* const ring, int size, LEAF* const leaf)
594639 @brief Initialize a tRingBuffer to the default mempool of a LEAF instance.
595− @param delay A pointer to the tRingbuffer to initialize.
640+ @param buffer A pointer to the tRingbuffer to initialize.
641+ @param size Size of the buffer. Should be a power of 2. Will otherwise be adjusted to the nearest greater power of 2.
596642 @param leaf A pointer to the leaf instance.
597643
598644 @fn void tRingBuffer_initToPool (tRingBuffer* const ring, int size, tMempool* const mempool)
599645 @brief Initialize a tRingBuffer to a specified mempool.
600− @param delay A pointer to the tRingbuffer to initialize.
646+ @param buffer A pointer to the tRingbuffer to initialize.
647+ @param size Size of the buffer. Should be a power of 2. Will otherwise be adjusted to the nearest greater power of 2.
601648 @param mempool A pointer to the tMempool to use.
602649
603650 @fn void tRingBuffer_free (tRingBuffer* const ring)
604651 @brief Free a tRingBuffer from its mempool.
605− @param delay A pointer to the tRingBuffer to free.
652+ @param buffer A pointer to the tRingBuffer to free.
606653
607654 @fn void tRingBuffer_push (tRingBuffer* const ring, float val)
608− @brief
609− @param delay A pointer to the relevant tRingBuffer.
655+ @brief Push a value to the ring buffer, overwriting the oldest value if the buffer is full.
656+ @param buffer A pointer to the relevant tRingBuffer.
657+ @param input The value to push to the buffer.
610658
611659 @fn float tRingBuffer_getNewest (tRingBuffer* const ring)
612− @brief
613− @param delay A pointer to the relevant tRingBuffer.
660+ @brief Get the newest value in the ring buffer.
661+ @param buffer A pointer to the relevant tRingBuffer.
662+ @return The newest value in the ring buffer.
614663
615664 @fn float tRingBuffer_getOldest (tRingBuffer* const ring)
616− @brief
617− @param delay A pointer to the relevant tRingBuffer.
665+ @brief Get the oldest value in the ring buffer.
666+ @param buffer A pointer to the relevant tRingBuffer.
667+ @return The oldest value in the ring buffer.
618668
619669 @fn float tRingBuffer_get (tRingBuffer* const ring, int index)
620− @brief
621− @param delay A pointer to the relevant tRingBuffer.
622−
623− @fn float tRingBuffer_clear (tRingBuffer* const ring)
624− @brief
625− @param delay A pointer to the relevant tRingBuffer.
626−
670+ @brief Get the value at an index of the buffer.
671+ @param buffer A pointer to the relevant tRingBuffer.
672+ @param index The index to access.
673+ @return The value at the given index.
674+
627675 @fn int tRingBuffer_getSize (tRingBuffer* const ring)
628− @brief
629− @param delay A pointer to the relevant tRingBuffer.
676+ @brief Get the size of the ring buffer.
677+ @param buffer A pointer to the relevant tRingBuffer.
678+ @return The size of the buffer.
630679 
631680 @} */
632681 typedef struct _tRingBuffer
@@ -650,7 +699,6 @@ extern "C" { · 17 unmodified lines
650699 float tRingBuffer_getNewest (tRingBuffer* const ring);
651700 float tRingBuffer_getOldest (tRingBuffer* const ring);
652701 float tRingBuffer_get (tRingBuffer* const ring, int index);
653− float tRingBuffer_clear (tRingBuffer* const ring);
654702 int tRingBuffer_getSize (tRingBuffer* const ring);
655703
656704 #ifdef __cplusplus
leaf/Src/leaf-analysis.c+3−3
@@ -196,7 +196,7 @@ void tPowerFollower_free (tPowerFollower* const pf) · 195 unmodified lines
196196 mpool_free((char*)p, p->mempool);
197197 }
198198
199−int tPowerFollower_setFactor(tPowerFollower* const pf, float factor)
199+void tPowerFollower_setFactor(tPowerFollower* const pf, float factor)
200200 {
201201 _tPowerFollower* p = *pf;
202202
@@ -207,14 +207,14 @@ int tPowerFollower_setFactor(tPowerFollower* const pf, float factor) · 4 unmodified lines
207207 return 0;
208208 }
209209
210−float tPowerFollower_tick(tPowerFollower* const pf, float input)
210+float tPowerFollower_tick(tPowerFollower* const pf, float input)
211211 {
212212 _tPowerFollower* p = *pf;
213213 p->curr = p->factor*input*input+p->oneminusfactor*p->curr;
214214 return p->curr;
215215 }
216216
217−float tPowerFollower_sample(tPowerFollower* const pf)
217+float tPowerFollower_getPower(tPowerFollower* const pf)
218218 {
219219 _tPowerFollower* p = *pf;
220220 return p->curr;
leaf/Src/leaf-delay.c+3−5
@@ -80,7 +80,7 @@ float tDelay_tick (tDelay* const dl, float input) · 79 unmodified lines
8080 return d->lastOut;
8181 }
8282
83−int tDelay_setDelay (tDelay* const dl, uint32_t delay)
83+void tDelay_setDelay (tDelay* const dl, uint32_t delay)
8484 {
8585 _tDelay* d = *dl;
8686
@@ -454,7 +454,7 @@ float tHermiteDelay_tickOut (tHermiteDelay* const dl) · 367 unmodified lines
454454 return d->lastOut;
455455 }
456456
457−int tHermiteDelay_setDelay (tHermiteDelay* const dl, float delay)
457+void tHermiteDelay_setDelay (tHermiteDelay* const dl, float delay)
458458 {
459459 _tHermiteDelay* d = *dl;
460460
@@ -471,8 +471,6 @@ int tHermiteDelay_setDelay (tHermiteDelay* const dl, float delay) · 10 unmodified lines
471471 d->omAlpha = 1.0f - d->alpha;
472472
473473 if ( d->outPoint == d->maxDelay ) d->outPoint = 0;
474−
475− return 0;
476474 }
477475
478476 float tHermiteDelay_tapOut (tHermiteDelay* const dl, uint32_t tapDelay)
@@ -620,7 +618,7 @@ float tAllpassDelay_tick (tAllpassDelay* const dl, float input) · 141 unmodified lines
620618 return d->lastOut;
621619 }
622620
623−int tAllpassDelay_setDelay (tAllpassDelay* const dl, float delay)
621+void tAllpassDelay_setDelay (tAllpassDelay* const dl, float delay)
624622 {
625623 _tAllpassDelay* d = *dl;
626624
leaf/Src/leaf-distortion.c+2−1
@@ -22,7 +22,6 @@ · 21 unmodified lines
2222 // Sample-Rate reducer
2323 //============================================================================================================
2424
25−
2625 void tSampleReducer_init (tSampleReducer* const sr, LEAF* const leaf)
2726 {
2827 tSampleReducer_initToPool(sr, &leaf->mempool);
@@ -68,6 +67,7 @@ void tSampleReducer_setRatio(tSampleReducer* const sr, float ratio) · 39 unmodified lines
6867
6968 }
7069
70+#if LEAF_INCLUDE_TABLES
7171 //============================================================================================================
7272 // Oversampler
7373 //============================================================================================================
@@ -303,6 +303,7 @@ int tOversampler_getLatency(tOversampler* const osr) · 229 unmodified lines
303303 _tOversampler* os = *osr;
304304 return os->phaseLength;
305305 }
306+#endif
306307
307308 //============================================================================================================
308309 // WAVEFOLDER
leaf/Src/leaf-envelopes.c+4−3
@@ -23,6 +23,7 @@ · 22 unmodified lines
2323
2424 #endif
2525
26+#if LEAF_INCLUDE_TABLES
2627 // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Envelope ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ //
2728 void tEnvelope_init(tEnvelope* const envlp, float attack, float decay, int loop, LEAF* const leaf)
2829 {
@@ -211,9 +212,9 @@ float tEnvelope_tick(tEnvelope* const envlp) · 182 unmodified lines
211212
212213 return env->next;
213214 }
215+#endif
214216
215−
216−
217+#if LEAF_INCLUDE_TABLES
217218 /* ADSR */
218219 void tADSR_init(tADSR* const adsrenv, float attack, float decay, float sustain, float release, LEAF* const leaf)
219220 {
@@ -482,7 +483,7 @@ float tADSR_tick(tADSR* const adsrenv) · 262 unmodified lines
482483
483484 return adsr->next;
484485 }
485−
486+#endif
486487
487488
488489
leaf/Src/leaf-filters.c+2−0
@@ -900,6 +900,7 @@ void tSVF_setFreqAndQ(tSVF* const svff, float freq, float Q) · 899 unmodified lines
900900 svf->a3 = svf->g * svf->a2;
901901 }
902902
903+#if LEAF_INCLUDE_TABLES
903904 // Efficient version of tSVF where frequency is set based on 12-bit integer input for lookup in tanh wavetable.
904905 void tEfficientSVF_init(tEfficientSVF* const svff, SVFType type, uint16_t input, float Q, LEAF* const leaf)
905906 {
@@ -970,6 +971,7 @@ void tEfficientSVF_setQ(tEfficientSVF* const svff, float Q) · 64 unmodified lines
970971 svf->a2 = svf->g * svf->a1;
971972 svf->a3 = svf->g * svf->a2;
972973 }
974+#endif
973975
974976 /* Highpass */
975977 void tHighpass_init(tHighpass* const ft, float freq, LEAF* const leaf)
leaf/Src/leaf-math.c+2−3
@@ -827,11 +827,9 @@ float median3f(float a, float b, float c) · 826 unmodified lines
827827 return fmax(fmin(a, b), fmin(fmax(a, b), c));
828828 }
829829
830+#if LEAF_INCLUDE_MINBLEP
830831 /// MINBLEPS
831−
832832 // https://github.com/MrBlueXav/Dekrispator_v2 blepvco.c
833−
834−
835833 void place_step_dd(float *buffer, int index, float phase, float w, float scale)
836834 {
837835 float r;
@@ -874,3 +872,4 @@ void place_slope_dd(float *buffer, int index, float phase, float w, float slope_ · 36 unmodified lines
874872 index++;
875873 }
876874 }
875+#endif
leaf/Src/leaf-oscillators.c+8−0
@@ -86,6 +86,7 @@ void tTableSampleRateChanged(tTable* const cy) · 85 unmodified lines
8686 c->inc = c->freq * leaf->invSampleRate;
8787 }
8888
89+#if LEAF_INCLUDE_TABLES
8990 // Cycle
9091 void tCycle_init(tCycle* const cy, LEAF* const leaf)
9192 {
@@ -155,7 +156,9 @@ void tCycleSampleRateChanged (tCycle* const cy) · 63 unmodified lines
155156
156157 c->inc = c->freq * leaf->invSampleRate;
157158 }
159+#endif
158160
161+#if LEAF_INCLUDE_TABLES
159162 //========================================================================
160163 /* Triangle */
161164 void tTriangle_init(tTriangle* const cy, LEAF* const leaf)
@@ -226,7 +229,9 @@ void tTriangleSampleRateChanged (tTriangle* const cy) · 64 unmodified lines
226229
227230 c->inc = c->freq * leaf->invSampleRate;
228231 }
232+#endif
229233
234+#if LEAF_INCLUDE_TABLES
230235 //========================================================================
231236 /* Square */
232237 void tSquare_init(tSquare* const cy, LEAF* const leaf)
@@ -296,7 +301,9 @@ void tSquareSampleRateChanged (tSquare* const cy) · 63 unmodified lines
296301
297302 c->inc = c->freq * leaf->invSampleRate;
298303 }
304+#endif
299305
306+#if LEAF_INCLUDE_TABLES
300307 //=====================================================================
301308 // Sawtooth
302309 void tSawtooth_init(tSawtooth* const cy, LEAF* const leaf)
@@ -366,6 +373,7 @@ void tSawtoothSampleRateChanged (tSawtooth* const cy) · 63 unmodified lines
366373
367374 c->inc = c->freq * leaf->invSampleRate;
368375 }
376+#endif
369377
370378 //==============================================================================
371379
leaf/Src/leaf-tables.c+9−2
@@ -2,10 +2,13 @@ · 1 unmodified line
22
33 #if _WIN32 || _WIN64
44
5+#include "..\leaf-config.h"
56 #include "..\Inc\leaf-tables.h"
67 #include "..\Inc\leaf-global.h"
8+
79 #else
810
11+#include "../leaf-config.h"
912 #include "../Inc/leaf-tables.h"
1013 #include "../Inc/leaf-global.h"
1114
@@ -14,6 +17,8 @@ · 2 unmodified lines
1417
1518 #include "stdlib.h"
1619
20+#if LEAF_INCLUDE_TABLES
21+
1722 const float __leaf_table_fir2XLow[32] = { 0.001067048115027622, -0.004557728776555209, -0.016711590887520535, -0.021065500881657994, -0.003828695019946828, 0.01865935152799254, 0.012036365576553658, -0.02064070362810112, -0.02682399333687091, 0.017862623081258543, 0.0492716766870816, -0.004310232755957251, -0.08571879958189704, -0.03828300159135686, 0.18420501161808442, 0.4054061613074031, 0.4054061613074031, 0.18420501161808442, -0.03828300159135686, -0.08571879958189704, -0.004310232755957251, 0.0492716766870816, 0.017862623081258543, -0.02682399333687091, -0.02064070362810112, 0.012036365576553658, 0.01865935152799254, -0.003828695019946828, -0.021065500881657994, -0.016711590887520535, -0.004557728776555209, 0.001067048115027622
1823
1924 };
@@ -14059,11 +14064,11 @@ const float __leaf_table_sinewave[SINE_TABLE_SIZE] = {0.0f, 0.00305f, 0.00613f, · 14039 unmodified lines
1405914064 -0.08582f, -0.08276f, -0.07968f, -0.07663f, -0.07358f, -0.07053f, -0.06744f, -0.06439f, -0.06134f, -0.05826f, -0.05521f, -0.05215f, -0.04907f, -0.04602f, -0.04294f, -0.03989f, -0.03683f, -0.03375f, -0.0307f, -0.02762f,
1406014065 -0.02457f, -0.02148f, -0.01843f, -0.01535f, -0.0123f, -0.00922f, -0.00616f, -0.00308f
1406114066 };
14067+#endif
1406214068
1406314069
14070+#if LEAF_INCLUDE_MINBLEP
1406414071 // From https://github.com/MrBlueXav/Dekrispator_v2 minblep_tables.c
14065−
14066−
1406714072 /* minBLEP tables
1406814073 *
1406914074 * sinc cutoff frequency: 0.9 nyquist
@@ -15820,3 +15825,5 @@ slope_dd_table [MINBLEP_PHASES * SLOPE_DD_PULSE_LENGTH + 1] = · 1750 unmodified lines
1582015825 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00,
1582115826 0.000000e+00
1582215827 };
15828+
15829+#endif
leaf/leaf-config.h+14−0
@@ -0,0 +1,14 @@
1+/*
2+ ==============================================================================
3+
4+ leaf-config.h
5+ Created: 18 Dec 2020 1:24:49pm
6+ Author: Matthew Wang
7+
8+ ==============================================================================
9+*/
10+
11+#pragma once
12+
13+#define LEAF_INCLUDE_TABLES 0
14+#define LEAF_INCLUDE_MINBLEP 0

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