From 963a4156472a1109d8188444ac87bd0312ad5b76 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Tue, 23 Aug 2022 13:19:52 -0400 Subject: [PATCH] set-voice.sh now correctly detects the RHVoice that is installed and sets it instead of just using bdl. --- speech/set-voice.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/speech/set-voice.sh b/speech/set-voice.sh index 03e12a7..bd60d08 100755 --- a/speech/set-voice.sh +++ b/speech/set-voice.sh @@ -51,6 +51,8 @@ if [[ "$(uname)" == "Darwin" ]]; then sed="gsed" grep="ggrep" fi +export grep +export sed # Settings to improve accessibility of dialog. export DIALOGOPTS='--insecure --no-lines --visit-items' # Turn off debug messages @@ -136,7 +138,10 @@ set_voice() { [ "$x" = "$tmp" ] && break counter=$(( $counter + 1 )) done + local RHVoiceName="$(find "${WINEPREFIX}/drive_c/ProgramData/Olga Yakovleva/RHVoice/data/voices/" -maxdepth 1 -type d)" + RHVoiceName="${RHVoiceName##*/}" fullVoice="${voiceListFullName[$counter]}" + fullVoice="${fullVoice/RHVoice/RHVoice\\\\${RHVoiceName}}" wineserver -k # If we don't do this it's likely wine will overwrite our reverted change or even clobber the registry key entirely # Remove any existing rate change for voices $sed -i '/"DefaultTTSRate"=dword:/d' "${WINEPREFIX}/user.reg" @@ -152,7 +157,10 @@ test_voice() { [ "$x" = "$tmp" ] && break counter=$(( $counter + 1 )) done + local RHVoiceName="$(find "${WINEPREFIX}/drive_c/ProgramData/Olga Yakovleva/RHVoice/data/voices/" -maxdepth 1 -type d)" + RHVoiceName="${RHVoiceName##*/}" fullVoice="${voiceListFullName[$counter]}" + fullVoice="${fullVoice/RHVoice/RHVoice\\\\${RHVoiceName}}" wineserver -k # If we don't do this it's likely wine will overwrite our reverted change or even clobber the registry key entirely $sed -i -E -e 's/"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\(SOFTWARE|Software)\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Token(Enum|)s\\\\[^"]+"/"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\'"${fullVoice//\\/\\\\}"'"/g' "${WINEPREFIX}/user.reg" cat << "EOF" > /tmp/speak.vbs @@ -182,7 +190,7 @@ voiceListFullName=($($grep -P '\[Software\\\\(Wow6432Node\\\\|)Microsoft\\\\Spee IFS="$ifs" voiceList=() for x in "${voiceListFullName[@]}" ; do - voiceList+=("$(echo "$x" | $sed -E -e 's/Software\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Token(Enum|)s\\\\(.+)/\1/g')") + voiceList+=("$(echo "$x" | $sed -E -e 's/Software\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Token(Enum|)s\\\\(.+)/\3/g')") done oldVoice="$($grep -P '"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\(SOFTWARE|Software)\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Token(Enum|)s\\\\[^"]+"' "${WINEPREFIX}/user.reg" | $sed -E -e 's/"DefaultTokenId"="([^"]+)"/\1/g')" exit=1