Skip to content

feat(libSceAudioOut): host volume and mute hotkeys, opt-in mute on focus loss - #12569

Merged
adriadam10 merged 75 commits into
boykopovar:mainfrom
MarcZX10:feat/host-volume-mute
Oct 30, 2026
Merged

adriadam10 merged 75 commits into
boykopovar:mainfrom
MarcZX10:feat/host-volume-mute

Conversation

@MarcZX10

Copy link
Copy Markdown
Contributor

What

Host-side master volume and mute for the game window, plus an opt-in mute while the window has no focus. This is a control of the host, like a media player's volume. It is not a console behaviour and the title does not see it.

  • Hotkeys are three new input-mapping actions in the same system as F10, F11 and F12: VolumeDown (F5), VolumeUp (F6), ToggleMute (F8). They are keyboard-only, rebindable in anyps5-input.ini, never reach the pad, and follow the same conflict rule as the existing actions (a shared key triggers both). F5, F6 and F8 are used by no other default binding. Each handled press prints one line on stderr.
  • Volume is 0 to 100 in steps of 5, starting at 100 or at ANYPS5_VOLUME. The gain is the square of the volume as a fraction of 100, in 16.16 fixed point. Mute is separate from the volume, so unmuting restores it. A volume key while muted also unmutes. A gain change ramps at a constant per-frame step (10 ms for a full-scale change), exact and continuous across buffers.
  • ANYPS5_MUTE_ON_FOCUS_LOSS=1 mutes while the display window has no focus and restores on focus gained. Unset or 0 is today's behaviour. It never replaces the user's own mute. Only focus events of the display window count. An invalid value of either variable, including an empty one, stops the game with an error naming the variable.
  • At the default state (volume 100, not muted, focus not lost) the audio path is bypassed entirely: the title's own buffer pointer goes to SDL, with no copy and no multiply. A reopened port or a returned ramp is exactly at unity again.
  • Where it applies: AudioOut.cpp just before SDL_QueueAudio for every non-vibration port, and AudioOut2Context.cpp in DeviceCallback (the only place the main mix reaches the speakers). libSceAudio3d plays through sceAudioOutOutput, so it is covered. Not touched: the controller's sound card and haptics (vibration ports, the AudioOut2 pad device), and the microphone.
  • No on-screen indicator: feedback is the stderr line only.

Commits (67): the pure state class and its steps, mute independence, focus, gain (each with its test), the ramp and the S16 and float gain with their tests, the bypass filter, the strict setting parsers and message wording, the shared state, one commit per playback hook, the three input controls (per action: key request, mapping action, default key, each with a test), the VideoOut wiring (settings at startup, hotkeys, focus events, first focus read), and docs per file (ENVIRONMENT.md, INPUT_MAPPING.md in three commits, USAGE.md). The input mapper's action list and defaults follow the native table (its source-contract test).

Overlaps with open PRs (edits kept local, branched from main): #7499 (InputMapping.hpp/.cpp, PadInput.cpp, tests/InputMapping.cpp, INPUT_MAPPING.md), #11860 (input mapper and tests/InputMapping.cpp), #9154 (AudioOut.cpp, AudioOut2Context.cpp, VideoOut CMakeLists.txt, PadInput.cpp), #11049 and #11584 (libSceAudioOut/CMakeLists.txt), #12379 and #12536 (VideoOut, CMake and VulkanDevice areas; no code of theirs used).

Tested

Linux x86_64, GCC 12, throwaway archive build of this branch and of main (319621b). No console, no title.

  • New tests, all passed: audio_out_host_volume (state machine, steps at 0 and 100, mute restore, focus transitions, gain, strict setting parsers, messages), audio_out_host_gain (S16 and float on mono, stereo and 8 channels: byte-for-byte bypass at unity, exact first sample and landing frame, up and down ramps, no step above the slope, a ramp split across buffers equal to one buffer, saturation, rounding, filter pointer and copy rules), audio_out_host_volume_state (shared state, env parsing, invalid values refused and named, concurrent readers), pad_host_volume (requests and focus events). pad_keyboard_mouse and pad_input_mapping gained cases for the three actions, their defaults, key repeat, mouse and wheel refusal, shared keys and unknown names. Input mapper: node --test tests 25 pass.
  • Existing audio, input and video-out tests, ctest -R '^(audio_out|pad_|video_out_)': main 85 tests, 0 failed; this branch 89 tests, 0 failed. The per-test results are identical except for the four added tests (pad_command_file was not built in the first branch run and passed when built).
  • Video-out with a display: ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation xvfb-run -a ctest -R '^(video_out_|pad_)' -V with -DANYPS5_VIDEO_OUT_TEST_DRIVER=x11: main 33/33 passed, branch 34/34 passed (the extra one is pad_host_volume). The validation layer was found in both runs and VUID- appears 0 times in both.
  • Negative controls: 51 mutations of the new code (step clamps, mute independence, focus rules, gain at default and its curve, parsers, bypass, ramp, saturation, rounding, per-frame gain, filter copy rules, state publishing, env names, window ID and event rules, request order, key repeat, keyboard-only rules, default keys) were applied in scratch copies. 50 fail at the intended assertion. The last one, accepting an empty level, is an equivalent mutant because std::from_chars already rejects an empty string. Two controls first passed (an upward ramp without a final snap, S16 truncation instead of rounding); tests were added and now catch them. Removing the bypass is not caught by the byte-for-byte S16 sample test, since unity is an identity; the filter's pointer and copy assertions catch it.
  • check_conventions.py --base upstream/main, git diff --check, the public-headers audit and env_reference.py --check are clean.

Not run: Windows, macOS, a real audio device (the hooks themselves were reasoned, not heard), a real window system with a real SDL focus sequence (the hotkey wiring and focus events in PadInput.cpp are covered through the pure functions they call, not end to end), a hardware GPU, a console.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: llvmpipe (LLVM 15.0.6, 256 bits), Vulkan software rasterizer via Xvfb (x11 driver), Linux 6.1; no hardware GPU
  • AI-assisted: yes

