shithub: leaf

Download patch

ref: 5f6600ecfb49a2d787173d4ed3ed662dd3c152a2
parent: a949752fa9be02fff8f446e7454e6c87163a7da9
author: Matthew Wang <mjw7@princeton.edu>
date: Thu May 7 12:21:09 EDT 2020

always let sampler update start and end if it's not playing

--- a/LEAF/Src/leaf-sampling.c
+++ b/LEAF/Src/leaf-sampling.c
@@ -230,10 +230,10 @@
 {
     _tSampler* p = *sp;
     
-    if (p->active == 0)         return 0.f;
-    
     attemptStartEndChange(sp);
     
+    if (p->active == 0)         return 0.f;
+    
     if ((p->inc == 0.0f) || (p->len < 2))
     {
         //        p->inCrossfade = 1;
@@ -573,9 +573,8 @@
     {
         return;
     }
-    // if (p->active)
+    if (p->active) // only bother with these checks if we're actually playing
     {
-        
         if (start > p->end)
         {
             tempflip = -1;
@@ -611,13 +610,12 @@
                 return;
             }
         }
+        if (tempflip != p->flip && p->flipStart < 0)
+        {
+            p->flipIdx = 0;
+        }
     }
     
-    if (tempflip != p->flip && p->flipStart < 0)
-    {
-        p->flipIdx = 0;
-    }
-    
     p->start = LEAF_clipInt(0, start, p->samp->recordedLength-1);
     handleStartEndChange(sp);
     p->targetstart = -1;
@@ -634,10 +632,8 @@
     {
         return;
     }
-    //if (p->active)
+    if (p->active) // only bother with these checks if we're actually playing
     {
-        
-        
         if (p->start > end)
         {
             tempflip = -1;
@@ -673,11 +669,10 @@
                 return;
             }
         }
-    }
-    
-    if (tempflip != p->flip && p->flipStart < 0)
-    {
-        p->flipIdx = 0;
+        if (tempflip != p->flip && p->flipStart < 0)
+        {
+            p->flipIdx = 0;
+        }
     }
     
     p->end = LEAF_clipInt(0, end, p->samp->recordedLength-1);