Browse Source

Remove EAX from the build, unless EAX_SDK_AVAILABLE is defined. Use some

data types which are defined now in EFX, but this change does not actually
change the code to use EFX in place of EAX. It just removes EAX entirely.
cypythonide
a'moaca' 14 years ago
parent
commit
d22b190895
  1. 7
      MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plAudio/plAudioCaps.cpp
  2. 4
      MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.cpp
  3. 41
      MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.cpp
  4. 4
      MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.h
  5. 9
      MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plAudio/plEAXListenerMod.cpp
  6. 2
      MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plAudio/plEAXListenerMod.h

7
MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plAudio/plAudioCaps.cpp

@ -35,8 +35,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plEAXEffects.h" #include "plEAXEffects.h"
#include "plAudioCaps.h" #include "plAudioCaps.h"
#ifdef EAX_SDK_AVAILABLE
#include <eax.h> #include <eax.h>
#include <eaxlegacy.h> #include <eaxlegacy.h>
#endif
#include <DShow.h> #include <DShow.h>
#include "../plStatusLog/plStatusLog.h" #include "../plStatusLog/plStatusLog.h"
@ -197,6 +199,7 @@ void plAudioCapsDetector::EnumerateAudioDevices()
hsBool plAudioCapsDetector::IDetectEAX( ) hsBool plAudioCapsDetector::IDetectEAX( )
{ {
#ifdef EAX_SDK_AVAILABLE
hsBool gotSupport = true; hsBool gotSupport = true;
if(!alIsExtensionPresent((ALchar *)"EAX4.0")) // is eax 4 supported if(!alIsExtensionPresent((ALchar *)"EAX4.0")) // is eax 4 supported
@ -217,4 +220,8 @@ hsBool plAudioCapsDetector::IDetectEAX( )
kLogMe 0xff00ff00, "EAX 4 available"); kLogMe 0xff00ff00, "EAX 4 available");
} }
return gotSupport; return gotSupport;
#else
kLogMe 0xff00ff00, "EAX disabled in this build");
return false;
#endif
} }

4
MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.cpp

@ -28,7 +28,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "alc.h" #include "alc.h"
#include "efx.h" #include "efx.h"
#include <MMREG.H> #include <MMREG.H>
#ifdef EAX_SDK_AVAILABLE
#include <eax.h> #include <eax.h>
#endif
#include "hsTimer.h" #include "hsTimer.h"
#include "hsGeometry3.h" #include "hsGeometry3.h"
@ -209,10 +211,12 @@ void plAudioSystem::IEnumerateDevices()
if(major > 1 || (major == 1 && minor >= 1)) if(major > 1 || (major == 1 && minor >= 1))
{ {
hsBool supportsEAX = false; hsBool supportsEAX = false;
#ifdef EAX_SDK_AVAILABLE
if(alIsExtensionPresent((ALchar *)"EAX4.0") || alIsExtensionPresent((ALchar *) "EAX4.0Emulated")) if(alIsExtensionPresent((ALchar *)"EAX4.0") || alIsExtensionPresent((ALchar *) "EAX4.0Emulated"))
{ {
supportsEAX = true; supportsEAX = true;
} }
#endif
DeviceDescriptor desc(devices, supportsEAX); DeviceDescriptor desc(devices, supportsEAX);
fDeviceList.push_back(desc); fDeviceList.push_back(desc);
} }

41
MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.cpp

