aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorcbdev <cb@cbcdn.com>2019-03-30 14:34:20 +0100
committercbdev <cb@cbcdn.com>2019-03-30 14:34:20 +0100
commita2b0728027dd8961ef84220c8c8eaf8a81154c71 (patch)
treef0f3454aabe47676f58a4f4b0932dfdae22ef68c
parent56adfff2911ef548406afe8db2841729c957f291 (diff)
downloadmidimonster-a2b0728027dd8961ef84220c8c8eaf8a81154c71.tar.gz
midimonster-a2b0728027dd8961ef84220c8c8eaf8a81154c71.tar.bz2
midimonster-a2b0728027dd8961ef84220c8c8eaf8a81154c71.zip
Fix MIDI mapping syntax
-rw-r--r--README.md17
-rw-r--r--backends/midi.c35
-rw-r--r--configs/launchctl-sacn.cfg48
-rw-r--r--configs/midi-osc.cfg32
-rw-r--r--configs/osc-kbd.cfg24
-rw-r--r--configs/unifest-17.cfg288
6 files changed, 239 insertions, 205 deletions
diff --git a/README.md b/README.md
index 3f5606a..8dfcdd8 100644
--- a/README.md
+++ b/README.md
@@ -245,11 +245,19 @@ The MIDI backend supports multiple channel types
* `note` - Note On/Off messages
* `nrpn` - NRPNs (not yet implemented)
-A channel is specified using `<type><channel>.<index>`.
+A channel is specified using the syntax `channel<channel>.<type><index>`. The shorthand `ch` may be used instead
+of `channel`.
+The earlier syntax of `<type><channel>.<index>` is officially deprecated but still supported for compatability
+reasons. This support may be removed at some future time.
-Example mapping:
+Channels range from `0` to `15`. Each channel consists of 128 notes (numbered `0` through `127`) and 128 CC's
+(numbered likewise), a channel pressure control (also called 'channel aftertouch') and a pitch control.
+Each Note also has an additional pressure value associated with it.
+
+Example mappings:
```
-midi1.cc0.9 > midi2.note1.4
+midi1.ch0.note9 > midi2.channel1.cc4
+midi1.channel15.cc1 > midi1.channel0.note0
```
#### Known bugs / problems
@@ -259,7 +267,8 @@ a configuration option at a later time.
NRPNs are not yet fully implemented, though rudimentary support is in the codebase.
-The channel specification syntax is currently a bit clunky.
+To see which events your MIDI devices output, ALSA provides the `aseqdump` utility. You can
+list all incoming events using `aseqdump -p <portname>`.
### The `evdev` backend
diff --git a/backends/midi.c b/backends/midi.c
index d856ced..ad7f6fe 100644
--- a/backends/midi.c
+++ b/backends/midi.c
@@ -118,19 +118,30 @@ static channel* midi_channel(instance* instance, char* spec){
.label = 0
};
+ //support deprecated syntax for a transition period...
+ uint8_t old_syntax = 0;
char* channel;
- if(!strncmp(spec, "cc", 2)){
+ 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{
fprintf(stderr, "Unknown MIDI channel specification %s\n", spec);
@@ -138,19 +149,33 @@ static channel* midi_channel(instance* instance, char* spec){
}
ident.fields.channel = strtoul(channel, &channel, 10);
-
- //FIXME test this
- if(ident.fields.channel > 16){
+ if(ident.fields.channel > 15){
fprintf(stderr, "MIDI channel out of range in channel spec %s\n", spec);
return NULL;
}
if(*channel != '.'){
- fprintf(stderr, "Need MIDI channel specification of form channel.control, had %s\n", spec);
+ fprintf(stderr, "Need MIDI channel specification of form channel<X>.<control><Y>, had %s\n", spec);
return NULL;
}
+ //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;
+ }
+ }
+
ident.fields.control = strtoul(channel, NULL, 10);
if(ident.label){
diff --git a/configs/launchctl-sacn.cfg b/configs/launchctl-sacn.cfg
index 164b477..c2dec84 100644
--- a/configs/launchctl-sacn.cfg
+++ b/configs/launchctl-sacn.cfg
@@ -18,28 +18,28 @@ priority = 100
[map]
-lc.cc0.0 > out.1
-lc.cc0.1 > out.2
-lc.cc0.2 > out.3
-lc.cc0.3 > out.4
-lc.cc0.4 > out.5
-lc.cc0.5 > out.6
-lc.cc0.6 > out.7
-lc.cc0.7 > out.8
-lc.cc0.8 > out.9
-lc.cc0.9 > out.10
-lc.cc0.10 > out.11
-lc.cc0.11 > out.12
-lc.cc0.12 > out.13
-lc.cc0.13 > out.14
-lc.cc0.14 > out.15
-lc.cc0.15 > out.16
+lc.ch0.cc0 > out.1
+lc.ch0.cc1 > out.2
+lc.ch0.cc2 > out.3
+lc.ch0.cc3 > out.4
+lc.ch0.cc4 > out.5
+lc.ch0.cc5 > out.6
+lc.ch0.cc6 > out.7
+lc.ch0.cc7 > out.8
+lc.ch0.cc8 > out.9
+lc.ch0.cc9 > out.10
+lc.ch0.cc10 > out.11
+lc.ch0.cc11 > out.12
+lc.ch0.cc12 > out.13
+lc.ch0.cc13 > out.14
+lc.ch0.cc14 > out.15
+lc.ch0.cc15 > out.16
-lc.note0.0 > out.1
-lc.note0.1 > out.2
-lc.note0.2 > out.3
-lc.note0.3 > out.4
-lc.note0.4 > out.5
-lc.note0.5 > out.6
-lc.note0.6 > out.7
-lc.note0.7 > out.8
+lc.ch0.note0 > out.1
+lc.ch0.note1 > out.2
+lc.ch0.note2 > out.3
+lc.ch0.note3 > out.4
+lc.ch0.note4 > out.5
+lc.ch0.note5 > out.6
+lc.ch0.note6 > out.7
+lc.ch0.note7 > out.8
diff --git a/configs/midi-osc.cfg b/configs/midi-osc.cfg
index 215daa9..755077c 100644
--- a/configs/midi-osc.cfg
+++ b/configs/midi-osc.cfg
@@ -33,20 +33,20 @@ write = BCF
[map]
-bcf.cc0.81 <> touch./fader1
-bcf.cc0.82 <> touch./fader2
-bcf.cc0.83 <> touch./fader3
-bcf.cc0.84 <> touch./fader4
-bcf.cc0.85 <> touch./fader5
-bcf.cc0.86 <> touch./fader6
-bcf.cc0.87 <> touch./fader7
-bcf.cc0.88 <> touch./fader8
+bcf.ch0.cc81 <> touch./fader1
+bcf.ch0.cc82 <> touch./fader2
+bcf.ch0.cc83 <> touch./fader3
+bcf.ch0.cc84 <> touch./fader4
+bcf.ch0.cc85 <> touch./fader5
+bcf.ch0.cc86 <> touch./fader6
+bcf.ch0.cc87 <> touch./fader7
+bcf.ch0.cc88 <> touch./fader8
-bcf.cc0.81 <> touch./multifader1/1
-bcf.cc0.82 <> touch./multifader1/2
-bcf.cc0.83 <> touch./multifader1/3
-bcf.cc0.84 <> touch./multifader1/4
-bcf.cc0.85 <> touch./multifader1/5
-bcf.cc0.86 <> touch./multifader1/6
-bcf.cc0.87 <> touch./multifader1/7
-bcf.cc0.88 <> touch./multifader1/8
+bcf.ch0.cc81 <> touch./multifader1/1
+bcf.ch0.cc82 <> touch./multifader1/2
+bcf.ch0.cc83 <> touch./multifader1/3
+bcf.ch0.cc84 <> touch./multifader1/4
+bcf.ch0.cc85 <> touch./multifader1/5
+bcf.ch0.cc86 <> touch./multifader1/6
+bcf.ch0.cc87 <> touch./multifader1/7
+bcf.ch0.cc88 <> touch./multifader1/8
diff --git a/configs/osc-kbd.cfg b/configs/osc-kbd.cfg
index 0abd131..eb80378 100644
--- a/configs/osc-kbd.cfg
+++ b/configs/osc-kbd.cfg
@@ -11,15 +11,15 @@ bind = * 8000
dest = learn@8001
[map]
-pad./1/push1 > out.note0.60
-pad./1/push2 > out.note0.61
-pad./1/push3 > out.note0.62
-pad./1/push4 > out.note0.63
-pad./1/push5 > out.note0.64
-pad./1/push6 > out.note0.65
-pad./1/push7 > out.note0.66
-pad./1/push8 > out.note0.67
-pad./1/push9 > out.note0.68
-pad./1/push10 > out.note0.69
-pad./1/push11 > out.note0.70
-pad./1/push12 > out.note0.71
+pad./1/push1 > out.ch0.note60
+pad./1/push2 > out.ch0.note61
+pad./1/push3 > out.ch0.note62
+pad./1/push4 > out.ch0.note63
+pad./1/push5 > out.ch0.note64
+pad./1/push6 > out.ch0.note65
+pad./1/push7 > out.ch0.note66
+pad./1/push8 > out.ch0.note67
+pad./1/push9 > out.ch0.note68
+pad./1/push10 > out.ch0.note69
+pad./1/push11 > out.ch0.note70
+pad./1/push12 > out.ch0.note71
diff --git a/configs/unifest-17.cfg b/configs/unifest-17.cfg
index 1fab484..47e9ec2 100644
--- a/configs/unifest-17.cfg
+++ b/configs/unifest-17.cfg
@@ -40,156 +40,156 @@ read = 36:1
[map]
; ArtNet
-claudius.1 < lc1.cc0.1
-claudius.2 < lc1.cc0.2
-claudius.3 < lc1.cc0.3
-claudius.4 < lc1.cc0.4
-claudius.5 < lc1.cc0.5
-claudius.6 < lc1.cc0.6
-claudius.7 < lc1.cc0.7
-claudius.8 < lc1.cc0.8
-claudius.9 < lc1.cc0.9
-claudius.10 < lc1.cc0.10
-claudius.11 < lc1.cc0.11
-claudius.12 < lc1.cc0.12
-claudius.13 < lc1.cc0.13
-claudius.14 < lc1.cc0.14
-claudius.15 < lc1.cc0.15
-claudius.16 < lc1.cc0.16
+claudius.1 < lc1.ch0.cc1
+claudius.2 < lc1.ch0.cc2
+claudius.3 < lc1.ch0.cc3
+claudius.4 < lc1.ch0.cc4
+claudius.5 < lc1.ch0.cc5
+claudius.6 < lc1.ch0.cc6
+claudius.7 < lc1.ch0.cc7
+claudius.8 < lc1.ch0.cc8
+claudius.9 < lc1.ch0.cc9
+claudius.10 < lc1.ch0.cc10
+claudius.11 < lc1.ch0.cc11
+claudius.12 < lc1.ch0.cc12
+claudius.13 < lc1.ch0.cc13
+claudius.14 < lc1.ch0.cc14
+claudius.15 < lc1.ch0.cc15
+claudius.16 < lc1.ch0.cc16
; BCF Fader
-out.note0.0 < bcf1.cc0.81
-out.note0.1 < bcf1.cc0.82
-out.note0.2 < bcf1.cc0.83
-out.note0.3 < bcf1.cc0.84
-out.note0.4 < bcf1.cc0.85
-out.note0.5 < bcf1.cc0.86
-out.note0.6 < bcf1.cc0.87
-out.note0.7 < bcf1.cc0.88
-out.note0.8 < bcf2.cc0.81
-out.note0.9 < bcf2.cc0.82
-out.note0.10 < bcf2.cc0.83
-out.note0.11 < bcf2.cc0.84
-out.note0.12 < bcf2.cc0.85
-out.note0.13 < bcf2.cc0.86
-out.note0.14 < bcf2.cc0.87
-out.note0.15 < bcf2.cc0.88
+out.ch0.ch0.note< bcf1.ch0.cc81
+out.ch0.note1 < bcf1.ch0.cc82
+out.ch0.note2 < bcf1.ch0.cc83
+out.ch0.note3 < bcf1.ch0.cc84
+out.ch0.note4 < bcf1.ch0.cc85
+out.ch0.note5 < bcf1.ch0.cc86
+out.ch0.note6 < bcf1.ch0.cc87
+out.ch0.note7 < bcf1.ch0.cc88
+out.ch0.note8 < bcf2.ch0.cc81
+out.ch0.note9 < bcf2.ch0.cc82
+out.ch0.note10 < bcf2.ch0.cc83
+out.ch0.note11 < bcf2.ch0.cc84
+out.ch0.note12 < bcf2.ch0.cc85
+out.ch0.note13 < bcf2.ch0.cc86
+out.ch0.note14 < bcf2.ch0.cc87
+out.ch0.note15 < bcf2.ch0.cc88
; LC Rotary
-out.note0.16 < lc1.cc0.1
-out.note0.17 < lc1.cc0.2
-out.note0.18 < lc1.cc0.3
-out.note0.19 < lc1.cc0.4
-out.note0.20 < lc1.cc0.5
-out.note0.21 < lc1.cc0.6
-out.note0.22 < lc1.cc0.7
-out.note0.23 < lc1.cc0.8
-out.note0.24 < lc1.cc0.9
-out.note0.25 < lc1.cc0.10
-out.note0.26 < lc1.cc0.11
-out.note0.27 < lc1.cc0.12
-out.note0.28 < lc1.cc0.13
-out.note0.29 < lc1.cc0.14
-out.note0.30 < lc1.cc0.15
-out.note0.31 < lc1.cc0.16
-out.note0.32 < lc2.cc0.1
-out.note0.33 < lc2.cc0.2
-out.note0.34 < lc2.cc0.3
-out.note0.35 < lc2.cc0.4
-out.note0.36 < lc2.cc0.5
-out.note0.37 < lc2.cc0.6
-out.note0.38 < lc2.cc0.7
-out.note0.39 < lc2.cc0.8
-out.note0.40 < lc2.cc0.9
-out.note0.41 < lc2.cc0.10
-out.note0.42 < lc2.cc0.11
-out.note0.43 < lc2.cc0.12
-out.note0.44 < lc2.cc0.13
-out.note0.45 < lc2.cc0.14
-out.note0.46 < lc2.cc0.15
-out.note0.47 < lc2.cc0.16
+out.ch0.note16 < lc1.ch0.cc1
+out.ch0.note17 < lc1.ch0.cc2
+out.ch0.note18 < lc1.ch0.cc3
+out.ch0.note19 < lc1.ch0.cc4
+out.ch0.note20 < lc1.ch0.cc5
+out.ch0.note21 < lc1.ch0.cc6
+out.ch0.note22 < lc1.ch0.cc7
+out.ch0.note23 < lc1.ch0.cc8
+out.ch0.note24 < lc1.ch0.cc9
+out.ch0.note25 < lc1.ch0.cc10
+out.ch0.note26 < lc1.ch0.cc11
+out.ch0.note27 < lc1.ch0.cc12
+out.ch0.note28 < lc1.ch0.cc13
+out.ch0.note29 < lc1.ch0.cc14
+out.ch0.note30 < lc1.ch0.cc15
+out.ch0.note31 < lc1.ch0.cc16
+out.ch0.note32 < lc2.ch0.cc1
+out.ch0.note33 < lc2.ch0.cc2
+out.ch0.note34 < lc2.ch0.cc3
+out.ch0.note35 < lc2.ch0.cc4
+out.ch0.note36 < lc2.ch0.cc5
+out.ch0.note37 < lc2.ch0.cc6
+out.ch0.note38 < lc2.ch0.cc7
+out.ch0.note39 < lc2.ch0.cc8
+out.ch0.note40 < lc2.ch0.cc9
+out.ch0.note41 < lc2.ch0.cc10
+out.ch0.note42 < lc2.ch0.cc11
+out.ch0.note43 < lc2.ch0.cc12
+out.ch0.note44 < lc2.ch0.cc13
+out.ch0.note45 < lc2.ch0.cc14
+out.ch0.note46 < lc2.ch0.cc15
+out.ch0.note47 < lc2.ch0.cc16
; LC Button
-out.note0.48 < lc1.note0.0
-out.note0.49 < lc1.note0.1
-out.note0.50 < lc1.note0.2
-out.note0.51 < lc1.note0.3
-out.note0.52 < lc1.note0.4
-out.note0.53 < lc1.note0.5
-out.note0.54 < lc1.note0.6
-out.note0.55 < lc1.note0.7
+out.ch0.note48 < lc1.ch0.note0
+out.ch0.note49 < lc1.ch0.note1
+out.ch0.note50 < lc1.ch0.note2
+out.ch0.note51 < lc1.ch0.note3
+out.ch0.note52 < lc1.ch0.note4
+out.ch0.note53 < lc1.ch0.note5
+out.ch0.note54 < lc1.ch0.note6
+out.ch0.note55 < lc1.ch0.note7
-out.note0.56 < lc2.note0.0
-out.note0.57 < lc2.note0.1
-out.note0.58 < lc2.note0.2
-out.note0.59 < lc2.note0.3
-out.note0.60 < lc2.note0.4
-out.note0.61 < lc2.note0.5
-out.note0.62 < lc2.note0.6
-out.note0.63 < lc2.note0.7
+out.ch0.note56 < lc2.ch0.note0
+out.ch0.note57 < lc2.ch0.note1
+out.ch0.note58 < lc2.ch0.note2
+out.ch0.note59 < lc2.ch0.note3
+out.ch0.note60 < lc2.ch0.note4
+out.ch0.note61 < lc2.ch0.note5
+out.ch0.note62 < lc2.ch0.note6
+out.ch0.note63 < lc2.ch0.note7
; Launchpad
-out.note0.64 < pad.note0.0
-out.note0.65 < pad.note0.1
-out.note0.66 < pad.note0.2
-out.note0.67 < pad.note0.3
-out.note0.68 < pad.note0.4
-out.note0.69 < pad.note0.5
-out.note0.70 < pad.note0.6
-out.note0.71 < pad.note0.7
-out.note0.72 < pad.note0.16
-out.note0.73 < pad.note0.17
-out.note0.74 < pad.note0.18
-out.note0.75 < pad.note0.19
-out.note0.76 < pad.note0.20
-out.note0.77 < pad.note0.21
-out.note0.78 < pad.note0.22
-out.note0.79 < pad.note0.23
-out.note0.80 < pad.note0.32
-out.note0.81 < pad.note0.33
-out.note0.82 < pad.note0.34
-out.note0.83 < pad.note0.35
-out.note0.84 < pad.note0.36
-out.note0.85 < pad.note0.37
-out.note0.86 < pad.note0.38
-out.note0.87 < pad.note0.39
-out.note0.88 < pad.note0.48
-out.note0.89 < pad.note0.49
-out.note0.90 < pad.note0.50
-out.note0.91 < pad.note0.51
-out.note0.92 < pad.note0.52
-out.note0.93 < pad.note0.53
-out.note0.94 < pad.note0.54
-out.note0.95 < pad.note0.55
-out.note0.96 < pad.note0.64
-out.note0.97 < pad.note0.65
-out.note0.98 < pad.note0.66
-out.note0.99 < pad.note0.67
-out.note0.100 < pad.note0.68
-out.note0.101 < pad.note0.69
-out.note0.102 < pad.note0.70
-out.note0.103 < pad.note0.71
-out.note0.104 < pad.note0.80
-out.note0.105 < pad.note0.81
-out.note0.106 < pad.note0.82
-out.note0.107 < pad.note0.83
-out.note0.108 < pad.note0.84
-out.note0.109 < pad.note0.85
-out.note0.110 < pad.note0.86
-out.note0.111 < pad.note0.87
-out.note0.112 < pad.note0.96
-out.note0.113 < pad.note0.97
-out.note0.114 < pad.note0.98
-out.note0.115 < pad.note0.99
-out.note0.116 < pad.note0.100
-out.note0.117 < pad.note0.101
-out.note0.118 < pad.note0.102
-out.note0.119 < pad.note0.103
-out.note0.120 < pad.note0.112
-out.note0.121 < pad.note0.113
-out.note0.122 < pad.note0.114
-out.note0.123 < pad.note0.115
-out.note0.124 < pad.note0.116
-out.note0.125 < pad.note0.117
-out.note0.126 < pad.note0.118
-out.note0.127 < pad.note0.119
+out.ch0.note64 < pad.ch0.note0
+out.ch0.note65 < pad.ch0.note1
+out.ch0.note66 < pad.ch0.note2
+out.ch0.note67 < pad.ch0.note3
+out.ch0.note68 < pad.ch0.note4
+out.ch0.note69 < pad.ch0.note5
+out.ch0.note70 < pad.ch0.note6
+out.ch0.note71 < pad.ch0.note7
+out.ch0.note72 < pad.ch0.note16
+out.ch0.note73 < pad.ch0.note17
+out.ch0.note74 < pad.ch0.note18
+out.ch0.note75 < pad.ch0.note19
+out.ch0.note76 < pad.ch0.note20
+out.ch0.note77 < pad.ch0.note21
+out.ch0.note78 < pad.ch0.note22
+out.ch0.note79 < pad.ch0.note23
+out.ch0.note80 < pad.ch0.note32
+out.ch0.note81 < pad.ch0.note33
+out.ch0.note82 < pad.ch0.note34
+out.ch0.note83 < pad.ch0.note35
+out.ch0.note84 < pad.ch0.note36
+out.ch0.note85 < pad.ch0.note37
+out.ch0.note86 < pad.ch0.note38
+out.ch0.note87 < pad.ch0.note39
+out.ch0.note88 < pad.ch0.note48
+out.ch0.note89 < pad.ch0.note49
+out.ch0.note90 < pad.ch0.note50
+out.ch0.note91 < pad.ch0.note51
+out.ch0.note92 < pad.ch0.note52
+out.ch0.note93 < pad.ch0.note53
+out.ch0.note94 < pad.ch0.note54
+out.ch0.note95 < pad.ch0.note55
+out.ch0.note96 < pad.ch0.note64
+out.ch0.note97 < pad.ch0.note65
+out.ch0.note98 < pad.ch0.note66
+out.ch0.note99 < pad.ch0.note67
+out.ch0.note100 < pad.ch0.note68
+out.ch0.note101 < pad.ch0.note69
+out.ch0.note102 < pad.ch0.note70
+out.ch0.note103 < pad.ch0.note71
+out.ch0.note104 < pad.ch0.note80
+out.ch0.note105 < pad.ch0.note81
+out.ch0.note106 < pad.ch0.note82
+out.ch0.note107 < pad.ch0.note83
+out.ch0.note108 < pad.ch0.note84
+out.ch0.note109 < pad.ch0.note85
+out.ch0.note110 < pad.ch0.note86
+out.ch0.note111 < pad.ch0.note87
+out.ch0.note112 < pad.ch0.note96
+out.ch0.note113 < pad.ch0.note97
+out.ch0.note114 < pad.ch0.note98
+out.ch0.note115 < pad.ch0.note99
+out.ch0.note116 < pad.ch0.note100
+out.ch0.note117 < pad.ch0.note101
+out.ch0.note118 < pad.ch0.note102
+out.ch0.note119 < pad.ch0.note103
+out.ch0.note120 < pad.ch0.note112
+out.ch0.note121 < pad.ch0.note113
+out.ch0.note122 < pad.ch0.note114
+out.ch0.note123 < pad.ch0.note115
+out.ch0.note124 < pad.ch0.note116
+out.ch0.note125 < pad.ch0.note117
+out.ch0.note126 < pad.ch0.note118
+out.ch0.note127 < pad.ch0.note119