HLE: speak the title's narration with the host's speech synthesizer #82
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/82"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by permadiego on 2026-11-24T00:19:29Z.
What changed
The title's narration (accessibility speech) was silent: every stream the accessibility provider created (slot 0x68 from text, 0xa8 from SSML) was an empty WAVE file. It is now spoken by the host's WinRT speech synthesizer (
Windows.Media.SpeechSynthesis) in its default voice.victory-hlenow depends onwindowson Windows (it was optional, for diagnostics only), addingFoundation,Media_SpeechSynthesisandStorage_Streams.victory-gpualready builds the crate, so this adds only those modules.Not done: voices are not listed (
enumerate_voicesstill reports none) and the title's voice choice is ignored; the default voice speaks everything.Verification
cargo test -p victory-hle speechon Windows 10 with the David, Zira and Mark voices:data) mixes and resamples to 1,600 samples of the expected value; 8-bit and non-WAVE input is refused.Not run in the game: I have no world run here, so the title playing the narration is untested.
🤖 Generated with Claude Code
Imported from Marvisak/VIctory. Originally posted by DaviTostes on 2026-11-24T01:12:01Z.
Tested
df5e928: pass (no regression).cargo xwin ... --target x86_64-pc-windows-msvc -p victory-hle: 83 passed, 1 failed, including the 4 tests this PR adds.modules::net::tests::only_loopback_is_reachable— Wine'sws2_32lacksWSAConnectByList(the same gap as #118), not this PR.No game data used.
Imported from Marvisak/VIctory. Originally posted by Exorion1er on 2026-11-24T09:33:30Z.
#691 is the same feature (WinRT
SpeechSynthesizerfor the title's narration), but its branch includes a workspace-widecargo fmtcommit (36 files, about +1,800/−650), so it conflicts withmainand would conflict with many open PRs. This PR changes onlyspeech.rsandCargo.tomland merges cleanly. #691's speech part has a few more tests, which could be carried over here.Checked by reading both diffs. AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by gabrielvbraga on 2026-11-24T13:47:34Z.
Tested this branch on Windows 11 with pt-BR voices (Microsoft Maria and Daniel), a different setup from the Windows 10 / English voices above:
cargo test -p victory-hle speechpasses all 4 tests, includingtext_and_ssml_are_spoken_when_a_voice_is_installed.I'd started the same thing in #825 before seeing this PR, and I'll drop mine in favour of this one. Two differences in my branch (https://github.com/gabrielvbraga/VIctory/tree/speech-synthesis) that may be worth taking:
speakjoins its thread with no time limit, so a synthesizer that never completes would block the title's thread for good. Mine keeps one long-lived speech thread and waits withrecv_timeout(10 s), falling back to the silent stream.close_streamfrees whatever handle it is given, so a second close of the same stream is a double free, andstream_size/stream_dataon a closed handle read freed memory. Mine keeps open streams in a map keyed by handle: close frees only a handle still in the map, and an unknown handle reads as silence.Happy to help if you want either change.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:15:51Z.
Automated triage for the maintainers.
Needs rebase. This PR does not merge cleanly into current
main(ac2525d). Conflicting files:crates/victory-hle/Cargo.toml.The content has not been reviewed yet; it will be once the branch is rebased onto
main.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by gabrielvbraga on 2026-11-26T16:50:57Z.
The two changes I suggested above are on this branch, rebased onto current main and passing clippy and tests: https://github.com/gabrielvbraga/VIctory/tree/speech-synthesis
Happy to send them as a small follow-up PR once this one is merged.
Imported from Marvisak/VIctory. Originally posted by kilolimaVI on 2026-11-26T21:17:35Z.
Crash report and a fix for this PR.
Crash: speaking on several threads at once kills the test process with
0xc0000409(STATUS_STACK_BUFFER_OVERRUN). Eachspeakcreates and drops its own WinRTSpeechSynthesizeron a thread of its own, and concurrent create/drop of the synthesizer is what crashes. Reproduced with a stress test (8 threads × 3 lines each): it crashed on the first run on Windows 11, AMD Radeon 780M / Ryzen 7 8845HS, toolchain 1.98.1. The title speaks from several threads, so this would hit it too.Fix: one dedicated speech thread owns a single lazily created synthesizer and takes lines from a queue (
OnceLock<Option<Sender<Line>>>); callers wait for their answer up to 10 s. With it the same stress test passes 20/20 runs and clippy is clean.Commits on top of this PR's head: https://github.com/kilolimaVI/VIctory/commits/pr82-fix
Happy to open it as a PR against this branch, or the fix can be cherry-picked.
AI-assisted (Claude).
Imported from Marvisak/VIctory. Originally posted by kilolimaVI on 2026-11-27T10:24:44Z.
Brought onto current main with the concurrency fix as #3394, crediting you as co-author. Thanks for the original!
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.