# playaudio - execute an audio player
# GEM-init expects this script in /usr/local/bin/
# prepared for trying yper-snd.ttp, lps.ttp, gemjing.prg and /dev/audio
# $1 is the full name of the audio file without file extension
#
if [ -f /usr/bin/yper-snd.ttp ] ; then
  for ext in wav snd voc iff avr dvs hsn mod
  do
    if [ -r $1.$ext ]; then
      exec /usr/bin/yper-snd.ttp $1.$ext >>/var/log/snd.log
    fi
  done
elif [ -f /usr/bin/lps.ttp ] ; then
  for ext in wav hsn iff svx snd au avr voc sam
  do
    if [ -r $1.$ext ]; then
      exec /usr/bin/lps.ttp -v 2000 $1.$ext >>/var/log/lps.log
    fi
  done
elif [ -f /usr/bin/gemjing.prg ] ; then
  for ext in wav hsn avr smp dvs au snd
  do
    if [ -r $1.$ext ]; then
      cd /usr/bin
#     x.gtp gemjing.prg -q $(unix2dos $1.$ext) ...not needed
      x.gtp gemjing.prg -q $1.$ext
    fi
  done
elif [ -c /dev/audio ] ; then
  cp $1 /dev/audio >/dev/null &
else
  echo "error: no audio player or audio device found"
fi
