Repository navigation
App device routing - #123
Merged
Merged
Conversation
…tory IAppAudioRouting with AudioPolicyRouting: the undocumented WinRT factory Windows.Media.Internal.AudioPolicyConfig (AudioSes.dll), picked by the interface IDs it lists (Windows 11 ab3d4648, Windows 10 2a59116d) and called through its vtable with raw HSTRINGs. Every answer of Windows is a result value; an unknown interface makes the feature unavailable with one warning. Registered in DI, not used yet.
AppRoutingRules: one app across devices (grouping parameter or file, linked transitively), the route as seen from one device, whether a row belongs in a device's list, the app's home row, when a volume copy applies, and the outcome of a move from Windows' answer for each process.
AppRouting reads every app's route from Windows on one worker and sets Route, RouteDeviceName and PlaysHere on its models; triggers (a session starting or stopping, apps or devices coming and going, the default device changing) only mark the app as waiting. Moves set all processes of the app, and the app's volume and mute are copied once to the device it moved to when it first plays there. Sessions know whether they play (registered before the state is read), device models group sessions by the shared SameApp rule, and inactive devices are named through the device enumerator. Created at start; no UI yet.
A move's log and volume copy step is skipped after Dispose and its result is cancelled; a failed read after a move Windows made still reports the move. The factory file keeps its byte order mark.
Every app that can be moved opens from its icon (System Sounds only with several sessions) and shows a device box before its sessions: "Default device" with the current default, then each active device; a pinned device that isn't active is the last item, greyed, only its icon when Windows can't name it. Picking a device moves the app; a notice above the bottom bar says where it is set to play, with Undo for 5 s, or that the move failed. A pinned app shows its device's name next to its name, and rows of apps that play on another device are hidden. Opening the mixer reads every app's route again. Five strings in all languages.
App and foreground-app hotkeys find apps on every device through AppRouting: a saved app's hotkeys sit on its home model (where it is set to play; Windows refuses a combination twice) and move when that changes, and a press gives every model of the app the same volume or mute. An app that only plays on another device gets its hotkeys too. The same-app rule no longer takes an empty grouping parameter or path as shared.
A1 opens the test app's box and checks it lists the default device and every output device without changing anything. A2 moves a test app with its own executable to another device, checks the notice, box and badge, presses Undo, and always puts it back; inconclusive with one output device.
While a pinned device is disabled or unplugged, Windows plays the app on the default device, and when the device returns it reports the pin again but leaves the app where it is: the app only hears of its route when it's set. When a device becomes active, apps pinned to it that don't play there are set to it again.
Each Set makes the app reopen its stream, and refreshes before it plays on the returned device would set it again; an app is sent back once per return, and again if the device leaves and returns once more.
G-Stas
marked this pull request as ready for review
October 30, 2026 00:56
The test audio app gets --routing (Windows' automatic stream routing, so it moves at once like a real player). The UI tests read, set and reset an app's route through Windows' audio policy (the app's interop files compiled into the tests) and can turn a second device off and on; they never touch a default device or a device another app plays on. New tests: a move plays there, leaves the default's list and comes back with Undo; the moved app is listed on its device with the device's name; it keeps its volume; it goes back to its device when the device is turned on again; a route set outside Volumey shows; app hotkeys reach the app on its new device.
The scenario IDs of the plan don't belong in the code; the test names say what each checks.
-AppDir points it at another Debug build, e.g. a trimmed self-contained publish, instead of the one in bin.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #14