diff --git a/Engine/source/sfx/openal/LoadOAL.h b/Engine/source/sfx/openal/LoadOAL.h index de9f781bd..9b2792657 100644 --- a/Engine/source/sfx/openal/LoadOAL.h +++ b/Engine/source/sfx/openal/LoadOAL.h @@ -28,11 +28,9 @@ #endif #if defined(TORQUE_OS_MAC) -# include -# include -# include -# include -# include +//#define AL_ALEXT_PROTOTYPES true +# include +# include #elif defined(TORQUE_OS_LINUX) # include # include @@ -237,6 +235,8 @@ typedef struct LPALCISEXTENSIONPRESENT alcIsExtensionPresent; LPALCGETPROCADDRESS alcGetProcAddress; LPALCGETENUMVALUE alcGetEnumValue; + +#if defined(AL_ALEXT_PROTOTYPES) LPALGENEFFECTS alGenEffects; LPALDELETEEFFECTS alDeleteEffects; LPALISEFFECT alIsEffect; @@ -260,6 +260,7 @@ typedef struct LPALGETAUXILIARYEFFECTSLOTIV alGetAuxiliaryEffectSlotiv; LPALGETAUXILIARYEFFECTSLOTF alGetAuxiliaryEffectSlotf; LPALGETAUXILIARYEFFECTSLOTFV alGetAuxiliaryEffectSlotfv; +#endif } OPENALFNTABLE, *LPOPENALFNTABLE; #endif diff --git a/Engine/source/sfx/openal/mac/LoadOAL.mac.cpp b/Engine/source/sfx/openal/mac/LoadOAL.mac.cpp index d7836b30d..7ed7cda26 100644 --- a/Engine/source/sfx/openal/mac/LoadOAL.mac.cpp +++ b/Engine/source/sfx/openal/mac/LoadOAL.mac.cpp @@ -434,7 +434,7 @@ ALboolean LoadOAL10Library(char *szOALFullPathName, LPOPENALFNTABLE lpOALFnTable warn("Failed to retrieve 'alcGetEnumValue' function address\n"); return AL_FALSE; } - +#if defined(AL_ALEXT_PROTOTYPES) //efx lpOALFnTable->alGenEffects = (LPALGENEFFECTS)alGenEffects; if (lpOALFnTable->alGenEffects == NULL) @@ -574,7 +574,7 @@ ALboolean LoadOAL10Library(char *szOALFullPathName, LPOPENALFNTABLE lpOALFnTable warn("Failed to retrieve 'alSource3i' function address\n"); return AL_FALSE; } - +#endif return AL_TRUE; } diff --git a/Engine/source/sfx/openal/sfxALDevice.cpp b/Engine/source/sfx/openal/sfxALDevice.cpp index e620a483c..080d77d6d 100644 --- a/Engine/source/sfx/openal/sfxALDevice.cpp +++ b/Engine/source/sfx/openal/sfxALDevice.cpp @@ -44,8 +44,10 @@ SFXALDevice::SFXALDevice( SFXProvider *provider, // $pref::SFX::frequency or $pref::SFX::bitrate! //check auxiliary device sends 4 and add them to the device ALint attribs[4] = { 0 }; +#if defined(AL_ALEXT_PROTOTYPES) ALCint iSends = 0; attribs[0] = ALC_MAX_AUXILIARY_SENDS; +#endif attribs[1] = 4; mDevice = mOpenAL.alcOpenDevice( name ); @@ -56,8 +58,10 @@ SFXALDevice::SFXALDevice( SFXProvider *provider, if( mContext ) mOpenAL.alcMakeContextCurrent( mContext ); - mOpenAL.alcGetIntegerv(mDevice, ALC_MAX_AUXILIARY_SENDS, 1, &iSends); - U32 err = mOpenAL.alcGetError( mDevice ); +#if defined(AL_ALEXT_PROTOTYPES) + mOpenAL.alcGetIntegerv(mDevice, ALC_MAX_AUXILIARY_SENDS, 1, &iSends); +#endif + U32 err = mOpenAL.alcGetError( mDevice ); if( err != ALC_NO_ERROR ) Con::errorf( "SFXALDevice - Initialization Error: %s", mOpenAL.alcGetString( mDevice, err ) ); @@ -84,8 +88,10 @@ SFXALDevice::~SFXALDevice() { _releaseAllResources(); ///cleanup our effects +#if defined(AL_ALEXT_PROTOTYPES) mOpenAL.alDeleteAuxiliaryEffectSlots(4, effectSlot); mOpenAL.alDeleteEffects(2, effect); +#endif ///cleanup of effects ends mOpenAL.alcMakeContextCurrent( NULL ); mOpenAL.alcDestroyContext( mContext ); @@ -155,7 +161,9 @@ void SFXALDevice::setListener( U32 index, const SFXListenerProperties& listener mOpenAL.alListenerfv( AL_ORIENTATION, (const F32 *)&tupple[0] ); ///Pass a unit size to openal, 1.0 assumes 1 meter to 1 game unit. ///Crucial for air absorbtion calculations. +#if defined(AL_ALEXT_PROTOTYPES) mOpenAL.alListenerf(AL_METERS_PER_UNIT, 1.0f); +#endif } //----------------------------------------------------------------------------- @@ -218,6 +226,7 @@ void SFXALDevice::setRolloffFactor( F32 factor ) mUserRolloffFactor = factor; } +#if defined(AL_ALEXT_PROTOTYPES) void SFXALDevice::openSlots() { for (uLoop = 0; uLoop < 4; uLoop++) @@ -322,4 +331,5 @@ void SFXALDevice::setReverb(const SFXReverbProperties& reverb) } -} \ No newline at end of file +} +#endif diff --git a/Engine/source/sfx/openal/sfxALDevice.h b/Engine/source/sfx/openal/sfxALDevice.h index 277b2496a..d6aa7ea82 100644 --- a/Engine/source/sfx/openal/sfxALDevice.h +++ b/Engine/source/sfx/openal/sfxALDevice.h @@ -85,6 +85,7 @@ class SFXALDevice : public SFXDevice virtual void setDistanceModel( SFXDistanceModel model ); virtual void setDopplerFactor( F32 factor ); virtual void setRolloffFactor( F32 factor ); +#if defined(AL_ALEXT_PROTOTYPES) //function for openAL to open slots virtual void openSlots(); //slots @@ -93,7 +94,8 @@ class SFXALDevice : public SFXDevice ALuint uLoop; //get values from sfxreverbproperties and pass it to openal device virtual void setReverb(const SFXReverbProperties& reverb); +#endif virtual void resetReverb() {} }; -#endif // _SFXALDEVICE_H_ \ No newline at end of file +#endif // _SFXALDEVICE_H_ diff --git a/Engine/source/sfx/openal/sfxALVoice.cpp b/Engine/source/sfx/openal/sfxALVoice.cpp index ccba74143..12267d3c0 100644 --- a/Engine/source/sfx/openal/sfxALVoice.cpp +++ b/Engine/source/sfx/openal/sfxALVoice.cpp @@ -118,8 +118,10 @@ void SFXALVoice::_play() #ifdef DEBUG_SPEW Platform::outputDebugString( "[SFXALVoice] Starting playback" ); #endif +#if defined(AL_ALEXT_PROTOTYPES) //send every voice that plays to the alauxiliary slot that has the reverb mOpenAL.alSource3i(mSourceName, AL_AUXILIARY_SEND_FILTER, 1, 0, AL_FILTER_NULL); +#endif mOpenAL.alSourcePlay( mSourceName ); //WORKAROUND: Adjust play cursor for buggy OAL when resuming playback. Do this after alSourcePlay diff --git a/Tools/CMake/torque3d.cmake b/Tools/CMake/torque3d.cmake index 4071266fc..7a726ae3d 100644 --- a/Tools/CMake/torque3d.cmake +++ b/Tools/CMake/torque3d.cmake @@ -61,9 +61,8 @@ mark_as_advanced(TORQUE_BASIC_LIGHTING) option(TORQUE_SFX_DirectX "DirectX Sound" OFF) mark_as_advanced(TORQUE_SFX_DirectX) option(TORQUE_SFX_OPENAL "OpenAL Sound" ON) - -if(TORQUE_SFX_OPENAL) - +#windows uses openal-soft +if(WIN32) #disable a few things that are not required set(ALSOFT_TESTS OFF CACHE BOOL "Build and install test programs" FORCE) set(ALSOFT_UTILS OFF CACHE BOOL "Build and install utility programs" FORCE) @@ -73,14 +72,15 @@ if(TORQUE_SFX_OPENAL) set(ALSOFT_NO_CONFIG_UTIL OFF CACHE BOOL "Disable building the alsoft-config utility" FORCE) set(ALSOFT_HRTF_DEFS OFF CACHE BOOL "Install HRTF definition files" FORCE) set(ALSOFT_AMBDEC_PRESETS OFF CACHE BOOL "Install AmbDec presets" FORCE) - + add_subdirectory( ${libDir}/openal-soft ${CMAKE_CURRENT_BINARY_DIR}/openal-soft) +endif() +if(TORQUE_SFX_OPENAL) #Hide some unnecessary fields as advanced mark_as_advanced(ALSOFT_AMBDEC_PRESETS) mark_as_advanced(ALSOFT_BACKEND_DSOUND) mark_as_advanced(ALSOFT_BACKEND_MMDEVAPI) - mark_as_advanced(ALSOFT_BUILD_ROUTER) mark_as_advanced(ALSOFT_BACKEND_WAVE) mark_as_advanced(ALSOFT_BACKEND_WINMM) mark_as_advanced(ALSOFT_CONFIG) @@ -316,6 +316,7 @@ addPath("${srcDir}/scene") addPath("${srcDir}/scene/culling") addPath("${srcDir}/scene/zones") addPath("${srcDir}/scene/mixin") +addPath("${srcDir}/shaderGen") addPath("${srcDir}/terrain") addPath("${srcDir}/environment") addPath("${srcDir}/forest") @@ -401,7 +402,7 @@ if(TORQUE_SFX_OPENAL AND NOT TORQUE_DEDICATED) endif() if(APPLE) addPath("${srcDir}/sfx/openal/mac") - addInclude("${libDir}/openal-soft/include") + addFramework("OpenAL") endif() endif()