# --- ROCK-COPYRIGHT-NOTE-BEGIN --- # # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # Please add additional copyright information _after_ the line containing # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by # the ./scripts/Create-CopyPatch script. Do not edit this copyright text! # # ROCK Linux: rock-src/misc/output/tts/functions.sh # ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. A copy of the GNU General Public # License can be found at Documentation/COPYING. # # Many people helped and are helping developing ROCK Linux. Please # have a look at http://www.rocklinux.org/ and the Documentation/TEAM # file for details. # # --- ROCK-COPYRIGHT-NOTE-END --- # first we will construct a universal 'say' function function say_proc() { while read line do while read -t1 subline; do line="$( echo -e "${line%.}.\\n$subline" | tail -n10 )" done case "$ROCKCFG_OUTPUT_TTS_SYSTEM" in ownscript) echo "${line%.}." | ($ROCKCFG_OUTPUT_TTS_SAYPROG 2>&1) > /dev/null ;; festival) echo "${line%.}." | $ROCKCFG_OUTPUT_TTS_FESTIVAL --tts - ;; mbrola) echo "${line%.}." | $ROCKCFG_OUTPUT_TTS_TXT2PHO \ | $ROCKCFG_OUTPUT_TTS_MBROLA \ $ROCKCFG_OUTPUT_TTS_VOICEFILE - -.wav \ | $ROCKCFG_OUTPUT_TTS_PLAY ;; flite) $ROCKCFG_OUTPUT_TTS_FLITE -t "${line%.}." 2>&1 > /dev/null ;; esac done } function say() { if [ -z "$ROCK_OUPUT_PLUGIN_TTS_PROC_ACTIVE" ]; then export ROCK_OUPUT_PLUGIN_TTS_PROC_ACTIVE=1 exec 198> >( say_proc ) fi echo "$*" >&198 } # A free-form header at start of a section usually followed by calls to # echo_status_terminal(). # echo_header_tts() { [ $ROCKCFG_OUTPUT_TTS_ENABLE_HEADER -eq 1 ] && say "$*" } # A free-form status message informaing the user of what is happening just # now. # echo_status_tts() { [ $ROCKCFG_OUTPUT_TTS_ENABLE_STATUS -eq 1 ] && say "$*" } # A free-form error or warning message if something fails. # echo_error_tts() { [ $ROCKCFG_OUTPUT_TTS_ENABLE_ERROR -eq 1 ] && say "$*" } # We deny to build a package for some reason. # # Usage: echo_pkg_deny # echo_pkg_deny_tts() { [ $ROCKCFG_OUTPUT_TTS_ENABLE_PKG_DENY -eq 1 ] && say `eval echo "$ROCKCFG_OUTPUT_TTS_TXT_PKG_DENY"` } # We start building a package. # # Usage: echo_pkg_start \ # # echo_pkg_start_tts() { [ $ROCKCFG_OUTPUT_TTS_ENABLE_PKG_START -eq 1 ] && say `eval echo "$ROCKCFG_OUTPUT_TTS_TXT_PKG_START"` } # We finished building a package. # # Usage: echo_pkg_finish # echo_pkg_finish_tts() { [ $ROCKCFG_OUTPUT_TTS_ENABLE_PKG_FINISH -eq 1 ] && say `eval echo "$ROCKCFG_OUTPUT_TTS_TXT_PKG_FINISH"` } # We aborted building a package. # # Usage: echo_pkg_abort # echo_pkg_abort_tts() { [ $ROCKCFG_OUTPUT_TTS_ENABLE_PKG_ABORT -eq 1 ] && say `eval echo "$ROCKCFG_OUTPUT_TTS_TXT_PKG_ABORT"` } # Whenever the tail of error logs are printed, this function is used for # that. The parameter may contain newlines. # echo_errorquote_tts() { [ $ROCKCFG_OUTPUT_TTS_ENABLE_ERRORQUOTE -eq 1 ] && say `eval echo "$ROCKCFG_OUTPUT_TTS_TXT_ERRORQUOTE"` }