From 2fd8b26abecc7fec4d3fd960643091ff4e0889f9 Mon Sep 17 00:00:00 2001 From: twobit Date: Thu, 5 Sep 2013 00:56:41 +0200 Subject: [PATCH] clear osc on note-off-event --- firmware/apps/mariotheme.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/firmware/apps/mariotheme.c b/firmware/apps/mariotheme.c index 3ea04dd..1567e6a 100644 --- a/firmware/apps/mariotheme.c +++ b/firmware/apps/mariotheme.c @@ -103,7 +103,7 @@ uint16_t freq[] = { }; -uint8_t order[] = { //0, 1, 2, 1, 2 +uint8_t order[] = { 0, 1, 2, 1, 2, 3, 4, 3, 5, @@ -124,10 +124,18 @@ static void mix_mario(void) { uint8_t p = order[row]; + uint8_t n; + + n = pgm_read_byte(&patterns[p][0][note]); + if (n == 0) osc[0] = 0; + osc[0] += freq[n]; + n = pgm_read_byte(&patterns[p][1][note]); + if (n == 0) osc[1] = 0; + osc[1] += freq[n]; + n = pgm_read_byte(&patterns[p][2][note]); + if (n == 0) osc[2] = 0; + osc[2] += freq[n]; - osc[0] += freq[pgm_read_byte(&patterns[p][0][note])]; - osc[1] += freq[pgm_read_byte(&patterns[p][1][note])]; - osc[2] += freq[pgm_read_byte(&patterns[p][2][note])]; uint8_t amp = (osc[0] > 0xf000) | (osc[1] > 0xf000) |