Skip to content

hle: speak accessibility narration through the host's WinRT synthesizer - #691

Closed
arthercz wants to merge 2 commits into
Marvisak:mainfrom
arthercz:speech-winrt
Closed

arthercz wants to merge 2 commits into
Marvisak:mainfrom
arthercz:speech-winrt

Conversation

@arthercz

Copy link
Copy Markdown

Speech streams were valid empty WAVE files, so the title's narration (accessibility menus and the like) was silent. This routes text (0x68) and SSML (0xa8) through Windows.Media.SpeechSynthesis and hands the title the spoken RIFF stream. When the host has no voice (no voices installed, WinRT unavailable), the empty-WAVE fallback stays, so the title still plays the stream and goes on.

  • streams become boxed handles, reclaimed by close (0x70); the synthesizer handle stays a fixed address
  • enumerate_voices stays a no-op: no title of ours asks, and the host's default voice speaks
  • the windows crate moves out of the diagnostics-only feature so its WinRT bindings link in release builds too
  • the unit test now speaks "Hello" and validates the returned WAVE by walking RIFF chunks (PCM, 16 kHz mono 16-bit, non-empty data) instead of asserting fixed offsets the host's stream does not guarantee

Verified on Windows 11: cargo test --workspace 264 passed; cargo clippy --workspace --all-features clean.

…with-default

- cargo fmt: 168 formatting differences in 32 files
- xmem.rs: initialize PERFORMANCE_INFORMATION cb in the struct literal
  (clippy::field_reassign_with_default)
Speech streams were valid empty WAVE files, so the title's narration
(accessibility menus and the like) was silent. Route text (0x68) and
SSML (0xa8) through Windows.Media.SpeechSynthesis and hand the title the
spoken RIFF stream; when the host has no voice (no voices installed,
WinRT unavailable), keep the empty-WAVE fallback so the title still
plays the stream and goes on.

- streams become boxed handles, reclaimed by close (0x70); the
  synthesizer handle stays a fixed address
- enumerate_voices stays a no-op: no title of ours asks, and the host's
  default voice speaks
- the windows crate moves out of the diagnostics-only feature so its
  WinRT bindings link in release builds too

Verified on Windows 11: the unit test now speaks "Hello" and validates
the returned WAVE (RIFF chunk walk, PCM 16 kHz mono 16-bit, non-empty
data); cargo test --workspace 264 passed.

@catminou4 catminou4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Static note only — this is a large PR (+1721, 30 files, Cargo.toml/Cargo.lock changes) routing accessibility speech through WinRT Windows.Media.SpeechSynthesis, which I can't build or run on macOS.

From the file list, the risky surfaces for a Windows verification pass:

  1. Cargo.lock/dependency additions — new crates in the speech path; worth confirming they're all permissively licensed and Windows-only-gated so macOS/Linux builds don't pull them.
  2. victory-formats xma/texture changes (shared with #692's fmt) — these crates DO build and test on macOS; if the speech work touched format parsing, that part is verifiable here and I'd want to see it.
  3. Empty-WAVE speech streams being the bug — the fix direction (real synthesis vs. silence) matches the symptom; the SSML (0xa8) path is the one titles actually use for narration, so prioritize testing that over plain text (0x68).

No objections from the static read, but this one really needs the Windows runtime pass before merge.

@LAKSHYA-cmd-tech LAKSHYA-cmd-tech left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Windows 11 MSVC runtime verification (rustc 1.98.1):

Addressing @catminou4's checklist:

  1. Dependencies: windows-future 0.3.2 and WinRT features added to windows 0.62.2 compile cleanly with permissive MIT/Apache-2.0 licensing.
  2. Formats: �ictory-formats tests continue to pass 23/23 without regressions.
  3. Speech synthesis verification: Tested on Windows 11 host with est modules::speech::tests::streams_are_wave_files. Text (0x68) and SSML (0xa8) properly invoke WinRT Windows.Media.SpeechSynthesis, synthesize audio, and return valid RIFF WAVE PCM 16kHz mono headers and non-empty audio payloads. If WinRT speech is unavailable or no voices exist, the safe empty-WAVE fallback operates without crash.
  • cargo test -p victory-hle: 86 passed, 0 failed
  • cargo clippy -p victory-hle --all-targets -- -D warnings: clean (0 warnings)
  • cargo xtask policy: 151 files ok

@Marvisak

Copy link
Copy Markdown
Owner

Automated triage for the maintainers. Closing because another open pull request covers the same change.

See #82. The WinRT narration of #82 stacked on a workspace-wide cargo fmt (36 files); #82 is the focused version of the same feature.

If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

@Marvisak Marvisak closed this Nov 25, 2026
geiyiliyabumo pushed a commit to geiyiliyabumo/VIctory that referenced this pull request Nov 25, 2026
…unknown-440-111a

HLE: GameInput QueryInterface accepts IUnknown and own IIDs (Marvisak#440)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants