From 147729592cee2c0ab121b28fc4047f397e8a7a4f Mon Sep 17 00:00:00 2001 From: Oskar Sveinsen Date: Tue, 23 Nov 2021 14:30:23 +0100 Subject: [PATCH] fix the last bug, envelope not being copied correctly --- synth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/synth.c b/synth.c index 5dbc7e9..8203f13 100644 --- a/synth.c +++ b/synth.c @@ -3,7 +3,7 @@ static void set_envelope(EnvelopeStep *dst, int dstlen, const EnvelopeStep *src) { /* copy src to dst */ - while (dstlen-- > 0 && src->duration) *dst++ = *src++; + while (src->duration && dstlen-- > 0) *dst++ = *src++; /* pad remainder of dst with {0, 0} */ while (dstlen-- > 0) *dst++ = (EnvelopeStep){0, 0};