Files
RP412/MUNGA_L4/L4AUDRES.h
T
CydandClaude Opus 5 25e25260b1 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>
2026-08-06 00:08:55 -05:00

174 lines
4.4 KiB
C++

#pragma once
#include "..\munga\objstrm.h"
#include "..\munga\entity.h"
#include "..\munga\audio.h"
#include "openal/al.h"
ALuint AL_getBuffer(int index);
extern ALuint *g_buffers;
extern int g_numBuffers;
//
// RP412AUDIOBASS low-band trim, stepped live by the Home/End keys. Applied as
// a per-zone gain in the mix; see the comment block in L4AUDRES.cpp for why it
// lives here and not in EFX.
//
void RPBassTrimInitialize();
void RPBassTrimStep(int direction);
float RPBassTrim();
float RPBufferBassGain(int buffer_index);
//class AudioHardware;
//##########################################################################
//###################### AudioObjectStream ###########################
//##########################################################################
class AudioObjectStream:
public PlugStream
{
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Construction, Destruction and testing
//
public:
AudioObjectStream();
AudioObjectStream(
ResourceDescription *resource_description,
Entity *entity
);
~AudioObjectStream();
Logical
TestInstance() const;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Implementations
//
private:
RegisteredClass*
MakeObjectImplementation(Enumeration class_ID);
void
CreatedObjectImplementation(
RegisteredClass *object,
ObjectID object_ID
);
void
BuildFromPageImplementation(
NameList *entry_list,
Enumeration class_ID,
ObjectID object_ID
);
void
BuiltFromPageImplementation(
Enumeration class_ID,
ObjectID object_ID,
const CString &object_name_string
);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Private data
//
private:
Entity *entity;
};
//##########################################################################
//#################### L4AudioResourceManager ########################
//##########################################################################
class L4AudioResourceManager:
public Node
{
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Construction, Destruction, Testing
//
public:
L4AudioResourceManager();
~L4AudioResourceManager();
Logical
TestInstance() const;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Static audio object methods
//
public:
//
//--------------------------------------------------------------------
// PreloadResources
//--------------------------------------------------------------------
//
void
PreloadResources(
NotationFile *notation_file
);
//
//--------------------------------------------------------------------
// UnloadResources
//--------------------------------------------------------------------
//
void
UnloadResources(
);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Static audio object methods - tool support
//
public:
//
//--------------------------------------------------------------------
// CreateStaticAudioStreamResource
//--------------------------------------------------------------------
//
static ResourceDescription::ResourceID
CreateStaticAudioStreamResource(
ResourceFile *resource_file
);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Dynamic audio object methods
//
public:
//
//--------------------------------------------------------------------
// CreateEntityAudioObjects
//--------------------------------------------------------------------
//
void
CreateEntityAudioObjects(
Entity *entity,
AudioRepresentation audio_representation
);
//
//--------------------------------------------------------------------
// DestroyEntityAudioObjects
//--------------------------------------------------------------------
//
void
DestroyEntityAudioObjects(Entity *entity);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Dynamic audio object methods - tool support
//
public:
//
//--------------------------------------------------------------------
// CreateModelAudioStreamResource
//--------------------------------------------------------------------
//
static ResourceDescription::ResourceID
CreateModelAudioStreamResource(
ResourceFile *resource_file,
const char *model_name,
NotationFile *model_file,
const ResourceDirectories *directories
);
};