shithub: leaf

Download patch

ref: 1dfd63fc3f965b06401a54a9342628d92d348546
parent: a45c028fd591d15d011fff515a6c022c5cc62359
author: Davis Polito <davispolito1@gmail.com>
date: Tue May 24 11:29:02 EDT 2022

Fix Oscillators FM

--- a/leaf/Inc/leaf-oscillators.h
+++ b/leaf/Inc/leaf-oscillators.h
@@ -66,7 +66,7 @@
         tMempool mempool;
         // Underlying phasor
         uint32_t phase;
-        uint32_t inc;
+        int32_t inc;
 		float freq;
         float invSampleRateTimesTwoTo32;
         uint32_t mask;
--- a/leaf/Src/leaf-midi.c
+++ b/leaf/Src/leaf-midi.c
@@ -137,6 +137,7 @@
 // Remove noteVal. return 1 if removed, 0 if not
 int tStack_remove(tStack* const stack, uint16_t noteVal)
 {
+
     _tStack* ns = *stack;
     
     uint8_t k;
@@ -801,7 +802,7 @@
             //grab old notes off the stack if there are notes waiting to replace the free voice
             for (int j = 0; j < tStack_getSize(&poly->stack); ++j)
             {
-                noteToTest = tStack_get(&poly->stack, j);
+                noteToTest = tStack_get(&poly->stack, j); //note to check if it is waiting to be recovered
 
                 if (poly->notes[noteToTest][0] == -3) //if there is a stolen note waiting (marked inactive but on the stack)
                 {
@@ -809,6 +810,8 @@
                     poly->voices[voice][1] = poly->notes[noteToTest][1]; // set the velocity of the voice to be the velocity of that note
                     poly->voices[voice][2] = noteToTest;
                     poly->notes[noteToTest][0] = voice; //mark that it is no longer stolen and is now active
+                    //poly->notes[][0] = -1;
+                    break;
                 }
             }
         }