shithub: leaf

Download patch

ref: 24675fa3b52525e4383214a69cec0d5cae6d1e51
parent: 74dc8f99954d1a1543ebfa33c1a4e2f70b9fbb31
author: Matthew Wang <mjw7@princeton.edu>
date: Fri Sep 25 13:36:37 EDT 2020

mb osc sync out value fix

--- a/TestPlugin/Source/MyTest.cpp
+++ b/TestPlugin/Source/MyTest.cpp
@@ -55,9 +55,9 @@
     LEAF_init(&leaf, sampleRate, blockSize, memory, MSIZE, &getRandomFloat);
     
     tMBSaw_init(&bsaw, &leaf);
-    tMBSaw_setFreq(&bsaw, 100);
+    tMBSaw_setFreq(&bsaw, -100);
     tMBTriangle_init(&btri, &leaf);
-    tMBTriangle_setFreq(&btri, 200);
+    tMBTriangle_setFreq(&btri, -200);
     tMBPulse_init(&bpulse, &leaf);
     tMBPulse_setFreq(&bpulse, -500);
     
--- a/leaf/Src/leaf-oscillators.c
+++ b/leaf/Src/leaf-oscillators.c
@@ -1120,7 +1120,7 @@
         {
             if (p < 0.0f) {
                 p += 1.0f;
-                c->syncout = p / -w + 1e-20f;
+                c->syncout = (1.0f - p) / -w + 1e-20f;
                 place_step_dd(c->_f, j, 1.0f - p, -w, -1.0f);
                 k = 1;
                 x = -0.5f;
@@ -1162,7 +1162,7 @@
             }
             if (p < 0.0f) {
                 p += 1.0f;
-                c->syncout = p / -w + 1e-20f;
+                c->syncout = (1.0f - p) / -w + 1e-20f;
                 place_step_dd(c->_f, j, 1.0f - p, -w, -1.0f);
                 k = 1;
                 x = -0.5f;
@@ -1455,7 +1455,7 @@
         {
             if (p < 0.0f) {
                 p += 1.0f;
-                c->syncout = p / -w + 1e-20f;
+                c->syncout = (1.0f - p) / -w + 1e-20f;
                 x = 0.5f - (p - b) / b1;
                 place_slope_dd(c->_f, j, 1.0f - p, -w, 1.0f / b + 1.0f / b1);
                 k = 1;
@@ -1498,7 +1498,7 @@
             }
             if (p < 0.0f) {
                 p += 1.0f;
-                c->syncout = p / -w + 1e-20f;
+                c->syncout = (1.0f - p) / -w + 1e-20f;
                 x = 0.5f - (p - b) / b1;
                 place_slope_dd(c->_f, j, 1.0f - p, -w, 1.0f / b + 1.0f / b1);
                 k = 1;
@@ -1673,7 +1673,7 @@
         
     } else if (p < 0.0f) {
         p += 1.0f;
-        c->syncout = p / -w + 1e-20f;
+        c->syncout = (1.0f - p) / -w + 1e-20f;
         place_step_dd(c->_f, j, 1.0f - p, -w, -1.0f);
     }
     else {