shithub: leaf

Download patch

ref: 36ee16b1cc0d164245df413860b91718285498b6
parent: 53da637f80eaabb0a4d7c2044f16520b31a34f2f
author: mulshine <mulshine@princeton.edu>
date: Mon Jan 21 07:24:41 EST 2019

Updated C file for delay.

--- a/LEAF/Src/leaf-delay.c
+++ b/LEAF/Src/leaf-delay.c
@@ -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;