diff --git a/set-voice.sh b/set-voice.sh index e878f21..8f40927 100755 --- a/set-voice.sh +++ b/set-voice.sh @@ -1,6 +1,8 @@ #!/bin/bash # Set Voice # Set the default wine voice based on installed options. +# Rate can be specified as a numeric argument to this script, 1 through 9. +# The default rate is 7 # # Copyright 2020, Storm Dragon, # @@ -104,7 +106,9 @@ set_voice() { done fullVoice=${voiceListFullName[$counter]} 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\\\\Tokens\\\\[^"]+"/"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\'"${fullVoice//\\/\\\\}"'"/g' "${WINEPREFIX}/user.reg" + # Remove any existing rate change for voices + sed -i '/"DefaultTTSRate"=dword:/d' "${WINEPREFIX}/user.reg" + sed -i -E -e 's/"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\(SOFTWARE|Software)\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Tokens\\\\[^"]+"/"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\'"${fullVoice//\\/\\\\}"'"\n"DefaultTTSRate"=dword:0000000'${2:-7}'/g' "${WINEPREFIX}/user.reg" } test_voice() { @@ -151,7 +155,7 @@ voice="$(menulist ${voiceList[@]})" case $? in 0) - set_voice "$voice" ; exit=0 ;; + set_voice "$voice" "$1" ; exit=0 ;; 3) test_voice "$voice";; *)