From 4ebcda3a1b0d90c44e91a5dfe455ad59fe694cbe Mon Sep 17 00:00:00 2001 From: cbdev Date: Mon, 9 Mar 2020 21:31:54 +0100 Subject: Update README and example config --- configs/osc-artnet.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'configs') diff --git a/configs/osc-artnet.cfg b/configs/osc-artnet.cfg index ab1d767..35b2111 100644 --- a/configs/osc-artnet.cfg +++ b/configs/osc-artnet.cfg @@ -5,7 +5,7 @@ bind = 0.0.0.0 [osc touch] -bind = * 8000 +bind = 0.0.0.0 8000 dest = learn@8001 [artnet out] -- cgit v1.2.3 From daf9ac5b883cf981a163654d58932bfbdce619d9 Mon Sep 17 00:00:00 2001 From: cbdev Date: Tue, 17 Mar 2020 23:58:06 +0100 Subject: Output routing info to log --- configs/launchctl-sacn.cfg | 2 +- midimonster.c | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'configs') diff --git a/configs/launchctl-sacn.cfg b/configs/launchctl-sacn.cfg index dedfc0f..10a736a 100644 --- a/configs/launchctl-sacn.cfg +++ b/configs/launchctl-sacn.cfg @@ -7,7 +7,7 @@ name = MIDIMonster [backend sacn] -bind = 0.0.0.0 +bind = 0.0.0.0 5568 local [midi lc] read = Launch Control diff --git a/midimonster.c b/midimonster.c index 1691671..5109eab 100644 --- a/midimonster.c +++ b/midimonster.c @@ -456,6 +456,7 @@ static int core_loop(){ int main(int argc, char** argv){ int rv = EXIT_FAILURE; char* cfg_file = DEFAULT_CFG; + size_t u, n = 0, max = 0; //parse commandline arguments if(args_parse(argc, argv, &cfg_file)){ @@ -494,6 +495,14 @@ int main(int argc, char** argv){ signal(SIGINT, signal_handler); + //count and report mappings + for(u = 0; u < sizeof(routing.map) / sizeof(routing.map[0]); u++){ + n += routing.entries[u]; + max = max(max, routing.entries[u]); + } + LOGPF("Routing %" PRIsize_t " sources, largest bucket has %" PRIsize_t " entries", + n, max); + if(!fds){ fprintf(stderr, "No descriptors registered for multiplexing\n"); } -- cgit v1.2.3 From ee086b47e5171698ed9c221e704120522f6abb73 Mon Sep 17 00:00:00 2001 From: cbdev Date: Sat, 25 Apr 2020 00:23:57 +0200 Subject: Add rtpmidi to README, add example config --- README.md | 3 +++ backends/rtpmidi.md | 4 ++-- configs/print.lua | 5 +++++ configs/rtpmidi.cfg | 22 ++++++++++++++++++++++ 4 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 configs/print.lua create mode 100644 configs/rtpmidi.cfg (limited to 'configs') diff --git a/README.md b/README.md index a7ca212..2eda183 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ Currently, the MIDIMonster supports the following protocols: | ArtNet | Linux, Windows, OSX | Version 4 | [`artnet`](backends/artnet.md) | | Streaming ACN (sACN / E1.31) | Linux, Windows, OSX | | [`sacn`](backends/sacn.md) | | OpenSoundControl (OSC) | Linux, Windows, OSX | | [`osc`](backends/osc.md) | +| RTP-MIDI | Linux, Windows, OSX | AppleMIDI sessions supported | [`rtpmidi`](backends/rtpmidi.md) | | OpenPixelControl | Linux, Windows, OSX | 8 Bit & 16 Bit modes | [`openpixelcontrol`](backends/openpixelcontrol.md) | | evdev input devices | Linux | Virtual output supported | [`evdev`](backends/evdev.md) | | Open Lighting Architecture | Linux, OSX | | [`ola`](backends/ola.md) | @@ -36,6 +37,7 @@ one protocol into channel(s) on any other (or the same) supported protocol, for * Use an OSC app as a simple lighting controller via ArtNet or sACN * Visualize ArtNet data using OSC tools * Control lighting fixtures or DAWs using gamepad controllers, trackballs, etc ([Example configuration](configs/evdev.cfg)) +* Connect a device speaking RTP MIDI (for example, an iPad) to your computer or lighting console ([Example configuration](configs/rtpmidi.cfg)) * Play games, type, or control your mouse using MIDI controllers ([Example configuration](configs/midi-mouse.cfg)) If you encounter a bug or suspect a problem with a protocol implementation, please @@ -145,6 +147,7 @@ special information. These documentation files are located in the `backends/` di * [`winmidi` backend documentation](backends/winmidi.md) * [`artnet` backend documentation](backends/artnet.md) * [`sacn` backend documentation](backends/sacn.md) +* [`rtpmidi` backend documentation](backends/rtpmidi.md) * [`evdev` backend documentation](backends/evdev.md) * [`loopback` backend documentation](backends/loopback.md) * [`ola` backend documentation](backends/ola.md) diff --git a/backends/rtpmidi.md b/backends/rtpmidi.md index 13fd1f6..82548bf 100644 --- a/backends/rtpmidi.md +++ b/backends/rtpmidi.md @@ -27,7 +27,7 @@ stream, which may lead to inconsistencies during playback. |-----------------------|-----------------------|-----------------------|-----------------------| | `detect` | `on` | `off` | Output channel specifications for any events coming in on configured instances to help with configuration. | | `mdns-name` | `computer1` | none | mDNS hostname to announce (`.local`). Apple-mode instances will be announced via mDNS if set. | -| `mdns-interface` | `wlan0` | none | Limit addresses announced via mDNS to this interface. On Windows, this is prefix-matched against the user-editable "friendly" interface name. | +| `mdns-interface` | `wlan0` | none | Limit addresses announced via mDNS to this interface. On Windows, this is prefix-matched against the user-editable "friendly" interface name. If this name matches an interface exactly, discovery uses exactly this device. | #### Instance configuration @@ -84,7 +84,7 @@ rmidi1.ch0.pitch > rmidi2.ch1.pitch #### Known bugs / problems -This backend is currently still a work in progress, and is not mentioned on the main README yet for that reason. +This backend has been in development for a long time due to its complexity. There may still be bugs hidden in there. Critical feedback and tests across multiple devices are very welcome. The mDNS and DNS-SD implementations in this backend are extremely terse, to the point of violating the diff --git a/configs/print.lua b/configs/print.lua new file mode 100644 index 0000000..c6391d3 --- /dev/null +++ b/configs/print.lua @@ -0,0 +1,5 @@ +-- This function prints the name of the channel it handles and it's value +-- It can be used for a simple debug output with the `default-handler` configuration option +function printchannel(value) + print(input_channel() .. " @ " .. value) +end diff --git a/configs/rtpmidi.cfg b/configs/rtpmidi.cfg new file mode 100644 index 0000000..4128274 --- /dev/null +++ b/configs/rtpmidi.cfg @@ -0,0 +1,22 @@ +; Simple RTP MIDI example configuration + +[backend rtpmidi] +; This causes the backend itself to output channel values +detect = on +; When connecting multiple MIDIMonster hosts via RTP MIDI, set this to something else on each computer +mdns-name = midimonster-host + +[rtpmidi rtp] +mode = apple +; Invite everyone we see on the network +invite = * + +; This instance just sends all incoming events to the `printchannel` function +[lua print] +script = print.lua +default-handler = printchannel + +; Map all notes and CC's coming in to the Lua instance +[map] +rtp.ch{0..15}.cc{0..127} > print.ch{0..15}.cc{0..127} +rtp.ch{0..15}.note{0..127} > print.ch{0..15}.cnote{0..127} -- cgit v1.2.3 From ceefbdb7eddfdccd7b1b6cb452f920382cdae4b0 Mon Sep 17 00:00:00 2001 From: cbdev Date: Sat, 25 Apr 2020 00:33:57 +0200 Subject: Fix spelling --- configs/print.lua | 2 +- configs/rtpmidi.cfg | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'configs') diff --git a/configs/print.lua b/configs/print.lua index c6391d3..dc28bb6 100644 --- a/configs/print.lua +++ b/configs/print.lua @@ -1,4 +1,4 @@ --- This function prints the name of the channel it handles and it's value +-- This function prints the name of the channel it handles and its current value -- It can be used for a simple debug output with the `default-handler` configuration option function printchannel(value) print(input_channel() .. " @ " .. value) diff --git a/configs/rtpmidi.cfg b/configs/rtpmidi.cfg index 4128274..3223bd7 100644 --- a/configs/rtpmidi.cfg +++ b/configs/rtpmidi.cfg @@ -1,9 +1,9 @@ ; Simple RTP MIDI example configuration [backend rtpmidi] -; This causes the backend itself to output channel values +; This causes the backend itself to print channel values as they come in detect = on -; When connecting multiple MIDIMonster hosts via RTP MIDI, set this to something else on each computer +; When connecting multiple MIDIMonster hosts via RTP MIDI, set this to something different on each computer mdns-name = midimonster-host [rtpmidi rtp] -- cgit v1.2.3 From 7693ed34ab5e549b8b7fb8ca395bbf15616d6915 Mon Sep 17 00:00:00 2001 From: Spacelord Date: Sun, 26 Apr 2020 02:28:11 +0200 Subject: Update layering config to use the new default-handler functionality --- configs/layering.cfg | 5 ++-- configs/layering.lua | 82 +++++++--------------------------------------------- 2 files changed, 14 insertions(+), 73 deletions(-) (limited to 'configs') diff --git a/configs/layering.cfg b/configs/layering.cfg index 7adcd6f..b71f9e5 100644 --- a/configs/layering.cfg +++ b/configs/layering.cfg @@ -7,7 +7,7 @@ bind = 0.0.0.0 [midi in] -read = Launch Control +read = BCF [artnet out] destination = 255.255.255.255 @@ -15,9 +15,10 @@ universe = 1 [lua layers] script = layering.lua +default-handler = handler [map] -in.ch0.cc{0..15} > layers.in{0..15} +in.ch1.cc{1..8} > layers.in{0..7} layers.out{0..511} > out.{1..512} in.ch0.note0 > layers.control diff --git a/configs/layering.lua b/configs/layering.lua index 5d9458d..5ddde65 100644 --- a/configs/layering.lua +++ b/configs/layering.lua @@ -3,74 +3,14 @@ -- so we have 32 possible offsets (32 * 16 = 512) current_layer = 0 --- Set the current_layer based on the control input channel -function control(value) - current_layer = math.floor(value * 31.99); -end - --- Handler functions for the input channels --- Calculate the channel offset and just output the value the input channel provides -function in0(value) - output("out"..((current_layer * 16)), value) - print("Output on out"..(current_layer * 16)) -end - -function in1(value) - output("out"..((current_layer * 16) + 1), value) -end - -function in2(value) - output("out"..((current_layer * 16) + 2), value) -end - -function in3(value) - output("out"..((current_layer * 16) + 3), value) -end - -function in4(value) - output("out"..((current_layer * 16) + 4), value) -end - -function in5(value) - output("out"..((current_layer * 16) + 5), value) -end - -function in6(value) - output("out"..((current_layer * 16) + 6), value) -end - -function in7(value) - output("out"..((current_layer * 16) + 7), value) -end - -function in8(value) - output("out"..((current_layer * 16) + 8), value) -end - -function in9(value) - output("out"..((current_layer * 16) + 9), value) -end - -function in10(value) - output("out"..((current_layer * 16) + 10), value) -end - -function in11(value) - output("out"..((current_layer * 16) + 11), value) -end - -function in12(value) - output("out"..((current_layer * 16) + 12), value) -end - -function in13(value) - output("out"..((current_layer * 16) + 13), value) -end - -function in14(value) - output("out"..((current_layer * 16) + 14), value) -end - -function in15(value) - output("out"..((current_layer * 16) + 15), value) -end +function handler(value) + if(input_channel() == "control") then + -- Set the current_layer based on the control input channel + current_layer = math.floor(value * 31.99); + else + -- Handler functions for the input channels + -- Calculate the channel offset and just output the value the input channel provides + output("out"..((current_layer * 16) + tonumber(input_channel())), value) + print("Output on out"..(current_layer * 16)) + end +end \ No newline at end of file -- cgit v1.2.3 From 5f2808188b71c6eea7440c70321ccfe7b3ccdd55 Mon Sep 17 00:00:00 2001 From: cbdev Date: Sun, 26 Apr 2020 02:31:59 +0200 Subject: Fix channel name for layering config --- DEVELOPMENT.md | 2 ++ configs/layering.cfg | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'configs') diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 495c4f9..79005a9 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -34,6 +34,8 @@ in spirit rather than by the letter. * Prefer to name unsigned loop counters `u` and signed ones `i` * Place comments above the section they are commenting on * Use inline comments sparingly +* Do not omit '{}' brackets, even if optional (e.g. single-statement conditional bodies) +* Opening braces stay on the same line as the condition #### C specific diff --git a/configs/layering.cfg b/configs/layering.cfg index b71f9e5..f312a65 100644 --- a/configs/layering.cfg +++ b/configs/layering.cfg @@ -7,7 +7,7 @@ bind = 0.0.0.0 [midi in] -read = BCF +read = Launch Control [artnet out] destination = 255.255.255.255 @@ -18,7 +18,7 @@ script = layering.lua default-handler = handler [map] -in.ch1.cc{1..8} > layers.in{0..7} +in.ch1.cc{0..15} > layers.{0..15} layers.out{0..511} > out.{1..512} in.ch0.note0 > layers.control -- cgit v1.2.3