shithub: leaf

Download patch

ref: f257cc4a97aa54f74305cc2ff3115134a0294318
parent: c4b3d6bb03cfc9ba708c7ed3db9348961a9eb220
author: spiricom <jeff@snyderphonics.com>
date: Fri May 8 17:23:48 EDT 2020

fixed bug where tPoly object can return active voice number that is higher than max voices because the stack has stolen notes in it

--- a/LEAF/Src/leaf-midi.c
+++ b/LEAF/Src/leaf-midi.c
@@ -653,7 +653,7 @@
 int tPoly_getNumActiveVoices(tPoly* const polyh)
 {
     _tPoly* poly = *polyh;
-    return tStack_getSize(&poly->stack);
+    return LEAF_clip(0, tStack_getSize(&poly->stack), poly->numVoices);
 }
 
 float tPoly_getPitch(tPoly* const polyh, uint8_t voice)