diff options
author | cbdev <cb@cbcdn.com> | 2020-03-09 21:12:48 +0100 |
---|---|---|
committer | cbdev <cb@cbcdn.com> | 2020-03-09 21:12:48 +0100 |
commit | 878988c9d5a8e106af16d55702176a0ce8f0ae71 (patch) | |
tree | 0b891199d003a9f205279446e0ab9c4e9bbea322 | |
parent | 62afd5d7fb2c6d764d0756136041d0162cb022db (diff) | |
download | midimonster-878988c9d5a8e106af16d55702176a0ce8f0ae71.tar.gz midimonster-878988c9d5a8e106af16d55702176a0ce8f0ae71.tar.bz2 midimonster-878988c9d5a8e106af16d55702176a0ce8f0ae71.zip |
Remove deprecated MIDI channel syntax
-rw-r--r-- | backends/midi.c | 79 | ||||
-rw-r--r-- | backends/midi.md | 2 |
2 files changed, 30 insertions, 51 deletions
diff --git a/backends/midi.c b/backends/midi.c index f73ebb4..f378f1e 100644 --- a/backends/midi.c +++ b/backends/midi.c @@ -111,39 +111,22 @@ static channel* midi_channel(instance* inst, char* spec, uint8_t flags){ .label = 0 }; - //support deprecated syntax for a transition period... - uint8_t old_syntax = 0; - char* channel; - + char* channel = NULL; if(!strncmp(spec, "ch", 2)){ channel = spec + 2; if(!strncmp(spec, "channel", 7)){ channel = spec + 7; } } - else if(!strncmp(spec, "cc", 2)){ - ident.fields.type = cc; - channel = spec + 2; - old_syntax = 1; - } - else if(!strncmp(spec, "note", 4)){ - ident.fields.type = note; - channel = spec + 4; - old_syntax = 1; - } - else if(!strncmp(spec, "nrpn", 4)){ - ident.fields.type = nrpn; - channel = spec + 4; - old_syntax = 1; - } - else{ - LOGPF("Unknown control type in %s", spec); + + if(!channel){ + LOGPF("Invalid channel specification %s", spec); return NULL; } ident.fields.channel = strtoul(channel, &channel, 10); if(ident.fields.channel > 15){ - LOGPF("Channel out of range in spec %s", spec); + LOGPF("MIDI channel out of range in spec %s", spec); return NULL; } @@ -154,33 +137,31 @@ static channel* midi_channel(instance* inst, char* spec, uint8_t flags){ //skip the period channel++; - if(!old_syntax){ - if(!strncmp(channel, "cc", 2)){ - ident.fields.type = cc; - channel += 2; - } - else if(!strncmp(channel, "note", 4)){ - ident.fields.type = note; - channel += 4; - } - else if(!strncmp(channel, "nrpn", 4)){ - ident.fields.type = nrpn; - channel += 4; - } - else if(!strncmp(channel, "pressure", 8)){ - ident.fields.type = pressure; - channel += 8; - } - else if(!strncmp(channel, "pitch", 5)){ - ident.fields.type = pitchbend; - } - else if(!strncmp(channel, "aftertouch", 10)){ - ident.fields.type = aftertouch; - } - else{ - LOGPF("Unknown control type in %s", spec); - return NULL; - } + if(!strncmp(channel, "cc", 2)){ + ident.fields.type = cc; + channel += 2; + } + else if(!strncmp(channel, "note", 4)){ + ident.fields.type = note; + channel += 4; + } + else if(!strncmp(channel, "nrpn", 4)){ + ident.fields.type = nrpn; + channel += 4; + } + else if(!strncmp(channel, "pressure", 8)){ + ident.fields.type = pressure; + channel += 8; + } + else if(!strncmp(channel, "pitch", 5)){ + ident.fields.type = pitchbend; + } + else if(!strncmp(channel, "aftertouch", 10)){ + ident.fields.type = aftertouch; + } + else{ + LOGPF("Unknown control type in %s", spec); + return NULL; } ident.fields.control = strtoul(channel, NULL, 10); diff --git a/backends/midi.md b/backends/midi.md index 108860e..8188444 100644 --- a/backends/midi.md +++ b/backends/midi.md @@ -34,8 +34,6 @@ The MIDI backend supports mapping different MIDI events to MIDIMonster channels. A MIDIMonster channel is specified using the syntax `channel<channel>.<type><index>`. The shorthand `ch` may be used instead of the word `channel` (Note that `channel` here refers to the MIDI channel number). -The earlier syntax of `<type><channel>.<index>` is officially deprecated but still supported for compatibility -reasons. This support may be removed at some future time. The `pitch` and `aftertouch` events are channel-wide, thus they can be specified as `channel<channel>.<type>`. |