--- /dev/null
+#!/bin/bash
+
+usage()
+{
+ cat <<EOF
+sidplayall.sh: play some sids interactively
+-g [glob]: The glob to use (default *)
+-h: show this help message
+EOF
+}
+
+sidplayer_pid=$$
+glob="*"
+while getopts "g:h" flag; do
+ case $flag in
+ g) glob=$OPTARG;;
+ h) usage; exit 0;;
+ *) echo "getopts error"
+ echo
+ usage
+ exit 1;;
+ esac
+ #echo "$flag" $OPTIND $OPTARG
+done
+
+get_next_action() {
+ line="?"
+ while [ $line == "?" ]; do
+ read line
+ case $line in
+ "") next_file=1;;
+ n) next_file=1;;
+ t) track=$(($track+1));;
+ r) track=$(($track-1));;
+ q) exit 0;;
+ ?) echo "Unknown command. Commands are:
+Enter or n: next file
+t: next track
+r: previous track
+q: quit\
+"
+ line="?";;
+ esac
+ done
+}
+
+for sid in $glob.sid; do
+ track=1
+ next_file=0
+ while [ $next_file -eq 0 ]; do
+ next_file=0
+ sidplayer "$sid" $track &
+ sidplayer_pid=$!
+ trap "kill $sidplayer_pid; exit" INT TERM EXIT
+ get_next_action
+ prev_sidplayer_pid=$sidplayer_pid
+ sidplayer_pid=$$
+ kill $prev_sidplayer_pid
+ done
+done