Implement first playable PRK.Client audio iteration
Implement the approved first playable audio milestone from tsk_n87n48dj3s. Native Windows/Linux/macOS playback using separately shipped OpenAL Soft and AOT-compatible interop; no static linking or legacy Miles dependency. Preserve original AO formats and authored bank behavior. Listener at character head with camera-facing orientation. Reuse existing preferences and lifecycle. No new enhancement controls; defer combat/footsteps/placed ambience and SWS music transitions. Acceptance criteria - Validated dependency-light SBF catalog/hash/metadata decoding shared with existing sound tooling where practical; malformed data, unsafe paths and unresolved/cyclic references fail safely. - PCM WAV, IMA ADPCM WAV, MPEG-in-WAV and Ogg/Vorbis decode against representative installed assets; bounded decoding/cache avoids frame blocking. - Independent positional and nonpositional voices through OpenAL Soft; existing volume controls affect playback. Listener updates do not follow camera zoom. - UI and server PlaySound hooks work without depending on graphics effects. Stale queued/decode work cannot play after zoning/logout; unavailable devices degrade safely; shutdown releases resources. - Native library packaging/build instructions and LGPL notices/source distribution obligations are explicit for all three OSes. - Focused automated tests, installed-asset checks, client build/tests and available native/AOT validation pass. Record Windows/macOS or audible validation not available on this host rather than claiming completion. Implementation and validation Implemented on feature/client-audio-first-iteration; committed as 141602d54 (feature: Add first playable client audio). Shared validated SBF parser is reused by server sound tooling. Managed NLayer 3.0.0/NVorbis 0.10.5 plus PCM/IMA decoding avoid additional native decoder packaging. Original duplicate IDs are preserved and later definitions win; legacy RIFF missing-padding sizes, leading-slash bank paths and nosound sentinel are supported. OpenAL Soft 1.25.2 shared-library package has a pinned CMake recipe, source archive, exact dated ApplyPatch.cmake modifications and license notices. The patch reuses static buffer queues and preallocates 1024 voice-transition commands; the backend preallocates 128 bound sources and caches native buffers. No HRTF dataset is bundled in this first version. Playback uses bounded queues/cache/voice budgets and independent voices; UI/server hooks, head listener, existing volume controls and generation-based teardown are wired. Timed ambience graphs, moving-source attachment/material-specific triggers and music streaming/transitions remain deferred; diagnostics explicitly report unsupported graphs and budget refusals. Verified: client and PlayfieldEngine build; focused audio/UI/catalogue tests; Linux NativeAOT publish; silent native check of original codecs, 128 concurrent float voices, installed GUI-bank playback and runtime reset. Installed corpus census: 5,241 assets decoded, 3 long assets refused by the declared size budget, no codec failures (5,244 total WAV/Ogg assets). Performance requirement After functional verification, measure and remove steady-state audio allocations and quantify frame-handoff/background/native playback costs. User requested no runtime allocations and no significant engine impact. Distinguish unavoidable asset-loading/decoding allocations from warmed playback/frame paths; do not claim native mixer allocation behavior or engine-wide performance without measurement. The one-time baseline verified zero warmed caller/publication, catalog, decoder-handoff and owner-tick managed allocations. Per user direction, ongoing regression tests retain only lightweight caller/publication/submission and catalog checks; worker instrumentation is removed. Fixed rings, reusable preparation/voice arrays, dedicated threads, nonblocking frame publication and cached native state replaced allocating records/LINQ/queues. The baseline used a Linux/glibc malloc-family interposer and --audio-benchmark; both have been removed after verification, along with runtime timing/allocation/drop counters. Initial frame publication was 72 B/frame; native per-replay deque allocations were 512 calls/145,408 B per 128-voice burst. These were removed. Allocation backtraces identified occasional native transition-pool expansion, now preallocated. Repeated warmed native runs returned zero measured allocator calls; native pools may still grow under larger/stalled-driver backlogs, so an unconditional all-runtime/no-all-platform-allocation claim is not made. Linux NativeAOT/null-sink measurements: added frame handoff roughly 0.07–0.09 microseconds mean/p99, under 0.003% of a 240 Hz frame budget. 128 moving-listener voices at 240 Hz consumed about 2% of one CPU core including harness/idle output, about 1.6% of one core above idle. Owner work was about 10–13 microseconds per tick. These are isolated added-path costs; real-device latency and Windows/macOS allocator behavior remain unmeasured. Additional rendered-engine comparison now exercises the actual hidden Vulkan client on the RX 9070 at 1920x1080, offline playfield 655 (31,152 reported renderables), with disabled/idle/128-voice modes and reversed run order. First paired runs averaged approximately 3.058 ms disabled and 3.050 ms stressed; the repeated comparison averaged approximately 3.050 ms disabled, 3.087 ms idle and 3.092 ms stressed. Idle/stress differences are small relative to run-to-run variation; this supports no meaningful observed degradation in this scene, not a universal no-impact guarantee. Real Bootstrap audio update averaged 0.55–0.72 microseconds, with zero measured frame/owner/decoder allocations after warmup. The baseline used automation-only snapshots, stress/counter-reset commands and automation-audio-performance.py. These one-off additions and PRK_DISABLE_AUDIO are now removed; normal automation contracts are restored. Cold loads, evictions, malformed-input logging and existing transport/frame allocations are outside the warmed-path claim. Latest cleanup validation: 92 focused tests passing, 1 conditional native test skipped; cleaned Linux NativeAOT publish, codec playback, 128 voices, mono/stereo buffer rebinding and runtime reset pass. The native source package no longer includes the allocation probe. Native mono/stereo static-buffer rebinding, pooled source reuse and generation reset pass after the performance refactor. The source/archive/patch/license package is copied into published output. Server sound test execution was blocked by pre-existing root-owned PRK.TerrainRender/obj files; PlayfieldEngine build had passed. Broader platform/device validation remains outstanding. Profiling cleanup scope Remove one-off benchmark/probe/scripts, automation stress APIs and all runtime measurement machinery. Retain the playback pools/queues, OpenAL optimization patches, functional --audio-check/--audio-census diagnostics and lightweight allocation regression tests. Baseline evidence above is preserved as verification history, not a permanent profiling subsystem. Cleanup changes are currently uncommitted on the existing task branch. Outstanding validation/release gates: audible/real-device checks, further scenes and allocator stress beyond the measured envelope; Windows/macOS native/AOT builds and signing/library replacement; audible in-client UI/server/volume/listener/zoning checks; EULA review. Broad client regression run passed 2,574 tests with 57 install-fixture failures when the supplied installation lacked its extracted rdb.db. A composed read-only fixture corrected that mismatch; its longer sweep exposed missing stock profiles/install-census discrepancies and timed out before completion. These are not treated as passing validation. Research task remains the broader evidence handoff. Pull request - #2551 — WIP: feature: Add first playable client audio - https://git.project-rk.com/prk/engines/pulls/2551 - Draft; feature/client-audio-first-iteration -> develop. Task status remains in_progress pending the existing release/platform/device validation gates.
Checklist
5 of 6 complete- Validate shared SBF catalog/hash and all original codecs against malformed fixtures and installed assets.
- Implement bounded independent OpenAL voices, volumes, listener snapshots and safe asynchronous lifecycle; verify focused tests.
- Wire UI and server-requested sounds plus character-head/camera orientation and zoning/logout cleanup; verify integration regressions.
- Provide native dependency packaging/license artifacts and validate client/tests, installed data and available AOT/native playback; record remaining platform validation.
- Verify allocation-free warmed frame/playback paths with regression tests and measure frame handoff, voice stress and native/managed allocation costs; document asset-loading exceptions and remaining limits.
- Before release, pass Windows/macOS native/AOT and real-device audible UI/server/listener/volume/zoning validation; verify signing/library replacement, Linux baseline ABI and EULA compliance.
- Area
- Project Rubi-Ka
- Project
- engines
- Kind
- Feature
- Task ID
tsk_vjf59g4jc2- Updated