Issue #26: runtime master volume (-/= keys, persisted)

The game audio plays hot with no in-game control -- testers couldn't
hear voice chat without the Windows mixer (playtest night).  The -/=
keys now step the OpenAL listener gain (the master scale every source
inherits) in 5% steps, clamped 0..150%, edge-detected in the per-frame
poll with a foreground guard; the value persists to content\volume.cfg
and reloads at boot (BT_AUDIO_VOLUME env still wins when set; default
stays 0.6).  README updated.

Verified: volume.cfg 0.25 -> boot log "master gain=0.25"; key stepping
needs a live focused session (awaiting live verification).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
arcattack
2026-07-23 00:53:07 -05:00
co-authored by Claude Opus 4.8
parent 44f7c39ee1
commit 4e0fcbf328
3 changed files with 61 additions and 1 deletions
+18
View File
@@ -2746,6 +2746,24 @@ void
// task #12: Generator1-4 actions assign the selected weapon
// to Generator A..D; Reconnect toggles Manual/Auto.
gBTGenSelKey = gBTInput.genSel;
// issue #26: -/= step the master volume (edge-detected;
// VK_OEM_MINUS/VK_OEM_PLUS, focus-guarded like all polls).
{
extern void BTAudioMasterVolumeStep(int direction);
static int sVolDn = 0, sVolUp = 0;
unsigned long fgpid = 0;
if (GetForegroundWindow() != 0)
GetWindowThreadProcessId(GetForegroundWindow(), &fgpid);
int focused_vol = (fgpid == GetCurrentProcessId());
int dn = focused_vol
&& (GetAsyncKeyState(VK_OEM_MINUS) & 0x8000) != 0;
int up = focused_vol
&& (GetAsyncKeyState(VK_OEM_PLUS) & 0x8000) != 0;
if (dn && !sVolDn) BTAudioMasterVolumeStep(-1);
if (up && !sVolUp) BTAudioMasterVolumeStep(+1);
sVolDn = dn;
sVolUp = up;
}
// task #13: the Valve action cycles the coolant valve.
gBTValveKey = gBTInput.valve;
// Gitea #7: the Flush action HELD = the coolant MFD's