Enable OpenAL for all platforms

New scons variable 'OPENAL' (defaults to '1') to toggle the
OpenAL sound backend.

Enable via "s_useOpenAL 1".
This commit is contained in:
dhewg 2011-12-11 15:58:00 +01:00
parent db65f7a61d
commit 74acc03147
4 changed files with 20 additions and 6 deletions

View file

@ -13,7 +13,7 @@ conf_filename='site.conf'
# choose configuration variables which should be saved between runs # choose configuration variables which should be saved between runs
# ( we handle all those as strings ) # ( we handle all those as strings )
serialized=['CC', 'CXX', 'X86', 'BUILD', 'IDNET_HOST', 'DEDICATED', serialized=['CC', 'CXX', 'X86', 'BUILD', 'IDNET_HOST', 'DEDICATED',
'DEBUG_MEMORY', 'LIBC_MALLOC', 'ID_NOLANADDRESS', 'ID_MCHECK', 'ALSA', 'DEBUG_MEMORY', 'LIBC_MALLOC', 'ID_NOLANADDRESS', 'ID_MCHECK', 'OPENAL', 'ALSA',
'TARGET_CORE', 'TARGET_GAME', 'TARGET_D3XP', 'TARGET_MONO', 'TARGET_DEMO', 'NOCURL', 'TARGET_CORE', 'TARGET_GAME', 'TARGET_D3XP', 'TARGET_MONO', 'TARGET_DEMO', 'NOCURL',
'BUILD_ROOT', 'BUILD_GAMEPAK', 'BASEFLAGS' ] 'BUILD_ROOT', 'BUILD_GAMEPAK', 'BASEFLAGS' ]
@ -109,6 +109,9 @@ ID_MCHECK (default 2)
note that Doom has it's own block allocator/checking note that Doom has it's own block allocator/checking
this should not be considered a replacement, but an additional tool this should not be considered a replacement, but an additional tool
OPENAL (default 1)
enable OpenAL sound backend support
ALSA (default 1) ALSA (default 1)
enable ALSA sound backend support enable ALSA sound backend support
@ -176,6 +179,7 @@ LIBC_MALLOC = '1'
ID_NOLANADDRESS = '0' ID_NOLANADDRESS = '0'
ID_MCHECK = '2' ID_MCHECK = '2'
BUILD_ROOT = 'build' BUILD_ROOT = 'build'
OPENAL = '1'
ALSA = '1' ALSA = '1'
SETUP = '0' SETUP = '0'
SDK = '0' SDK = '0'
@ -378,7 +382,7 @@ local_idlibpic = 0
# switch between base game build and d3xp game build # switch between base game build and d3xp game build
local_d3xp = 0 local_d3xp = 0
GLOBALS = 'g_env g_env_noopt g_game_env g_os g_cpu g_build ID_MCHECK ALSA idlib_objects game_objects local_dedicated local_gamedll local_demo local_idlibpic local_curl local_d3xp OPTCPPFLAGS' GLOBALS = 'g_env g_env_noopt g_game_env g_os g_cpu g_build ID_MCHECK OPENAL ALSA idlib_objects game_objects local_dedicated local_gamedll local_demo local_idlibpic local_curl local_d3xp OPTCPPFLAGS'
# end general configuration ---------------------- # end general configuration ----------------------

View file

@ -118,7 +118,7 @@ If you have questions concerning this license or the applicable additional terms
#endif #endif
#ifndef ID_OPENAL #ifndef ID_OPENAL
# if ( defined(_WIN32) || defined(MACOS_X) ) && !defined( ID_DEDICATED ) # if !defined( ID_DEDICATED )
# define ID_OPENAL 1 # define ID_OPENAL 1
# else # else
# define ID_OPENAL 0 # define ID_OPENAL 0

View file

@ -396,5 +396,9 @@ void idAudioHardwareOSS::Write( bool flushing ) {
-=============== -===============
*/ */
bool Sys_LoadOpenAL( void ) { bool Sys_LoadOpenAL( void ) {
#if ID_OPENAL
return true;
#else
return false; return false;
#endif
} }

View file

@ -212,7 +212,6 @@ if ( local_dedicated == 0 ):
else: else:
sys_string += ' \ sys_string += ' \
stub/stub_gl.cpp \ stub/stub_gl.cpp \
stub/openal_stub.cpp \
linux/dedicated.cpp' linux/dedicated.cpp'
sys_list = scons_utils.BuildList( 'sys', sys_string ) sys_list = scons_utils.BuildList( 'sys', sys_string )
@ -233,7 +232,8 @@ local_env = g_env.Clone()
if ( local_dedicated == 1 ): if ( local_dedicated == 1 ):
local_env.Append( CPPDEFINES = [ 'ID_DEDICATED' ] ) local_env.Append( CPPDEFINES = [ 'ID_DEDICATED' ] )
# don't enable alsa for a dedicated server binary # don't enable openal or alsa for a dedicated server binary
OPENAL = '0'
ALSA = '0' ALSA = '0'
if ( local_gamedll == 1 ): if ( local_gamedll == 1 ):
@ -247,6 +247,10 @@ if ( local_curl == 0 ):
sound_env = local_env.Clone() sound_env = local_env.Clone()
sound_list = [ '../linux/sound.cpp' ] sound_list = [ '../linux/sound.cpp' ]
if ( OPENAL != '1' ):
sound_env.Append( CPPDEFINES = 'ID_OPENAL=0' )
sound_list.append( '../../sys/stub/openal_stub.cpp' )
if ( g_os == "Linux" and ALSA != '0' ): if ( g_os == "Linux" and ALSA != '0' ):
sound_list.append( '../../sys/linux/sound_alsa.cpp' ) sound_list.append( '../../sys/linux/sound_alsa.cpp' )
else: else:
@ -266,7 +270,9 @@ if ( local_curl == 1 ):
if ( local_dedicated == 0 ): if ( local_dedicated == 0 ):
local_env.Append( LIBS = [ 'X11', 'Xext', 'Xxf86vm' ] ) # 'Xxf86dga', local_env.Append( LIBS = [ 'X11', 'Xext', 'Xxf86vm' ] ) # 'Xxf86dga',
local_env.Append( LIBPATH = [ '/usr/X11R6/lib' ] ) local_env.Append( LIBPATH = [ '/usr/X11R6/lib' ] )
# local_env.Append( LIBS = [ 'openal' ] )
if ( OPENAL == '1' ):
local_env.Append( LIBS = [ 'openal' ] )
source_list = core_list source_list = core_list
source_list += idlib_objects source_list += idlib_objects