shithub: leaf

Download patch

ref: 53da637f80eaabb0a4d7c2044f16520b31a34f2f
parent: 33c1f56e83295114dfb9f7d8fc5fcf7454a35dc0
author: mulshine <mulshine@princeton.edu>
date: Wed Jan 16 12:58:38 EST 2019

Got rid of some extras and solved a bug.

--- a/LEAF/Inc/leaf-delay.h
+++ b/LEAF/Inc/leaf-delay.h
@@ -122,13 +122,10 @@
     float lastOut, lastIn;
     
     uint32_t inPoint;
-    uint32_t outPoint;
     
     uint32_t maxDelay;
     
     float delay, inc, idx;
-    
-    float alpha, omAlpha, coeff;
     
     float apInput;
     
--- a/LEAF/Src_cpp/leaf-delay.cpp
+++ b/LEAF/Src_cpp/leaf-delay.cpp
@@ -428,7 +428,6 @@
     d->idx = 0.0f;
     d->inc = 1.0f;
     d->inPoint = 0;
-    d->outPoint = 0;
     
     tTapeDelay_setDelay(d, 1.f);
 }
@@ -451,13 +450,13 @@
     if (++(d->inPoint) == d->maxDelay )    d->inPoint = 0;
 
     int idx =  (int) d->idx;
-    d->alpha = d->idx - idx;
+    float alpha = d->idx - idx;
     
     d->lastOut =    LEAF_interpolate_hermite (d->buff[((idx - 1) + d->maxDelay) % d->maxDelay],
                                               d->buff[idx],
                                               d->buff[(idx + 1) % d->maxDelay],
                                               d->buff[(idx + 2) % d->maxDelay],
-                                              d->alpha);
+                                              alpha);
     
     float diff = (d->inPoint - d->idx);
     while (diff < 0.f) diff += d->maxDelay;
@@ -467,8 +466,6 @@
     d->idx += d->inc;
     
     if (d->idx >= d->maxDelay) d->idx = 0.f;
-    
-    if ( ++(d->outPoint) >= d->maxDelay ) d->outPoint -= d->maxDelay;
 
     return d->lastOut;
 }
@@ -483,14 +480,6 @@
 {
     d->delay = LEAF_clip(1.f, delay,  d->maxDelay);
     
-    float outPointer = d->inPoint - d->delay;
-    
-    while ( outPointer < 0 )
-        outPointer += d->maxDelay; // modulo maximum length
-    
-    d->outPoint = (uint32_t) outPointer;   // integer part
-    
-    
     return 0;
 }
 
@@ -509,7 +498,7 @@
                                               d->buff[idx],
                                               d->buff[(idx + 1) % d->maxDelay],
                                               d->buff[(idx + 2) % d->maxDelay],
-                                              d->alpha);
+                                              alpha);
     
     return samp;
     
binary files a/LEAF_JUCEPlugin/.DS_Store b/LEAF_JUCEPlugin/.DS_Store differ