Skip to content

feat(hle): add silent spatial-audio fallback endpoint and held durations for VICTORY_KEYS - #405

Open
gdemontalivet wants to merge 1 commit into
pragyaangaur:mainfrom
gdemontalivet:feat/macos-silent-audio-key-holds
Open

gdemontalivet wants to merge 1 commit into
pragyaangaur:mainfrom
gdemontalivet:feat/macos-silent-audio-key-holds

Conversation

@gdemontalivet

Copy link
Copy Markdown
Contributor

Two small quality-of-life gaps affect headless Macs, CI runners, and unattended test runs:

  1. Missing host audio render endpoint or muted benchmark runs: On machines without an active audio output device (such as a headless Mac mini, SSH/CI session, or disconnected display audio), IMMDeviceEnumerator::GetDefaultAudioEndpoint(eRender, ...) fails with E_NOTFOUND, stalling audio initialization; during automated A/B runs on desktop Macs, there is also no switch to keep title audio timing active without playing sound through the host speakers.
  2. Multi-second held prompts in VICTORY_KEYS: feat(input): VICTORY_KEYS in release builds, for unattended runs past the title's prompts #285 enabled VICTORY_KEYS in release builds with a fixed 200 ms tap per entry, whereas some input prompts require holding a key or button down for several seconds (for example 6:Enter:2.5).

What changed

  1. Silent WASAPI + ISpatialAudioClient fallback endpoint (crates/victory-hle/src/modules/audio/silent.rs, audio.rs, docs/macos.md):
    • Wrap the host IMMDeviceEnumerator returned by CoCreateInstance so systems with a working render endpoint continue to use native host audio unchanged unless VICTORY_SILENT_AUDIO=1 is set.
    • When GetDefaultAudioEndpoint returns E_NOTFOUND or VICTORY_SILENT_AUDIO=1 is set, return a COM-counted silent render IMMDevice implementing IAudioClient / IAudioClient3, IAudioRenderClient, IAudioClock, IPropertyStore, and ISpatialAudioClient / ISpatialAudioObjectRenderStream (48 kHz stereo IEEE float, 10 ms period timer signaling the client's render event so the audio engine's clock and mixing thread advance at real-time cadence without host audio output).
  2. Optional hold duration in VICTORY_KEYS (crates/victory-hle/src/modules/gameinput.rs):

How it was tested

  • Apple M5 Max, CrossOver Preview with D3DMetal, isolated test bottle:
    • cargo test --workspace (native macOS): all passed (0 failed).
    • victory-hle --lib under Wine (--test-threads=1): audio (18/18) and gameinput (11/11) tests passed, covering host-endpoint passthrough, missing-endpoint fallback, VICTORY_SILENT_AUDIO=1 override, COM reference counting, 48 kHz render-event pacing, and tap/hold VICTORY_KEYS parsing.
    • cargo xtask policy, git diff --check, and cargo clippy --workspace --all-targets --target x86_64-pc-windows-gnullvm -- -D warnings (with and without --features diagnostics): clean. All test inputs are synthetic.

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.

1 participant