#!/bin/sh
# Play 32-instrument .mod-files

DEV=/dev/dsp
SPEED=22222
OPT=
QUIET="-q"

if [ $# -eq 0 ] ; then
  echo "Usage: `basename $0` [-P] [-N] [-s Speed] [-o Device] [-v] [str-options] file ..."
  echo "    -P   play thru /dev/pcsp"
  echo "    -R   randomize the files" 
  echo "    -N   nonstop play"
  echo "    -v   verbose"
  exit 0
fi
while true
  do
    case $1 in
      -o)  DEV=$2 ; shift 2 ;;
      -s)  SPEED=$2 ; shift 2 ;;
      -P)  DEV="/dev/pcsp" ; SPEED=16000 ; shift ;;
      -N)  NONSTOP="Y" ; shift ;;
      -R)  RAND="Y" ; shift ;;
      -v)  QUIET="" ; shift ;;
      -*)  OPT="$OPT $1" ; shift ;;
      *)   break ;;
    esac
  done

if [ "$RAND" = "Y" ] ; then
  set `randomize $*`
fi
while true
do
  for i in $*
  do
     str32 $OPT $QUIET -s $SPEED -o $DEV $i
  done
  if [ "$NONSTOP" != "Y" ] ; then
    break
  fi
done
