OpenAL is enabled, EAX fixes and removed DirectSound completely.

This commit is contained in:
Justin Marshall
2026-05-22 10:57:43 -07:00
parent 01d10ecca8
commit 06ea7e7297
20 changed files with 809 additions and 4667 deletions
+95 -3
View File
@@ -45,8 +45,79 @@ If you have questions concerning this license or the applicable additional terms
#include <AL/alc.h>
#define ID_ALCHAR
#endif
#ifndef OPENAL
#define OPENAL
#endif
#include "../openal/include/efxlib.h"
#ifndef AL_EFFECT_TYPE
#define AL_EFFECT_TYPE 0x8001
#define AL_EFFECT_NULL 0x0000
#define AL_EFFECT_REVERB 0x0001
#define AL_EFFECT_EAXREVERB 0x8000
#define AL_EFFECTSLOT_EFFECT 0x0001
#define AL_EFFECTSLOT_GAIN 0x0002
#define AL_EFFECTSLOT_AUXILIARY_SEND_AUTO 0x0003
#define AL_AUXILIARY_SEND_FILTER 0x20006
#define AL_DIRECT_FILTER 0x20005
#define AL_FILTER_TYPE 0x8001
#define AL_FILTER_NULL 0x0000
#define AL_FILTER_LOWPASS 0x0001
#define AL_LOWPASS_GAIN 0x0001
#define AL_LOWPASS_GAINHF 0x0002
#define AL_REVERB_DENSITY 0x0001
#define AL_REVERB_DIFFUSION 0x0002
#define AL_REVERB_GAIN 0x0003
#define AL_REVERB_GAINHF 0x0004
#define AL_REVERB_DECAY_TIME 0x0005
#define AL_REVERB_DECAY_HFRATIO 0x0006
#define AL_REVERB_REFLECTIONS_GAIN 0x0007
#define AL_REVERB_REFLECTIONS_DELAY 0x0008
#define AL_REVERB_LATE_REVERB_GAIN 0x0009
#define AL_REVERB_LATE_REVERB_DELAY 0x000A
#define AL_REVERB_AIR_ABSORPTION_GAINHF 0x000B
#define AL_REVERB_ROOM_ROLLOFF_FACTOR 0x000C
#define AL_REVERB_DECAY_HFLIMIT 0x000D
#define AL_EAXREVERB_DENSITY 0x0001
#define AL_EAXREVERB_DIFFUSION 0x0002
#define AL_EAXREVERB_GAIN 0x0003
#define AL_EAXREVERB_GAINHF 0x0004
#define AL_EAXREVERB_GAINLF 0x0005
#define AL_EAXREVERB_DECAY_TIME 0x0006
#define AL_EAXREVERB_DECAY_HFRATIO 0x0007
#define AL_EAXREVERB_DECAY_LFRATIO 0x0008
#define AL_EAXREVERB_REFLECTIONS_GAIN 0x0009
#define AL_EAXREVERB_REFLECTIONS_DELAY 0x000A
#define AL_EAXREVERB_REFLECTIONS_PAN 0x000B
#define AL_EAXREVERB_LATE_REVERB_GAIN 0x000C
#define AL_EAXREVERB_LATE_REVERB_DELAY 0x000D
#define AL_EAXREVERB_LATE_REVERB_PAN 0x000E
#define AL_EAXREVERB_ECHO_TIME 0x000F
#define AL_EAXREVERB_ECHO_DEPTH 0x0010
#define AL_EAXREVERB_MODULATION_TIME 0x0011
#define AL_EAXREVERB_MODULATION_DEPTH 0x0012
#define AL_EAXREVERB_AIR_ABSORPTION_GAINHF 0x0013
#define AL_EAXREVERB_HFREFERENCE 0x0014
#define AL_EAXREVERB_LFREFERENCE 0x0015
#define AL_EAXREVERB_ROOM_ROLLOFF_FACTOR 0x0016
#define AL_EAXREVERB_DECAY_HFLIMIT 0x0017
#endif
typedef void ( ALAPIENTRY *EfxGenEffects )( ALsizei, ALuint * );
typedef void ( ALAPIENTRY *EfxDeleteEffects )( ALsizei, const ALuint * );
typedef void ( ALAPIENTRY *EfxEffecti )( ALuint, ALenum, ALint );
typedef void ( ALAPIENTRY *EfxEffectf )( ALuint, ALenum, ALfloat );
typedef void ( ALAPIENTRY *EfxEffectfv )( ALuint, ALenum, const ALfloat * );
typedef void ( ALAPIENTRY *EfxGenAuxiliaryEffectSlots )( ALsizei, ALuint * );
typedef void ( ALAPIENTRY *EfxDeleteAuxiliaryEffectSlots )( ALsizei, const ALuint * );
typedef void ( ALAPIENTRY *EfxAuxiliaryEffectSloti )( ALuint, ALenum, ALint );
typedef void ( ALAPIENTRY *EfxAuxiliaryEffectSlotf )( ALuint, ALenum, ALfloat );
typedef void ( ALAPIENTRY *EfxSource3i )( ALuint, ALenum, ALint, ALint, ALint );
typedef void ( ALAPIENTRY *EfxGenFilters )( ALsizei, ALuint * );
typedef void ( ALAPIENTRY *EfxDeleteFilters )( ALsizei, const ALuint * );
typedef void ( ALAPIENTRY *EfxFilteri )( ALuint, ALenum, ALint );
typedef void ( ALAPIENTRY *EfxFilterf )( ALuint, ALenum, ALfloat );
// demo sound commands
typedef enum {
SCMD_STATE, // followed by a load game state
@@ -258,7 +329,7 @@ public:
/*
===================================================================================
Encapsulates functionality of a DirectSound buffer.
Encapsulates functionality of a legacy software-mixer output buffer.
===================================================================================
*/
@@ -740,6 +811,10 @@ public:
ALuint AllocOpenALSource( idSoundChannel *chan, bool looping, bool stereo );
void FreeOpenALSource( ALuint handle );
bool InitOpenALEFX( void );
void ShutdownOpenALEFX( void );
void ApplyOpenALReverb( const EAXREVERBPROPERTIES &reverb );
void ApplyOpenALSourceEffects( ALuint source, long occlusion, bool stereo );
#ifdef PREY
virtual int GetSubtitleIndex(const char* soundName);
@@ -789,10 +864,28 @@ public:
EAXGet alEAXGet;
EAXSetBufferMode alEAXSetBufferMode;
EAXGetBufferMode alEAXGetBufferMode;
EfxGenEffects alGenEffects;
EfxDeleteEffects alDeleteEffects;
EfxEffecti alEffecti;
EfxEffectf alEffectf;
EfxEffectfv alEffectfv;
EfxGenAuxiliaryEffectSlots alGenAuxiliaryEffectSlots;
EfxDeleteAuxiliaryEffectSlots alDeleteAuxiliaryEffectSlots;
EfxAuxiliaryEffectSloti alAuxiliaryEffectSloti;
EfxAuxiliaryEffectSlotf alAuxiliaryEffectSlotf;
EfxSource3i alSource3i;
EfxGenFilters alGenFilters;
EfxDeleteFilters alDeleteFilters;
EfxFilteri alFilteri;
EfxFilterf alFilterf;
ALuint openalReverbEffect;
ALuint openalReverbSlot;
ALuint openalOcclusionFilter;
bool openalEFXAvailable;
bool openalEFXEAXReverb;
idEFXFile EFXDatabase;
bool efxloaded;
// latches
static bool useOpenAL;
static bool useEAXReverb;
// mark available during initialization, or through an explicit test
static int EAXAvailable;
@@ -824,7 +917,6 @@ public:
static idCVar s_clipVolumes;
static idCVar s_realTimeDecoding;
static idCVar s_libOpenAL;
static idCVar s_useOpenAL;
static idCVar s_useEAXReverb;
static idCVar s_muteEAXReverb;
static idCVar s_decompressionLimit;