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