@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 9154 core/libs/prx/libSceVideoOut/include/PadInput.hpp L65

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 674 core/libs/prx/libSceVideoOut/CMakeLists.txt
core/libs/prx/libSceVideoOut/include/PadInput.hpp
core/libs/prx/libSceVideoOut/src/InputMapping.cpp
core/libs/prx/libSceVideoOut/src/PadInput.cpp
docs/user/INPUT_MAPPING.md
PR 1896 docs/dev/ENVIRONMENT.md
PR 3786 docs/user/USAGE.md
PR 4472 docs/dev/ENVIRONMENT.md
PR 5021 core/libs/prx/libSceAudioOut/CMakeLists.txt
core/libs/prx/libSceVideoOut/CMakeLists.txt
docs/user/USAGE.md
PR 5925 docs/user/USAGE.md
PR 6185 docs/dev/ENVIRONMENT.md
PR 6186 docs/dev/ENVIRONMENT.md
PR 6924 docs/dev/ENVIRONMENT.md
docs/user/USAGE.md
PR 7449 docs/dev/ENVIRONMENT.md
PR 7457 docs/dev/ENVIRONMENT.md
PR 7499 core/libs/prx/libScePad/include/InputMapping.hpp
core/libs/prx/libSceVideoOut/src/InputMapping.cpp
core/libs/prx/libSceVideoOut/src/PadInput.cpp
core/libs/prx/libSceVideoOut/tests/InputMapping.cpp
docs/user/INPUT_MAPPING.md
PR 7514 docs/dev/ENVIRONMENT.md
PR 7604 docs/dev/ENVIRONMENT.md
PR 7642 docs/dev/ENVIRONMENT.md
docs/user/USAGE.md
PR 7922 docs/dev/ENVIRONMENT.md
PR 8004 docs/dev/ENVIRONMENT.md
PR 8484 docs/dev/ENVIRONMENT.md
PR 8542 docs/dev/ENVIRONMENT.md
PR 9012 docs/dev/ENVIRONMENT.md
PR 9289 docs/dev/ENVIRONMENT.md
PR 9345 docs/dev/ENVIRONMENT.md
docs/user/USAGE.md
PR 9356 docs/dev/ENVIRONMENT.md
PR 9387 docs/dev/ENVIRONMENT.md
PR 9712 docs/dev/ENVIRONMENT.md
PR 9852 docs/dev/ENVIRONMENT.md
PR 10026 docs/dev/ENVIRONMENT.md
PR 10043 docs/dev/ENVIRONMENT.md
docs/user/USAGE.md
PR 10112 core/libs/prx/libScePad/CMakeLists.txt
core/libs/prx/libSceVideoOut/CMakeLists.txt
core/libs/prx/libSceVideoOut/include/PadInput.hpp
core/libs/prx/libSceVideoOut/src/PadInput.cpp
PR 10193 docs/dev/ENVIRONMENT.md
docs/user/USAGE.md
PR 10442 docs/dev/ENVIRONMENT.md
PR 10757 docs/dev/ENVIRONMENT.md
PR 10792 docs/user/USAGE.md
PR 10846 docs/dev/ENVIRONMENT.md
PR 10861 docs/user/USAGE.md
PR 10894 docs/dev/ENVIRONMENT.md
PR 11119 core/libs/prx/libSceVideoOut/CMakeLists.txt
PR 11948 core/libs/prx/libSceVideoOut/CMakeLists.txt
docs/dev/ENVIRONMENT.md
PR 12120 docs/dev/ENVIRONMENT.md
PR 12308 core/libs/prx/libScePad/CMakeLists.txt
PR 12309 core/libs/prx/libScePad/CMakeLists.txt
PR 12310 core/libs/prx/libScePad/CMakeLists.txt
PR 12311 core/libs/prx/libScePad/CMakeLists.txt
PR 12312 core/libs/prx/libScePad/CMakeLists.txt
PR 12324 docs/dev/ENVIRONMENT.md
PR 12544 docs/dev/ENVIRONMENT.md

@adriadam10 adriadam10 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The full Build's windows job fails on this head in pad_sdl (Exit code 0xc0000409, an abort() after 0.38 s, run 40951632982). I reran the failed jobs once and it failed the same way, so it is not a flake; main does not have this failure.

  • core/libs/prx/libSceVideoOut/CMakeLists.txt:26: libSceVideoOut now links libSceAudioOut, a second shared library that statically links its own SDL2 and libScePad. pad_sdl_tests (tests/PadSdl.cpp) drives PadInput with SDL virtual joysticks and aborts in one of its Require calls, so the new dependency, or the new PadInput code that runs inside that test (HostVolumeConfigureFromEnvironment_nid_no_patch in the constructor, the focus read in the first Update), changes what that test sees on Windows.
  • Please reproduce pad_sdl on Windows and find which Require aborts. One direction: keep libSceVideoOut from depending on libSceAudioOut (for example put the shared volume state somewhere both already link, such as libScePad) and check that pad_sdl passes again.

The other jobs on this head are green and the review of the rest (gain path, bypass, shared state, input actions, docs, tests) is unchanged.

@MarcZX10

Copy link
Copy Markdown
Contributor Author

Re-checked — new head, pad_sdl now names the failing check

Thanks @adriadam10: the Windows pad_sdl abort could not be tied to one assertion because Require in PadSdl.cpp aborted without printing anything, and the log of run 40951632982 shows only the abort.

What changed

New head c1d819b95407b44975961578b4032d3ec1ca5a63, one commit on top of 3826206b0e: Require in core/libs/prx/libSceVideoOut/tests/PadSdl.cpp now prints pad_sdl: check failed at line N to stderr before it aborts. No other file changes, and the branch was not rewritten.

What I ran

Linux, GCC 12, no build or test run (this host has no free space for one):

