feat(audio): add microphone testing, level meter and gain #1102
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!1102
Loading…
Reference in a new issue
No description provided.
Delete branch "Phishinabowl/Longshot:feat/microphone-test-and-gain"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type: feat · Risk: medium · Tested on: Windows, RTX 3080; native Ubuntu Linux, RTX 5090 Laptop GPU; fixtures, full host builds and manual mic play-tests · Needs: none
Why
Players need to check microphone input and adjust a quiet signal before the game listens for an ocarina song. An explicit test and live incoming/adjusted levels help distinguish a quiet microphone from excessive amplification.
Longshot issue/PR and recent-claim searches found no competing implementation in the reviewed results; exact searches for
microphone_gainand "Test microphone" returned none. Hookshot API queries were inaccessible, so exhaustive cross-forge coverage is not claimed. Existing selectors/device capacity arrive through merged #1001 and #751; no closing issue is claimed.What changed
Audio gains Test microphone and Microphone gain. Testing starts explicitly; a read-only meter appears in the help box for both controls, labeled Testing, with incoming/adjusted percentages and explanatory bullets.
host/nn_audio_in.cshares SDL2/SDL3 capture with guest streams, applies software gain once before fan-out, saturates samples and reports freshness, clipping, fallback and availability. Stopping the test releases its reference without stopping capture needed by the game.gpu/vk/vk_menu.cppstops testing on Audio/page exit, overlay close, focus loss or Microphone Off. Gain persists; test state does not.vk_ui.hpreserves help paragraphs and bullets; long microphone explanations reduce font size only when needed to fit the bounded panel.MkwVkHost.mic_test, bump ABI 24 to 25, and preserve earlier callbacks, Mono, text input and settings paths.srccutextraction and native regression fixtures. Machine-assisted translations are not represented as native-speaker reviewed.The mic device-limit and playback-selector changes already arrive through main; their old commits are not reintroduced.
Measurements
Verdict: The requested mic controls work on Windows and native Linux. Default-state median FPS changed by -0.15% on Windows and -0.45% on Linux, within the observed native-interval variation. Active-test results are variable; no performance gain or exact zero-overhead claim is made. The renderer cap is 60 FPS, not disabled:
HOS_FPS_MAX=1000is only a separate host ceiling. Linux stays near that cap, limiting what FPS can establish about small overhead.Rebase validation and evidence reuse: Rebased onto main
3bb97bef; code/check revisionc314e05e. The only conflict was the 13 translated-table entry counts: both sets of translations were retained and counts recomputed. Range-diff preserves every microphone change; host/nn_audio_in.c, host/rx_backend.c, vk_api.h and paragraph rendering are byte-identical to the previously tested branch. Upstream changed renderer matrix-multiply lowering, capture/replay and FG/build tooling, but not the microphone capture/gain/ownership path. FG was off in the existing measurements. The final upstream DLSS-default change applies only below 7 GB VRAM, not to either measured 10/24-GB GPU. Retain those numbers as scoped evidence for the unchanged mic feature; upstream renderer changes may change absolute FPS and these tables do not claim otherwise. No new game build or gameplay run was needed for this rebase.Nine affected checks ran on each platform: eight pass (mic state/gain, help meter, paragraphs, translations, menu keys, audio ABI/devices, upstream FG row and upscaler rows). The ninth, test_bug_report_defaults.py, has the same auto-profile shadow_res assertion on current main, reproduced on both Windows and Linux. Guide source/hash checks pass after a fresh game-free Graphics capture incorporating upstream's Built-in FG label; only image content/caption/provenance changed, not website layout or dimensions. Prior full-suite/runtime evidence below is historical, not a claim of a new full run after this rebase.
Retained pre-rebase performance source: clean committed code
bc0997d444f951445653a7d7aa49f78471a18a7e(pre-rebase documentation headda32cbb1had no runtime-source difference) against merge basef792212691eb3d49a37ff90b5690f0da20077a41. Normal-optimization matching host/renderer builds were statically inspected; cached programs/pipelines were warmed on the same PC before measurement. The branch is now rebased onto main3bb97bef4ce61a3b48804c712e46cfd9d795b612; the tables retain their actual original build identities. These are historical microphone-feature comparisons, not fresh absolute FPS measurements of the new renderer.Hardware: Windows 10 Pro 19045, Ryzen 9 5900XT, 64 GB, RTX 3080 (driver 32.0.16.2124), Clang 23.1.5; Ubuntu 26.04.1 LTS, kernel 7.0.0-43-generic, Core Ultra 9 275HX, about 61.2 GiB RAM, RTX 5090 Laptop GPU (NVIDIA 595.99.02), Clang 23.1.6.
Scene: stationary KakarikoVillage_Child, copied save, position (-32.33, 99.26, 47.44), camera -109.9 degrees. The world is not frozen. Windows reported window/output 2560x1440 and Auto settled at 67% render resolution on both sides. Linux reported window/swapchain 2560x1600 after startup and guest backbuffer 2304x1440, retaining saved Auto choices. V-Sync Auto selected mailbox; frame generation off, gain 100%, test stopped for the main/topic comparison.
Method: native control bridge plus a private orchestration harness; independent save/options copies. Warm each side 45 s; settle 30 s; measure 60 s; alternate main/topic/main/topic. Use medians of native
vk: ... presents, ... fps; a frame:intervals, then the median of the two runs. Profiling switches were used only during warm-up, not measured runs. Window, map, position and camera checks reject configuration drift. Warm-up profiling on Windows reported about 9.8 ms GPU time and 0.47 ms summed host resource waits at about 47 FPS; those categories do not account for all host/pacing work.How to reproduce: build the named merge base and topic with normal optimization, use identical copies of a save at this Kakariko spot and each PC's stated settings, disable frame generation, retain renderer cap 60, warm both, and collect two interleaved 60 s log samples after 30 s settling. For active capture, keep the same selected Test microphone row; alternate Start/Stop twice and sample 25 s after settling. Windows timing is anchored to the first actual capture-open log event (200 ms polling); native menu toggles are 50 s apart. Linux phase-end open counts 0/1/1/2 verify alignment. Never compare different window sizes or reuse the rejected early Windows phase labels.
f7922126bc0997d4Baseline for the next table: the same topic with testing stopped; main has no test control. Same process, same selected Audio row and settings. Two windows per state.
bc0997d4bc0997d4The low second stopped Linux interval (56.4 FPS) makes its active median higher; this is not evidence that recording improves performance. Windows active versus stopped changed -0.49%. All active sessions required capture-open evidence; the corrected Windows sequence recorded 1/1/2/2 cumulative opens. Device/sample-conversion latency and uncapped CPU cost were not measured.
Representative native log samples (full interval samples are retained in the local run records; the tables report their medians):
Pre-rebase full game-free validation: Windows 600 pass/25 fail/42 skip (667); its failed-name set is unchanged from prior pinned-main controls. Linux 631 pass/19 fail/17 skip (667); 18 are the prior main failures, and the additional dev-packs fixture was an inherited private no-prepare environment setting, reproduced on main. After removing that default from the toolchain-only environment, the focused fixture passes on both main and topic. No source assertion was weakened. Neither full suite is globally green. Earlier diagnostic qualifications remain below.
Guide validation: source/PNG checks pass for the supplied Longshot inputs; unchanged external Launcher sources were not supplied or re-reviewed. Local website build and 19-page/1069-link static check pass. Desktop 1440 px and phone 390/360 px views pass light/dark checks and visual inspection, including opening the full-size image. Website units: 101 pass/2 fail; both reproduce in pinned-main controls (HDR prose assertion and Windows CRLF expectation in the save-scrubber test). No unrelated fix is included.
Flags and settings
Two Audio controls are added; no environment or build flag is added.
microphone_gainScreenshots
UI-only menu captures from pinned source, using the maintained menu, bundled fonts and software rendering. The active meter values (24% incoming / 48% adjusted) are synthetic layout inputs. Actual Windows/Linux capture behavior and measurement results are described in the PR.
Testing
Tested: Core mic/audio fixtures pass on both platforms, including gain once before fan-out, conversion/saturation/unity, freshness/clipping, capture ownership/handoff, SDL2/SDL3 adapters, help-box/localization/paragraphs, output recovery/pre-mix switching, Mono, text input, ABI, settings-path and dependency checks. Expanded 37-check selection: Windows 33 pass/3 failures/one declared skip; Linux 36 pass/one failure. Expanded failures are included in the main controls above. The full suites byte-compile tracked Python and preserve source hashes.
Matching full host/renderer builds with normal optimization passed on both platforms; latest retained-work updates exited 0 in 23.60 s and 20.54 s. Static PE/ELF dependency/protection checks passed. Headless Most preparation retained 47,867 program keys on both, with no missing noted pipelines/variants and accepted GPU-specific cache identities; no compatibility check was bypassed.
On both updated builds the owner confirmed All checks pass on both for expected saves/progress and settings, microphone selection, Start/Stop test, reacting meters on Test and Gain, gain adjustment, playback/Mono, and testing stopping on Audio/focus exit. Logs identify source
eb356c3c, the intended reusable options/save paths and the existing Auto choices. Read-only observed log snapshots contain no tagged error/fatal, shader-translation failure, Vulkan error or device-loss line. This is a bounded log observation and manual functional acceptance, not a performance result.tests/test_utf8_paths.pypasses on both systems; its native Windows fixture exercises non-ASCII/emoji paths.tests/test_fs_path_utf8.pyalso passes on Windows and declares a native-Windows API skip on Linux. The whole game builds used existing paths (including spaces on Windows); no separate whole-game build under a non-ASCII directory is claimed.Remaining failures:
tests/test_auto_handheld.pytests/test_bug_report_defaults.pytests/test_crash_dialog.pytests/test_crt_options.pytests/test_failed_compile_keeps_objects.pytests/test_fastfp_fma.pytests/test_fpx_sticky.pytests/test_fsr_uniform_ownership.pytests/test_guest_imported.pytests/test_import_reach.pytests/test_linux_preflight.pytests/test_linux_update.pytests/test_longshot_ctl.pytests/test_make_game_cache.pytests/test_missing_nup.pytests/test_mods_size_table.pytests/test_nonuniform_image_arrays.pytests/test_pads_after_menu.pytests/test_parallel_init_order.pytests/test_pending_guest_import.pytests/test_release.pytests/test_replay_write_order.pytests/test_run_all_changed.pytests/test_spawn_emit.pytests/test_tested_configurations.pytests/test_vk_occlusion_queries.pytests/test_walk_key.pytests/test_work_lock.pytests/test_longshot_ctl.pyhas the same ten failed checks centered on fake-process relaunch timeouts/missing named pipes on both Windows runs; main additionally reports cleanup file-lock errors. Its full signatures therefore differ. Both the test and script are unchanged by this topic; this is shared-primary-failure evidence rather than proof that every timing-sensitive diagnostic is explained.Windows has 42 declared skips; the seven checks previously missing zstandard now run without failures in the build venv. Linux has 17 declared skips. Expanded Windows failures also include the baseline crash-dialog decoding and missing-OpenSSL release checks; the stale build-recovery assertion fails on both platforms. No package was installed or test source changed to clear baseline failures.
Twenty-three committed earlier
docs/tested/2026-11-16-mic-test-gain-phishinabowl-*.mdfragments preserve earlier and current invocations, superseded attempts, controls, builds and play-tests. Older rows retain their original source identity; current*-rebased-*records identify the new base/topic. The frozen catalogue is unchanged. Logs/JUnit/hash records remain local pending authored/redacted attachments.Additional acceptance: The owner confirmed changed gain/device close/reopen persistence on both platforms before the controlled comparisons. Local-only source/test commits include assistance attribution. The final translated-help fix passes native regression checks on both PCs and its English/German UI captures were visually reviewed.
Not tested: Every save slot; exact real-device gain endpoints and clipping/staleness; physical unplug/replug and default fallback; guest ocarina capture surviving test stop; every overlay-close/Microphone-Off path on real hardware; every language/menu-size combination or native-speaker translation accuracy. Fixtures cover several of these behaviors but do not replace physical/runtime checks. No uncapped CPU-cost or latency claim.
Must be tested: None.
Risks
What could break: Shared capture ownership, sample conversion/gain, disconnect recovery, menu cleanup and help sizing in longer translations. Captured samples still pass through gain processing with testing stopped; the capped idle/off comparison does not resolve every small CPU cost.
Turning it off: Stop the test; gain 100% restores unity scaling. Microphone Off disables input. Reverting the feature removes its controls/processing.
Compatibility: No save-format change. Optional
microphone_gaindefaults to 100%; test state never persists. ABI 25 requires matching host/renderer. No new tool dependency. Translator source stamp is834adaaffe55cf51; normal program/pipeline caches were reused on both PCs, without bypasses. Reuse on other GPU/driver/environments is not guaranteed. Linux headless preparation rewrote only Auto-tuning markers; the verified original options file was restored before the accepted normal-display play-test. This is a local preparation observation, not a source workaround in this PR.Checklist
Everyone
type(scope): description) of the status line's type.main. Rebased onto3bb97beffetched for this update; the translation-count conflict is resolved and affected checks are controlled against that main.python -I -B tests/run_all.pypasses (any failure that also fails onmainis named). All topic failures reproduce on pinned main; the Windows diagnostic qualification is explicit. Neither suite is all-green.third_party/untouched (a new folder with aPROVENANCE.mdinstead).When it applies
docs/tested/for each new recorded run (format indocs/tested-configurations.md). Twenty-three earlier records, twenty-four final records and two rebase-check records, with actual source identities and rejected attempts retained.MKWVK_API_VERSIONbumped (gpu/vk/vk_api.h'sMkwVkHostorMkwVkRendererchanged).tests/that reads changed source updated in this PR, not weakened.Tested in game: Windows 10, RTX 3080 driver 32.0.16.2124 and Ubuntu 26.04.1, RTX 5090 Laptop driver 595.99.02: owner Audio mic selection, Start/Stop, Test/Gain meters, gain, playback/Mono, focus/Audio cleanup and restart persistence passed. Final
bc0997d4builds ran the copied Kakariko scene and actual microphone capture through native menu controls on both PCs; final layout also checked with source-built UI fixtures. No game data uploaded.UI-only menu captures from pinned source, using the maintained menu, bundled fonts and software rendering. The active meter values (24% incoming / 48% adjusted) are synthetic layout inputs. Actual Windows/Linux capture behavior and measurement results are described in the PR.
Published the reviewed mic test/meter/gain branch and five captioned UI-only screenshots. Windows and native Linux play-tests/persistence pass; default and active/stopped FPS measurements and baseline test failures are in the description. Measurements ran code
bc0997d4; headda32cbb1adds only guide/evidence documentation, so no runtime-source change requires remeasurement. Retaining tested merge basef7922126as agreed; the current-main checklist qualification remains visible. No game data or binaries uploaded.da32cbb112802cb5b6c3New commits pushed, approval review dismissed automatically according to repository settings
Rebased onto current main
d76feb2dand pushed head802cb5b6. Resolved the sole conflict by recomputing combined translation counts, preserving both sets of strings. Nine affected checks per OS: eight pass; the existing bug-report auto-profile assertion reproduces on current main on Windows and Linux. Capture/gain/ownership, host wiring and ABI code are unchanged; range-diff changes only translation counts in our feature patch. Retaining the original, explicitly labeled historical microphone measurements; upstream renderer changes can alter absolute FPS, and no new-renderer FPS is claimed. Frame generation was off in those measurements. Refreshed only the affected UI-only guide capture/provenance. No full suite, game rebuild or gameplay launch. All Everyone items are now settled; physical reconnect/ocarina/native-speaker scenarios remain disclosed optional coverage, not claimed tested.WIP: feat(audio): add microphone testing, level meter and gainto feat(audio): add microphone testing, level meter and gain802cb5b6c3a1be173d10Finished the last incoming main delta as well: rebased onto
3bb97bef, resolving the same translated-count overlap. Both platforms reran the nine affected checks: eight pass, one existing auto-profile assertion reproduced on final current main. The additional upstream DLSS default is only for GPUs under 7 GB and does not apply to either measured GPU. Historical mic measurements retain their original identities and the reuse rationale remains explicit. The inspected Graphics capture is retained because the final change is below the pictured view; source review fingerprints updated. No full game build or full test suite.