HydraIssues

Mercator: per-instance audio device selection via launch args (-MicDevice, -AudioOutDevice)
open feature Project: mercatortalks Parent: #838 Reporter: cederik 19 Aug 2026 17:47

Description

Request

Add two launch arguments to the Mercator application (Mercator56.exe) so each running instance can select its audio devices by name instead of using the Windows defaults:

  • -MicDevice="<capture device name>" selects the microphone (audio capture) device, for example CABLE-A Output.
  • -AudioOutDevice="<render device name>" selects the audio output (render) device, for example CABLE-A Input or a named virtual speaker.

When an argument is absent, keep the current behavior (system default device). Device match should be a case-insensitive substring or exact name match on the WASAPI friendly name, and a missing device should log an error and fall back to the default rather than crash.

Why

The Hydra platform is adding multi-stream bodies (issue #504): one Windows machine runs N concurrent streams, each with its own virtual display, its own Sunshine instance, and its own visitor. The target scenario is three mercator-talks sessions on one RTX A5000 machine, which means three Mercator instances in one Windows session.

Mercator currently reads the default recording device (the platform sets VB-Cable "CABLE Output" as default, fed by hydravoice) and plays to the default render device. With three instances of the same executable:

  • All three instances open the same default microphone, so every instance hears all three visitors mixed together.
  • All three instances play into the same default output, so every stream captures all three experiences' audio.

Windows per-app audio routing cannot separate them because it keys on the executable path, and all three instances are the same exe. Per-instance device selection inside the application is the only clean mechanism.

Platform side (already planned, not part of this request)

  • Three virtual cables on the body (VB-Cable plus Cable A and Cable B) give three independent mic devices.
  • One hydravoice instance per stream slot, each writing into its own cable and listening on its own port.
  • Sunshine instance k captures the render device assigned to instance k via its audio_sink setting.
  • Each Mercator instance is launched by hydrabody with its own -MicDevice/-AudioOutDevice values, alongside the existing -ResX/-ResY -windowed -ForceRes args and a per-instance -UserDir.

Acceptance

  1. Two Mercator instances started on one machine with different -MicDevice values each capture only their own cable (speak into cable A, only instance A reacts).
  2. Two instances with different -AudioOutDevice values render into separate devices (verified with per-device level meters).
  3. An instance started without the new arguments behaves exactly as today.

Contact: this gates the 3x mercator-talks milestone of issue #504 (multi-stream bodies). Test hardware is available at bxl1-test-2 (chunky-turnip-23, RTX A5000).

Status update 2026-08-19

This request may be unnecessary. Windows per-app audio routing covers capture devices too, and the platform now launches each instance from a per-slot exe path (hardlink), giving each instance its own routing identity. Plan: pin per-slot default input/output devices via SoundVolumeView /SetAppDefault, no app change. This issue stays open as the FALLBACK until the multi-stream hardware spike (issue #504, spike 1) verifies per-app capture routing works for hardlinked exe identities and that Unreal honors the persisted override. Do not start work on this before that spike reports.

Session Context

Experience
mercator-talks

Comments (2)

api 18 Oct 2026 21:01

Correcting the premise of this ticket before anyone builds to it. Per-instance audio device selection CANNOT be done via launch args. Unreal hardcodes its audio output device: FMixerDevice::InitializeHardware pins OutputDeviceIndex to AUDIO_MIXER_DEFAULT_DEVICE_INDEX with the comment "TODO: Support overriding which audio device user wants to open", verbatim from 4.18 through 5.7, and GetDefaultDeviceName() returns an empty FString in both the XAudio2 and WASAPI backends. There is no -AudioDevice or -AudioMixerDevice switch in engine source in any version; the ones quoted on forums do not exist. A scan of the shipped 185 MB Mercator binary found only -AudioCallbackBufferFrameSize, -AudioNumBuffersToEnqueue and -AudioCaptureProtocol, and -ExecCmds / -DPCVars / -ini: are compiled out of Shipping builds. Parented to #838 as a Mercator build ask. If the project wants per-instance audio it needs a source or Blueprint change calling UAudioMixerBlueprintLibrary::SwapAudioOutputDevice (which IS compiled into this exe), not a launch argument. The platform-side route is per-process WASAPI loopback capture, tracked separately under #550/#553.

api 19 Oct 2026 10:02

Superseded in scope by #844, which carries the full audio finding: Sunshine always captures the system default (audio.cpp:481), audio_sink MOVES that default rather than selecting capture (:851), and Unreal hardcodes AUDIO_MIXER_DEFAULT_DEVICE_INDEX so no launch arg can exist. The per-instance route is a Sunshine fork using per-process WASAPI loopback, with UAudioMixerBlueprintLibrary::SwapAudioOutputDevice as the project-side fallback.