g++ -std=c++20 -fsyntax-only -Icore/libs -I3rdparty/SDL2/include core/libs/prx/libSceVideoOut/tests/PadSdl.cpp
python3 tools/check_conventions.py --base upstream/main
git diff --check upstream/main

The syntax check passes, check_conventions.py reports all checks passed and git diff --check is clean.

Not verified

  • Windows: I cannot reproduce pad_sdl there, so which Require aborts is still unknown; the next Windows run on this head will print its line.
  • Whether the new dependency of libSceVideoOut on libSceAudioOut, or the new PadInput code in the constructor and first Update, is the cause: only read, not confirmed. The hooks shared between the two libraries are already extern "C" (HostVolumeControl.hpp), so a symbol that the patched library does not export is not the explanation here.
  • Decoupling libSceVideoOut from libSceAudioOut as suggested: not done, because without the failing line it would be a change made blind.

To get this to a good state

A Windows run on this head will give the failing line. With it I will look at the assertion and, if it points at the dependency, move the shared volume state as suggested. I will re-run the same commands on any new head.

@adriadam10 adriadam10 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the diagnostic commit. Checked the Windows log of run 40951632982 for pad_sdl: the abort() is raised from pad_sdl_tests.exe itself (pad_sdl_tests.exe+0x161bb2, i.e. a Require), not from libSceAudioOut or an uncaught exception, so the environment parsing is not the cause and one of the pad/slot assertions fails.

The head still has the same dependency (core/libs/prx/libSceVideoOut/CMakeLists.txt:26, libSceVideoOut linking libSceAudioOut), and pad_sdl still has to pass on Windows before this can merge. The Build run on c1d819b954 (run 40962672138) will print pad_sdl: check failed at line N; once it does, please fix that case, or, if it points at the new dependency, move the shared volume state so libSceVideoOut does not link a second shared library that carries its own libScePad/SDL copy. Nothing else in the review changes.

@MarcZX10

Copy link
Copy Markdown
Contributor Author

Re-checked — new head, libSceVideoOut no longer links libSceAudioOut

Thanks @adriadam10: the shared host volume state now lives in libScePad, which both libraries already link, so libSceVideoOut no longer loads a second shared library with its own static SDL2.

What changed

New head bb4263eba9b79260edacbd0a587a07566fc2e53d, three commits on top of c1d819b954 (no rewrite):

  • 33e43e21c4 moves HostVolume.hpp, HostVolumeControl.hpp and HostVolumeSettings.hpp from libSceAudioOut/include to libScePad/include, with their guards and includes.
  • 4ab931dd4a moves HostVolumeState.cpp to libScePad/src, adds it to libScePad, removes it from libSceAudioOut, and points the tests that compile it and docs/dev/ENVIRONMENT.md at the new path.
  • bb4263eba9 drops libSceAudioOut from target_link_libraries(libSceVideoOut ...); that line is now the same as on main.

libSceAudioOut reaches the state through the same extern "C" hooks, now exported by libScePad.

What I ran

Linux, GCC 12, a throwaway build of this head from git archive with -DBUILD_TESTING=ON (the host CPU gate relaxed in the scratch copy, as this host lacks some required extensions):

ninja pad_sdl_tests pad_host_volume_tests libScePad libSceAudioOut libSceVideoOut <every audio_out_*_tests target>
ctest -R '^(pad_|audio_out_)' --timeout 60 --output-on-failure
python3 tools/check_conventions.py --base upstream/main
git diff --check upstream/main
python3 core/libs/tests/test_public_headers.py --audit-only
python3 tools/env_reference.py --check
Check Result
Build of the targets above exit 0
pad_sdl pass
pad_host_volume pass
audio_out_host_volume, audio_out_host_volume_state pass
other audio_out_* tests pass (50 passed in total)
pad_command_file, pad_input_mapping, pad_output_pacing, pad_keyboard_mouse not run: their targets were not part of this build
conventions, git diff --check, header audit, environment reference clean
ctest lines for the volume and pad tests
 5/54 Test #1707: audio_out_host_volume ..........................   Passed    0.00 sec
 7/54 Test #1709: audio_out_host_volume_state ....................   Passed    0.00 sec
