Browse Source

revert to using the stock mac framework, and encapsulate nonstandard openal extensions usage under a set of #if defined(AL_ALEXT_PROTOTYPES) blocks

Brian Roberts 6 years ago
parent
commit
518cd593b2

+ 6 - 5
Engine/source/sfx/openal/LoadOAL.h

@@ -28,11 +28,9 @@
 #endif
 #endif
 
 
 #if defined(TORQUE_OS_MAC)
 #if defined(TORQUE_OS_MAC)
-#  include <AL/al.h>
-#  include <AL/alc.h>
-#  include <AL/alext.h>
-#  include <AL/efx.h>
-#  include <AL/efx-presets.h>
+//#define AL_ALEXT_PROTOTYPES true
+#  include <OpenAL/al.h>
+#  include <OpenAL/alc.h>
 #elif defined(TORQUE_OS_LINUX)
 #elif defined(TORQUE_OS_LINUX)
 #  include <AL/al.h>
 #  include <AL/al.h>
 #  include <AL/alc.h>
 #  include <AL/alc.h>
@@ -237,6 +235,8 @@ typedef struct
 	LPALCISEXTENSIONPRESENT		alcIsExtensionPresent;
 	LPALCISEXTENSIONPRESENT		alcIsExtensionPresent;
 	LPALCGETPROCADDRESS			alcGetProcAddress;
 	LPALCGETPROCADDRESS			alcGetProcAddress;
 	LPALCGETENUMVALUE			   alcGetEnumValue;
 	LPALCGETENUMVALUE			   alcGetEnumValue;
+    
+#if defined(AL_ALEXT_PROTOTYPES)
    LPALGENEFFECTS				   alGenEffects;
    LPALGENEFFECTS				   alGenEffects;
    LPALDELETEEFFECTS			   alDeleteEffects;
    LPALDELETEEFFECTS			   alDeleteEffects;
    LPALISEFFECT				   alIsEffect;
    LPALISEFFECT				   alIsEffect;
@@ -260,6 +260,7 @@ typedef struct
    LPALGETAUXILIARYEFFECTSLOTIV			alGetAuxiliaryEffectSlotiv;
    LPALGETAUXILIARYEFFECTSLOTIV			alGetAuxiliaryEffectSlotiv;
    LPALGETAUXILIARYEFFECTSLOTF			alGetAuxiliaryEffectSlotf;
    LPALGETAUXILIARYEFFECTSLOTF			alGetAuxiliaryEffectSlotf;
    LPALGETAUXILIARYEFFECTSLOTFV			alGetAuxiliaryEffectSlotfv;
    LPALGETAUXILIARYEFFECTSLOTFV			alGetAuxiliaryEffectSlotfv;
+#endif
 } OPENALFNTABLE, *LPOPENALFNTABLE;
 } OPENALFNTABLE, *LPOPENALFNTABLE;
 #endif
 #endif
 
 

+ 2 - 2
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");
 		warn("Failed to retrieve 'alcGetEnumValue' function address\n");
 		return AL_FALSE;
 		return AL_FALSE;
 	}
 	}
-   
+#if defined(AL_ALEXT_PROTOTYPES)
     //efx
     //efx
     lpOALFnTable->alGenEffects = (LPALGENEFFECTS)alGenEffects;
     lpOALFnTable->alGenEffects = (LPALGENEFFECTS)alGenEffects;
     if (lpOALFnTable->alGenEffects == NULL)
     if (lpOALFnTable->alGenEffects == NULL)
@@ -574,7 +574,7 @@ ALboolean LoadOAL10Library(char *szOALFullPathName, LPOPENALFNTABLE lpOALFnTable
         warn("Failed to retrieve 'alSource3i' function address\n");
         warn("Failed to retrieve 'alSource3i' function address\n");
         return AL_FALSE;
         return AL_FALSE;
     }
     }
-   
+#endif
 	return AL_TRUE;
 	return AL_TRUE;
 }
 }
 
 

+ 13 - 3
Engine/source/sfx/openal/sfxALDevice.cpp

@@ -44,8 +44,10 @@ SFXALDevice::SFXALDevice(  SFXProvider *provider,
    // $pref::SFX::frequency or $pref::SFX::bitrate!
    // $pref::SFX::frequency or $pref::SFX::bitrate!
    //check auxiliary device sends 4 and add them to the device
    //check auxiliary device sends 4 and add them to the device
    ALint attribs[4] = { 0 };
    ALint attribs[4] = { 0 };
+#if defined(AL_ALEXT_PROTOTYPES)
    ALCint iSends = 0;
    ALCint iSends = 0;
    attribs[0] = ALC_MAX_AUXILIARY_SENDS;
    attribs[0] = ALC_MAX_AUXILIARY_SENDS;
+#endif
    attribs[1] = 4;
    attribs[1] = 4;
 
 
    mDevice = mOpenAL.alcOpenDevice( name );
    mDevice = mOpenAL.alcOpenDevice( name );
@@ -56,8 +58,10 @@ SFXALDevice::SFXALDevice(  SFXProvider *provider,
 
 
       if( mContext ) 
       if( mContext ) 
          mOpenAL.alcMakeContextCurrent( 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 )
       if( err != ALC_NO_ERROR )
          Con::errorf( "SFXALDevice - Initialization Error: %s", mOpenAL.alcGetString( mDevice, err ) );
          Con::errorf( "SFXALDevice - Initialization Error: %s", mOpenAL.alcGetString( mDevice, err ) );
@@ -84,8 +88,10 @@ SFXALDevice::~SFXALDevice()
 {
 {
    _releaseAllResources();
    _releaseAllResources();
    ///cleanup our effects
    ///cleanup our effects
+#if defined(AL_ALEXT_PROTOTYPES)
    mOpenAL.alDeleteAuxiliaryEffectSlots(4, effectSlot);
    mOpenAL.alDeleteAuxiliaryEffectSlots(4, effectSlot);
    mOpenAL.alDeleteEffects(2, effect);
    mOpenAL.alDeleteEffects(2, effect);
+#endif
    ///cleanup of effects ends
    ///cleanup of effects ends
    mOpenAL.alcMakeContextCurrent( NULL );
    mOpenAL.alcMakeContextCurrent( NULL );
 	mOpenAL.alcDestroyContext( mContext );
 	mOpenAL.alcDestroyContext( mContext );
@@ -155,7 +161,9 @@ void SFXALDevice::setListener( U32 index, const SFXListenerProperties& listener
    mOpenAL.alListenerfv( AL_ORIENTATION, (const F32 *)&tupple[0] );
    mOpenAL.alListenerfv( AL_ORIENTATION, (const F32 *)&tupple[0] );
    ///Pass a unit size to openal, 1.0 assumes 1 meter to 1 game unit.
    ///Pass a unit size to openal, 1.0 assumes 1 meter to 1 game unit.
    ///Crucial for air absorbtion calculations.
    ///Crucial for air absorbtion calculations.
+#if defined(AL_ALEXT_PROTOTYPES)
    mOpenAL.alListenerf(AL_METERS_PER_UNIT, 1.0f);
    mOpenAL.alListenerf(AL_METERS_PER_UNIT, 1.0f);
+#endif
 }
 }
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
@@ -218,6 +226,7 @@ void SFXALDevice::setRolloffFactor( F32 factor )
    mUserRolloffFactor = factor;
    mUserRolloffFactor = factor;
 }
 }
 
 
+#if defined(AL_ALEXT_PROTOTYPES)
 void SFXALDevice::openSlots()
 void SFXALDevice::openSlots()
 {
 {
    for (uLoop = 0; uLoop < 4; uLoop++)
    for (uLoop = 0; uLoop < 4; uLoop++)
@@ -322,4 +331,5 @@ void SFXALDevice::setReverb(const SFXReverbProperties& reverb)
 
 
    }
    }
 
 
-}
+}
+#endif

+ 3 - 1
Engine/source/sfx/openal/sfxALDevice.h

@@ -85,6 +85,7 @@ class SFXALDevice : public SFXDevice
       virtual void setDistanceModel( SFXDistanceModel model );
       virtual void setDistanceModel( SFXDistanceModel model );
       virtual void setDopplerFactor( F32 factor );
       virtual void setDopplerFactor( F32 factor );
       virtual void setRolloffFactor( F32 factor );
       virtual void setRolloffFactor( F32 factor );
+#if defined(AL_ALEXT_PROTOTYPES)
       //function for openAL to open slots
       //function for openAL to open slots
       virtual void openSlots();
       virtual void openSlots();
       //slots
       //slots
@@ -93,7 +94,8 @@ class SFXALDevice : public SFXDevice
       ALuint   uLoop;
       ALuint   uLoop;
       //get values from sfxreverbproperties and pass it to openal device
       //get values from sfxreverbproperties and pass it to openal device
       virtual void setReverb(const SFXReverbProperties& reverb);
       virtual void setReverb(const SFXReverbProperties& reverb);
+#endif
       virtual void resetReverb() {}
       virtual void resetReverb() {}
 };
 };
 
 
-#endif // _SFXALDEVICE_H_
+#endif // _SFXALDEVICE_H_

+ 2 - 0
Engine/source/sfx/openal/sfxALVoice.cpp

