#!/bin/sh

flite_repeat ()
{
  while true
  do
    tmpfile=`tempfile 2>/dev/null` || tempfile=/tmp/test$$
    trap "rm -f $tempfile" 0 1 2 5 15
    Xdialog --title "flite speech synthesizer: text input" --inputbox "type some text to synthesize (type Exit! to quit):" 14 81 2> $tempfile
    if [ "`cat $tempfile`" = "Exit!" ]; then 
      exit 0
    fi
    flite -t "`cat $tempfile`"
  done
}

flite_single ()
{
  tmpfile=`tempfile 2>/dev/null` || tempfile=/tmp/test$$
  trap "rm -f $tempfile" 0 1 2 5 15
  Xdialog --title "flite speech synthesizer: text input" --editbox "" 14 81 2> $tempfile
  flite -t "`cat $tempfile`"
}

flite_single
#flite_repeat
