New L4AUDEFX bridge (OpenAL Soft ALC_EXT_EFX): one EAXReverb aux slot at the authentic AUDIO.INI global_reverb_scale (0.3) + a scratch AL_FILTER_LOWPASS (params copied at attach). F9 filters (was: computed then thrown away -- everything full-bright at all distances): Dynamic3D ExecuteModel drives GAINHF from highFreqCutoffScale x brightnessScale x maxMIDIFilterCutoff, UNGATED (decomp part_008.c:7496, 7589-7604 -- every moving 3D sound dulls with distance per the AUDIO.INI knee-60/exp-2.0 model); Static3D from brightness x max (:7831-7884); Direct inside its existing gated NRPN-rate block. AWE 100-8000 Hz curve -> EFX 5 kHz-reference gainhf via a 2-pole approximation [T3 curve, endpoints exact]. F11 reverb (was: bone-dry everywhere): 3D patch sources attach an aux send at Start, exactly where the original sent CC91 = global_reverb_scale (part_008.c:7278-7394); Direct cockpit sources keep CC91=0 -- dry. The wet-exterior vs dry-cockpit contrast is back. F12 placement (was: every cockpit sound dead-center): DirectPatchSource Start places sources by the authored 6-value position enum (front/rear card + pan CC10, decomp @00463848/@004638a8) as listener-relative directions, composed with the zone L/C/R pan. New PatchResource GetBankID/GetPatchID pass-throughs (the LOD accessor is protected). Regression (35s drive+fire): EFX READY, stable, deliveries unregressed, no AL errors. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
196 lines
4.7 KiB
C++
196 lines
4.7 KiB
C++
#pragma once
|
|
|
|
#include "..\munga\audlvl.h"
|
|
#include "l4audhdw.h"
|
|
#include "openal/al.h"
|
|
|
|
enum SampleChannel
|
|
{
|
|
CHANNEL_LEFT,
|
|
CHANNEL_RIGHT,
|
|
CHANNEL_CENTER
|
|
};
|
|
|
|
enum SampleLoop
|
|
{
|
|
LoopAtWill, //Will play once or loop as desired
|
|
ForceStatic, //Plays only once even if looped
|
|
LoopAlways, //Ramp up and then down
|
|
SampleLoopMax
|
|
};
|
|
|
|
struct SAMPLEINFO
|
|
{
|
|
int bufferIndex;
|
|
bool implemented;
|
|
const char *file;
|
|
SampleChannel chan;
|
|
SampleLoop loop;
|
|
// (task #50, AUDIO_FIDELITY F1/F13) full-zone metadata from the SF2 banks:
|
|
// the authored MIDI note SELECTS zones by [keyLo,keyHi]; loop regions are
|
|
// sub-ranges in sample frames (AL_SOFT_loop_points); releaseSec is the
|
|
// authored releaseVolEnv fade applied on Stop instead of an instant cut.
|
|
int keyLo;
|
|
int keyHi;
|
|
int loopStart;
|
|
int loopEnd;
|
|
float releaseSec;
|
|
};
|
|
|
|
// AllExplosion (bank2 p125) authors 25 layered zones -- the largest preset.
|
|
const int MAX_PRESET_SAMPLES = 25;
|
|
|
|
struct PRESETINFO
|
|
{
|
|
int sampleNum;
|
|
SAMPLEINFO samples[MAX_PRESET_SAMPLES];
|
|
bool is3d;
|
|
};
|
|
|
|
extern PRESETINFO allPresets[2][128];
|
|
|
|
bool PRESET_isImplemented(int bank, int preset);
|
|
int PRESET_getNumSamples(int bank, int preset);
|
|
SAMPLEINFO PRESET_getSampleInfo(int bank, int preset, int sampleInd);
|
|
void PRESET_setBufferIndex(int bank, int preset, int sampleInd, int index);
|
|
|
|
// (task #50, AUDIO_FIDELITY F13) authored release fades: StopNote registers a
|
|
// dB-linear gain ramp instead of cutting; AudioHead::Execute services them.
|
|
void PRESET_serviceReleaseFades(float elapsed_seconds);
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PatchLevelOfDetail ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
typedef MIDIValue SBKPatchID;
|
|
typedef MIDIValue SBKBankID;
|
|
|
|
class PatchLevelOfDetail:
|
|
public AudioLevelOfDetail
|
|
{
|
|
public:
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// Construction, Destruction, Testing
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
PatchLevelOfDetail(PlugStream *stream);
|
|
~PatchLevelOfDetail();
|
|
|
|
void PlayNote(SourceSet sourceSet, int note);
|
|
void StopNote(SourceSet sourceSet);
|
|
|
|
Logical
|
|
TestInstance() const;
|
|
|
|
virtual AudioVoiceCount
|
|
GetVoiceCount()
|
|
{return PRESET_getNumSamples(bankID,patchID);}
|
|
|
|
// (task #50) expose the authored bank/patch so the game-side footstep
|
|
// intensity send can identify footstep sources precisely.
|
|
int GetBankID() const { return (int)bankID; }
|
|
int GetPatchID() const { return (int)patchID; }
|
|
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// BuildFromPage
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
static void
|
|
BuildFromPage(
|
|
PlugStream *stream,
|
|
NameList *name_list,
|
|
ClassID class_ID,
|
|
ObjectID object_ID
|
|
);
|
|
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// Accessors
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
void
|
|
SetupPatch(SourceSet sourceSet, int note);
|
|
|
|
MIDINRPNValue
|
|
GetMaxMIDIFilterCutoff()
|
|
{return maxMIDIFilterCutoff;}
|
|
|
|
private:
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// Private data
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
SBKBankID
|
|
bankID;
|
|
SBKPatchID
|
|
patchID;
|
|
MIDINRPNValue
|
|
maxMIDIFilterCutoff;
|
|
|
|
#ifdef LAB_ONLY
|
|
int
|
|
setupCount;
|
|
#endif
|
|
|
|
//
|
|
// Keep table of created patchs to verify that duplicates
|
|
// are not created
|
|
//
|
|
#if DEBUG_LEVEL>0
|
|
static TableOf<PatchLevelOfDetail*, unsigned int>
|
|
patchTableSocket;
|
|
#endif
|
|
};
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PatchResource ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
class PatchResource:
|
|
public AudioResource
|
|
{
|
|
public:
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// Construction, Destruction, Testing
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
PatchResource(PlugStream *stream);
|
|
~PatchResource();
|
|
|
|
void PlayNote(SourceSet sourceSet, int note);
|
|
void StopNote(SourceSet sourceSet);
|
|
|
|
Logical
|
|
TestInstance() const;
|
|
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// BuildFromPage
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
static void
|
|
BuildFromPage(
|
|
PlugStream *stream,
|
|
NameList *name_list,
|
|
ClassID class_ID,
|
|
ObjectID object_ID
|
|
);
|
|
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// Accessors
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
void
|
|
SetupPatch(SourceSet sourceSet, int note);
|
|
|
|
MIDINRPNValue
|
|
GetMaxMIDIFilterCutoff();
|
|
|
|
// (task #50) authored bank/patch pass-throughs (the LOD accessor is
|
|
// protected on AudioResource) -- zone metadata lookups at the source layer.
|
|
int GetBankID();
|
|
int GetPatchID();
|
|
};
|
|
|