set-voice.sh now correctly detects the RHVoice that is installed and sets it instead of just using bdl.

This commit is contained in:
Storm Dragon 2022-08-23 13:19:52 -04:00
parent 4db6eae6a0
commit 963a415647

View File

@ -51,6 +51,8 @@ if [[ "$(uname)" == "Darwin" ]]; then
sed="gsed" sed="gsed"
grep="ggrep" grep="ggrep"
fi fi
export grep
export sed
# Settings to improve accessibility of dialog. # Settings to improve accessibility of dialog.
export DIALOGOPTS='--insecure --no-lines --visit-items' export DIALOGOPTS='--insecure --no-lines --visit-items'
# Turn off debug messages # Turn off debug messages
@ -136,7 +138,10 @@ set_voice() {
[ "$x" = "$tmp" ] && break [ "$x" = "$tmp" ] && break
counter=$(( $counter + 1 )) counter=$(( $counter + 1 ))
done done
local RHVoiceName="$(find "${WINEPREFIX}/drive_c/ProgramData/Olga Yakovleva/RHVoice/data/voices/" -maxdepth 1 -type d)"
RHVoiceName="${RHVoiceName##*/}"
fullVoice="${voiceListFullName[$counter]}" 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 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 # Remove any existing rate change for voices
$sed -i '/"DefaultTTSRate"=dword:/d' "${WINEPREFIX}/user.reg" $sed -i '/"DefaultTTSRate"=dword:/d' "${WINEPREFIX}/user.reg"
@ -152,7 +157,10 @@ test_voice() {
[ "$x" = "$tmp" ] && break [ "$x" = "$tmp" ] && break
counter=$(( $counter + 1 )) counter=$(( $counter + 1 ))
done done
local RHVoiceName="$(find "${WINEPREFIX}/drive_c/ProgramData/Olga Yakovleva/RHVoice/data/voices/" -maxdepth 1 -type d)"
RHVoiceName="${RHVoiceName##*/}"
fullVoice="${voiceListFullName[$counter]}" 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 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" $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 cat << "EOF" > /tmp/speak.vbs
@ -182,7 +190,7 @@ voiceListFullName=($($grep -P '\[Software\\\\(Wow6432Node\\\\|)Microsoft\\\\Spee
IFS="$ifs" IFS="$ifs"
voiceList=() voiceList=()
for x in "${voiceListFullName[@]}" ; do 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 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')" 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 exit=1