From 2b2d11ed3c40f76b9414c3907b70a09c74d22eb1 Mon Sep 17 00:00:00 2001 From: Albert Graef Date: Sun, 12 Aug 2018 09:01:54 +0200 Subject: [PATCH] Rework the MIDI_OCTAVE directive so that the octave offset can also be given in the next token. --- example.midizaprc | 4 ++-- readconfig.c | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/example.midizaprc b/example.midizaprc index 132bae6..2bf0126 100644 --- a/example.midizaprc +++ b/example.midizaprc @@ -41,8 +41,8 @@ # Two of the most common alternatives are listed below (uncomment one of # the following lines to use these): -#MIDI_OCTAVE-1 # ASA (Acoustical Society of America; middle C is C4) -#MIDI_OCTAVE-2 # alternate MIDI (various manufacturers; middle C is C3) +#MIDI_OCTAVE -1 # ASA (Acoustical Society of America; middle C is C4) +#MIDI_OCTAVE -2 # alternate MIDI (various manufacturers; middle C is C3) # The program distinguishes between messages on different MIDI # channels. By default, messages are assumed to be on MIDI channel 1, diff --git a/readconfig.c b/readconfig.c index 2c430ab..312b8ae 100644 --- a/readconfig.c +++ b/readconfig.c @@ -1214,6 +1214,9 @@ read_config_file(void) if (!strncmp(tok, "MIDI_OCTAVE", 11)) { char *a = tok+11; int k, n; + if (!*a) + // look for the offset in the next token + a = token(NULL, &delim); if (sscanf(a, "%d%n", &k, &n) == 1 && !a[n]) { midi_octave = k; } else {