52 lines
1.6 KiB
Bash
Executable File
52 lines
1.6 KiB
Bash
Executable File
#!/bin/sh
|
|
# Build a 32-bit Wine prefix, install the SAPI4 runtime, the MSTTS engine and
|
|
# the MSTTS voices, and register everything.
|
|
#
|
|
# Usage: setup/setup-prefix.sh [path-to-asset-repo]
|
|
# Default asset repo: ../Microsoft-Sam-Mary-Mike-TruVoice-WSAPI4
|
|
set -eu
|
|
|
|
HERE=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
|
ROOT=$(CDPATH= cd -- "$HERE/.." && pwd)
|
|
ASSETS=${1:-$ROOT/../Microsoft-Sam-Mary-Mike-TruVoice-WSAPI4}
|
|
|
|
[ -d "$ASSETS/spchapi" ] || { echo "asset dir not found: $ASSETS" >&2; exit 1; }
|
|
|
|
export WINEPREFIX=${WINEPREFIX:-$HOME/.wine-microslopsam}
|
|
export WINEARCH=win32
|
|
|
|
if [ -z "${DISPLAY:-}" ]; then
|
|
WRUN="xvfb-run -a wine"
|
|
else
|
|
WRUN="wine"
|
|
fi
|
|
|
|
echo "== prefix: $WINEPREFIX"
|
|
mkdir -p "$WINEPREFIX"
|
|
$WRUN wineboot -u
|
|
|
|
SPEECH_DIR="$WINEPREFIX/drive_c/windows/speech"
|
|
ENGINE_DIR="$WINEPREFIX/drive_c/Program Files/Common Files/microsoft shared/SpeechEngines/TTS"
|
|
mkdir -p "$SPEECH_DIR" "$ENGINE_DIR"
|
|
|
|
echo "== runtime -> $SPEECH_DIR"
|
|
cp "$ASSETS"/spchapi/SPEECH.DLL "$SPEECH_DIR/"
|
|
|
|
echo "== engine + voices -> $ENGINE_DIR"
|
|
cp "$ASSETS"/msttsl/msttssyn.dll "$ENGINE_DIR/"
|
|
cp "$ASSETS"/msttsl/*.vce "$ASSETS"/msttsl/*.cfg "$ENGINE_DIR/"
|
|
|
|
echo "== registry"
|
|
python3 "$HERE/inf2reg.py" --section APIReg \
|
|
--define "49000=C:\\windows\\speech" \
|
|
"$ASSETS/spchapi/SPCHAPI.INF" > "$HERE/out-spchapi.reg"
|
|
python3 "$HERE/inf2reg.py" --section TTSReg \
|
|
--define "49000=C:\\Program Files\\Common Files\\microsoft shared\\SpeechEngines\\TTS" \
|
|
"$ASSETS/msttsl/mstts.inf" > "$HERE/out-mstts.reg"
|
|
|
|
$WRUN regedit /S "$HERE/out-spchapi.reg"
|
|
$WRUN regedit /S "$HERE/out-mstts.reg"
|
|
|
|
echo "== done"
|
|
echo "list voices: $WRUN $ROOT/host/sapi4host.exe -l"
|