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 61 62 63 64 65 66 67 68
|
#!/bin/sh
function usage {
echo "usage: smfrec [-amxy] [-d device] [-i device] midifile"
exit 2
}
set -- `getopt amxyd:i: $* 2>/dev/null`
if test $? != 0; then
usage;
fi
extclock=0
sendrt=0
input=""
device=$MIDIDEV
metronome=0
tempo=0
append=0
for i; do
case "$i" in
-x)
extclock=1; shift;;
-y)
sendrt=1; shift;;
-m)
metronome=1; shift;;
-a)
append=1; shift;;
-d)
device=$2; shift; shift;;
-i)
input=$2; shift; shift;;
--)
shift; break;;
esac
done
if [ "$#" != "1" -o -z "$1" ]; then
usage;
fi
midish -b << END
if $append {
songimportsmf "$1"
}
if "$device" {
devattach 0 "$device"
if $extclock == 1 {
devsetmaster 0
}
if $sendrt {
devsendrt 0 1
}
}
if "$input" {
devattach 1 "$input"
filtnew myfilt
filtdevmap myfilt 1 0
songsetcurfilt myfilt
}
metroswitch $metronome
tracknew rec
songsetcurtrack rec
songrecord
songexportsmf "$1"
END
|