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:
@@ -1182,9 +1182,11 @@ void
|
||||
// non-positional cockpit path which never took distance attenuation anyway.
|
||||
//
|
||||
const float direct_note_pitch = RPNotePitchFactor((int)GetCurrentNoteValue());
|
||||
PatchResource *direct_patch = Cast_Object(PatchResource*, GetAudioResource());
|
||||
for (int i=0; i < channelSet.count; i++)
|
||||
{
|
||||
alSourcef(channelSet.sources[i], AL_GAIN, volume_scale * volume_scale);
|
||||
alSourcef(channelSet.sources[i], AL_GAIN,
|
||||
volume_scale * volume_scale * direct_patch->GetZoneBassGain(i));
|
||||
alSourcef(channelSet.sources[i], AL_PITCH, (float)relativePitch * direct_note_pitch);
|
||||
}
|
||||
}
|
||||
@@ -1574,10 +1576,12 @@ void
|
||||
}
|
||||
|
||||
const float dynamic_note_pitch = RPNotePitchFactor((int)GetCurrentNoteValue());
|
||||
PatchResource *dynamic_patch = Cast_Object(PatchResource*, GetAudioResource());
|
||||
for (int i=0; i < channelSet.count; i++)
|
||||
{
|
||||
alSource3f(channelSet.sources[i],AL_POSITION,pos.x,pos.y,pos.z);
|
||||
alSourcef(channelSet.sources[i], AL_GAIN, volume_scale * volume_scale);
|
||||
alSourcef(channelSet.sources[i], AL_GAIN,
|
||||
volume_scale * volume_scale * dynamic_patch->GetZoneBassGain(i));
|
||||
alSourcef(channelSet.sources[i], AL_PITCH, (float)relativePitch * dynamic_note_pitch);
|
||||
alSource3f(channelSet.sources[i],AL_VELOCITY,-relative_velocity.x,-relative_velocity.y,-relative_velocity.z);
|
||||
|
||||
@@ -2163,7 +2167,8 @@ void
|
||||
const float static_note_pitch = RPNotePitchFactor((int)GetCurrentNoteValue());
|
||||
for (int i=0; i < channelSet.count; i++)
|
||||
{
|
||||
alSourcef(channelSet.sources[i], AL_GAIN, volume_scale * volume_scale);
|
||||
alSourcef(channelSet.sources[i], AL_GAIN,
|
||||
volume_scale * volume_scale * patch_resource->GetZoneBassGain(i));
|
||||
alSourcef(channelSet.sources[i], AL_PITCH, (float)relativePitch * static_note_pitch);
|
||||
alSource3f(channelSet.sources[i],AL_POSITION,relative_position.x,relative_position.y,relative_position.z);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user