@ -32,6 +32,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "hsTypes.h" #include "hsTypes.h"
#include "hsThread.h" #include "hsThread.h"
#ifndef EAX_SDK_AVAILABLE
#include <EFX-Util.h>
#endif
#include "plEAXEffects.h" #include "plEAXEffects.h"
#include "../plAudioCore/plAudioCore.h" #include "../plAudioCore/plAudioCore.h"
#include "plDSoundBuffer.h" #include "plDSoundBuffer.h"
@ -43,15 +46,19 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include <dmusici.h> #include <dmusici.h>
#include <dxerr9.h> #include <dxerr9.h>
#ifdef EAX_SDK_AVAILABLE
#include <eax.h> #include <eax.h>
#include <eax-util.h> #include <eax-util.h>
#include <eaxlegacy.h> #include <eaxlegacy.h>
#endif
#include "../plStatusLog/plStatusLog.h" #include "../plStatusLog/plStatusLog.h"
#define kDebugLog if( myLog != nil ) myLog->AddLineF( #define kDebugLog if( myLog != nil ) myLog->AddLineF(
#ifdef EAX_SDK_AVAILABLE
static EAXGet s_EAXGet; static EAXGet s_EAXGet;
static EAXSet s_EAXSet; static EAXSet s_EAXSet;
#endif
//// GetInstance ///////////////////////////////////////////////////////////// //// GetInstance /////////////////////////////////////////////////////////////
@ -79,6 +86,7 @@ plEAXListener::~plEAXListener()
hsBool plEAXListener::Init( void ) hsBool plEAXListener::Init( void )
{ {
#ifdef EAX_SDK_AVAILABLE
if( fInited ) if( fInited )
return true; return true;
@ -128,6 +136,10 @@ hsBool plEAXListener::Init( void )
ClearProcessCache(); ClearProcessCache();
return true; return true;
#else /* !EAX_SDK_AVAILABLE */
plStatusLog::AddLineS("audio.log", "EAX disabled in this build");
return false;
#endif
} }
//// Shutdown //////////////////////////////////////////////////////////////// //// Shutdown ////////////////////////////////////////////////////////////////
@ -137,8 +149,10 @@ void plEAXListener::Shutdown( void )
if( !fInited ) if( !fInited )
return; return;
#ifdef EAX_SDK_AVAILABLE
s_EAXSet = nil; s_EAXSet = nil;
s_EAXGet = nil; s_EAXGet = nil;
#endif
IRelease(); IRelease();
} }
@ -147,7 +161,9 @@ bool plEAXListener::SetGlobalEAXProperty(GUID guid, unsigned long ulProperty, vo
{ {
if(fInited) if(fInited)
{ {
#ifdef EAX_SDK_AVAILABLE
return s_EAXSet(&guid, ulProperty, 0, pData, ulDataSize) == AL_NO_ERROR; return s_EAXSet(&guid, ulProperty, 0, pData, ulDataSize) == AL_NO_ERROR;
#endif
} }
return false; return false;
} }
@ -156,19 +172,29 @@ bool plEAXListener::GetGlobalEAXProperty(GUID guid, unsigned long ulProperty, vo
{ {
if(fInited) if(fInited)
{ {
#ifdef EAX_SDK_AVAILABLE
return s_EAXGet(&guid, ulProperty, 0, pData, ulDataSize) == AL_NO_ERROR; return s_EAXGet(&guid, ulProperty, 0, pData, ulDataSize) == AL_NO_ERROR;
#endif
} }
return false; return false;
} }
bool plEAXSource::SetSourceEAXProperty(unsigned source, GUID guid, unsigned long ulProperty, void *pData, unsigned long ulDataSize) bool plEAXSource::SetSourceEAXProperty(unsigned source, GUID guid, unsigned long ulProperty, void *pData, unsigned long ulDataSize)
{ {
#ifdef EAX_SDK_AVAILABLE
return s_EAXSet(&guid, ulProperty, source, pData, ulDataSize) == AL_NO_ERROR; return s_EAXSet(&guid, ulProperty, source, pData, ulDataSize) == AL_NO_ERROR;
#else
return false;
#endif
} }
bool plEAXSource::GetSourceEAXProperty(unsigned source, GUID guid, unsigned long ulProperty, void *pData, unsigned long ulDataSize) bool plEAXSource::GetSourceEAXProperty(unsigned source, GUID guid, unsigned long ulProperty, void *pData, unsigned long ulDataSize)
{ {
#ifdef EAX_SDK_AVAILABLE
return s_EAXGet(&guid, ulProperty, source, pData, ulDataSize) == AL_NO_ERROR; return s_EAXGet(&guid, ulProperty, source, pData, ulDataSize) == AL_NO_ERROR;
#else
return false;
#endif
} }
@ -203,7 +229,7 @@ void plEAXListener::IFail( const char *msg, hsBool major )
// Mutes the given properties, so if you have some props that you want // Mutes the given properties, so if you have some props that you want
// half strength, this function will do it for ya. // half strength, this function will do it for ya.
void plEAXListener::IMuteProperties( EAXLISTENERPROPERTIES *props, hsScalar percent ) void plEAXListener::IMuteProperties( EAXREVERBPROPERTIES *props, hsScalar percent )
{ {
// We only mute the room, roomHF and roomLF, since those control the overall effect // We only mute the room, roomHF and roomLF, since those control the overall effect
// application. All three are a direct linear blend as defined by eax-util.cpp, so // application. All three are a direct linear blend as defined by eax-util.cpp, so
@ -212,7 +238,9 @@ void plEAXListener::IMuteProperties( EAXLISTENERPROPERTIES *props, hsScalar perc
hsScalar invPercent = 1.f - percent; hsScalar invPercent = 1.f - percent;
// The old way, as dictated by EAX sample code... // The old way, as dictated by EAX sample code...
#ifdef EAX_SDK_AVAILABLE
props->lRoom = (int)( ( (float)EAXLISTENER_MINROOM * invPercent ) + ( (float)props->lRoom * percent ) ); props->lRoom = (int)( ( (float)EAXLISTENER_MINROOM * invPercent ) + ( (float)props->lRoom * percent ) );
#endif
// The new way, as suggested by EAX guys... // The new way, as suggested by EAX guys...
// props->lRoom = (int)( 2000.f * log( invPercent ) ) + props->lRoom; // props->lRoom = (int)( 2000.f * log( invPercent ) ) + props->lRoom;
@ -243,6 +271,7 @@ void plEAXListener::ClearProcessCache( void )
void plEAXListener::ProcessMods( hsTArray<plEAXListenerMod *> &modArray ) void plEAXListener::ProcessMods( hsTArray<plEAXListenerMod *> &modArray )
{ {
#ifdef EAX_SDK_AVAILABLE
int i; int i;
float totalStrength; float totalStrength;
hsBool firstOne; hsBool firstOne;
@ -386,6 +415,7 @@ void plEAXListener::ProcessMods( hsTArray<plEAXListenerMod *> &modArray )
{ {
IFail( false ); IFail( false );
} }
#endif /* EAX_SDK_AVAILABLE */
} }
@ -474,8 +504,13 @@ void plEAXSourceSettings::Enable( hsBool e )
fEnabled = e; fEnabled = e;
if( !e ) if( !e )
{ {
#ifdef EAX_SDK_AVAILABLE
fRoom = EAXBUFFER_MINROOM; fRoom = EAXBUFFER_MINROOM;
fRoomHF = EAXBUFFER_MINROOMHF; fRoomHF = EAXBUFFER_MINROOMHF;
#else
fRoom = 0;
fRoomHF = 0;
#endif
fRoomAuto = true; fRoomAuto = true;
fRoomHFAuto = true; fRoomHFAuto = true;
@ -621,6 +656,7 @@ void plEAXSource::SetFrom( plEAXSourceSettings *settings, unsigned source, hsBoo
dirtyParams = settings->fDirtyParams; dirtyParams = settings->fDirtyParams;
// Do the params // Do the params
#ifdef EAX_SDK_AVAILABLE
if( dirtyParams & plEAXSourceSettings::kRoom ) if( dirtyParams & plEAXSourceSettings::kRoom )
{ {
SetSourceEAXProperty(source, DSPROPSETID_EAX_BufferProperties, DSPROPERTY_EAXBUFFER_ROOM, &settings->fRoom, sizeof(settings->fRoom)); SetSourceEAXProperty(source, DSPROPSETID_EAX_BufferProperties, DSPROPERTY_EAXBUFFER_ROOM, &settings->fRoom, sizeof(settings->fRoom));
@ -647,10 +683,12 @@ void plEAXSource::SetFrom( plEAXSourceSettings *settings, unsigned source, hsBoo
SetSourceEAXProperty(source, DSPROPSETID_EAX_BufferProperties, DSPROPERTY_EAXBUFFER_OCCLUSIONROOMRATIO, &settings->GetCurrSofts().fOcclusionRoomRatio, sizeof(settings->GetCurrSofts().fOcclusionRoomRatio)); SetSourceEAXProperty(source, DSPROPSETID_EAX_BufferProperties, DSPROPERTY_EAXBUFFER_OCCLUSIONROOMRATIO, &settings->GetCurrSofts().fOcclusionRoomRatio, sizeof(settings->GetCurrSofts().fOcclusionRoomRatio));
SetSourceEAXProperty(source, DSPROPSETID_EAX_BufferProperties, DSPROPERTY_EAXBUFFER_OCCLUSIONDIRECTRATIO, &settings->GetCurrSofts().fOcclusionDirectRatio, sizeof(settings->GetCurrSofts().fOcclusionDirectRatio)); SetSourceEAXProperty(source, DSPROPSETID_EAX_BufferProperties, DSPROPERTY_EAXBUFFER_OCCLUSIONDIRECTRATIO, &settings->GetCurrSofts().fOcclusionDirectRatio, sizeof(settings->GetCurrSofts().fOcclusionDirectRatio));
} }
#endif /* EAX_SDK_AVAILABLE */
settings->ClearDirtyParams(); settings->ClearDirtyParams();
// Do all the flags in one pass // Do all the flags in one pass
#ifdef EAX_SDK_AVAILABLE
DWORD flags; DWORD flags;
@ -674,6 +712,7 @@ void plEAXSource::SetFrom( plEAXSourceSettings *settings, unsigned source, hsBoo
// Flag setting failed somehow // Flag setting failed somehow
hsAssert( false, "Unable to set EAX buffer flags" ); hsAssert( false, "Unable to set EAX buffer flags" );
} }
#endif /* EAX_SDK_AVAILABLE */
} }

4
MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.h

@ -43,7 +43,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
class plDSoundBuffer; class plDSoundBuffer;
class plEAXListenerMod; class plEAXListenerMod;
#ifdef EAX_SDK_AVAILABLE
typedef struct _EAXREVERBPROPERTIES EAXREVERBPROPERTIES; typedef struct _EAXREVERBPROPERTIES EAXREVERBPROPERTIES;
#else
#include <EFX-Util.h>
#endif
class plEAXListener class plEAXListener
{ {

9
MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plAudio/plEAXListenerMod.cpp

@ -29,6 +29,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// // // //
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
#ifndef EAX_SDK_AVAILABLE
#include <EFX-Util.h>
#endif
#include "hsTypes.h" #include "hsTypes.h"
#include "plEAXListenerMod.h" #include "plEAXListenerMod.h"
#include "../plIntersect/plSoftVolume.h" #include "../plIntersect/plSoftVolume.h"
@ -37,7 +40,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plAudioSystem.h" #include "plAudioSystem.h"
#include "../pnMessage/plAudioSysMsg.h" #include "../pnMessage/plAudioSysMsg.h"
#ifdef EAX_SDK_AVAILABLE
#include <eax-util.h> #include <eax-util.h>
#endif
plEAXListenerMod::plEAXListenerMod() plEAXListenerMod::plEAXListenerMod()
@ -47,7 +52,9 @@ plEAXListenerMod::plEAXListenerMod()
fRegistered = false; fRegistered = false;
fGetsMessages = false; fGetsMessages = false;
#ifdef EAX_SDK_AVAILABLE
memcpy( fListenerProps, &REVERB_ORIGINAL_PRESETS[ ORIGINAL_GENERIC ], sizeof( EAXREVERBPROPERTIES ) ); memcpy( fListenerProps, &REVERB_ORIGINAL_PRESETS[ ORIGINAL_GENERIC ], sizeof( EAXREVERBPROPERTIES ) );
#endif
} }
plEAXListenerMod::~plEAXListenerMod() plEAXListenerMod::~plEAXListenerMod()
@ -216,7 +223,9 @@ void plEAXListenerMod::Write( hsStream* s, hsResMgr* mgr )
void plEAXListenerMod::SetFromPreset( UInt32 preset ) void plEAXListenerMod::SetFromPreset( UInt32 preset )
{ {
#ifdef EAX_SDK_AVAILABLE
memcpy( fListenerProps, &REVERB_ORIGINAL_PRESETS[ preset ], sizeof( EAXREVERBPROPERTIES ) ); memcpy( fListenerProps, &REVERB_ORIGINAL_PRESETS[ preset ], sizeof( EAXREVERBPROPERTIES ) );
#endif
} }
float plEAXListenerMod::GetStrength( void ) float plEAXListenerMod::GetStrength( void )

2
MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plAudio/plEAXListenerMod.h

@ -37,7 +37,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
class plMessage; class plMessage;
class plSoftVolume; class plSoftVolume;
#ifdef EAX_SDK_AVAILABLE
typedef struct _EAXREVERBPROPERTIES EAXREVERBPROPERTIES; typedef struct _EAXREVERBPROPERTIES EAXREVERBPROPERTIES;
#endif
class plEAXListenerMod : public plSingleModifier class plEAXListenerMod : public plSingleModifier
{ {

Loading…
Cancel
Save