50/54 Test #2221: pad_sdl ........................................   Passed    0.03 sec
53/54 Test #2224: pad_host_volume ................................   Passed    0.00 sec

Not verified

  • Windows: not built or run here, so whether pad_sdl now passes there is untested by me; the full Build on this head will show it, and the diagnostic commit still prints the failing line if it does not.
  • Which Require failed on the previous head: still unknown, since that run did not reach pad_sdl.
  • macOS: not run.

To get this to a good state

A full Build run on this head will show whether the Windows pad_sdl failure is gone. I will re-run the same commands on any new head.

@TechLevelZero

Copy link
Copy Markdown
Contributor

✅ NVIDIA GPU test: passed

PR head c1d819b merged onto main bb04a4f · tested 2026-10-29 22:34 UTC · 14 min

GPU NVIDIA RTX 2000 Ada Generation, driver 595.99.02, Vulkan 1.4.329
Host Ubuntu 26.04.1 LTS, kernel 7.0.0-38-generic, container ubuntu:24.04
Logs build and test logs for this run
Build ✅ passed (Release, -DANYPS5_ENABLE_SPIRV_TOOLS=ON)
Tests ✅ 784 passed · 2 failed (0 new, 2 also fail on main) · 8 skipped (ANYPS5_REQUIRE_VULKAN=1)
Test setup CPU-only tests without a GPU; GPU tests (and any CPU-only test that failed or skipped without one) once on the GPU with VK_LAYER_KHRONOS_validation and ANYPS5_NO_SHADER_CACHE=1; main ran the same way
Test selection 794 of 2,918 tests run: the ones this change can reach, chosen by tools/select_tests.py from main's build graph
Vulkan validation ✅ no new validation IDs vs main (386 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_bda_device 34.3 s
Failing on main too (2, not counted against this PR)
agc_submit_progress
agc_submit_progress_no_timeline
Validation IDs already present on main (3 IDs in 119 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (119 tests): agc_driver, agc_driver_address_passes_draw_transitions, agc_driver_address_passes_targets_split, agc_driver_alias_copy_label, agc_driver_array_layer_target, agc_driver_bda_anchor_reads, agc_driver_bindless_images, agc_driver_branch_past_endpgm, and 111 more
VUID-vkCmdCopyImage-srcImage-01548 (6 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_partial_store, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-vkCmdCopyImage-srcImage-01551 (6 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_partial_store, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
Skipped (8)
agc_driver_bda_reads_shadowed_results: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_bda_reads_shadowed_results_per_build: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_msaa_dcc_compared_import_2: skipped, the device reports host imports that keep write protection, so the write-watch probe compares none of them
agc_driver_msaa_dcc_compared_import_4: skipped, the device reports host imports that keep write protection, so the write-watch probe compares none of them
agc_driver_msaa_dcc_compared_import_8: skipped, the device reports host imports that keep write protection, so the write-watch probe compares none of them
agc_host_import_sparse: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_import_settle_initial_dcc: skipped, the device has no deferred settle of host imports: imports under 1 MiB wait for one only on Windows
agc_unit_shadow_completion_store: skipped, the device reports watched host memory written when it imports or reads it
Reproduce
git fetch origin c1d819b95407b44975961578b4032d3ec1ca5a63 bb04a4f1ea0175e9e4f149f0359a764d62ff3296
git checkout bb04a4f1ea0175e9e4f149f0359a764d62ff3296 && git merge --no-ff c1d819b95407b44975961578b4032d3ec1ca5a63
git submodule update --init --recursive
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON
cmake --build build && cmake --build build --target libs
VK_DRIVER_FILES=/nonexistent/icd.json ctest --test-dir build -E '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 32 --output-on-failure
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
  ctest --test-dir build -R '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 4 --output-on-failure
# failures are then re-run alone: --timeout 360 --parallel 2; new validation IDs: the test alone, twice, --parallel 1

Automated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 30, 2026
@TechLevelZero

Copy link
Copy Markdown
Contributor

✅ NVIDIA GPU test: passed

PR head bb4263e merged onto main f6fddd6 · tested 2026-10-30 05:38 UTC · 15 min

GPU NVIDIA RTX 2000 Ada Generation, driver 595.99.02, Vulkan 1.4.329
Host Ubuntu 26.04.1 LTS, kernel 7.0.0-38-generic, container ubuntu:24.04
Logs build and test logs for this run
Build ✅ passed (Release, -DANYPS5_ENABLE_SPIRV_TOOLS=ON)
Tests ✅ 818 passed · 0 failed · 8 skipped (ANYPS5_REQUIRE_VULKAN=1)
Test setup CPU-only tests without a GPU; GPU tests (and any CPU-only test that failed or skipped without one) once on the GPU with VK_LAYER_KHRONOS_validation and ANYPS5_NO_SHADER_CACHE=1; main ran the same way
Test selection 826 of 2,950 tests run: the ones this change can reach, chosen by tools/select_tests.py from main's build graph
Vulkan validation ✅ no new validation IDs vs main (402 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_bda_device 77.7 s
Validation IDs already present on main (3 IDs in 125 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (125 tests): agc_driver, agc_driver_address_passes, agc_driver_address_passes_draw_transitions, agc_driver_address_passes_targets_split, agc_driver_alias_copy_label, agc_driver_bitfield_mask, agc_driver_buffer_atomic_csub, agc_driver_buffer_atomics, and 117 more
VUID-vkCmdCopyImage-srcImage-01548 (6 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_partial_store, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-vkCmdCopyImage-srcImage-01551 (6 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_partial_store, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
Skipped (8)
agc_driver_bda_reads_shadowed_results: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_bda_reads_shadowed_results_per_build: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_msaa_dcc_compared_import_2: skipped, the device reports host imports that keep write protection, so the write-watch probe compares none of them
agc_driver_msaa_dcc_compared_import_4: skipped, the device reports host imports that keep write protection, so the write-watch probe compares none of them
agc_driver_msaa_dcc_compared_import_8: skipped, the device reports host imports that keep write protection, so the write-watch probe compares none of them
agc_host_import_sparse: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_import_settle_initial_dcc: skipped, the device has no deferred settle of host imports: imports under 1 MiB wait for one only on Windows
agc_unit_shadow_completion_store: skipped, the device reports watched host memory written when it imports or reads it
Reproduce
git fetch origin bb4263eba9b79260edacbd0a587a07566fc2e53d f6fddd60d826831f70f7c62e25423610ee742bcc
git checkout f6fddd60d826831f70f7c62e25423610ee742bcc && git merge --no-ff bb4263eba9b79260edacbd0a587a07566fc2e53d
git submodule update --init --recursive
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON
cmake --build build && cmake --build build --target libs
VK_DRIVER_FILES=/nonexistent/icd.json ctest --test-dir build -E '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 32 --output-on-failure
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
  ctest --test-dir build -R '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 4 --output-on-failure
# failures are then re-run alone: --timeout 360 --parallel 2; new validation IDs: the test alone, twice, --parallel 1

Automated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs.

@adriadam10
adriadam10 force-pushed the feat/host-volume-mute branch from bb4263e to 04aa91f Compare October 30, 2026 13:00
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 30, 2026
HostVolume holds the host output volume from 0 to 100 and moves it in steps of 5 without leaving the range. A move that changes nothing returns false.
Register audio_out_host_volume. It starts at 100, moves in steps of 5 in both directions, and refuses to leave 0 to 100.
The muted flag is separate from the volume, so unmuting brings back the volume that was set before.
Muting at 100, at 90 and at 0 keeps the volume, and unmuting returns it.
Raising or lowering the volume while muted unmutes, so the step is audible. A step that cannot move the volume still reports a change when it unmutes.
Both directions unmute, including at 0 and at 100 where the volume itself cannot move.
SetVolume takes a value from 0 to 100 for an initial volume and refuses anything else.
MarcZX10 and others added 25 commits October 30, 2026 16:29
The volume keys and the focus rule live in the video output's input handling and drive the audio output's shared host volume. libSceAudioOut does not depend on libSceVideoOut.
…commands

ApplyHostVolumeRequests runs the requested commands in the order up, down, mute and reports whether there was one, leaving the final state for the caller to print.
They are called across libraries like the other _nid_no_patch and _nid_postfix helpers, so their symbols must not depend on the C++ mangling of a particular compiler.
Register pad_host_volume. An empty request set changes nothing, volume up and down move one step and return to exactly unity, mute toggles, combined requests run up then down then mute, and the other host requests are ignored.
…volume

Only focus lost and gained events of the display window count. Minimizing, restoring, closing and the events of other windows change nothing, and the shared volume only acts on them when the focus option is on.
Nothing happens by default, focus lost silences and focus gained restores exactly unity with the option on, other window events, other windows and key events are ignored, and the user's own mute survives a focus round trip.
… starts

PadInput applies ANYPS5_VOLUME and ANYPS5_MUTE_ON_FOCUS_LOSS next to the input mapping, so an invalid value stops the game at the same point as an invalid mapping file, with an error naming the variable.
… on stderr

The requests are handled only for key events of the display window, like fullscreen, the overlay and the screenshot, and each handled press prints one line with the resulting level or mute.
The display window's focus events drive the shared host volume. With ANYPS5_MUTE_ON_FOCUS_LOSS unset or 0 they change nothing; with 1 the audio is silent from focus lost until focus gained, and each change prints one line on stderr.
A window created without focus sends no focus lost event, so the first update reads the focus itself.
With the option on, a window that opens behind another one starts silent instead of waiting for a first focus event that never comes. With the option off this changes nothing.
Both are read in HostVolumeState.cpp when video output starts, and both refuse an invalid value with an error naming the variable.
VolumeDown, VolumeUp and ToggleMute join the supported actions with their default keys and the keyboard-only rule.
F5, F6 and F8 are used by no other default binding.
…s trigger both

The configuration file does not reject a key bound to two actions, so the volume hotkeys follow the rule of the existing ones.
States that it is a host control and not a console behaviour, the steps and the curve, the bypass at the default, what is and is not covered, the stderr feedback, and the two variables.
…ost gain

Halves round toward positive, and a ramp from silence back to unity never falls, stays within the slope and lands exactly on unity.
Require aborted without saying which check failed, so a failure on a CI host that cannot be reproduced locally left no trace of the assertion in the log. It now prints the source line before aborting.
libSceVideoOut reads and changes the shared host volume state, and linking libSceAudioOut for it puts a second shared library with its own static SDL2 into libSceVideoOut. Both libraries already link libScePad, so the headers that describe that state move there first; the include paths and guards follow.
The volume, mute and focus state that libSceAudioOut applies and libSceVideoOut changes now lives in libScePad, which both libraries already link, instead of in libSceAudioOut. The tests that compile the state directly and the environment reference follow the file.
The host volume hooks libSceVideoOut calls now come from libScePad, so libSceVideoOut no longer needs libSceAudioOut. That library links its own static SDL2, and loading it with libSceVideoOut is the dependency the Windows pad_sdl abort points at; the libSceVideoOut link line is back to what main has.
@adriadam10
adriadam10 force-pushed the feat/host-volume-mute branch from 04aa91f to cca2d08 Compare October 30, 2026 15:43
@adriadam10
adriadam10 merged commit 6362046 into boykopovar:main Oct 30, 2026
15 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Rebased onto current main again: PadInput.hpp gained padCaptured next to the new hostFocusSynced, and tests/PadSdl.cpp gained includes next to <source_location>; both kept, no logic change. Build and ctest pass after the rebase (423 tests, 0 failed); merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants