From fec26ba3f193f3e31e08b55dfb3c60aa30eed63f Mon Sep 17 00:00:00 2001 From: cbdev Date: Sun, 6 Sep 2020 22:45:20 +0200 Subject: Add rate limiting notice to sACN and ArtNet --- TODO | 1 + 1 file changed, 1 insertion(+) (limited to 'TODO') diff --git a/TODO b/TODO index befa5e6..44336d4 100644 --- a/TODO +++ b/TODO @@ -4,3 +4,4 @@ udp backends may ignore MTU make event collectors threadsafe to stop marshalling data... collect & check backend API version move all connection establishment to _start to be able to hot-stop/start all backends +event deduplication in core? -- cgit v1.2.3 From bb122923379f3439c62241652b82ed403ad835f7 Mon Sep 17 00:00:00 2001 From: cbdev Date: Sat, 24 Oct 2020 12:31:27 +0200 Subject: Add generic lua pkg-config data --- TODO | 4 ++++ backends/Makefile | 6 +++--- backends/visca.c | 3 ++- 3 files changed, 9 insertions(+), 4 deletions(-) (limited to 'TODO') diff --git a/TODO b/TODO index 44336d4..5662479 100644 --- a/TODO +++ b/TODO @@ -5,3 +5,7 @@ make event collectors threadsafe to stop marshalling data... collect & check backend API version move all connection establishment to _start to be able to hot-stop/start all backends event deduplication in core? + +per-channel filters + * invert + * edge detection diff --git a/backends/Makefile b/backends/Makefile index 4f89b43..d815f84 100644 --- a/backends/Makefile +++ b/backends/Makefile @@ -79,9 +79,9 @@ ola.so: CPPFLAGS += -Wno-write-strings # The pkg-config name for liblua5.3 is subject to discussion. I prefer 'lua5.3' (which works on Debian and OSX), # but Arch requires 'lua53' which works on Debian, too, but breaks on OSX. -lua.so: CFLAGS += $(shell pkg-config --cflags lua53 || pkg-config --cflags lua5.3 || echo "-DBUILD_ERROR=\"Missing pkg-config data for lua53\"") -lua.so: LDLIBS += $(shell pkg-config --libs lua53 || pkg-config --libs lua5.3 || echo "-DBUILD_ERROR=\"Missing pkg-config data for lua53\"") -lua.dll: CFLAGS += $(shell pkg-config --cflags lua53 || pkg-config --cflags lua5.3 || echo "-DBUILD_ERROR=\"Missing pkg-config data for lua53\"") +lua.so: CFLAGS += $(shell pkg-config --cflags lua53 || pkg-config --cflags lua5.3 || pkg-config --cflags lua || echo "-DBUILD_ERROR=\"Missing pkg-config data for lua53\"") +lua.so: LDLIBS += $(shell pkg-config --libs lua53 || pkg-config --libs lua5.3 || pkg-config --libs lua || echo "-DBUILD_ERROR=\"Missing pkg-config data for lua53\"") +lua.dll: CFLAGS += $(shell pkg-config --cflags lua53 || pkg-config --cflags lua5.3 || pkg-config --cflags lua || echo "-DBUILD_ERROR=\"Missing pkg-config data for lua53\"") lua.dll: LDLIBS += -L../ -llua53 python.so: CFLAGS += $(shell pkg-config --cflags python3 || pkg-config --cflags python || echo "-DBUILD_ERROR=\"Missing pkg-config data for python3\"") diff --git a/backends/visca.c b/backends/visca.c index 9f398a2..ba81f8d 100644 --- a/backends/visca.c +++ b/backends/visca.c @@ -8,8 +8,9 @@ /* TODO * VISCA server - * Rate limiting + * Command output rate limiting / deduplication * Inquiry + * Reconnect on connection close */ MM_PLUGIN_API int init(){ -- cgit v1.2.3 From 00ba26c238a2e75c5b7d2e32469eae02179efde9 Mon Sep 17 00:00:00 2001 From: cbdev Date: Fri, 8 Jan 2021 23:03:11 +0100 Subject: Implement EPN reception for the jack backend --- TODO | 1 + backends/jack.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++- backends/jack.h | 10 ++++++++ backends/jack.md | 7 ++++-- backends/winmidi.c | 2 +- 5 files changed, 88 insertions(+), 4 deletions(-) (limited to 'TODO') diff --git a/TODO b/TODO index 5662479..2ab5f10 100644 --- a/TODO +++ b/TODO @@ -5,6 +5,7 @@ make event collectors threadsafe to stop marshalling data... collect & check backend API version move all connection establishment to _start to be able to hot-stop/start all backends event deduplication in core? +move all typenames to _t per-channel filters * invert diff --git a/backends/jack.c b/backends/jack.c index a3caf73..176144f 100644 --- a/backends/jack.c +++ b/backends/jack.c @@ -101,6 +101,68 @@ static void mmjack_process_midiout(void* buffer, size_t sample_offset, uint8_t t } } +//this state machine was copied more-or-less verbatim from the alsa midi implementation - fixes there will need to be integrated +static void mmjack_handle_epn(mmjack_port* port, uint8_t chan, uint16_t control, uint16_t value){ + mmjack_channel_ident ident = { + .label = 0 + }; + + //switching between nrpn and rpn clears all valid bits + if(((port->epn_status[chan] & EPN_NRPN) && (control == 101 || control == 100)) + || (!(port->epn_status[chan] & EPN_NRPN) && (control == 99 || control == 98))){ + port->epn_status[chan] &= ~(EPN_NRPN | EPN_PARAMETER_LO | EPN_PARAMETER_HI); + } + + //setting an address always invalidates the value valid bits + if(control >= 98 && control <= 101){ + port->epn_status[chan] &= ~EPN_VALUE_HI; + } + + //parameter hi + if(control == 101 || control == 99){ + port->epn_control[chan] &= 0x7F; + port->epn_control[chan] |= value << 7; + port->epn_status[chan] |= EPN_PARAMETER_HI | ((control == 99) ? EPN_NRPN : 0); + if(control == 101 && value == 127){ + port->epn_status[chan] &= ~EPN_PARAMETER_HI; + } + } + + //parameter lo + if(control == 100 || control == 98){ + port->epn_control[chan] &= ~0x7F; + port->epn_control[chan] |= value & 0x7F; + port->epn_status[chan] |= EPN_PARAMETER_LO | ((control == 98) ? EPN_NRPN : 0); + if(control == 100 && value == 127){ + port->epn_status[chan] &= ~EPN_PARAMETER_LO; + } + } + + //value hi, clears low, mark as update candidate + if(control == 6 + //check if parameter is set before accepting value update + && ((port->epn_status[chan] & (EPN_PARAMETER_HI | EPN_PARAMETER_LO)) == (EPN_PARAMETER_HI | EPN_PARAMETER_LO))){ + port->epn_value[chan] = value << 7; + port->epn_status[chan] |= EPN_VALUE_HI; + } + + //value lo, flush the value + if(control == 38 + && port->epn_status[chan] & EPN_VALUE_HI){ + port->epn_value[chan] &= ~0x7F; + port->epn_value[chan] |= value & 0x7F; + port->epn_status[chan] &= ~EPN_VALUE_HI; + + //find the updated channel + ident.fields.sub_type = port->epn_status[chan] & EPN_NRPN ? midi_nrpn : midi_rpn; + ident.fields.sub_channel = chan; + ident.fields.sub_control = port->epn_control[chan]; + + //ident.fields.port set on output in mmjack_handle_midi + mmjack_midiqueue_append(port, ident, port->epn_value[chan]); + } +} + static int mmjack_process_midi(instance* inst, mmjack_port* port, size_t nframes, size_t* mark){ mmjack_instance_data* data = (mmjack_instance_data*) inst->impl; void* buffer = jack_port_get_buffer(port->port, nframes); @@ -113,7 +175,6 @@ static int mmjack_process_midi(instance* inst, mmjack_port* port, size_t nframes if(port->input){ if(event_count){ DBGPF("Reading %u MIDI events from port %s", event_count, port->name); - //TODO (n)rpn RX for(u = 0; u < event_count; u++){ ident.label = 0; //read midi data from stream @@ -135,6 +196,15 @@ static int mmjack_process_midi(instance* inst, mmjack_port* port, size_t nframes ident.fields.sub_control = 0; value = event.buffer[1]; } + + //forward the EPN CCs to the EPN state machine + if(ident.fields.sub_type == midi_cc + && ((ident.fields.sub_control <= 101 && ident.fields.sub_control >= 98) + || ident.fields.sub_control == 6 + || ident.fields.sub_control == 38)){ + mmjack_handle_epn(port, ident.fields.sub_channel, ident.fields.sub_control, value); + } + //append midi data mmjack_midiqueue_append(port, ident, value); } diff --git a/backends/jack.h b/backends/jack.h index ca62ea5..762282b 100644 --- a/backends/jack.h +++ b/backends/jack.h @@ -16,6 +16,11 @@ static int mmjack_shutdown(size_t n, instance** inst); #define JACK_DEFAULT_SERVER_NAME "default" #define JACK_MIDIQUEUE_CHUNK 10 +#define EPN_NRPN 8 +#define EPN_PARAMETER_HI 4 +#define EPN_PARAMETER_LO 2 +#define EPN_VALUE_HI 1 + enum /*mmjack_midi_channel_type*/ { midi_none = 0, midi_note = 0x90, @@ -59,10 +64,15 @@ typedef struct /*_mmjack_port_data*/ { double min; uint8_t mark; double last; + size_t queue_len; size_t queue_alloc; mmjack_midiqueue* queue; + uint16_t epn_control[16]; + uint16_t epn_value[16]; + uint8_t epn_status[16]; + pthread_mutex_t lock; } mmjack_port; diff --git a/backends/jack.md b/backends/jack.md index 3d426f3..4ff77f6 100644 --- a/backends/jack.md +++ b/backends/jack.md @@ -83,8 +83,11 @@ by the MIDIMonster #### Known bugs / problems -Extended parameter numbers (`rpn` and `nrpn` control types) can currently only be transmitted, not properly -received as such. Support for this functionality is planned. +MIDI extended parameter numbers (EPNs, the `rpn` and `nrpn` control types) will also generate events on the controls (CC 101 through +98, 38 and 6) that are used as the lower layer transport. When using EPNs, mapping those controls is probably not useful. + +EPN control types support only the full 14-bit transfer encoding, not the shorter variant transmitting only the 7 +high-order bits. This may be changed if there is sufficient interest in the functionality. While JACK has rudimentary capabilities for transporting OSC messages, configuring and parsing such channels with this backend would take a great amount of dedicated syntax & code. CV ports can provide fine-grained single diff --git a/backends/winmidi.c b/backends/winmidi.c index 66456e8..d12dc71 100644 --- a/backends/winmidi.c +++ b/backends/winmidi.c @@ -402,7 +402,7 @@ static void winmidi_handle_epn(instance* inst, uint8_t chan, uint16_t control, u ident.fields.control = data->epn_control[chan]; val.normalised = (double) data->epn_value[chan] / 16383.0; - winmidi_enqueue_input(inst, ident,val); + winmidi_enqueue_input(inst, ident, val); } } -- cgit v1.2.3 From 91764dfc3ad86994ce27e5c80a92c034e12b849c Mon Sep 17 00:00:00 2001 From: cbdev Date: Sat, 16 Jan 2021 19:34:21 +0100 Subject: Add notes --- TODO | 3 +++ 1 file changed, 3 insertions(+) (limited to 'TODO') diff --git a/TODO b/TODO index 2ab5f10..9158e24 100644 --- a/TODO +++ b/TODO @@ -10,3 +10,6 @@ move all typenames to _t per-channel filters * invert * edge detection + +channel discovery / enumeration +note exit condition/reconnection details for backends -- cgit v1.2.3 From a743153aafffb38a6d8765d1f1c634dde51d5558 Mon Sep 17 00:00:00 2001 From: cbdev Date: Mon, 21 Jun 2021 22:15:15 +0200 Subject: Repository cleanup, part 2 --- .ci.sh | 134 ----------------------------------------- .travis.yml | 157 ------------------------------------------------- MIDIMonster.svg | 1 - Makefile | 18 +++--- TODO | 15 ----- assets/MIDIMonster.svg | 1 + assets/TODO | 15 +++++ assets/ci-config.yml | 157 +++++++++++++++++++++++++++++++++++++++++++++++++ assets/ci.sh | 134 +++++++++++++++++++++++++++++++++++++++++ assets/midimonster.1 | 42 +++++++++++++ assets/midimonster.ico | Bin 0 -> 321510 bytes assets/midimonster.rc | 22 +++++++ midimonster.1 | 42 ------------- midimonster.c | 6 +- midimonster.ico | Bin 321510 -> 0 bytes midimonster.rc | 22 ------- 16 files changed, 385 insertions(+), 381 deletions(-) delete mode 100755 .ci.sh delete mode 100644 .travis.yml delete mode 100644 MIDIMonster.svg delete mode 100644 TODO create mode 100644 assets/MIDIMonster.svg create mode 100644 assets/TODO create mode 100644 assets/ci-config.yml create mode 100755 assets/ci.sh create mode 100644 assets/midimonster.1 create mode 100644 assets/midimonster.ico create mode 100644 assets/midimonster.rc delete mode 100644 midimonster.1 delete mode 100644 midimonster.ico delete mode 100644 midimonster.rc (limited to 'TODO') diff --git a/.ci.sh b/.ci.sh deleted file mode 100755 index 4a646a9..0000000 --- a/.ci.sh +++ /dev/null @@ -1,134 +0,0 @@ -#!/bin/bash - -# Check for Travis and use the provided fold method if detected -if declare -f travis_fold > /dev/null; then - ci_fold(){ - travis_fold "$1" "$2" - } -else - ci_fold(){ - printf -- "-- %s stage %s --\n" "$1" "$2" - } -fi - -if [ -z "$OS" ]; then - OS="linux" -fi - -if [ "$TASK" = "spellcheck" ]; then - result=0 - # Create list of files to be spellchecked - spellcheck_files=$(find . -type f | grep -v ".git/") - - # Run spellintian to find spelling errors - sl_results=$(xargs spellintian 2>&1 <<< "$spellcheck_files") - - sl_errors=$(wc -l <<< "$sl_results") - sl_errors_dups=$((grep "\(duplicate word\)" | wc -l) <<< "$sl_results") - sl_errors_nodups=$((grep -v "\(duplicate word\)" | wc -l) <<< "$sl_results") - - if [ "$sl_errors" -ne 0 ]; then - printf "Spellintian found %s errors (%s spelling, %s duplicate words):\n\n" "$sl_errors" "$sl_errors_nodups" "$sl_errors_dups" - printf "%s\n\n" "$sl_results" - result=1 - else - printf "Spellintian reports no errors\n" - fi - - # Run codespell to find some more - cs_results=$(xargs codespell --quiet 2 <<< "$spellcheck_files" 2>&1) - cs_errors=$(wc -l <<< "$cs_results") - if [ "$cs_errors" -ne 0 ]; then - printf "Codespell found %s errors:\n\n" "$cs_errors" - printf "%s\n\n" "$cs_results" - result=1 - else - printf "Codespell reports no errors\n" - fi - exit "$result" -elif [ "$TASK" = "codesmell" ]; then - result=0 - - if [ -z "$(which lizard)" ]; then - printf "Installing lizard...\n" - pip3 install lizard - fi - - # Run shellcheck for all shell scripts - printf "Running shellcheck...\n" - shell_files="$(find . -type f -iname \*.sh)" - xargs shellcheck -Cnever -s bash <<< "$shell_files" - if [ "$?" -ne "0" ]; then - result=1 - fi - - # Run cloc for some stats - printf "Code statistics:\n\n" - cloc ./ - - # Run lizard for the project - printf "Running lizard for code complexity analysis\n" - lizard ./ - if [ "$?" -ne "0" ]; then - result=1 - fi - - exit "$result" -elif [ "$TASK" = "sanitize" ]; then - # Run sanitized compile - ci_fold start "make_sanitize" - if ! make sanitize; then - printf "Failed to build\n" - exit 1 - fi - ci_fold end "make_sanitize" -elif [ "$TASK" = "windows" ]; then - ci_fold start "make_windows" - if ! make windows; then - printf "Failed to build\n" - exit 1 - fi - make -C backends lua.dll - ci_fold end "make_windows" - if [ "$(git describe)" == "$(git describe --abbrev=0)" ] || [ -n "$DEPLOY" ]; then - ci_fold start "deploy_windows" - mkdir ./deployment - mkdir ./deployment/backends - mkdir ./deployment/docs - # Strip the Windows binaries as they become huge quickly - strip midimonster.exe backends/*.dll - cp ./midimonster.exe ./deployment/ - cp ./backends/*.dll ./deployment/backends/ - cp ./backends/*.dll.disabled ./deployment/backends/ - cp ./monster.cfg ./deployment/monster.cfg - cp ./backends/*.md ./deployment/docs/ - cp -r ./configs ./deployment/ - cd ./deployment - zip -r "./midimonster-$(git describe)-windows.zip" "./" - find . ! -iname '*.zip' -delete - ci_fold end "deploy_windows" - fi -else - # Otherwise compile as normal - ci_fold start "make" - if ! make full; then - printf "Failed to build\n" - exit 1 - fi - ci_fold end "make" - if [ "$(git describe)" == "$(git describe --abbrev=0)" ] || [ -n "$DEPLOY" ]; then - ci_fold start "deploy_unix" - mkdir ./deployment - mkdir ./deployment/backends - mkdir ./deployment/docs - cp ./midimonster ./deployment/ - cp ./backends/*.so ./deployment/backends/ - cp ./monster.cfg ./deployment/monster.cfg - cp ./backends/*.md ./deployment/docs/ - cp -r ./configs ./deployment/ - cd ./deployment - tar czf "midimonster-$(git describe)-$OS.tgz" "./" - find . ! -iname '*.tgz' -delete - ci_fold end "deploy_unix" - fi -fi diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 9fbe236..0000000 --- a/.travis.yml +++ /dev/null @@ -1,157 +0,0 @@ -language: c -group: edge -os: linux -dist: bionic - -before_script: - - export -f travis_fold - - export OS="$TRAVIS_OS_NAME" - -script: - - "bash .ci.sh" - -addons: - apt: - packages: &core_build - # This is all the bits we need to enable all options - - libasound2-dev - - libevdev-dev - - libola-dev - - libjack-jackd2-dev - - liblua5.3-dev - - python3-dev - - libssl-dev - - lintian - packages: &core_build_gpp_latest - - *core_build - - gcc-8 - - g++-8 - packages: &core_build_clang_latest - - *core_build - - clang-6.0 - packages: &core_build_windows - - *core_build - - mingw-w64 - packages: &linters - - python3 - - python3-pip - - lintian - - codespell - - shellcheck - - cloc - -jobs: - fast_finish: true - include: - - os: linux - dist: bionic - compiler: clang - env: TASK='compile' - addons: - apt: - packages: - - *core_build_clang_latest - - os: linux - dist: bionic - compiler: gcc - env: TASK='compile' - addons: - apt: - packages: - - *core_build_gpp_latest - - os: linux - dist: bionic - compiler: mingw32-gcc - env: - - TASK='windows' - - CC='x86_64-w64-mingw32-gcc' - addons: - apt: - packages: - - *core_build_windows - - os: linux - dist: bionic - compiler: clang - env: TASK='sanitize' - addons: - apt: - packages: - - *core_build_clang_latest - - os: osx - osx_image: xcode10.2 - compiler: clang - env: - - TASK='compile' - - os: osx - osx_image: xcode10.2 - compiler: clang - env: - - TASK='sanitize' - - os: linux - dist: bionic - env: TASK='codesmell' - addons: - apt: - packages: - - *linters - - os: linux - dist: bionic - env: TASK='spellcheck' - addons: - apt: - packages: - - *linters - allow_failures: - - os: linux - dist: bionic - env: TASK='codesmell' - - os: linux - dist: bionic - env: TASK='spellcheck' - -env: - global: - # No colours in terminal (to reduce log file size) - - TERM=dumb - # Parallel make build - - MAKEFLAGS="-j 4" - -cache: - apt: true - -before_install: -# Travis clones with --branch, which omits tags. Since we use them for the version string at build time, fetch them - - git pull --tags - - printf "This is %s on %s\n" "$(git describe)" "$TRAVIS_OS_NAME" - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi -# 'brew install' sometimes returns non-zero for some arcane reason. Executing 'true' resets the exit code and allows Travis to continue building... -# Travis seems to have Python 2.7 installed by default, which for some reason prevents pkg-config from reading python3.pc - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install ola lua openssl jack python3; brew link --overwrite python; true; fi -# OpenSSL is not a proper install due to some Apple bull, so provide additional locations via the environment... -# Additionally, newer versions of this "recipe" seem to use the name 'openssl@1.1' instead of plain 'openssl' and there seems to be -# no way to programmatically get the link and include paths. Genius! Hardcoding the new version for the time being... - - export CFLAGS="$CFLAGS -I/usr/local/opt/openssl@1.1/include" - - export LDFLAGS="$LDFLAGS -L/usr/local/opt/openssl@1.1/lib" -#Use the latest clang if we're compiling with clang - - if [ "$TRAVIS_OS_NAME" == "linux" -a "$CC" = "clang" ]; then export CC="clang-6.0"; export CXX="clang-6.0"; fi -# Download libraries to link with for Windows - - if [ "$TASK" == "windows" ]; then wget "https://downloads.sourceforge.net/project/luabinaries/5.3.5/Windows%20Libraries/Dynamic/lua-5.3.5_Win64_dllw6_lib.zip" -O lua53.zip; unzip lua53.zip lua53.dll; fi - -notifications: - irc: - channels: - - "irc.hackint.org#midimonster" - on_success: change # default: always - on_failure: always # default: always - nick: mm_ci - use_notice: true - -deploy: - provider: releases - file_glob: true - token: $GITHUB_TOKEN - file: ./deployment/* - skip_cleanup: true - draft: true - on: - tags: true diff --git a/MIDIMonster.svg b/MIDIMonster.svg deleted file mode 100644 index 7e411dc..0000000 --- a/MIDIMonster.svg +++ /dev/null @@ -1 +0,0 @@ -Asset 3 \ No newline at end of file diff --git a/Makefile b/Makefile index 9b95f1b..50fc73e 100644 --- a/Makefile +++ b/Makefile @@ -11,14 +11,18 @@ GITVERSION = $(shell git describe) CFLAGS ?= -g -Wall -Wpedantic #CFLAGS += -DDEBUG # Hide all non-API symbols for export -CFLAGS += -fvisibility=hidden -I./ +CFLAGS += -fvisibility=hidden + +# Subdirectory objects need the include path +RCCFLAGS += -I./ +CFLAGS += -I./ midimonster: LDLIBS = -ldl # Replace version string with current git-describe if possible ifneq "$(GITVERSION)" "" midimonster: CFLAGS += -DMIDIMONSTER_VERSION=\"$(GITVERSION)\" midimonster.exe: CFLAGS += -DMIDIMONSTER_VERSION=\"$(GITVERSION)\" -resource.o: RCCFLAGS += -DMIDIMONSTER_VERSION=\\\"$(GITVERSION)\\\" +assets/resource.o: RCCFLAGS += -DMIDIMONSTER_VERSION=\\\"$(GITVERSION)\\\" endif # Work around strange linker passing convention differences in Linux and OSX @@ -55,10 +59,10 @@ backends-full: midimonster: midimonster.c portability.h $(OBJS) $(CC) $(CFLAGS) $(LDFLAGS) $< $(OBJS) $(LDLIBS) -o $@ -resource.o: midimonster.rc midimonster.ico +assets/resource.o: assets/midimonster.rc assets/midimonster.ico $(RCC) $(RCCFLAGS) $< -o $@ --output-format=coff -midimonster.ico: MIDIMonster.svg +assets/midimonster.ico: assets/MIDIMonster.svg convert -density 384 $< -define icon:auto-resize $@ midimonster.exe: export CC = x86_64-w64-mingw32-gcc @@ -66,14 +70,14 @@ midimonster.exe: RCC ?= x86_64-w64-mingw32-windres midimonster.exe: CFLAGS += -Wno-format midimonster.exe: LDLIBS = -lws2_32 midimonster.exe: LDFLAGS += -Wl,--out-implib,libmmapi.a -midimonster.exe: midimonster.c portability.h $(OBJS) resource.o - $(CC) $(CFLAGS) $(LDFLAGS) $< $(OBJS) resource.o $(LDLIBS) -o $@ +midimonster.exe: midimonster.c portability.h $(OBJS) assets/resource.o + $(CC) $(CFLAGS) $(LDFLAGS) $< $(OBJS) assets/resource.o $(LDLIBS) -o $@ clean: $(RM) midimonster $(RM) midimonster.exe $(RM) libmmapi.a - $(RM) resource.o + $(RM) assets/resource.o $(RM) $(OBJS) $(MAKE) -C backends clean diff --git a/TODO b/TODO deleted file mode 100644 index 9158e24..0000000 --- a/TODO +++ /dev/null @@ -1,15 +0,0 @@ -keepalive channels per backend? -Note source in channel value struct -udp backends may ignore MTU -make event collectors threadsafe to stop marshalling data... -collect & check backend API version -move all connection establishment to _start to be able to hot-stop/start all backends -event deduplication in core? -move all typenames to _t - -per-channel filters - * invert - * edge detection - -channel discovery / enumeration -note exit condition/reconnection details for backends diff --git a/assets/MIDIMonster.svg b/assets/MIDIMonster.svg new file mode 100644 index 0000000..7e411dc --- /dev/null +++ b/assets/MIDIMonster.svg @@ -0,0 +1 @@ +Asset 3 \ No newline at end of file diff --git a/assets/TODO b/assets/TODO new file mode 100644 index 0000000..9158e24 --- /dev/null +++ b/assets/TODO @@ -0,0 +1,15 @@ +keepalive channels per backend? +Note source in channel value struct +udp backends may ignore MTU +make event collectors threadsafe to stop marshalling data... +collect & check backend API version +move all connection establishment to _start to be able to hot-stop/start all backends +event deduplication in core? +move all typenames to _t + +per-channel filters + * invert + * edge detection + +channel discovery / enumeration +note exit condition/reconnection details for backends diff --git a/assets/ci-config.yml b/assets/ci-config.yml new file mode 100644 index 0000000..9fbe236 --- /dev/null +++ b/assets/ci-config.yml @@ -0,0 +1,157 @@ +language: c +group: edge +os: linux +dist: bionic + +before_script: + - export -f travis_fold + - export OS="$TRAVIS_OS_NAME" + +script: + - "bash .ci.sh" + +addons: + apt: + packages: &core_build + # This is all the bits we need to enable all options + - libasound2-dev + - libevdev-dev + - libola-dev + - libjack-jackd2-dev + - liblua5.3-dev + - python3-dev + - libssl-dev + - lintian + packages: &core_build_gpp_latest + - *core_build + - gcc-8 + - g++-8 + packages: &core_build_clang_latest + - *core_build + - clang-6.0 + packages: &core_build_windows + - *core_build + - mingw-w64 + packages: &linters + - python3 + - python3-pip + - lintian + - codespell + - shellcheck + - cloc + +jobs: + fast_finish: true + include: + - os: linux + dist: bionic + compiler: clang + env: TASK='compile' + addons: + apt: + packages: + - *core_build_clang_latest + - os: linux + dist: bionic + compiler: gcc + env: TASK='compile' + addons: + apt: + packages: + - *core_build_gpp_latest + - os: linux + dist: bionic + compiler: mingw32-gcc + env: + - TASK='windows' + - CC='x86_64-w64-mingw32-gcc' + addons: + apt: + packages: + - *core_build_windows + - os: linux + dist: bionic + compiler: clang + env: TASK='sanitize' + addons: + apt: + packages: + - *core_build_clang_latest + - os: osx + osx_image: xcode10.2 + compiler: clang + env: + - TASK='compile' + - os: osx + osx_image: xcode10.2 + compiler: clang + env: + - TASK='sanitize' + - os: linux + dist: bionic + env: TASK='codesmell' + addons: + apt: + packages: + - *linters + - os: linux + dist: bionic + env: TASK='spellcheck' + addons: + apt: + packages: + - *linters + allow_failures: + - os: linux + dist: bionic + env: TASK='codesmell' + - os: linux + dist: bionic + env: TASK='spellcheck' + +env: + global: + # No colours in terminal (to reduce log file size) + - TERM=dumb + # Parallel make build + - MAKEFLAGS="-j 4" + +cache: + apt: true + +before_install: +# Travis clones with --branch, which omits tags. Since we use them for the version string at build time, fetch them + - git pull --tags + - printf "This is %s on %s\n" "$(git describe)" "$TRAVIS_OS_NAME" + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi +# 'brew install' sometimes returns non-zero for some arcane reason. Executing 'true' resets the exit code and allows Travis to continue building... +# Travis seems to have Python 2.7 installed by default, which for some reason prevents pkg-config from reading python3.pc + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install ola lua openssl jack python3; brew link --overwrite python; true; fi +# OpenSSL is not a proper install due to some Apple bull, so provide additional locations via the environment... +# Additionally, newer versions of this "recipe" seem to use the name 'openssl@1.1' instead of plain 'openssl' and there seems to be +# no way to programmatically get the link and include paths. Genius! Hardcoding the new version for the time being... + - export CFLAGS="$CFLAGS -I/usr/local/opt/openssl@1.1/include" + - export LDFLAGS="$LDFLAGS -L/usr/local/opt/openssl@1.1/lib" +#Use the latest clang if we're compiling with clang + - if [ "$TRAVIS_OS_NAME" == "linux" -a "$CC" = "clang" ]; then export CC="clang-6.0"; export CXX="clang-6.0"; fi +# Download libraries to link with for Windows + - if [ "$TASK" == "windows" ]; then wget "https://downloads.sourceforge.net/project/luabinaries/5.3.5/Windows%20Libraries/Dynamic/lua-5.3.5_Win64_dllw6_lib.zip" -O lua53.zip; unzip lua53.zip lua53.dll; fi + +notifications: + irc: + channels: + - "irc.hackint.org#midimonster" + on_success: change # default: always + on_failure: always # default: always + nick: mm_ci + use_notice: true + +deploy: + provider: releases + file_glob: true + token: $GITHUB_TOKEN + file: ./deployment/* + skip_cleanup: true + draft: true + on: + tags: true diff --git a/assets/ci.sh b/assets/ci.sh new file mode 100755 index 0000000..4a646a9 --- /dev/null +++ b/assets/ci.sh @@ -0,0 +1,134 @@ +#!/bin/bash + +# Check for Travis and use the provided fold method if detected +if declare -f travis_fold > /dev/null; then + ci_fold(){ + travis_fold "$1" "$2" + } +else + ci_fold(){ + printf -- "-- %s stage %s --\n" "$1" "$2" + } +fi + +if [ -z "$OS" ]; then + OS="linux" +fi + +if [ "$TASK" = "spellcheck" ]; then + result=0 + # Create list of files to be spellchecked + spellcheck_files=$(find . -type f | grep -v ".git/") + + # Run spellintian to find spelling errors + sl_results=$(xargs spellintian 2>&1 <<< "$spellcheck_files") + + sl_errors=$(wc -l <<< "$sl_results") + sl_errors_dups=$((grep "\(duplicate word\)" | wc -l) <<< "$sl_results") + sl_errors_nodups=$((grep -v "\(duplicate word\)" | wc -l) <<< "$sl_results") + + if [ "$sl_errors" -ne 0 ]; then + printf "Spellintian found %s errors (%s spelling, %s duplicate words):\n\n" "$sl_errors" "$sl_errors_nodups" "$sl_errors_dups" + printf "%s\n\n" "$sl_results" + result=1 + else + printf "Spellintian reports no errors\n" + fi + + # Run codespell to find some more + cs_results=$(xargs codespell --quiet 2 <<< "$spellcheck_files" 2>&1) + cs_errors=$(wc -l <<< "$cs_results") + if [ "$cs_errors" -ne 0 ]; then + printf "Codespell found %s errors:\n\n" "$cs_errors" + printf "%s\n\n" "$cs_results" + result=1 + else + printf "Codespell reports no errors\n" + fi + exit "$result" +elif [ "$TASK" = "codesmell" ]; then + result=0 + + if [ -z "$(which lizard)" ]; then + printf "Installing lizard...\n" + pip3 install lizard + fi + + # Run shellcheck for all shell scripts + printf "Running shellcheck...\n" + shell_files="$(find . -type f -iname \*.sh)" + xargs shellcheck -Cnever -s bash <<< "$shell_files" + if [ "$?" -ne "0" ]; then + result=1 + fi + + # Run cloc for some stats + printf "Code statistics:\n\n" + cloc ./ + + # Run lizard for the project + printf "Running lizard for code complexity analysis\n" + lizard ./ + if [ "$?" -ne "0" ]; then + result=1 + fi + + exit "$result" +elif [ "$TASK" = "sanitize" ]; then + # Run sanitized compile + ci_fold start "make_sanitize" + if ! make sanitize; then + printf "Failed to build\n" + exit 1 + fi + ci_fold end "make_sanitize" +elif [ "$TASK" = "windows" ]; then + ci_fold start "make_windows" + if ! make windows; then + printf "Failed to build\n" + exit 1 + fi + make -C backends lua.dll + ci_fold end "make_windows" + if [ "$(git describe)" == "$(git describe --abbrev=0)" ] || [ -n "$DEPLOY" ]; then + ci_fold start "deploy_windows" + mkdir ./deployment + mkdir ./deployment/backends + mkdir ./deployment/docs + # Strip the Windows binaries as they become huge quickly + strip midimonster.exe backends/*.dll + cp ./midimonster.exe ./deployment/ + cp ./backends/*.dll ./deployment/backends/ + cp ./backends/*.dll.disabled ./deployment/backends/ + cp ./monster.cfg ./deployment/monster.cfg + cp ./backends/*.md ./deployment/docs/ + cp -r ./configs ./deployment/ + cd ./deployment + zip -r "./midimonster-$(git describe)-windows.zip" "./" + find . ! -iname '*.zip' -delete + ci_fold end "deploy_windows" + fi +else + # Otherwise compile as normal + ci_fold start "make" + if ! make full; then + printf "Failed to build\n" + exit 1 + fi + ci_fold end "make" + if [ "$(git describe)" == "$(git describe --abbrev=0)" ] || [ -n "$DEPLOY" ]; then + ci_fold start "deploy_unix" + mkdir ./deployment + mkdir ./deployment/backends + mkdir ./deployment/docs + cp ./midimonster ./deployment/ + cp ./backends/*.so ./deployment/backends/ + cp ./monster.cfg ./deployment/monster.cfg + cp ./backends/*.md ./deployment/docs/ + cp -r ./configs ./deployment/ + cd ./deployment + tar czf "midimonster-$(git describe)-$OS.tgz" "./" + find . ! -iname '*.tgz' -delete + ci_fold end "deploy_unix" + fi +fi diff --git a/assets/midimonster.1 b/assets/midimonster.1 new file mode 100644 index 0000000..44c414e --- /dev/null +++ b/assets/midimonster.1 @@ -0,0 +1,42 @@ +.TH MIDIMONSTER 1 "December 2019" +.SH NAME +midimonster \- Multi-protocol translation tool +.SH SYNOPSIS +.B midimonster +.I config-file +.RB [ "-i" +.IR instance.option=value ] +.RB [ "-b" +.IR backend.option=value ] + +.B midimonster -v +.SH DESCRIPTION +.B MIDIMonster +allows the user to translate any channel on one supported protocol into channel(s) +on any other (or the same) supported protocol. +.SH OPTIONS +.TP +.I config-file +The configuration file to read. If not specified, a default configuration file is read. + +.TP +.BI "-i " instance.option=value +Supply an additional instance configuration option +.IR option " for " instance "." +Command-line overrides are applied when the instance is first mentioned in the configuration file. + +.TP +.BI "-b " backend.option=value +Supply an additional backend configuration option +.IR option " to " backend "." +Command-line overrides are applied when the backend is first mentioned in the configuration file. + +.B -v +Display version information +.SH "SEE ALSO" +Online documentation and repository at https://github.com/cbdevnet/midimonster + +For more and in-depth information see the homepage at https://midimonster.net/ +as well as the knowledge base at https://kb.midimonster.net/ +.SH AUTHOR +Fabian "cbdev" Stumpf diff --git a/assets/midimonster.ico b/assets/midimonster.ico new file mode 100644 index 0000000..9391160 Binary files /dev/null and b/assets/midimonster.ico differ diff --git a/assets/midimonster.rc b/assets/midimonster.rc new file mode 100644 index 0000000..45a88aa --- /dev/null +++ b/assets/midimonster.rc @@ -0,0 +1,22 @@ +#include "midimonster.h" + +0 ICON "midimonster.ico" +1 VERSIONINFO +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904E4" + BEGIN + VALUE "CompanyName", "control8r" + VALUE "FileDescription", "MIDIMonster" + VALUE "InternalName", "MIDIMonster Core (Windows Build)" + VALUE "FileVersion", MIDIMONSTER_VERSION + VALUE "OriginalFilename", "midimonster.exe" + VALUE "ProductName", "MIDIMonster" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 1252 + END +END diff --git a/midimonster.1 b/midimonster.1 deleted file mode 100644 index 44c414e..0000000 --- a/midimonster.1 +++ /dev/null @@ -1,42 +0,0 @@ -.TH MIDIMONSTER 1 "December 2019" -.SH NAME -midimonster \- Multi-protocol translation tool -.SH SYNOPSIS -.B midimonster -.I config-file -.RB [ "-i" -.IR instance.option=value ] -.RB [ "-b" -.IR backend.option=value ] - -.B midimonster -v -.SH DESCRIPTION -.B MIDIMonster -allows the user to translate any channel on one supported protocol into channel(s) -on any other (or the same) supported protocol. -.SH OPTIONS -.TP -.I config-file -The configuration file to read. If not specified, a default configuration file is read. - -.TP -.BI "-i " instance.option=value -Supply an additional instance configuration option -.IR option " for " instance "." -Command-line overrides are applied when the instance is first mentioned in the configuration file. - -.TP -.BI "-b " backend.option=value -Supply an additional backend configuration option -.IR option " to " backend "." -Command-line overrides are applied when the backend is first mentioned in the configuration file. - -.B -v -Display version information -.SH "SEE ALSO" -Online documentation and repository at https://github.com/cbdevnet/midimonster - -For more and in-depth information see the homepage at https://midimonster.net/ -as well as the knowledge base at https://kb.midimonster.net/ -.SH AUTHOR -Fabian "cbdev" Stumpf diff --git a/midimonster.c b/midimonster.c index 3849953..51fe7ad 100644 --- a/midimonster.c +++ b/midimonster.c @@ -12,9 +12,9 @@ #define BACKEND_NAME "core" #define MM_SWAP_LIMIT 20 #include "midimonster.h" -#include "config.h" -#include "backend.h" -#include "plugin.h" +#include "core/config.h" +#include "core/backend.h" +#include "core/plugin.h" /* Core-internal structures */ typedef struct /*_event_collection*/ { diff --git a/midimonster.ico b/midimonster.ico deleted file mode 100644 index 9391160..0000000 Binary files a/midimonster.ico and /dev/null differ diff --git a/midimonster.rc b/midimonster.rc deleted file mode 100644 index 45a88aa..0000000 --- a/midimonster.rc +++ /dev/null @@ -1,22 +0,0 @@ -#include "midimonster.h" - -0 ICON "midimonster.ico" -1 VERSIONINFO -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904E4" - BEGIN - VALUE "CompanyName", "control8r" - VALUE "FileDescription", "MIDIMonster" - VALUE "InternalName", "MIDIMonster Core (Windows Build)" - VALUE "FileVersion", MIDIMONSTER_VERSION - VALUE "OriginalFilename", "midimonster.exe" - VALUE "ProductName", "MIDIMonster" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x0409, 1252 - END -END -- cgit v1.2.3