shithub: leaf

Download patch

ref: f98d24f939182df6a21177b8dde5937d160c8996
parent: ffde7bf885e8a4dbe08b470c82344e16805b0022
author: spiricom <jeff@snyderphonics.com>
date: Thu May 7 14:47:06 EDT 2020

sampling bug fix

binary files a/LEAF/.DS_Store b/LEAF/.DS_Store differ
--- a/LEAF/Src/leaf-sampling.c
+++ b/LEAF/Src/leaf-sampling.c
@@ -299,6 +299,9 @@
     //    if (fadeRightEnd >= length) fadeRightEnd = length - 1;
     uint32_t fadeRightStart = fadeRightEnd - cfxlen;
     
+
+
+
     if (p->mode == PlayLoop)
     {
         
@@ -395,6 +398,11 @@
         }
     }
     
+
+
+    attemptStartEndChange(sp);
+
+
     if (p->mode == PlayLoop)
     {
         if((int)p->idx < start)
@@ -569,10 +577,12 @@
     _tSampler* p = *sp;
     
     int tempflip;
+    /*
     if (start == p->end)
     {
         return;
     }
+    */
     if (p->active) // only bother with these checks if we're actually playing
     {
         if (start > p->end)
@@ -599,6 +609,11 @@
             if (start > p->idx)// start given is after current index or we're in a crossfade
             {
                 p->targetstart = start;
+                float tempLen = fabs(p->end - start) * 0.25f;
+                if (cfxlen > tempLen)
+                {
+                    p->cfxlen = tempLen;
+                }
                 return;
             }
         }
@@ -607,6 +622,11 @@
             if (start < p->idx)// start given is before current index or we're in a crossfade
             {
                 p->targetstart = start;
+                float tempLen = fabs(p->end - start) * 0.25f;
+                if (cfxlen > tempLen)
+                {
+                    p->cfxlen = tempLen;
+                }
                 return;
             }
         }
@@ -628,10 +648,12 @@
     
     int tempflip;
     
+    /*
     if (end == p->start)
     {
         return;
     }
+    */
     if (p->active) // only bother with these checks if we're actually playing
     {
         if (p->start > end)
@@ -658,6 +680,11 @@
             if (end < p->idx) // end given is before current index or we're in a crossfade
             {
                 p->targetend = end;
+                float tempLen = fabs(end - p->start) * 0.25f;
+                if (cfxlen > tempLen)
+                {
+                    p->cfxlen = tempLen;
+                }
                 return;
             }
         }
@@ -666,6 +693,11 @@
             if (end > p->idx) // end given is after current index or we're in a crossfade
             {
                 p->targetend = end;
+                float tempLen = fabs(end - p->start) * 0.25f;
+                if (cfxlen > tempLen)
+                {
+                    p->cfxlen = tempLen;
+                }
                 return;
             }
         }