shithub: leaf

Download patch

ref: 63e93a55b13ab22f80e48c2ef8ce2657f5f0f824
parent: 9e4dfd7da27db5a20ac5ace83e7e03c8a3c9ada4
author: spiricom <jeff@snyderphonics.com>
date: Wed May 6 12:49:39 EDT 2020

fixed oscillators negative freqs and vocoder warp and glottal pulse

binary files a/LEAF/.DS_Store b/LEAF/.DS_Store differ
--- a/LEAF/Src/leaf-oscillators.c
+++ b/LEAF/Src/leaf-oscillators.c
@@ -49,9 +49,7 @@
 {
     _tCycle* c = *cy;
     
-    if (freq < 0.0f) c->freq = 0.0f;
-    else if (freq > 20480.0f) c->freq = 20480.0f;
-    else c->freq  = freq;
+    c->freq  = freq;
 
     c->inc = freq * leaf.invSampleRate;
 }
@@ -129,9 +127,8 @@
 {
     _tSine* c = *cy;
     
-    if (freq < 0.0f) c->freq = 0.0f;
-    else if (freq > 20480.0f) c->freq = 20480.0f;
-    else c->freq  = freq;
+
+    c->freq  = freq;
     
     c->inc = freq * leaf.invSampleRate;
 }
@@ -204,9 +201,7 @@
 {
     _tTriangle* c = *cy;
     
-    if (freq < 0.0f) c->freq = 0.0f;
-    else if (freq > 20480.0f) c->freq = 20480.0f;
-    else c->freq  = freq;
+    c->freq  = freq;
     
     c->inc = c->freq * leaf.invSampleRate;
     
@@ -279,11 +274,9 @@
 void    tSquare_setFreq(tSquare* const cy, float freq)
 {
     _tSquare* c = *cy;
+
+    c->freq  = freq;
     
-    if (freq < 0.0f) c->freq = 0.0f;
-    else if (freq > 20480.0f) c->freq = 20480.0f;
-    else c->freq  = freq;
-    
     c->inc = c->freq * leaf.invSampleRate;
     
     c->w = c->freq * INV_20;
@@ -355,9 +348,7 @@
 {
     _tSawtooth* c = *cy;
     
-    if (freq < 0.0f) c->freq = 0.0f;
-    else if (freq > 20480.0f) c->freq = 20480.0f;
-    else c->freq  = freq;
+    c->freq  = freq;
     
     c->inc = c->freq * leaf.invSampleRate;
     
@@ -436,10 +427,8 @@
 void    tPhasor_setFreq(tPhasor* const ph, float freq)
 {
     _tPhasor* p = *ph;
-    
-    if (freq < 0.0f) p->freq = 0.0f;
-    else if (freq > 20480.0f) p->freq = 20480.0f;
-    else p->freq  = freq;
+
+    p->freq  = freq;
     
     p->inc = freq * leaf.invSampleRate;
 }