fix(ui): pre-merge code review — apply persisted settings without devtools, hide inert sliders
Two should-fix items from the pre-merge code review pass: 1. Persisted settings now apply on startup unconditionally (previously gated on ACDREAM_DEVTOOLS=1). 2. Music + Ambient volume sliders are hidden because the underlying engine paths don't exist yet (R5 MIDI playback). == 1. Settings load + apply outside DevToolsEnabled gate == Previous structure put SettingsStore construction, LoadDisplay / LoadAudio / etc, and ApplyDisplayWindowState inside the `if (DevToolsEnabled)` block. A user running with the env var unset silently got WindowOptions defaults (1280x720 / VSync=false / 60° FOV) instead of their saved settings.json values — even though the settings file existed and was valid. Refactored: extracted LoadAndApplyPersistedSettings() that runs unconditionally in OnLoad after _audioEngine is constructed but before the DevToolsEnabled block. Persisted values cached as _persistedDisplay / _persistedAudio / _persistedGameplay / _persistedChat / _persistedCharacter fields. The Settings PANEL construction (devtools-gated, naturally — no UI without ImGui) now reads those fields when wiring SettingsVM. The Settings UI gating is correct (panel needs ImGui devtools); the persisted-runtime-state gating was the bug. == 2. Music + Ambient sliders hidden == OpenAlAudioEngine has Music/MusicVolume/Ambient/AmbientVolume properties but they're never read — PlayMusic is a stub for R5 MIDI playback that hasn't shipped, StartAmbient reserves a handle but doesn't start a source. Dragging those sliders moved a number that nothing observed. Hid the Music + Ambient sliders from RenderAudioTab; left the AudioSettings record fields intact so settings.json round-trips the values across phases — when R5 lands and the sliders return, saved values will already be in place. Updated the panel's footer note to call out the limitation. Updated Audio_tab_when_active_renders_implemented_volume_sliders to assert Master + SFX are present AND Music + Ambient are absent. dotnet build green; dotnet test 1,309 / 1,309 green. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
944a0364c5
commit
a37ebdebff
3 changed files with 114 additions and 62 deletions
|
|
@ -226,11 +226,15 @@ public sealed class SettingsPanel : IPanel
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Render the Audio tab — four volume sliders (Master / Music / SFX /
|
||||
/// Ambient). Volumes update <i>live</i>: the host pushes the VM's
|
||||
/// AudioDraft into the running OpenAL engine each frame, so dragging
|
||||
/// a slider is audible immediately. Cancel reverts the draft and the
|
||||
/// engine catches up on the next frame.
|
||||
/// Render the Audio tab — Master + SFX volume sliders (live preview
|
||||
/// against the running OpenAL engine). Music + Ambient fields exist
|
||||
/// in <see cref="AudioSettings"/> and persist round-trip, but their
|
||||
/// sliders are intentionally hidden here because the underlying
|
||||
/// engine paths (PlayMusic / StartAmbient) are stubbed for R5 MIDI
|
||||
/// playback that hasn't shipped yet — exposing the sliders would be
|
||||
/// "moving a knob that does nothing." When R5 lands, restore the
|
||||
/// hidden sliders below and the JSON-persisted values will already
|
||||
/// be in place.
|
||||
/// </summary>
|
||||
private void RenderAudioTab(IPanelRenderer renderer)
|
||||
{
|
||||
|
|
@ -240,22 +244,26 @@ public sealed class SettingsPanel : IPanel
|
|||
if (renderer.SliderFloat("Master", ref master, 0f, 1f))
|
||||
_vm.SetAudio(a with { Master = master });
|
||||
|
||||
float music = a.Music;
|
||||
if (renderer.SliderFloat("Music", ref music, 0f, 1f))
|
||||
_vm.SetAudio(a with { Music = music });
|
||||
|
||||
float sfx = a.Sfx;
|
||||
if (renderer.SliderFloat("SFX", ref sfx, 0f, 1f))
|
||||
_vm.SetAudio(a with { Sfx = sfx });
|
||||
|
||||
float ambient = a.Ambient;
|
||||
if (renderer.SliderFloat("Ambient", ref ambient, 0f, 1f))
|
||||
_vm.SetAudio(a with { Ambient = ambient });
|
||||
// Music + Ambient hidden until R5 MIDI / ambient-loop engines
|
||||
// exist. AudioSettings still carries the fields so the JSON
|
||||
// round-trips and a future client doesn't drop them on save.
|
||||
//
|
||||
// float music = a.Music;
|
||||
// if (renderer.SliderFloat("Music", ref music, 0f, 1f))
|
||||
// _vm.SetAudio(a with { Music = music });
|
||||
// float ambient = a.Ambient;
|
||||
// if (renderer.SliderFloat("Ambient", ref ambient, 0f, 1f))
|
||||
// _vm.SetAudio(a with { Ambient = ambient });
|
||||
|
||||
renderer.Spacing();
|
||||
renderer.TextWrapped(
|
||||
"Volume changes preview live as you drag. Save persists the "
|
||||
+ "values to settings.json; Cancel reverts to the saved values.");
|
||||
+ "values to settings.json; Cancel reverts to the saved values. "
|
||||
+ "Music + Ambient mixing arrives with R5 MIDI playback.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue