From d22b19089531da3447a086a57cab35d850d98892 Mon Sep 17 00:00:00 2001 From: a'moaca' Date: Sun, 27 Mar 2011 16:24:10 -0700 Subject: [PATCH] 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. --- .../Plasma/PubUtilLib/plAudio/plAudioCaps.cpp | 7 ++++ .../PubUtilLib/plAudio/plAudioSystem.cpp | 4 ++ .../PubUtilLib/plAudio/plEAXEffects.cpp | 41 ++++++++++++++++++- .../Plasma/PubUtilLib/plAudio/plEAXEffects.h | 4 ++ .../PubUtilLib/plAudio/plEAXListenerMod.cpp | 9 ++++ .../PubUtilLib/plAudio/plEAXListenerMod.h | 2 + 6 files changed, 66 insertions(+), 1 deletion(-) diff --git a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plAudio/plAudioCaps.cpp b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plAudio/plAudioCaps.cpp index 08a152e6..594c36f8 100644 --- a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plAudio/plAudioCaps.cpp +++ b/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 "plAudioCaps.h" +#ifdef EAX_SDK_AVAILABLE #include #include +#endif #include #include "../plStatusLog/plStatusLog.h" @@ -197,6 +199,7 @@ void plAudioCapsDetector::EnumerateAudioDevices() hsBool plAudioCapsDetector::IDetectEAX( ) { +#ifdef EAX_SDK_AVAILABLE hsBool gotSupport = true; if(!alIsExtensionPresent((ALchar *)"EAX4.0")) // is eax 4 supported @@ -217,4 +220,8 @@ hsBool plAudioCapsDetector::IDetectEAX( ) kLogMe 0xff00ff00, "EAX 4 available"); } return gotSupport; +#else + kLogMe 0xff00ff00, "EAX disabled in this build"); + return false; +#endif } \ No newline at end of file diff --git a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.cpp b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.cpp index 93884b3f..6ac8bdb9 100644 --- a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.cpp +++ b/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 "efx.h" #include +#ifdef EAX_SDK_AVAILABLE #include +#endif #include "hsTimer.h" #include "hsGeometry3.h" @@ -209,10 +211,12 @@ void plAudioSystem::IEnumerateDevices() if(major > 1 || (major == 1 && minor >= 1)) { hsBool supportsEAX = false; +#ifdef EAX_SDK_AVAILABLE if(alIsExtensionPresent((ALchar *)"EAX4.0") || alIsExtensionPresent((ALchar *) "EAX4.0Emulated")) { supportsEAX = true; } +#endif DeviceDescriptor desc(devices, supportsEAX); fDeviceList.push_back(desc); } diff --git a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.cpp b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.cpp index 77b25f57..32ae6666 100644 --- a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.cpp +++ b/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 "hsThread.h" +#ifndef EAX_SDK_AVAILABLE +#include +#endif #include "plEAXEffects.h" #include "../plAudioCore/plAudioCore.h" #include "plDSoundBuffer.h" @@ -43,15 +46,19 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include #include +#ifdef EAX_SDK_AVAILABLE #include #include #include +#endif #include "../plStatusLog/plStatusLog.h" #define kDebugLog if( myLog != nil ) myLog->AddLineF( +#ifdef EAX_SDK_AVAILABLE static EAXGet s_EAXGet; static EAXSet s_EAXSet; +#endif //// GetInstance ///////////////////////////////////////////////////////////// @@ -79,6 +86,7 @@ plEAXListener::~plEAXListener() hsBool plEAXListener::Init( void ) { +#ifdef EAX_SDK_AVAILABLE if( fInited ) return true; @@ -128,6 +136,10 @@ hsBool plEAXListener::Init( void ) ClearProcessCache(); return true; +#else /* !EAX_SDK_AVAILABLE */ + plStatusLog::AddLineS("audio.log", "EAX disabled in this build"); + return false; +#endif } //// Shutdown //////////////////////////////////////////////////////////////// @@ -137,8 +149,10 @@ void plEAXListener::Shutdown( void ) if( !fInited ) return; +#ifdef EAX_SDK_AVAILABLE s_EAXSet = nil; s_EAXGet = nil; +#endif IRelease(); } @@ -147,7 +161,9 @@ bool plEAXListener::SetGlobalEAXProperty(GUID guid, unsigned long ulProperty, vo { if(fInited) { +#ifdef EAX_SDK_AVAILABLE return s_EAXSet(&guid, ulProperty, 0, pData, ulDataSize) == AL_NO_ERROR; +#endif } return false; } @@ -156,19 +172,29 @@ bool plEAXListener::GetGlobalEAXProperty(GUID guid, unsigned long ulProperty, vo { if(fInited) { +#ifdef EAX_SDK_AVAILABLE return s_EAXGet(&guid, ulProperty, 0, pData, ulDataSize) == AL_NO_ERROR; +#endif } return false; } 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; +#else + return false; +#endif } 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; +#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 // 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 // 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; // The old way, as dictated by EAX sample code... +#ifdef EAX_SDK_AVAILABLE props->lRoom = (int)( ( (float)EAXLISTENER_MINROOM * invPercent ) + ( (float)props->lRoom * percent ) ); +#endif // The new way, as suggested by EAX guys... // props->lRoom = (int)( 2000.f * log( invPercent ) ) + props->lRoom; @@ -243,6 +271,7 @@ void plEAXListener::ClearProcessCache( void ) void plEAXListener::ProcessMods( hsTArray &modArray ) { +#ifdef EAX_SDK_AVAILABLE int i; float totalStrength; hsBool firstOne; @@ -386,6 +415,7 @@ void plEAXListener::ProcessMods( hsTArray &modArray ) { IFail( false ); } +#endif /* EAX_SDK_AVAILABLE */ } @@ -474,8 +504,13 @@ void plEAXSourceSettings::Enable( hsBool e ) fEnabled = e; if( !e ) { +#ifdef EAX_SDK_AVAILABLE fRoom = EAXBUFFER_MINROOM; fRoomHF = EAXBUFFER_MINROOMHF; +#else + fRoom = 0; + fRoomHF = 0; +#endif fRoomAuto = true; fRoomHFAuto = true; @@ -621,6 +656,7 @@ void plEAXSource::SetFrom( plEAXSourceSettings *settings, unsigned source, hsBoo dirtyParams = settings->fDirtyParams; // Do the params +#ifdef EAX_SDK_AVAILABLE if( dirtyParams & plEAXSourceSettings::kRoom ) { 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_OCCLUSIONDIRECTRATIO, &settings->GetCurrSofts().fOcclusionDirectRatio, sizeof(settings->GetCurrSofts().fOcclusionDirectRatio)); } +#endif /* EAX_SDK_AVAILABLE */ settings->ClearDirtyParams(); // Do all the flags in one pass +#ifdef EAX_SDK_AVAILABLE DWORD flags; @@ -674,6 +712,7 @@ void plEAXSource::SetFrom( plEAXSourceSettings *settings, unsigned source, hsBoo // Flag setting failed somehow hsAssert( false, "Unable to set EAX buffer flags" ); } +#endif /* EAX_SDK_AVAILABLE */ } diff --git a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.h b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.h index 663091c0..a2f0345c 100644 --- a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.h +++ b/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 plEAXListenerMod; +#ifdef EAX_SDK_AVAILABLE typedef struct _EAXREVERBPROPERTIES EAXREVERBPROPERTIES; +#else +#include +#endif class plEAXListener { diff --git a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plAudio/plEAXListenerMod.cpp b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plAudio/plEAXListenerMod.cpp index 2879c5e8..51492102 100644 --- a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plAudio/plEAXListenerMod.cpp +++ b/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 +#endif #include "hsTypes.h" #include "plEAXListenerMod.h" #include "../plIntersect/plSoftVolume.h" @@ -37,7 +40,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plAudioSystem.h" #include "../pnMessage/plAudioSysMsg.h" +#ifdef EAX_SDK_AVAILABLE #include +#endif plEAXListenerMod::plEAXListenerMod() @@ -47,7 +52,9 @@ plEAXListenerMod::plEAXListenerMod() fRegistered = false; fGetsMessages = false; +#ifdef EAX_SDK_AVAILABLE memcpy( fListenerProps, &REVERB_ORIGINAL_PRESETS[ ORIGINAL_GENERIC ], sizeof( EAXREVERBPROPERTIES ) ); +#endif } plEAXListenerMod::~plEAXListenerMod() @@ -216,7 +223,9 @@ void plEAXListenerMod::Write( hsStream* s, hsResMgr* mgr ) void plEAXListenerMod::SetFromPreset( UInt32 preset ) { +#ifdef EAX_SDK_AVAILABLE memcpy( fListenerProps, &REVERB_ORIGINAL_PRESETS[ preset ], sizeof( EAXREVERBPROPERTIES ) ); +#endif } float plEAXListenerMod::GetStrength( void ) diff --git a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plAudio/plEAXListenerMod.h b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plAudio/plEAXListenerMod.h index 9875ec43..724da41f 100644 --- a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plAudio/plEAXListenerMod.h +++ b/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 plSoftVolume; +#ifdef EAX_SDK_AVAILABLE typedef struct _EAXREVERBPROPERTIES EAXREVERBPROPERTIES; +#endif class plEAXListenerMod : public plSingleModifier {