From c5f5dc54afee5669be6768c7c13afa598a7b0f81 Mon Sep 17 00:00:00 2001 From: Chris van Marle Date: Thu, 3 Jan 2019 08:07:53 +0100 Subject: [PATCH] Handle repeat cmd in miditones_scroll --- Makefile | 3 +++ miditones_scroll.c | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 089e9e3..8e1946d 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,8 @@ miditones: miditones.c gcc -O2 -Wall -o miditones miditones.c +miditones_scroll: miditones_scroll.c + gcc -O2 -Wall -o $@ $< + clean: rm -f miditones diff --git a/miditones_scroll.c b/miditones_scroll.c index 2062b43..4c77db5 100644 --- a/miditones_scroll.c +++ b/miditones_scroll.c @@ -106,6 +106,8 @@ * - Look for the optional self-describing file header. * 30 September 2016, L. Shustek, V1.6 * - Count the number of unnecessary "stop note" commands in the bytestream +* 3 January 2019, Chris van Marle, V1.7 +* - Handle repeat command (0xe0) */ #define VERSION "1.6" @@ -518,7 +520,7 @@ int main (int argc, char *argv[]) { timenow += delay; // advance time for (gen = 0; gen < MAX_TONEGENS; ++gen) gen_did_stopnote[gen] = false; - } else if (cmd != 0xf0) { /* a command */ + } else if (cmd != 0xf0 && cmd != 0xe0) { /* a command */ gen = cmd & 0x0f; if (gen > max_tonegen_found) max_tonegen_found = gen; @@ -556,7 +558,7 @@ int main (int argc, char *argv[]) { --bufptr; //don't do 0xf0 for code, because we don't want the trailing comma print_status (); // print final status if (codeoutput) { - fprintf (outfile, " 0xf0};\n"); + fprintf (outfile, " 0x%02x};\n", *(bufptr+1) & 0xf0); num_tonegens_used = countbits (tonegens_used); fprintf (outfile, "// This score contains %ld bytes, and %d tone generator%s used.\n", buflen, num_tonegens_used, num_tonegens_used == 1 ? " is" : "s are");