File: smfplay

package info (click to toggle)
midish 1.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,344 kB
  • sloc: ansic: 22,502; sh: 268; makefile: 119
file content (60 lines) | stat: -rwxr-xr-x 733 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/sh

usage() {
	echo "usage: smfplay [-mxy] [-d device] [-i device] midifile"
	exit 2
}

extclock=0
sendrt=0
input=""
device=$MIDIDEV
metronome="off"
tempo=0
pos=0

while getopts mxyd:i:g: optname; do
	case "$optname" in
	m)
		metronome="on";;
	x)
		extclock=1;;
	y)
		sendrt=1;;
	d)
		device=$OPTARG;;
	i)
		input=$OPTARG;;
	g)
		pos=$OPTARG;;
	esac
done
shift $(($OPTIND - 1))
if [ "$#" != "1" -o -z "$1" ]; then
	usage;
fi

exec midish -b <<EOF
import "$1"
g $pos
if "$device" {
	if "$input" {
		dnew 0 "$device" wo
	} else {
		dnew 0 "$device" rw
	}
	if $extclock == 1 {
		dclkrx 0
	}
	if $sendrt {
		dclktx {0}
	}
}
if "$input" {
	dnew 1 "$input" ro
	fnew myfilt
	fmap {any {1 0..15}} {any {0 0..15}}
}
m $metronome
p
EOF