shithub: neindaw

Download patch

ref: 79305b636909d40a7275b5a6ac2b69d3abce12cb
parent: cb1381e41c056d1aca8eff9237ae4b7820b36015
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Tue Aug 24 06:03:14 EDT 2021

zero cross point on the rise

--- a/fs.c
+++ b/fs.c
@@ -113,6 +113,8 @@
 	respond(r, nil);
 }
 
+#define CROSS(a,b) (a <= 0.0f && a < b)
+
 static int
 auxreaddsp(Aux *a, float *b, int n)
 {
@@ -135,7 +137,7 @@
 					break;
 			}
 			/* find the cross point */
-			if (s->crossvoice && i > 0 && cross < 1 && b[i] <= 0.0f && b[i-1] > 0.0f) {
+			if (s->crossvoice && i > 0 && cross < 1 && CROSS(b[i-1], b[i])) {
 				cross = i;
 				break;
 			}
@@ -185,7 +187,7 @@
 		for (j = 0; j < n; j++) { /* FIXME this could be faster */
 			if (s->crossvoice && i+1 < s->nvoice && cross < 1 && j > 0) {
 				/* crossvoicing AND we have at least one more on top, see if we can shut *this* one up */
-				if (m[j] <= 0.0f && m[j-1] > 0.0f) {
+				if (CROSS(m[j-1], m[j])) {
 					cross = j;
 					level = 0.0f; /* shut up forever */
 					b += j;