Skip to content

Commit f79bae6

Browse files
committed
Added starter script
1 parent 8239c40 commit f79bae6

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

src/Mplay.sh

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/bash
2+
3+
function realpath {
4+
local r=$1; local t=$(readlink $r)
5+
while [ $t ]; do
6+
r=$(cd $(dirname $r) && cd $(dirname $t) && pwd -P)/$(basename $t)
7+
t=$(readlink $r)
8+
done
9+
echo $r
10+
}
11+
12+
MPLAY_HOME=$(dirname $(realpath "$0"))
13+
14+
function usage()
15+
{
16+
echo "Mplay [-h|--help] [--device=midi-device] [--gui] midi-file"
17+
}
18+
19+
device="scva"
20+
interface="tui"
21+
file=""
22+
23+
while :; do
24+
case $1 in
25+
-h | -\? | --help)
26+
usage
27+
exit
28+
;;
29+
--device=?*)
30+
device=${1#*=}
31+
;;
32+
--gui)
33+
interface="Mplay"
34+
;;
35+
-*)
36+
usage
37+
exit 1
38+
;;
39+
*)
40+
file="$@"
41+
break
42+
;;
43+
esac
44+
shift
45+
done
46+
47+
if [ "$file" == "" ]; then
48+
usage
49+
exit 1
50+
fi
51+
52+
env MIDI_DEVICE=${device} julia ${MPLAY_HOME}/${interface}.jl "${file}"

0 commit comments

Comments
 (0)