@@ -118,8 +118,10 @@ void SFXALVoice::_play()
    #ifdef DEBUG_SPEW
    #ifdef DEBUG_SPEW
    Platform::outputDebugString( "[SFXALVoice] Starting playback" );
    Platform::outputDebugString( "[SFXALVoice] Starting playback" );
    #endif
    #endif
+#if defined(AL_ALEXT_PROTOTYPES)
    //send every voice that plays to the alauxiliary slot that has the reverb
    //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);
    mOpenAL.alSource3i(mSourceName, AL_AUXILIARY_SEND_FILTER, 1, 0, AL_FILTER_NULL);
+#endif
    mOpenAL.alSourcePlay( mSourceName );
    mOpenAL.alSourcePlay( mSourceName );
    
    
    //WORKAROUND: Adjust play cursor for buggy OAL when resuming playback.  Do this after alSourcePlay
    //WORKAROUND: Adjust play cursor for buggy OAL when resuming playback.  Do this after alSourcePlay

+ 7 - 6
Tools/CMake/torque3d.cmake

@@ -61,9 +61,8 @@ mark_as_advanced(TORQUE_BASIC_LIGHTING)
 option(TORQUE_SFX_DirectX "DirectX Sound" OFF)
 option(TORQUE_SFX_DirectX "DirectX Sound" OFF)
 mark_as_advanced(TORQUE_SFX_DirectX)
 mark_as_advanced(TORQUE_SFX_DirectX)
 option(TORQUE_SFX_OPENAL "OpenAL Sound" ON)
 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
     #disable a few things that are not required
     set(ALSOFT_TESTS OFF CACHE BOOL "Build and install test programs" FORCE)
     set(ALSOFT_TESTS OFF CACHE BOOL "Build and install test programs" FORCE)
     set(ALSOFT_UTILS OFF CACHE BOOL "Build and install utility 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_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_HRTF_DEFS OFF CACHE BOOL "Install HRTF definition files" FORCE)
     set(ALSOFT_AMBDEC_PRESETS OFF CACHE BOOL "Install AmbDec presets" FORCE)
     set(ALSOFT_AMBDEC_PRESETS OFF CACHE BOOL "Install AmbDec presets" FORCE)
-
+    
     add_subdirectory( ${libDir}/openal-soft ${CMAKE_CURRENT_BINARY_DIR}/openal-soft)
     add_subdirectory( ${libDir}/openal-soft ${CMAKE_CURRENT_BINARY_DIR}/openal-soft)
+endif()
 
 
+if(TORQUE_SFX_OPENAL)
     #Hide some unnecessary fields as advanced
     #Hide some unnecessary fields as advanced
     mark_as_advanced(ALSOFT_AMBDEC_PRESETS)
     mark_as_advanced(ALSOFT_AMBDEC_PRESETS)
     mark_as_advanced(ALSOFT_BACKEND_DSOUND)
     mark_as_advanced(ALSOFT_BACKEND_DSOUND)
     mark_as_advanced(ALSOFT_BACKEND_MMDEVAPI)
     mark_as_advanced(ALSOFT_BACKEND_MMDEVAPI)
-    mark_as_advanced(ALSOFT_BUILD_ROUTER)
     mark_as_advanced(ALSOFT_BACKEND_WAVE)
     mark_as_advanced(ALSOFT_BACKEND_WAVE)
     mark_as_advanced(ALSOFT_BACKEND_WINMM)
     mark_as_advanced(ALSOFT_BACKEND_WINMM)
     mark_as_advanced(ALSOFT_CONFIG)
     mark_as_advanced(ALSOFT_CONFIG)
@@ -316,6 +316,7 @@ addPath("${srcDir}/scene")
 addPath("${srcDir}/scene/culling")
 addPath("${srcDir}/scene/culling")
 addPath("${srcDir}/scene/zones")
 addPath("${srcDir}/scene/zones")
 addPath("${srcDir}/scene/mixin")
 addPath("${srcDir}/scene/mixin")
+addPath("${srcDir}/shaderGen")
 addPath("${srcDir}/terrain")
 addPath("${srcDir}/terrain")
 addPath("${srcDir}/environment")
 addPath("${srcDir}/environment")
 addPath("${srcDir}/forest")
 addPath("${srcDir}/forest")
@@ -401,7 +402,7 @@ if(TORQUE_SFX_OPENAL AND NOT TORQUE_DEDICATED)
       endif()
       endif()
    if(APPLE)
    if(APPLE)
       addPath("${srcDir}/sfx/openal/mac")
       addPath("${srcDir}/sfx/openal/mac")
-      addInclude("${libDir}/openal-soft/include")
+      addFramework("OpenAL")
     endif()
     endif()
 endif()
 endif()