4.0 KiB
Task G3 — Safe Optional Audio Playback and Settings
Scope
Implemented G3 exclusively in the Godot port worktree. No DCWASCII files were changed.
- Added
AudioImportManifest, a typed GodotResourcecatalog for the three supported ambience contexts and six supported SFX events. It provides the optionaluser://audiosetup directory and accepts only registeredAudioStreamobjects. - Replaced
AudioLibrary's arbitrary external directory scan with manifest-only playback. The library now owns ambient/SFXAudioStreamPlayers, routes them through separately namedAmbienceandSFXbuses, loops available ambience, and remains silent when no registered stream exists. - Preserved the old constructor's external-directory argument only as a harmless ignored compatibility value; it is no longer an audio decoding input. No runtime call inspects or loads arbitrary external audio files.
- Added keyboard-accessible volume controls to the existing Options panel:
A/Zlower/raise ambience andS/Xlower/raise SFX in ten-percent steps. Existing three-row arrow-key navigation and inventory rebinding behavior remains unchanged. - Added manifest/playback unit coverage, external-file fail-closed coverage, safe directory-setup coverage, a real Game/Options E2E for volumes/buses/manifest playback, and updated prior no-audio tests to assert external WAV files stay ignored.
Strict TDD evidence
- Added
test_audio_playback.gdandtest_audio_settings_e2e.gdbefore production code. - After the normal Godot import prerequisite, both RED invocations failed at parse/collection time because
audio_import_manifest.gd,AudioLibrary.AMBIENCE_BUS, andAudioLibrary.SFX_BUSdid not exist. This establishes the requested missing-manifest/settings contract was red before implementation. - Implemented the manifest, manifest-only player path, audio buses, and option controls. Focused green verification passed:
- Audio unit suites: 6 / 6, 33 assertions.
- Audio/no-audio/settings E2E suites: 3 / 3, 25 assertions.
Root-cause fixes found during verification
The original AudioLibrary enumerated files under an external home, retained their raw paths, and deliberately reported them unplayable. This neither implemented playback nor safely bounded decoder input. The fix removes that discovery route rather than adding a secondary guard: the only playback assignment is a typed AudioStream retrieved from AudioImportManifest; arbitrary user paths are ignored and no longer reported as discovered.
The first full verification also exposed a G2 navigation regression: adding two rows to the arrow-navigated option list changed the established two-Down/Enter sequence that opens inventory rebinding. The root cause was changing an existing navigation contract, not audio itself. The final UI keeps the original three-row navigation and adds audio controls as dedicated displayed keys (A/Z, S/X); the focused audio-settings and pre-existing full UI navigation E2E tests both pass.
Final verification
./scripts/verify.sh completed successfully with Godot 4.5.0:
- Unit: 185 / 185 tests passed, 1,407 assertions.
- Integration: 11 / 11 tests passed, 59,470 assertions.
- E2E: 57 / 57 tests passed, 571 assertions, including safe no-audio and audio-settings end-to-end paths.
- Visual capture: passed.
artifacts/visual-check.png:dungeon_non_black_pixels=489308,visible_pixels=17524,explored_pixels=10438,explored_luminance=0.012,unknown_pixels=365325,unknown_luminance=0.001.artifacts/visual-check-exit.png:dungeon_non_black_pixels=489252,visible_pixels=17404,explored_pixels=17146,explored_luminance=0.012,unknown_pixels=439497,unknown_luminance=0.001.
The standard GUT invalid-UID and Godot cleanup/resource warnings were emitted. There were no application parse errors, script errors, test failures, or visual verification failures.
Git
All G3 sources, generated UIDs, tests, and this root report are committed locally in one commit. No push and no pull request were created.