make the openal code compile without eax and enable it by default

This commit is contained in:
Jonathan Gray 2013-04-25 15:19:50 +10:00
parent 017bd42a1b
commit e5e1251df8

View file

@ -211,7 +211,7 @@ int s_entityWavVol_back[MAX_GENTITIES];
#define DEFAULT_REF_DISTANCE 300.0f // Default reference distance
#define DEFAULT_VOICE_REF_DISTANCE 1500.0f // Default voice reference distance
int s_UseOpenAL = false; // Determines if using Open AL or the default software mixer
int s_UseOpenAL = true; // Determines if using Open AL or the default software mixer
ALfloat listener_pos[3]; // Listener Position
ALfloat listener_ori[6]; // Listener Orientation
@ -227,6 +227,7 @@ void S_SetLipSyncs();
// EAX Related
#ifdef HAVE_EAX
typedef struct
{
ALuint ulNumApertures;
@ -308,6 +309,8 @@ const GUID EAX_PrimaryFXSlotID = { 0xf317866d, 0x924c, 0x450c, { 0x86, 0x1b, 0xe
const GUID EAX_REVERB_EFFECT = { 0xcf95c8f, 0xa3cc, 0x4849, { 0xb0, 0xb6, 0x83, 0x2e, 0xcc, 0x18, 0x22, 0xdf} };
#endif // HAVE_EAX
/**************************************************************************************************\
*
* End of Open AL Specific
@ -370,10 +373,12 @@ void S_SoundInfo_f(void) {
if (s_UseOpenAL)
{
#ifdef HAVE_EAX
Com_Printf("EAX 4.0 %s supported\n",s_bEAX?"is":"not");
Com_Printf("Eal file %s loaded\n",s_bEALFileLoaded?"is":"not");
Com_Printf("s_EnvironmentID = %d\n",s_EnvironmentID);
Com_Printf("s_bInWater = %s\n",s_bInWater?"true":"false");
#endif
}
else
{
@ -454,7 +459,7 @@ void S_Init( void ) {
s_CPUType = Cvar_Get("sys_cpuid","",0);
#if !(defined __linux__ && defined __i386__)
#ifdef _MSC_VER
#if !id386
#else
extern unsigned int uiMMXAvailable;
@ -478,13 +483,9 @@ void S_Init( void ) {
Cmd_AddCommand("mp3_calcvols", S_MP3_CalcVols_f);
Cmd_AddCommand("s_dynamic", S_SetDynamicMusic_f);
cv = Cvar_Get("s_UseOpenAL" , "0",CVAR_ARCHIVE|CVAR_LATCH);
s_UseOpenAL = !!(cv->integer);
if (s_UseOpenAL)
{
ALCDevice = alcOpenDevice((ALubyte*)"DirectSound3D");
ALCDevice = alcOpenDevice(NULL);
if (!ALCDevice)
return;
@ -513,7 +514,9 @@ void S_Init( void ) {
alListenerfv(AL_VELOCITY,listenerVel);
alListenerfv(AL_ORIENTATION,listenerOri);
#ifdef HAVE_EAX
InitEAXManager();
#endif
memset(s_channels, 0, sizeof(s_channels));
@ -537,6 +540,7 @@ void S_Init( void ) {
// Sources / Channels are not sending to any Slots (other than the Listener / Primary FX Slot)
s_channels[i].lSlotID = -1;
#ifdef HAVE_EAX
if (s_bEAX)
{
// Remove the RoomAuto flag from each Source (to remove Reverb Engine Statistical
@ -549,6 +553,7 @@ void S_Init( void ) {
s_eaxSet(&EAXPROPERTYID_EAX40_Source, EAXSOURCE_FLAGS,
s_channels[i].alSource, &ulFlags, sizeof(ulFlags));
}
#endif
s_numChannels++;
}
@ -596,7 +601,9 @@ void S_Init( void ) {
// for this level
mapname = Cvar_VariableString( "mapname" );
#ifdef HAVE_EAX
EALFileInit(mapname);
#endif
}
else
@ -696,7 +703,9 @@ void S_Shutdown( void )
// Close device
alcCloseDevice(ALCDevice);
#ifdef HAVE_EAX
ReleaseEAXManager();
#endif
s_numChannels = 0;
@ -905,6 +914,7 @@ void S_BeginRegistration( void )
s_soundMuted = qfalse; // we can play again
#ifdef HAVE_EAX
// Find name of level so we can load in the appropriate EAL file
if (s_UseOpenAL)
{
@ -916,6 +926,7 @@ void S_BeginRegistration( void )
s_FXSlotInfo[i].lEnvID = -1;
}
}
#endif
if (s_numSfx == 0) {
SND_setup();
@ -934,6 +945,7 @@ void S_BeginRegistration( void )
}
#ifdef HAVE_EAX
void EALFileInit(char *level)
{
long lRoom;
@ -964,7 +976,7 @@ void EALFileInit(char *level)
if (s_bEALFileLoaded)
{
s_lLastEnvUpdate = timeGetTime();
s_lLastEnvUpdate = Com_Milliseconds();
}
else
{
@ -980,6 +992,7 @@ void EALFileInit(char *level)
}
}
}
#endif // HAVE_EAX
@ -2310,7 +2323,9 @@ void S_UpdateEntityPosition( int entityNum, const vec3_t origin )
pos[2] = -origin[1];
alSourcefv(s_channels[i].alSource, AL_POSITION, pos);
#ifdef HAVE_EAX
UpdateEAXBuffer(ch);
#endif
}
/* pos[0] = origin[0];
@ -2318,10 +2333,12 @@ void S_UpdateEntityPosition( int entityNum, const vec3_t origin )
pos[2] = -origin[1];
alSourcefv(s_channels[i].alSource, AL_POSITION, pos);
#ifdef HAVE_EAX
if ((s_bEALFileLoaded) && !( ch->entchannel == CHAN_VOICE || ch->entchannel == CHAN_VOICE_ATTEN || ch->entchannel == CHAN_VOICE_GLOBAL ) )
{
UpdateEAXBuffer(ch);
}
#endif
*/
}
}
@ -2464,8 +2481,10 @@ Change the volumes of all the playing sounds for changes in their positions
*/
void S_Respatialize( int entityNum, const vec3_t head, vec3_t axis[3], int inwater )
{
#ifdef HAVE_EAX
EAXOCCLUSIONPROPERTIES eaxOCProp;
EAXACTIVEFXSLOTS eaxActiveSlots;
#endif
unsigned int ulEnvironment;
int i;
channel_t *ch;
@ -2489,7 +2508,7 @@ void S_Respatialize( int entityNum, const vec3_t head, vec3_t axis[3], int inwat
listener_ori[4] = axis[2][2];
listener_ori[5] = -axis[2][1];
alListenerfv(AL_ORIENTATION, listener_ori);
#ifdef HAVE_EAX
// Update EAX effects here
if (s_bEALFileLoaded)
{
@ -2561,6 +2580,7 @@ void S_Respatialize( int entityNum, const vec3_t head, vec3_t axis[3], int inwat
}
}
}
#endif // HAVE_EAX
}
else
{
@ -2898,8 +2918,10 @@ void S_Update_(void) {
}
}
#ifdef HAVE_EAX
if (s_bEALFileLoaded)
UpdateEAXBuffer(ch);
#endif
int nBytesDecoded = 0;
int nTotalBytesDecoded = 0;
@ -2982,7 +3004,7 @@ void S_Update_(void) {
if (ch->thesfx->lipSyncData)
{
// Record start time for Lip-syncing
s_channels[source].iStartTime = timeGetTime();
s_channels[source].iStartTime = Com_Milliseconds();
// Prepare lipsync value(s)
s_entityWavVol[ ch->entnum ] = ch->thesfx->lipSyncData[0];
@ -3016,7 +3038,7 @@ void S_Update_(void) {
if (ch->thesfx->lipSyncData)
{
// Record start time for Lip-syncing
s_channels[source].iStartTime = timeGetTime();
s_channels[source].iStartTime = Com_Milliseconds();
// Prepare lipsync value(s)
s_entityWavVol[ ch->entnum ] = ch->thesfx->lipSyncData[0];
@ -3339,8 +3361,10 @@ void UpdateLoopingSounds()
ch->master_vol = loop->volume;
alSourcef(s_channels[i].alSource, AL_GAIN, ((float)(ch->master_vol) * s_volume->value) / 255.f);
#ifdef HAVE_EAX
if (s_bEALFileLoaded)
UpdateEAXBuffer(ch);
#endif
ch->bProcessed = true;
loop->bProcessed = true;
@ -3413,8 +3437,10 @@ void UpdateLoopingSounds()
alSourcef(s_channels[source].alSource, AL_GAIN, ((float)(ch->master_vol) * s_volume->value) / 255.0f);
alSourcei(s_channels[source].alSource, AL_SOURCE_RELATIVE, ch->fixed_origin ? AL_TRUE : AL_FALSE);
#ifdef HAVE_EAX
if (s_bEALFileLoaded)
UpdateEAXBuffer(ch);
#endif
alGetError();
alSourcePlay(s_channels[source].alSource);
@ -3465,7 +3491,9 @@ void AL_UpdateRawSamples()
size = (s_rawend - s_paintedtime)<<2;
if (size > (MAX_RAW_SAMPLES<<2))
{
#ifdef _DEBUG
OutputDebugString("UpdateRawSamples :- Raw Sample buffer has overflowed !!!\n");
#endif
size = MAX_RAW_SAMPLES<<2;
s_paintedtime = s_rawend - MAX_RAW_SAMPLES;
}
@ -3588,7 +3616,7 @@ void S_SetLipSyncs()
char szString[256];
#endif
currentTime = timeGetTime();
currentTime = Com_Milliseconds();
memset(s_entityWavVol, 0, sizeof(s_entityWavVol));
@ -5279,6 +5307,7 @@ qboolean SND_RegisterAudio_LevelLoadEnd(qboolean bDeleteEverythingNotUsedThisLev
}
#ifdef HAVE_EAX
/****************************************************************************************************\
*
* EAX Related
@ -5752,7 +5781,7 @@ void UpdateEAXListener()
if ((!s_lpEAXManager) || (!s_bEAX))
return;
lCurTime = timeGetTime();
lCurTime = Com_Milliseconds();
if ((s_lLastEnvUpdate + ENV_UPDATE_RATE) < lCurTime)
{
@ -6324,3 +6353,4 @@ float CalcDistance(EMPOINT A, EMPOINT B)
{
return (float)sqrt(sqr(A.fX - B.fX)+sqr(A.fY - B.fY) + sqr(A.fZ - B.fZ));
}
#endif // HAVE_EAX