Remove Menu Music CMake option
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@5485 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 29e0a9e657c2bc447328b06c3dd92478c6f7cf41 Former-commit-id: ef7c09760fb0fb9ae6743810c4fcd634bc343eab
This commit is contained in:
parent
ac8d33bd7a
commit
b24d454a21
11 changed files with 97 additions and 204 deletions
|
@ -187,10 +187,6 @@ The Speed Dreams Team.
|
|||
on most Linux distros (only Fedora is working on this right now, AFAIK, 2012, July)
|
||||
Ask the dev team for any hint about building it ...
|
||||
|
||||
- OPTION_MENU_MUSIC:BOOL :
|
||||
Enable building with the new Menu Music enabled (def: OFF)
|
||||
Note: This requires new 3rd party libs : libogg, libvorbis, and libvorbisfile
|
||||
|
||||
- OPTION_OSGGRAPH:BOOL :
|
||||
Enable building of the WIP new OpenSceneGraph-based graphics module 'osggraph' (def: OFF)
|
||||
Note: This requires new 3rd party libs : OpenSceneGraph
|
||||
|
|
|
@ -151,36 +151,32 @@ MACRO(CHECK_LIBRARIES)
|
|||
MESSAGE(STATUS "Looking for library OpenAL - NOT found")
|
||||
ENDIF(OPENAL_FOUND)
|
||||
|
||||
IF(OPTION_MENU_MUSIC)
|
||||
# Ogg
|
||||
Find_Package(OGG)
|
||||
IF(OGG_FOUND)
|
||||
SET(HAVE_LIBOGG 1)
|
||||
MESSAGE(STATUS "Looking for library Ogg - found")
|
||||
ELSE(OGG_FOUND)
|
||||
MESSAGE(STATUS "Looking for library Ogg - NOT found")
|
||||
ENDIF(OGG_FOUND)
|
||||
|
||||
# Ogg
|
||||
Find_Package(OGG)
|
||||
IF(OGG_FOUND)
|
||||
SET(HAVE_LIBOGG 1)
|
||||
MESSAGE(STATUS "Looking for library Ogg - found")
|
||||
ELSE(OGG_FOUND)
|
||||
MESSAGE(STATUS "Looking for library Ogg - NOT found")
|
||||
ENDIF(OGG_FOUND)
|
||||
# Vorbis
|
||||
Find_Package(VORBIS)
|
||||
IF(VORBIS_FOUND)
|
||||
SET(HAVE_LIBVORBIS 1)
|
||||
MESSAGE(STATUS "Looking for library Vorbis - found")
|
||||
ELSE(VORBIS_FOUND)
|
||||
MESSAGE(STATUS "Looking for library Vorbis - NOT found")
|
||||
ENDIF(VORBIS_FOUND)
|
||||
|
||||
# Vorbis
|
||||
Find_Package(VORBIS)
|
||||
IF(VORBIS_FOUND)
|
||||
SET(HAVE_LIBVORBIS 1)
|
||||
MESSAGE(STATUS "Looking for library Vorbis - found")
|
||||
ELSE(VORBIS_FOUND)
|
||||
MESSAGE(STATUS "Looking for library Vorbis - NOT found")
|
||||
ENDIF(VORBIS_FOUND)
|
||||
|
||||
# VorbisFile
|
||||
Find_Package(VORBISFILE)
|
||||
IF(VORBISFILE_FOUND)
|
||||
SET(HAVE_LIBVORBISFILE 1)
|
||||
MESSAGE(STATUS "Looking for library VorbisFile - found")
|
||||
ELSE(VORBISFILE_FOUND)
|
||||
MESSAGE(STATUS "Looking for library VorbisFile - NOT found")
|
||||
ENDIF(VORBISFILE_FOUND)
|
||||
|
||||
ENDIF(OPTION_MENU_MUSIC)
|
||||
# VorbisFile
|
||||
Find_Package(VORBISFILE)
|
||||
IF(VORBISFILE_FOUND)
|
||||
SET(HAVE_LIBVORBISFILE 1)
|
||||
MESSAGE(STATUS "Looking for library VorbisFile - found")
|
||||
ELSE(VORBISFILE_FOUND)
|
||||
MESSAGE(STATUS "Looking for library VorbisFile - NOT found")
|
||||
ENDIF(VORBISFILE_FOUND)
|
||||
|
||||
# ENet
|
||||
Find_Package(ENET)
|
||||
|
|
|
@ -114,20 +114,14 @@ MACRO(_FIND_3RDPARTY_DEPENDENCIES ROOT_DIR)
|
|||
_FIND_3RDPARTY_DEPENDENCY(OPENAL AL/al.h "" openal32 ${ROOT_DIR} "")
|
||||
|
||||
# Menu Music requires ogg, vorbis, and vorbisfile
|
||||
# this option may be removed after Menu Music becomes on by default
|
||||
# and these libs become part of Official 3rdParty package
|
||||
IF(OPTION_MENU_MUSIC)
|
||||
# OGG.
|
||||
_FIND_3RDPARTY_DEPENDENCY(OGG ogg/ogg.h "" libogg ${ROOT_DIR} "")
|
||||
|
||||
# OGG.
|
||||
_FIND_3RDPARTY_DEPENDENCY(OGG ogg/ogg.h "" libogg ${ROOT_DIR} "")
|
||||
# Vorbis.
|
||||
_FIND_3RDPARTY_DEPENDENCY(VORBIS vorbis/vorbisfile.h "" libvorbis ${ROOT_DIR} "")
|
||||
|
||||
# Vorbis.
|
||||
_FIND_3RDPARTY_DEPENDENCY(VORBIS vorbis/vorbisfile.h "" libvorbis ${ROOT_DIR} "")
|
||||
|
||||
# VorbisFile.
|
||||
_FIND_3RDPARTY_DEPENDENCY(VORBISFILE vorbis/vorbisfile.h "" libvorbisfile ${ROOT_DIR} "")
|
||||
|
||||
ENDIF(OPTION_MENU_MUSIC)
|
||||
# VorbisFile.
|
||||
_FIND_3RDPARTY_DEPENDENCY(VORBISFILE vorbis/vorbisfile.h "" libvorbisfile ${ROOT_DIR} "")
|
||||
|
||||
# ENet.
|
||||
_FIND_3RDPARTY_DEPENDENCY(ENET enet/enet.h "" enet ${ROOT_DIR} "")
|
||||
|
@ -298,20 +292,15 @@ MACRO(SD_INSTALL_CUSTOM_3RDPARTY TARGET_NAME)
|
|||
LIST(APPEND _THIRDPARTY_DLL_PATHNAMES "${_DLL_PATHNAME}")
|
||||
|
||||
# Menu Music requires ogg, vorbis, and vorbisfile
|
||||
# this option may be removed after Menu Music becomes on by default
|
||||
# and these libs become part of Official 3rdParty package
|
||||
IF(OPTION_MENU_MUSIC)
|
||||
_FIND_3RDPARTY_DLL("${OGG_LIBRARY}" "libogg;libogg-0" "" _DLL_PATHNAME)
|
||||
LIST(APPEND _THIRDPARTY_DLL_PATHNAMES "${_DLL_PATHNAME}")
|
||||
|
||||
_FIND_3RDPARTY_DLL("${OGG_LIBRARY}" "libogg;libogg-0" "" _DLL_PATHNAME)
|
||||
LIST(APPEND _THIRDPARTY_DLL_PATHNAMES "${_DLL_PATHNAME}")
|
||||
_FIND_3RDPARTY_DLL("${VORBIS_LIBRARY}" "libvorbis;libvorbis-0" "" _DLL_PATHNAME)
|
||||
LIST(APPEND _THIRDPARTY_DLL_PATHNAMES "${_DLL_PATHNAME}")
|
||||
|
||||
_FIND_3RDPARTY_DLL("${VORBIS_LIBRARY}" "libvorbis;libvorbis-0" "" _DLL_PATHNAME)
|
||||
LIST(APPEND _THIRDPARTY_DLL_PATHNAMES "${_DLL_PATHNAME}")
|
||||
_FIND_3RDPARTY_DLL("${VORBISFILE_LIBRARY}" "libvorbisfile;libvorbisfile-3" "" _DLL_PATHNAME)
|
||||
LIST(APPEND _THIRDPARTY_DLL_PATHNAMES "${_DLL_PATHNAME}")
|
||||
|
||||
_FIND_3RDPARTY_DLL("${VORBISFILE_LIBRARY}" "libvorbisfile;libvorbisfile-3" "" _DLL_PATHNAME)
|
||||
LIST(APPEND _THIRDPARTY_DLL_PATHNAMES "${_DLL_PATHNAME}")
|
||||
|
||||
ENDIF(OPTION_MENU_MUSIC)
|
||||
|
||||
_FIND_3RDPARTY_DLL("${SDL_LIBRARY}" "SDL" ";lib" _DLL_PATHNAME)
|
||||
LIST(APPEND _THIRDPARTY_DLL_PATHNAMES "${_DLL_PATHNAME}")
|
||||
|
|
|
@ -74,8 +74,6 @@ MACRO(ADD_SD_COMPILE_OPTIONS)
|
|||
|
||||
SET(OPTION_3RDPARTY_EXPAT true CACHE BOOL "Use 3rd party Expat library rather than bundled TXML")
|
||||
|
||||
SET(OPTION_MENU_MUSIC true CACHE BOOL "Enable music play-back while navigating through the menus")
|
||||
|
||||
# Enable building with 3rd party SOLID library under Windows, as we ship the binary package,
|
||||
# but not under Linux, where FreeSolid seems not to be available by default on most distros.
|
||||
IF(WIN32)
|
||||
|
@ -152,10 +150,6 @@ MACRO(ADD_SD_COMPILE_OPTIONS)
|
|||
ADD_DEFINITIONS(-DTHIRD_PARTY_EXPAT)
|
||||
ENDIF(OPTION_3RDPARTY_EXPAT)
|
||||
|
||||
IF(OPTION_MENU_MUSIC)
|
||||
ADD_DEFINITIONS(-DMENU_MUSIC)
|
||||
ENDIF(OPTION_MENU_MUSIC)
|
||||
|
||||
IF(OPTION_3RDPARTY_SOLID)
|
||||
ADD_DEFINITIONS(-DTHIRD_PARTY_SOLID)
|
||||
ENDIF(OPTION_3RDPARTY_SOLID)
|
||||
|
|
|
@ -180,97 +180,73 @@ ENDMACRO(ADD_OPENAL_LIBRARY TARGET)
|
|||
|
||||
MACRO(ADD_OGG_INCLUDEDIR)
|
||||
|
||||
IF(OPTION_MENU_MUSIC)
|
||||
FIND_PACKAGE(OGG)
|
||||
|
||||
FIND_PACKAGE(OGG)
|
||||
|
||||
IF(OGG_FOUND)
|
||||
INCLUDE_DIRECTORIES(${OGG_INCLUDE_DIR})
|
||||
ELSE(OGG_FOUND)
|
||||
MESSAGE(FATAL_ERROR "Cannot find OGG header files")
|
||||
ENDIF(OGG_FOUND)
|
||||
|
||||
ENDIF(OPTION_MENU_MUSIC)
|
||||
IF(OGG_FOUND)
|
||||
INCLUDE_DIRECTORIES(${OGG_INCLUDE_DIR})
|
||||
ELSE(OGG_FOUND)
|
||||
MESSAGE(FATAL_ERROR "Cannot find OGG header files")
|
||||
ENDIF(OGG_FOUND)
|
||||
|
||||
ENDMACRO(ADD_OGG_INCLUDEDIR)
|
||||
|
||||
MACRO(ADD_OGG_LIBRARY TARGET)
|
||||
|
||||
IF(OPTION_MENU_MUSIC)
|
||||
FIND_PACKAGE(OGG)
|
||||
|
||||
FIND_PACKAGE(OGG)
|
||||
|
||||
IF(OGG_FOUND)
|
||||
TARGET_LINK_LIBRARIES(${TARGET} ${OGG_LIBRARY})
|
||||
ELSE(OGG_FOUND)
|
||||
MESSAGE(FATAL_ERROR "Cannot find OGG libraries")
|
||||
ENDIF(OGG_FOUND)
|
||||
|
||||
ENDIF(OPTION_MENU_MUSIC)
|
||||
IF(OGG_FOUND)
|
||||
TARGET_LINK_LIBRARIES(${TARGET} ${OGG_LIBRARY})
|
||||
ELSE(OGG_FOUND)
|
||||
MESSAGE(FATAL_ERROR "Cannot find OGG libraries")
|
||||
ENDIF(OGG_FOUND)
|
||||
|
||||
ENDMACRO(ADD_OGG_LIBRARY TARGET)
|
||||
|
||||
MACRO(ADD_VORBIS_INCLUDEDIR)
|
||||
|
||||
IF(OPTION_MENU_MUSIC)
|
||||
FIND_PACKAGE(VORBIS)
|
||||
|
||||
FIND_PACKAGE(VORBIS)
|
||||
|
||||
IF(VORBIS_FOUND)
|
||||
INCLUDE_DIRECTORIES(${VORBIS_INCLUDE_DIR})
|
||||
ELSE(VORBIS_FOUND)
|
||||
MESSAGE(FATAL_ERROR "Cannot find VORBIS header files")
|
||||
ENDIF(VORBIS_FOUND)
|
||||
|
||||
ENDIF(OPTION_MENU_MUSIC)
|
||||
IF(VORBIS_FOUND)
|
||||
INCLUDE_DIRECTORIES(${VORBIS_INCLUDE_DIR})
|
||||
ELSE(VORBIS_FOUND)
|
||||
MESSAGE(FATAL_ERROR "Cannot find VORBIS header files")
|
||||
ENDIF(VORBIS_FOUND)
|
||||
|
||||
ENDMACRO(ADD_VORBIS_INCLUDEDIR)
|
||||
|
||||
MACRO(ADD_VORBIS_LIBRARY TARGET)
|
||||
|
||||
IF(OPTION_MENU_MUSIC)
|
||||
FIND_PACKAGE(VORBIS)
|
||||
|
||||
FIND_PACKAGE(VORBIS)
|
||||
|
||||
IF(VORBIS_FOUND)
|
||||
TARGET_LINK_LIBRARIES(${TARGET} ${VORBIS_LIBRARY})
|
||||
ELSE(VORBIS_FOUND)
|
||||
MESSAGE(FATAL_ERROR "Cannot find VORBIS libraries")
|
||||
ENDIF(VORBIS_FOUND)
|
||||
|
||||
ENDIF(OPTION_MENU_MUSIC)
|
||||
IF(VORBIS_FOUND)
|
||||
TARGET_LINK_LIBRARIES(${TARGET} ${VORBIS_LIBRARY})
|
||||
ELSE(VORBIS_FOUND)
|
||||
MESSAGE(FATAL_ERROR "Cannot find VORBIS libraries")
|
||||
ENDIF(VORBIS_FOUND)
|
||||
|
||||
ENDMACRO(ADD_VORBIS_LIBRARY TARGET)
|
||||
|
||||
MACRO(ADD_VORBISFILE_INCLUDEDIR)
|
||||
|
||||
IF(OPTION_MENU_MUSIC)
|
||||
FIND_PACKAGE(VORBISFILE)
|
||||
|
||||
FIND_PACKAGE(VORBISFILE)
|
||||
|
||||
IF(VORBISFILE_FOUND)
|
||||
INCLUDE_DIRECTORIES(${VORBISFILE_INCLUDE_DIR})
|
||||
ELSE(VORBISFILE_FOUND)
|
||||
MESSAGE(FATAL_ERROR "Cannot find VORBISFILE header files")
|
||||
ENDIF(VORBISFILE_FOUND)
|
||||
|
||||
ENDIF(OPTION_MENU_MUSIC)
|
||||
IF(VORBISFILE_FOUND)
|
||||
INCLUDE_DIRECTORIES(${VORBISFILE_INCLUDE_DIR})
|
||||
ELSE(VORBISFILE_FOUND)
|
||||
MESSAGE(FATAL_ERROR "Cannot find VORBISFILE header files")
|
||||
ENDIF(VORBISFILE_FOUND)
|
||||
|
||||
ENDMACRO(ADD_VORBISFILE_INCLUDEDIR)
|
||||
|
||||
MACRO(ADD_VORBISFILE_LIBRARY TARGET)
|
||||
|
||||
IF(OPTION_MENU_MUSIC)
|
||||
FIND_PACKAGE(VORBISFILE)
|
||||
|
||||
FIND_PACKAGE(VORBISFILE)
|
||||
|
||||
IF(VORBISFILE_FOUND)
|
||||
TARGET_LINK_LIBRARIES(${TARGET} ${VORBISFILE_LIBRARY})
|
||||
ELSE(VORBISFILE_FOUND)
|
||||
MESSAGE(FATAL_ERROR "Cannot find VORBISFILE libraries")
|
||||
ENDIF(VORBISFILE_FOUND)
|
||||
|
||||
ENDIF(OPTION_MENU_MUSIC)
|
||||
IF(VORBISFILE_FOUND)
|
||||
TARGET_LINK_LIBRARIES(${TARGET} ${VORBISFILE_LIBRARY})
|
||||
ELSE(VORBISFILE_FOUND)
|
||||
MESSAGE(FATAL_ERROR "Cannot find VORBISFILE libraries")
|
||||
ENDIF(VORBISFILE_FOUND)
|
||||
|
||||
ENDMACRO(ADD_VORBISFILE_LIBRARY TARGET)
|
||||
|
||||
|
|
|
@ -21,13 +21,10 @@ SET(_SOURCES control.cpp glfeatures.cpp guibutton.cpp guifont.cpp
|
|||
glfeatures.h gui.h guiscreen.h guimenu.h tgfclient.h guifont.h )
|
||||
SET(_OTHER_SOURCES guimenutest.xml)
|
||||
|
||||
# Note: Menu music sources needed ONLY if menu music enabled.
|
||||
IF(OPTION_MENU_MUSIC)
|
||||
SET(_SOURCES ${_SOURCES}
|
||||
soundstream.cpp soundstream.h
|
||||
oggsoundstream.cpp oggsoundstream.h
|
||||
openalmusicplayer.cpp openalmusicplayer.h )
|
||||
ENDIF(OPTION_MENU_MUSIC)
|
||||
SET(_SOURCES ${_SOURCES}
|
||||
soundstream.cpp soundstream.h
|
||||
oggsoundstream.cpp oggsoundstream.h
|
||||
openalmusicplayer.cpp openalmusicplayer.h )
|
||||
|
||||
#disable developer warning
|
||||
IF (COMMAND CMAKE_POLICY)
|
||||
|
@ -67,17 +64,15 @@ IF(OPENAL_FOUND)
|
|||
TARGET_LINK_LIBRARIES(tgfclient ${OPENAL_LIBRARY})
|
||||
ENDIF(OPENAL_FOUND)
|
||||
|
||||
IF(OPTION_MENU_MUSIC)
|
||||
IF(VORBIS_FOUND)
|
||||
TARGET_LINK_LIBRARIES(tgfclient ${VORBIS_LIBRARY})
|
||||
ENDIF(VORBIS_FOUND)
|
||||
IF(VORBISFILE_FOUND)
|
||||
TARGET_LINK_LIBRARIES(tgfclient ${VORBISFILE_LIBRARY})
|
||||
ENDIF(VORBISFILE_FOUND)
|
||||
IF(OGG_FOUND)
|
||||
TARGET_LINK_LIBRARIES(tgfclient ${OGG_LIBRARY})
|
||||
ENDIF(OGG_FOUND)
|
||||
ENDIF(OPTION_MENU_MUSIC)
|
||||
IF(VORBIS_FOUND)
|
||||
TARGET_LINK_LIBRARIES(tgfclient ${VORBIS_LIBRARY})
|
||||
ENDIF(VORBIS_FOUND)
|
||||
IF(VORBISFILE_FOUND)
|
||||
TARGET_LINK_LIBRARIES(tgfclient ${VORBISFILE_LIBRARY})
|
||||
ENDIF(VORBISFILE_FOUND)
|
||||
IF(OGG_FOUND)
|
||||
TARGET_LINK_LIBRARIES(tgfclient ${OGG_LIBRARY})
|
||||
ENDIF(OGG_FOUND)
|
||||
|
||||
ADD_PLIB_LIBRARY(tgfclient ul sg js)
|
||||
ADD_SDL_LIBRARY(tgfclient)
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
|
||||
#define MAX_MUSIC_PATH 1024
|
||||
|
||||
#if MENU_MUSIC
|
||||
#include "oggsoundstream.h"
|
||||
#include "openalmusicplayer.h"
|
||||
|
||||
|
@ -107,10 +106,9 @@ static void playMenuMusic()
|
|||
timerId = SDL_AddTimer(nextcallinms, sdlTimerFunc, (void*)NULL);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void initMusic()
|
||||
{
|
||||
#if MENU_MUSIC
|
||||
readConfig();
|
||||
if (isEnabled()) {
|
||||
mapMutex = SDL_CreateMutex();
|
||||
|
@ -118,13 +116,11 @@ void initMusic()
|
|||
strcpy(currentMusicfile,defaultMusic);
|
||||
playMenuMusic();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void shutdownMusic()
|
||||
{
|
||||
#if MENU_MUSIC
|
||||
if(timerId != 0){
|
||||
SDL_RemoveTimer(timerId);
|
||||
timerId = 0;
|
||||
|
@ -147,11 +143,8 @@ void shutdownMusic()
|
|||
SDL_UnlockMutex(mapMutex);
|
||||
SDL_DestroyMutex(mapMutex);
|
||||
mapMutex = NULL;
|
||||
|
||||
|
||||
#endif
|
||||
}
|
||||
#if MENU_MUSIC
|
||||
|
||||
void pauseMenuMusic()
|
||||
{
|
||||
|
||||
|
@ -170,10 +163,9 @@ void pauseMenuMusic()
|
|||
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
void playMusic(char* filename)
|
||||
{
|
||||
#if MENU_MUSIC
|
||||
if (isEnabled()) {
|
||||
OpenALMusicPlayer* player = NULL;
|
||||
if(filename != NULL) {
|
||||
|
@ -210,12 +202,10 @@ void playMusic(char* filename)
|
|||
}
|
||||
playMenuMusic();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void setDefaultMusic(const char* filename)
|
||||
{
|
||||
#if MENU_MUSIC
|
||||
if(0 != filename){
|
||||
if(strlen(filename) < MAX_MUSIC_PATH){
|
||||
if(0 != strcmp(defaultMusic,filename)){
|
||||
|
@ -229,10 +219,8 @@ void setDefaultMusic(const char* filename)
|
|||
defaultMusic[0] = 0;
|
||||
GfLogInfo("Default Music changing to: %s \n", "NULL");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if MENU_MUSIC
|
||||
static void readConfig()
|
||||
{
|
||||
char fnbuf[1024];
|
||||
|
@ -270,11 +258,9 @@ static void readConfig()
|
|||
GfParmReleaseHandle(paramHandle);
|
||||
paramHandle = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
void setMusicVolume(float vol)
|
||||
{
|
||||
#if MENU_MUSIC
|
||||
if (vol < 0)
|
||||
vol = 0.0f;
|
||||
else if (vol > 1.0f)
|
||||
|
@ -283,5 +269,4 @@ void setMusicVolume(float vol)
|
|||
maxMusicVolume = vol;
|
||||
|
||||
GfLogInfo("Music maximum volume set to %.2f\n", maxMusicVolume);
|
||||
#endif
|
||||
}
|
|
@ -302,9 +302,7 @@ void OpenalSound::resume()
|
|||
{
|
||||
if (paused) {
|
||||
paused = false;
|
||||
#ifdef MENU_MUSIC
|
||||
alSourcePlay (source);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -313,9 +311,7 @@ void OpenalSound::pause()
|
|||
{
|
||||
if (!paused) {
|
||||
paused = true;
|
||||
#ifdef MENU_MUSIC
|
||||
alSourcePause (source);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,10 +40,8 @@ OpenalSoundInterface::OpenalSoundInterface(float sampling_rate, int n_channels)
|
|||
ALfloat zeroes[] = { 0.0f, 0.0f, 0.0f };
|
||||
ALfloat front[] = { 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f };
|
||||
|
||||
#ifdef MENU_MUSIC
|
||||
originalcontext = alcGetCurrentContext();
|
||||
if(originalcontext == NULL){
|
||||
#endif
|
||||
dev = alcOpenDevice( NULL );
|
||||
if( dev == NULL ) {
|
||||
GfLogError("OpenAL: Could not open device (alcOpenDevice failed)\n");
|
||||
|
@ -61,9 +59,8 @@ OpenalSoundInterface::OpenalSoundInterface(float sampling_rate, int n_channels)
|
|||
|
||||
alcMakeContextCurrent( cc );
|
||||
alcGetError(dev);
|
||||
#ifdef MENU_MUSIC
|
||||
}
|
||||
#endif
|
||||
|
||||
alGetError();
|
||||
|
||||
// Figure out the number of possible sources, watch out for an API update, perhaps
|
||||
|
@ -96,10 +93,8 @@ OpenalSoundInterface::OpenalSoundInterface(float sampling_rate, int n_channels)
|
|||
|
||||
OSI_MAX_SOURCES = sources;
|
||||
|
||||
#ifdef MENU_MUSIC
|
||||
// Reserve three sources for music
|
||||
OSI_MAX_SOURCES -= 3;
|
||||
#endif
|
||||
|
||||
OSI_MAX_STATIC_SOURCES = MAX(0, OSI_MAX_SOURCES - OSI_MIN_DYNAMIC_SOURCES);
|
||||
|
||||
|
@ -181,17 +176,13 @@ OpenalSoundInterface::~OpenalSoundInterface()
|
|||
}
|
||||
delete [] engpri;
|
||||
|
||||
#ifdef MENU_MUSIC
|
||||
if(originalcontext == NULL){
|
||||
#endif
|
||||
alcMakeContextCurrent(0);
|
||||
alcDestroyContext(cc);
|
||||
|
||||
if (!alcCloseDevice(dev))
|
||||
GfLogError("Failed to close OpenAL device: %s\n", alcGetString(dev, alcGetError(dev)));
|
||||
#ifdef MENU_MUSIC
|
||||
}
|
||||
#endif
|
||||
|
||||
if (car_src) {
|
||||
delete [] car_src;
|
||||
|
@ -214,11 +205,9 @@ Sound* OpenalSoundInterface::addSample (const char* filename, int flags, bool lo
|
|||
|
||||
void OpenalSoundInterface::update(CarSoundData** car_sound_data, int n_cars, sgVec3 p_obs, sgVec3 u_obs, sgVec3 c_obs, sgVec3 a_obs)
|
||||
{
|
||||
#ifdef MENU_MUSIC
|
||||
if(silent){
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
ALfloat listener_pos[3];
|
||||
#ifdef USE_OPENAL_DOPPLER
|
||||
|
@ -472,7 +461,6 @@ void OpenalSoundInterface::mute(bool bOn)
|
|||
{
|
||||
SoundInterface::mute(bOn);
|
||||
|
||||
#ifdef MENU_MUSIC
|
||||
if(bOn){
|
||||
for (unsigned int i=0; i<sound_list.size(); i++) {
|
||||
sound_list[i]->pause();
|
||||
|
@ -484,8 +472,4 @@ void OpenalSoundInterface::mute(bool bOn)
|
|||
sound_list[i]->resume();
|
||||
}
|
||||
}
|
||||
#else
|
||||
// Needed in case update() is not called right after this.
|
||||
alListenerf(AL_GAIN, getGlobalGain());
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -44,9 +44,7 @@ class OpenalSoundInterface : public SoundInterface
|
|||
|
||||
SoundSource* car_src;
|
||||
SoundSource tyre_src[4];
|
||||
#ifdef MENU_MUSIC
|
||||
ALCcontext* originalcontext;
|
||||
#endif
|
||||
ALCcontext* cc;
|
||||
ALCdevice* dev;
|
||||
int OSI_MAX_BUFFERS;
|
||||
|
|
|
@ -31,9 +31,7 @@
|
|||
|
||||
#include "soundconfig.h"
|
||||
|
||||
#if MENU_MUSIC
|
||||
#include "legacymenu.h"
|
||||
#endif
|
||||
|
||||
// list of options.
|
||||
static const char *soundOptionList[] = {SND_ATT_SOUND_STATE_OPENAL,
|
||||
|
@ -49,7 +47,6 @@ static int SoundOptionId;
|
|||
static float VolumeValue = 100.0f;
|
||||
static int VolumeValueId;
|
||||
|
||||
#if MENU_MUSIC
|
||||
// list of music states.
|
||||
static const char *musicStateList[] = {SND_VAL_MUSIC_STATE_ENABLED,
|
||||
SND_VAL_MUSIC_STATE_DISABLED};
|
||||
|
@ -63,8 +60,6 @@ static int MusicStateId;
|
|||
static float MusicVolumeValue = 100.0f;
|
||||
static int MusicVolumeValueId;
|
||||
|
||||
#endif
|
||||
|
||||
// gui screen handles.
|
||||
static void *scrHandle = NULL;
|
||||
static void *prevHandle = NULL;
|
||||
|
@ -103,7 +98,6 @@ static void readSoundCfg(void)
|
|||
sprintf(buf, "%g", VolumeValue);
|
||||
GfuiEditboxSetString(scrHandle, VolumeValueId, buf);
|
||||
|
||||
#if MENU_MUSIC
|
||||
optionName = GfParmGetStr(paramHandle, SND_SCT_MUSIC, SND_ATT_MUSIC_STATE, musicStateList[0]);
|
||||
|
||||
for (i = 0; i < nbMusicStates; i++) {
|
||||
|
@ -127,8 +121,6 @@ static void readSoundCfg(void)
|
|||
sprintf(buf, "%g", MusicVolumeValue);
|
||||
GfuiEditboxSetString(scrHandle, MusicVolumeValueId, buf);
|
||||
|
||||
#endif
|
||||
|
||||
GfParmReleaseHandle(paramHandle);
|
||||
}
|
||||
|
||||
|
@ -144,22 +136,17 @@ static void saveSoundOption(void *)
|
|||
void *paramHandle = GfParmReadFile(buf, GFPARM_RMODE_REREAD | GFPARM_RMODE_CREAT);
|
||||
GfParmSetStr(paramHandle, SND_SCT_SOUND, SND_ATT_SOUND_STATE, soundOptionList[curOption]);
|
||||
GfParmSetNum(paramHandle, SND_SCT_SOUND, SND_ATT_SOUND_VOLUME, "%", VolumeValue);
|
||||
|
||||
#if MENU_MUSIC
|
||||
GfParmSetStr(paramHandle, SND_SCT_MUSIC, SND_ATT_MUSIC_STATE, musicStateList[curMusicState]);
|
||||
GfParmSetNum(paramHandle, SND_SCT_MUSIC, SND_ATT_MUSIC_VOLUME, "%", MusicVolumeValue);
|
||||
#endif
|
||||
|
||||
GfParmWriteFile(NULL, paramHandle, "sound");
|
||||
GfParmReleaseHandle(paramHandle);
|
||||
|
||||
#if MENU_MUSIC
|
||||
// Shutdown the user interface.
|
||||
// Shutdown the user interface.
|
||||
LegacyMenu::self().shutdown();
|
||||
|
||||
// Restart the game.
|
||||
GfuiApp().restart();
|
||||
#endif
|
||||
|
||||
// Return to previous screen.
|
||||
GfuiScreenActivate(prevHandle);
|
||||
|
@ -189,7 +176,6 @@ static void changeVolume(void * )
|
|||
GfuiEditboxSetString(scrHandle, VolumeValueId, buf);
|
||||
}
|
||||
|
||||
#if MENU_MUSIC
|
||||
// Toggle music state enabled/disabled.
|
||||
static void changeMusicState(void *vp)
|
||||
{
|
||||
|
@ -212,7 +198,7 @@ static void changeMusicVolume(void * )
|
|||
sprintf(buf, "%g", MusicVolumeValue);
|
||||
GfuiEditboxSetString(scrHandle, MusicVolumeValueId, buf);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void onActivate(void * /* dummy */)
|
||||
{
|
||||
readSoundCfg();
|
||||
|
@ -244,13 +230,12 @@ void* SoundMenuInit(void *prevMenu)
|
|||
VolumeValueId = GfuiMenuCreateEditControl(scrHandle,param,"volumeedit",NULL,NULL,changeVolume);
|
||||
|
||||
|
||||
#if MENU_MUSIC
|
||||
// TODO remove this and uncomment the static controls in 'soundconfigmenu.xml'
|
||||
// if/when Music is officially included
|
||||
// HACK to allow CMake option 'OPTION_MENU_MUSIC' to show/hide these menu music labels
|
||||
GfuiMenuCreateLabelControl(scrHandle,param,"musicstaticlabel");
|
||||
GfuiMenuCreateLabelControl(scrHandle,param,"musicstaticvolume");
|
||||
// end of code to remove
|
||||
//// TODO remove this and uncomment the static controls in 'soundconfigmenu.xml'
|
||||
//// if/when Music is officially included
|
||||
//// HACK to allow CMake option 'OPTION_MENU_MUSIC' to show/hide these menu music labels
|
||||
//GfuiMenuCreateLabelControl(scrHandle,param,"musicstaticlabel");
|
||||
//GfuiMenuCreateLabelControl(scrHandle,param,"musicstaticvolume");
|
||||
//// end of code to remove
|
||||
|
||||
GfuiMenuCreateButtonControl(scrHandle,param,"musicleftarrow",(void*)-1,changeMusicState);
|
||||
GfuiMenuCreateButtonControl(scrHandle,param,"musicrightarrow",(void*)1,changeMusicState);
|
||||
|
@ -258,7 +243,6 @@ void* SoundMenuInit(void *prevMenu)
|
|||
MusicStateId = GfuiMenuCreateLabelControl(scrHandle,param,"musiclabel");
|
||||
|
||||
MusicVolumeValueId = GfuiMenuCreateEditControl(scrHandle,param,"musicvolumeedit",NULL,NULL,changeMusicVolume);
|
||||
#endif
|
||||
|
||||
GfParmReleaseHandle(param);
|
||||
|
||||
|
|
Loading…
Reference in a new issue