diff --git a/speech/set-voice.sh b/speech/set-voice.sh index 4712eac..eefc37d 100755 --- a/speech/set-voice.sh +++ b/speech/set-voice.sh @@ -48,6 +48,12 @@ # Settings to improve accessibility of dialog. export DIALOGOPTS='--insecure --no-lines --visit-items' +# Turn off debug messages +export WINEDEBUG="-all" +# Set DISPLAY, as needed +if [ -z "$DISPLAY" ] ; then +export DISPLAY=:0 +fi # Get the desired wine bottle @@ -64,8 +70,6 @@ if [[ -z "${WINEPREFIX}" ]]; then exit 0 fi -echo "wineprefix = $WINEPREFIX" - msgbox() { # Returns: None # Shows the provided message on the screen with an ok button. @@ -171,6 +175,14 @@ EOF doRestore=1 trap restore_voice SIGINT +# In case the user hasn't run a game using sapi in this prefix yet, let's try to initialize all the registry keys properly. +cat << "EOF" > /tmp/speak.vbs +dim speechobject +set speechobject=createobject("sapi.spvoice") +speechobject.speak "" +EOF +wine cscript "z:\tmp\speak.vbs" + # Create an array of available voices. ifs="$IFS" IFS=$'\n' @@ -189,9 +201,6 @@ if [[ "$(uname)" == "Darwin" ]]; then else oldVoice="$(grep -P '"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\(SOFTWARE|Software)\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Tokens\\\\[^"]+"' "${WINEPREFIX}/user.reg" | sed -E -e 's/"DefaultTokenId"="([^"]+)"/\1/g')" fi -echo "oldVoice: ${oldVoice}" -echo "voiceList: ${voiceList[@]}" -echo "voiceListFullName: ${voiceListFullName[@]}" #exit 1 exit=1 while [[ $exit -ne 0 ]] ; do