#!/bin/csh -f

#     soundtrack.csh v. 1.02
#               by
# L. Padilla (padilla@gae.ucm.es)
#      Madrid, January 2003.

echo ""

if (-x /usr/bin/aumix) then

  if (-f ~/.aumixrc && ! -f ~/.aumixrc.stmp) mv -f ~/.aumixrc ~/.aumixrc.stmp

  /usr/bin/aumix -d /dev/mixer -S
  /usr/bin/aumix -d /dev/mixer -m 100 -r 100 -m R

else

  echo "aumix not found, use your favorite mixer to"
  echo "set mic and rec channels to maximum level."
  echo ""

endif

echo "" > /tmp/soundtrack.tmp

while ("`cat /tmp/soundtrack.tmp`" != "x")

  sox -c 1 -s -w -r 48000 -t ossdsp /dev/dsp -t dat - band 0 4000 | soundtrack $*

  echo "Press x[enter] to exit or just [enter] to swipe again."

  head -c 1 > /tmp/soundtrack.tmp

end

rm -f /tmp/soundtrack.tmp

if (-x /usr/bin/aumix) then

  /usr/bin/aumix -d /dev/mixer -L > /dev/null

  if (-f ~/.aumixrc.stmp) then

    mv -f ~/.aumixrc.stmp ~/.aumixrc

  else

    rm -f ~/.aumixrc

  endif

else

  echo ""
  echo "aumix not found, use your favorite mixer to"
  echo "set mic and rec channels to minimum level."

endif

echo ""

exit
