Massive rewrite of how speaking with TTS is handled. This should open up compatibility with pretty much every wad out there as far as TTS is concerned. There may be unwanted speech until everything is ironed out.
This commit is contained in:
@ -1,5 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
launch_game() {
|
||||
pushd "${doomPath}"
|
||||
exec stdbuf -oL ${gzdoom} ${@} | speak
|
||||
popd
|
||||
}
|
||||
|
||||
speak() {
|
||||
startSpeech=1
|
||||
while IFS= read -r line; do
|
||||
echo "$line"
|
||||
if [[ $startSpeech -eq 1 ]] && [[ "$line" =~ ^-{5,}$ ]]; then
|
||||
startSpeech=0
|
||||
continue
|
||||
fi
|
||||
if [[ $startSpeech -eq 0 ]]; then
|
||||
echo "${line}" | {
|
||||
grep "${antiGrepStrings[@]}" |
|
||||
sed "${sedStrings[@]}" |
|
||||
spd-say -e ${spd_module} ${spd_pitch} ${spd_rate} ${spd_voice} ${spd_volume} -- > /dev/null 2>&1;
|
||||
}
|
||||
echo "$line"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Dialog setup:
|
||||
DIALOG_ITEM_HELP=""
|
||||
export DIALOGOPTS='--no-lines --visit-items'
|
||||
@ -48,10 +73,14 @@ doomGames=(
|
||||
|
||||
export antiGrepStrings=(
|
||||
'-E' '-v'
|
||||
'-e' '^(Decal|Fluidsynth|Load|Parse)[^ ]+'
|
||||
'-e' '^OS: .*Linux, Linux .*'
|
||||
'-e' '^Resolution:'
|
||||
'-e' '^[0-9]'
|
||||
'-e' '^P_StartScript:'
|
||||
'-e' '^(Facing|INTRO|MAP[0-9]+|README[0-9]+)'
|
||||
'-e' '^ *TITLEMAP'
|
||||
'-e' '^\[Toby Accessibility Mod\] (INTRO|READMe)([0-9]+).*'
|
||||
'-e' 'key card'
|
||||
'-e' '^Computer voice:'
|
||||
'-e' '^Ugh\.\.\. Huh\? What the hell was that\?! Better go check it out\.\.\.$'
|
||||
)
|
||||
|
||||
export grepStrings=(
|
||||
@ -217,8 +246,7 @@ case ${buttonCode} in
|
||||
'-warp' "$map"
|
||||
)
|
||||
fi
|
||||
pushd "$doomPath"
|
||||
exec stdbuf -oL ${gzdoom} ${gameOption} "$gamePath/Addons/DOOM/TobyV${tobyVersion%%-*}_"* "${flags[@]}" | while IFS= read -r l ; do echo "$l" | { grep "${grepStrings[@]}" | grep "${antiGrepStrings[@]}" | sed "${sedStrings[@]}" | spd-say -e ${spd_module} ${spd_pitch} ${spd_rate} ${spd_voice} ${spd_volume} --; } ; echo "$l";done
|
||||
launch_game ${gameOption} "${flags[@]}"
|
||||
;;
|
||||
2)
|
||||
# Exit was pressed, so exit.
|
||||
@ -270,15 +298,13 @@ case ${buttonCode} in
|
||||
)
|
||||
fi
|
||||
pushd "${doomPath}"
|
||||
exec stdbuf -oL ${gzdoom} ${gameOption} "$gamePath/Addons/TobyV${tobyVersion%%-*}_"* "${flags[@]}" | while IFS= read -r l ; do echo "$l" | { grep "${grepStrings[@]}" | grep "${antiGrepStrings[@]}" | sed "${sedStrings[@]}" | spd-say -e ${spd_module} ${spd_pitch} ${spd_rate} ${spd_voice} ${spd_volume} --; } ; echo "$l";done
|
||||
launch_game ${gameOption} "${flags[@]}"
|
||||
;;
|
||||
0)
|
||||
if [[ "${gameOption%% *}" == "custom_game" ]]; then
|
||||
custom_game
|
||||
else
|
||||
pushd "${doomPath}"
|
||||
exec stdbuf -oL ${gzdoom} ${gameOption} | while IFS= read -r l ; do echo "$l" | { grep "${grepStrings[@]}" | grep "${antiGrepStrings[@]}" | sed "${sedStrings[@]}" | spd-say -e ${spd_module} ${spd_pitch} ${spd_rate} ${spd_voice} ${spd_volume} -- > /dev/null 2>&1; }; echo "$l";done
|
||||
fi
|
||||
launch_game ${gameOption[@]} "${flags[@]}"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
Reference in New Issue
Block a user