aboutsummaryrefslogtreecommitdiffhomepage
path: root/backends/midi.c
diff options
context:
space:
mode:
authorcbdev <cb@cbcdn.com>2020-03-09 21:12:48 +0100
committercbdev <cb@cbcdn.com>2020-03-09 21:12:48 +0100
commit878988c9d5a8e106af16d55702176a0ce8f0ae71 (patch)
tree0b891199d003a9f205279446e0ab9c4e9bbea322 /backends/midi.c
parent62afd5d7fb2c6d764d0756136041d0162cb022db (diff)
downloadmidimonster-878988c9d5a8e106af16d55702176a0ce8f0ae71.tar.gz
midimonster-878988c9d5a8e106af16d55702176a0ce8f0ae71.tar.bz2
midimonster-878988c9d5a8e106af16d55702176a0ce8f0ae71.zip
Remove deprecated MIDI channel syntax
Diffstat (limited to 'backends/midi.c')
-rw-r--r--backends/midi.c79
1 files changed, 30 insertions, 49 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);