From f79bae6a9994797ddd0fdb5cde14129f9363df75 Mon Sep 17 00:00:00 2001 From: Josef Heinen Date: Sat, 27 Feb 2021 12:04:30 +0100 Subject: [PATCH] Added starter script --- src/Mplay.sh | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100755 src/Mplay.sh diff --git a/src/Mplay.sh b/src/Mplay.sh new file mode 100755 index 0000000..35ad3fc --- /dev/null +++ b/src/Mplay.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +function realpath { + local r=$1; local t=$(readlink $r) + while [ $t ]; do + r=$(cd $(dirname $r) && cd $(dirname $t) && pwd -P)/$(basename $t) + t=$(readlink $r) + done + echo $r +} + +MPLAY_HOME=$(dirname $(realpath "$0")) + +function usage() +{ + echo "Mplay [-h|--help] [--device=midi-device] [--gui] midi-file" +} + +device="scva" +interface="tui" +file="" + +while :; do + case $1 in + -h | -\? | --help) + usage + exit + ;; + --device=?*) + device=${1#*=} + ;; + --gui) + interface="Mplay" + ;; + -*) + usage + exit 1 + ;; + *) + file="$@" + break + ;; + esac + shift +done + +if [ "$file" == "" ]; then + usage + exit 1 +fi + +env MIDI_DEVICE=${device} julia ${MPLAY_HOME}/${interface}.jl "${file}"