Home and End are the bass knob
The volume keys wanted a partner, and the bass trim could not be one as it stood: it scaled the sample data as it loaded, so by the time anyone pressed a key the audio was already sitting in OpenAL buffers and nothing short of a restart would move it. So the trim is now a per-zone gain applied in the mix instead. Each buffer's depth - how much of the low band it occupies - is still worked out once at load from its playback rate, but the trim itself is read every frame, which is what lets Home and End move it while sounds are playing. It is the better form regardless: no rewriting of sample data, and no quantisation on top of audio that has already been through one gain stage. Home raises, End lowers, in steps of 0.05, and the setting is written to bass.cfg beside the exe exactly as the volume writes volume.cfg. Together with PageUp and PageDown that is the amplifier and the crossover the cabinets had in hardware and a desktop does not. Builds clean, runs, and neither knob fires unprompted. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include "l4keybd.h"
|
||||
#include "l4app.h"
|
||||
#include "l4audrnd.h" // RPAudioMasterVolumeStep, for the PgUp/PgDn keys
|
||||
#include "l4audres.h" // RPBassTrimStep, for the Home/End keys
|
||||
#include "l4dinput.h"
|
||||
#include "..\munga\appmgr.h"
|
||||
#include "dxutils.h"
|
||||
@@ -1539,9 +1540,14 @@ void
|
||||
// of whatever the player switched to.
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Home/End do the same for the bass trim - the crossover's low band to
|
||||
// PgUp/PgDn's amplifier.
|
||||
//
|
||||
{
|
||||
static int volume_up_held = 0;
|
||||
static int volume_down_held = 0;
|
||||
static int bass_up_held = 0;
|
||||
static int bass_down_held = 0;
|
||||
|
||||
int focused = 0;
|
||||
|
||||
@@ -1555,6 +1561,8 @@ void
|
||||
|
||||
const int up = focused && (GetAsyncKeyState(VK_PRIOR) & 0x8000) != 0;
|
||||
const int down = focused && (GetAsyncKeyState(VK_NEXT) & 0x8000) != 0;
|
||||
const int bass_up = focused && (GetAsyncKeyState(VK_HOME) & 0x8000) != 0;
|
||||
const int bass_down = focused && (GetAsyncKeyState(VK_END) & 0x8000) != 0;
|
||||
|
||||
if (up && !volume_up_held)
|
||||
{
|
||||
@@ -1564,9 +1572,19 @@ void
|
||||
{
|
||||
RPAudioMasterVolumeStep(-1);
|
||||
}
|
||||
if (bass_up && !bass_up_held)
|
||||
{
|
||||
RPBassTrimStep(+1);
|
||||
}
|
||||
if (bass_down && !bass_down_held)
|
||||
{
|
||||
RPBassTrimStep(-1);
|
||||
}
|
||||
|
||||
volume_up_held = up;
|
||||
volume_down_held = down;
|
||||
bass_up_held = bass_up;
|
||||
bass_down_held = bass_down;
|
||||
}
|
||||
|
||||
if (flags.keyboardExists)
|
||||
|
||||
Reference in New Issue
Block a user