Re #755 Applied Joe's menu-music-5040.patch : menu music first step
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@5042 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 87495f3c30b0f30c1a875d081960cecd6dabb40d Former-commit-id: 7cae952707f8401162d76aefd9981452fc7911ea
This commit is contained in:
parent
eb808f5d28
commit
a3472f3e04
24 changed files with 636 additions and 45 deletions
|
@ -34,6 +34,7 @@ I - Pre-requisites
|
||||||
Linux: Be carefull to compile plib with -fPIC on AMD64 if you run a 64 bit version.
|
Linux: Be carefull to compile plib with -fPIC on AMD64 if you run a 64 bit version.
|
||||||
- OpenAL soft 1.5 / 1.6 / 1.11 / 1.14 (http://connect.creativelabs.com/openal)
|
- OpenAL soft 1.5 / 1.6 / 1.11 / 1.14 (http://connect.creativelabs.com/openal)
|
||||||
(Torcs modified 0.0.8 from www.torcs.org also used to work in the past).
|
(Torcs modified 0.0.8 from www.torcs.org also used to work in the past).
|
||||||
|
- libOGG 1.3 or newer and libVorbis 1.3 or newer (optional for the moment, will soon get mandatory)
|
||||||
- ENet 1.3.2/4 (http://enet.bespin.org)
|
- ENet 1.3.2/4 (http://enet.bespin.org)
|
||||||
Linux: Be careful to compile ENet with -fPIC on AMD64 if you run a 64 bit build.
|
Linux: Be careful to compile ENet with -fPIC on AMD64 if you run a 64 bit build.
|
||||||
- Expat 2 (can be skipped for the moment, but won't anymore soon)
|
- Expat 2 (can be skipped for the moment, but won't anymore soon)
|
||||||
|
@ -171,6 +172,7 @@ The Speed Dreams Team.
|
||||||
- CMAKE_PREFIX_PATH:STRING :
|
- CMAKE_PREFIX_PATH:STRING :
|
||||||
Path prefixes for additional 3rdParty libraries (def:empty)
|
Path prefixes for additional 3rdParty libraries (def:empty)
|
||||||
(use /usr/local if you compiled some 3rdParty libs yourself).
|
(use /usr/local if you compiled some 3rdParty libs yourself).
|
||||||
|
|
||||||
- CMAKE_INSTALL_PREFIX:PATH :
|
- CMAKE_INSTALL_PREFIX:PATH :
|
||||||
Install path for Speed Dreams (def: /usr/local)
|
Install path for Speed Dreams (def: /usr/local)
|
||||||
|
|
||||||
|
@ -184,6 +186,10 @@ 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 libogg, libvorbis, and libvorbisfile (these dependencies are new for 2.1)
|
||||||
|
|
||||||
- OPTION_TRACE:BOOL :
|
- OPTION_TRACE:BOOL :
|
||||||
Full run-time traces if ON (def: ON)
|
Full run-time traces if ON (def: ON)
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
INCLUDE(../cmake/macros.cmake)
|
INCLUDE(../cmake/macros.cmake)
|
||||||
|
|
||||||
SD_INSTALL_FILES(DATA cmake FILES splitargn.cmake robot.def.in.cmake FindENET.cmake FindPLIB.cmake FindSOLID.cmake)
|
SD_INSTALL_FILES(DATA cmake FILES splitargn.cmake robot.def.in.cmake FindENET.cmake FindPLIB.cmake FindSOLID.cmake
|
||||||
|
FindOGG.cmake FindVORBISFILE.cmake FindVORBIS.cmake)
|
||||||
|
|
95
cmake/FindOGG.cmake
Normal file
95
cmake/FindOGG.cmake
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
# Locate OGG libraries ()
|
||||||
|
# This module defines
|
||||||
|
# OGG_LIBRARY : list of lib names
|
||||||
|
# OGG_FOUND : if false, do not try to link to OGG
|
||||||
|
# OGG_INCLUDE_DIR : where to find the headers
|
||||||
|
#
|
||||||
|
# $OGG_DIR is an environment variable that would
|
||||||
|
# correspond to the ./configure --prefix=$OGG_DIR
|
||||||
|
# used in building OGG.
|
||||||
|
#
|
||||||
|
# Created by Joe Thompson (based on Jean-Philippe Meuret's FindSOLID.cmake).
|
||||||
|
|
||||||
|
# No use to do all of this twice.
|
||||||
|
IF(OGG_FOUND)
|
||||||
|
RETURN()
|
||||||
|
ENDIF(OGG_FOUND)
|
||||||
|
|
||||||
|
# First, try with PkgConfig if available.
|
||||||
|
FIND_PACKAGE(PkgConfig)
|
||||||
|
IF(PKGCONFIG_FOUND)
|
||||||
|
|
||||||
|
PKG_CHECK_MODULES(OGG ogg)
|
||||||
|
IF(NOT OGG_FOUND)
|
||||||
|
PKG_CHECK_MODULES(OGG OGG)
|
||||||
|
ENDIF (NOT OGG_FOUND)
|
||||||
|
|
||||||
|
IF(OGG_FOUND)
|
||||||
|
SET(OGG_FOUND TRUE)
|
||||||
|
SET(OGG_INCLUDE_DIR ${OGG_INCLUDE_DIRS} CACHE STRING "OGG include paths")
|
||||||
|
SET(OGG_LIBRARY ${OGG_LIBRARIES} CACHE STRING "OGG library")
|
||||||
|
MESSAGE(STATUS "Looking for OGG --- found using pkg-config (${OGG_LIBRARY})")
|
||||||
|
RETURN()
|
||||||
|
ENDIF(OGG_FOUND)
|
||||||
|
|
||||||
|
ENDIF(PKGCONFIG_FOUND)
|
||||||
|
|
||||||
|
# Then try the good old way for include dirs.
|
||||||
|
IF(NOT APPLE)
|
||||||
|
|
||||||
|
FIND_PATH(OGG_INCLUDE_DIR ogg/ogg.h
|
||||||
|
HINTS ENV OGG_DIR
|
||||||
|
PATH_SUFFIXES
|
||||||
|
include/ogg include/OGG
|
||||||
|
PATHS
|
||||||
|
/usr /usr/local
|
||||||
|
DOC "Non-Apple include dir for OGG")
|
||||||
|
|
||||||
|
ELSE(NOT APPLE)
|
||||||
|
|
||||||
|
FIND_PATH(OGG_INCLUDE_DIR ogg.h
|
||||||
|
HINTS ENV OGG_DIR
|
||||||
|
PATH_SUFFIXES
|
||||||
|
Headers include/ogg
|
||||||
|
PATHS
|
||||||
|
#Additional MacOS Paths
|
||||||
|
~/Library/Frameworks/OGG.framework
|
||||||
|
/Library/Frameworks/OGG.framework
|
||||||
|
/System/Library/Frameworks/OGG.framework # Tiger
|
||||||
|
|
||||||
|
/usr /usr/local
|
||||||
|
DOC "Apple include dir for OGG")
|
||||||
|
|
||||||
|
ENDIF(NOT APPLE)
|
||||||
|
|
||||||
|
# Then try the good old way for libs.
|
||||||
|
FIND_LIBRARY(OGG_LIBRARY
|
||||||
|
NAMES ogg
|
||||||
|
HINTS ENV OGG_DIR
|
||||||
|
PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
|
||||||
|
PATHS /usr /usr/local)
|
||||||
|
|
||||||
|
IF(WIN32)
|
||||||
|
|
||||||
|
FIND_LIBRARY(OGG_LIBRARY
|
||||||
|
NAMES ogg
|
||||||
|
HINTS ENV OGG_DIR
|
||||||
|
PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
|
||||||
|
PATHS /usr /usr/local)
|
||||||
|
|
||||||
|
ENDIF(WIN32)
|
||||||
|
|
||||||
|
IF(OGG_INCLUDE_DIR AND OGG_LIBRARY AND (NOT WIN32 OR OGG_LIBRARY))
|
||||||
|
SET(OGG_FOUND TRUE)
|
||||||
|
ENDIF(OGG_INCLUDE_DIR AND OGG_LIBRARY AND (NOT WIN32 OR OGG_LIBRARY))
|
||||||
|
|
||||||
|
IF(OGG_FOUND)
|
||||||
|
MESSAGE(STATUS "Looking for OGG - found (${OGG_LIBRARY})")
|
||||||
|
SET(OGG_LIBRARY ${OGG_LIBRARY})
|
||||||
|
IF(WIN32)
|
||||||
|
SET(OGG_LIBRARY ${OGG_LIBRARY})
|
||||||
|
ENDIF(WIN32)
|
||||||
|
ELSE(OGG_FOUND)
|
||||||
|
MESSAGE(FATAL_ERROR "Could not find OGG")
|
||||||
|
ENDIF(OGG_FOUND)
|
||||||
|
|
95
cmake/FindVORBIS.cmake
Normal file
95
cmake/FindVORBIS.cmake
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
# Locate VORBIS libraries ()
|
||||||
|
# This module defines
|
||||||
|
# VORBIS_LIBRARY : list of lib names
|
||||||
|
# VORBIS_FOUND : if false, do not try to link to VORBIS
|
||||||
|
# VORBIS_INCLUDE_DIR : where to find the headers
|
||||||
|
#
|
||||||
|
# $VORBIS_DIR is an environment variable that would
|
||||||
|
# correspond to the ./configure --prefix=$VORBIS_DIR
|
||||||
|
# used in building VORBIS.
|
||||||
|
#
|
||||||
|
# Created by Joe Thompson (based on Jean-Philippe Meuret's FindSOLID.cmake).
|
||||||
|
|
||||||
|
# No use to do all of this twice.
|
||||||
|
IF(VORBIS_FOUND)
|
||||||
|
RETURN()
|
||||||
|
ENDIF(VORBIS_FOUND)
|
||||||
|
|
||||||
|
# First, try with PkgConfig if available.
|
||||||
|
FIND_PACKAGE(PkgConfig)
|
||||||
|
IF(PKGCONFIG_FOUND)
|
||||||
|
|
||||||
|
PKG_CHECK_MODULES(VORBIS vorbis)
|
||||||
|
IF(NOT VORBIS_FOUND)
|
||||||
|
PKG_CHECK_MODULES(VORBIS VORBIS)
|
||||||
|
ENDIF (NOT VORBIS_FOUND)
|
||||||
|
|
||||||
|
IF(VORBIS_FOUND)
|
||||||
|
SET(VORBIS_FOUND TRUE)
|
||||||
|
SET(VORBIS_INCLUDE_DIR ${VORBIS_INCLUDE_DIRS} CACHE STRING "VORBIS include paths")
|
||||||
|
SET(VORBIS_LIBRARY ${VORBIS_LIBRARIES} CACHE STRING "VORBIS library")
|
||||||
|
MESSAGE(STATUS "Looking for VORBIS --- found using pkg-config (${VORBIS_LIBRARY})")
|
||||||
|
RETURN()
|
||||||
|
ENDIF(VORBIS_FOUND)
|
||||||
|
|
||||||
|
ENDIF(PKGCONFIG_FOUND)
|
||||||
|
|
||||||
|
# Then try the good old way for include dirs.
|
||||||
|
IF(NOT APPLE)
|
||||||
|
|
||||||
|
FIND_PATH(VORBIS_INCLUDE_DIR vorbis/vorbisfile.h
|
||||||
|
HINTS ENV VORBIS_DIR
|
||||||
|
PATH_SUFFIXES
|
||||||
|
include/vorbis include/VORBIS
|
||||||
|
PATHS
|
||||||
|
/usr /usr/local
|
||||||
|
DOC "Non-Apple include dir for VORBIS")
|
||||||
|
|
||||||
|
ELSE(NOT APPLE)
|
||||||
|
|
||||||
|
FIND_PATH(VORBIS_INCLUDE_DIR vorbisfile.h
|
||||||
|
HINTS ENV VORBIS_DIR
|
||||||
|
PATH_SUFFIXES
|
||||||
|
Headers include/vorbis
|
||||||
|
PATHS
|
||||||
|
#Additional MacOS Paths
|
||||||
|
~/Library/Frameworks/VORBIS.framework
|
||||||
|
/Library/Frameworks/VORBIS.framework
|
||||||
|
/System/Library/Frameworks/VORBIS.framework # Tiger
|
||||||
|
|
||||||
|
/usr /usr/local
|
||||||
|
DOC "Apple include dir for VORBIS")
|
||||||
|
|
||||||
|
ENDIF(NOT APPLE)
|
||||||
|
|
||||||
|
# Then try the good old way for libs.
|
||||||
|
FIND_LIBRARY(VORBIS_LIBRARY
|
||||||
|
NAMES vorbis
|
||||||
|
HINTS ENV VORBIS_DIR
|
||||||
|
PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
|
||||||
|
PATHS /usr /usr/local)
|
||||||
|
|
||||||
|
IF(WIN32)
|
||||||
|
|
||||||
|
FIND_LIBRARY(VORBIS_LIBRARY
|
||||||
|
NAMES vorbis
|
||||||
|
HINTS ENV VORBIS_DIR
|
||||||
|
PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
|
||||||
|
PATHS /usr /usr/local)
|
||||||
|
|
||||||
|
ENDIF(WIN32)
|
||||||
|
|
||||||
|
IF(VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND (NOT WIN32 OR VORBIS_LIBRARY))
|
||||||
|
SET(VORBIS_FOUND TRUE)
|
||||||
|
ENDIF(VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND (NOT WIN32 OR VORBIS_LIBRARY))
|
||||||
|
|
||||||
|
IF(VORBIS_FOUND)
|
||||||
|
MESSAGE(STATUS "Looking for VORBIS - found (${VORBIS_LIBRARY})")
|
||||||
|
SET(VORBIS_LIBRARY ${VORBIS_LIBRARY})
|
||||||
|
IF(WIN32)
|
||||||
|
SET(VORBIS_LIBRARY ${VORBIS_LIBRARY})
|
||||||
|
ENDIF(WIN32)
|
||||||
|
ELSE(VORBIS_FOUND)
|
||||||
|
MESSAGE(FATAL_ERROR "Could not find VORBIS")
|
||||||
|
ENDIF(VORBIS_FOUND)
|
||||||
|
|
95
cmake/FindVORBISFILE.cmake
Normal file
95
cmake/FindVORBISFILE.cmake
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
# Locate VORBISFILE libraries ()
|
||||||
|
# This module defines
|
||||||
|
# VORBISFILE_LIBRARY : list of lib names
|
||||||
|
# VORBISFILE_FOUND : if false, do not try to link to VORBISFILE
|
||||||
|
# VORBISFILE_INCLUDE_DIR : where to find the headers
|
||||||
|
#
|
||||||
|
# $VORBISFILE_DIR is an environment variable that would
|
||||||
|
# correspond to the ./configure --prefix=$VORBISFILE_DIR
|
||||||
|
# used in building VORBISFILE.
|
||||||
|
#
|
||||||
|
# Created by Joe Thompson (based on Jean-Philippe Meuret's FindSOLID.cmake).
|
||||||
|
|
||||||
|
# No use to do all of this twice.
|
||||||
|
IF(VORBISFILE_FOUND)
|
||||||
|
RETURN()
|
||||||
|
ENDIF(VORBISFILE_FOUND)
|
||||||
|
|
||||||
|
# First, try with PkgConfig if available.
|
||||||
|
FIND_PACKAGE(PkgConfig)
|
||||||
|
IF(PKGCONFIG_FOUND)
|
||||||
|
|
||||||
|
PKG_CHECK_MODULES(VORBISFILE vorbisfile)
|
||||||
|
IF(NOT VORBISFILE_FOUND)
|
||||||
|
PKG_CHECK_MODULES(VORBISFILE VORBISFILE)
|
||||||
|
ENDIF (NOT VORBISFILE_FOUND)
|
||||||
|
|
||||||
|
IF(VORBISFILE_FOUND)
|
||||||
|
SET(VORBISFILE_FOUND TRUE)
|
||||||
|
SET(VORBISFILE_INCLUDE_DIR ${VORBISFILE_INCLUDE_DIRS} CACHE STRING "VORBISFILE include paths")
|
||||||
|
SET(VORBISFILE_LIBRARY ${VORBISFILE_LIBRARIES} CACHE STRING "VORBISFILE library")
|
||||||
|
MESSAGE(STATUS "Looking for VORBISFILE --- found using pkg-config (${VORBISFILE_LIBRARY})")
|
||||||
|
RETURN()
|
||||||
|
ENDIF(VORBISFILE_FOUND)
|
||||||
|
|
||||||
|
ENDIF(PKGCONFIG_FOUND)
|
||||||
|
|
||||||
|
# Then try the good old way for include dirs.
|
||||||
|
IF(NOT APPLE)
|
||||||
|
|
||||||
|
FIND_PATH(VORBISFILE_INCLUDE_DIR vorbis/vorbisfile.h
|
||||||
|
HINTS ENV VORBISFILE_DIR
|
||||||
|
PATH_SUFFIXES
|
||||||
|
include/vorbis include/VORBIS
|
||||||
|
PATHS
|
||||||
|
/usr /usr/local
|
||||||
|
DOC "Non-Apple include dir for VORBISFILE")
|
||||||
|
|
||||||
|
ELSE(NOT APPLE)
|
||||||
|
|
||||||
|
FIND_PATH(VORBISFILE_INCLUDE_DIR vorbisfile.h
|
||||||
|
HINTS ENV VORBISFILE_DIR
|
||||||
|
PATH_SUFFIXES
|
||||||
|
Headers include/vorbis
|
||||||
|
PATHS
|
||||||
|
#Additional MacOS Paths
|
||||||
|
~/Library/Frameworks/VORBIS.framework
|
||||||
|
/Library/Frameworks/VORBIS.framework
|
||||||
|
/System/Library/Frameworks/VORBIS.framework # Tiger
|
||||||
|
|
||||||
|
/usr /usr/local
|
||||||
|
DOC "Apple include dir for VORBISFILE")
|
||||||
|
|
||||||
|
ENDIF(NOT APPLE)
|
||||||
|
|
||||||
|
# Then try the good old way for libs.
|
||||||
|
FIND_LIBRARY(VORBISFILE_LIBRARY
|
||||||
|
NAMES vorbisfile
|
||||||
|
HINTS ENV VORBISFILE_DIR
|
||||||
|
PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
|
||||||
|
PATHS /usr /usr/local)
|
||||||
|
|
||||||
|
IF(WIN32)
|
||||||
|
|
||||||
|
FIND_LIBRARY(VORBISFILE_LIBRARY
|
||||||
|
NAMES vorbisfile
|
||||||
|
HINTS ENV VORBISFILE_DIR
|
||||||
|
PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
|
||||||
|
PATHS /usr /usr/local)
|
||||||
|
|
||||||
|
ENDIF(WIN32)
|
||||||
|
|
||||||
|
IF(VORBISFILE_INCLUDE_DIR AND VORBISFILE_LIBRARY AND (NOT WIN32 OR VORBISFILE_LIBRARY))
|
||||||
|
SET(VORBISFILE_FOUND TRUE)
|
||||||
|
ENDIF(VORBISFILE_INCLUDE_DIR AND VORBISFILE_LIBRARY AND (NOT WIN32 OR VORBISFILE_LIBRARY))
|
||||||
|
|
||||||
|
IF(VORBISFILE_FOUND)
|
||||||
|
MESSAGE(STATUS "Looking for VORBISFILE - found (${VORBISFILE_LIBRARY})")
|
||||||
|
SET(VORBISFILE_LIBRARY ${VORBISFILE_LIBRARY})
|
||||||
|
IF(WIN32)
|
||||||
|
SET(VORBISFILE_LIBRARY ${VORBISFILE_LIBRARY})
|
||||||
|
ENDIF(WIN32)
|
||||||
|
ELSE(VORBISFILE_FOUND)
|
||||||
|
MESSAGE(FATAL_ERROR "Could not find VORBISFILE")
|
||||||
|
ENDIF(VORBISFILE_FOUND)
|
||||||
|
|
|
@ -151,6 +151,37 @@ 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)
|
||||||
|
|
||||||
|
# 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)
|
||||||
|
|
||||||
# ENet
|
# ENet
|
||||||
Find_Package(ENET)
|
Find_Package(ENET)
|
||||||
|
|
||||||
|
|
|
@ -111,6 +111,22 @@ MACRO(_FIND_3RDPARTY_DEPENDENCIES ROOT_DIR)
|
||||||
|
|
||||||
# Open AL.
|
# Open AL.
|
||||||
_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
|
||||||
|
# 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} "")
|
||||||
|
|
||||||
|
# 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)
|
||||||
|
|
||||||
# ENet.
|
# ENet.
|
||||||
_FIND_3RDPARTY_DEPENDENCY(ENET enet/enet.h "" enet ${ROOT_DIR} "")
|
_FIND_3RDPARTY_DEPENDENCY(ENET enet/enet.h "" enet ${ROOT_DIR} "")
|
||||||
|
@ -220,7 +236,7 @@ MACRO(_FIND_3RDPARTY_DLL PACKAGE_NAME LINK_LIBRARY NAME_HINTS DLL_PATHNAME_VAR)
|
||||||
ENDFOREACH(_LIB_NAME ${NAME_HINTS})
|
ENDFOREACH(_LIB_NAME ${NAME_HINTS})
|
||||||
|
|
||||||
IF(NOT ${_DLL_PATHNAME_VAR})
|
IF(NOT ${_DLL_PATHNAME_VAR})
|
||||||
#MESSAGE(STATUS "Could not find 3rdParty DLL in ${NAME_HINTS} for ${PACKAGE_NAME}")
|
MESSAGE(STATUS "Could not find 3rdParty DLL in ${NAME_HINTS} for ${PACKAGE_NAME}")
|
||||||
ENDIF(NOT ${_DLL_PATHNAME_VAR})
|
ENDIF(NOT ${_DLL_PATHNAME_VAR})
|
||||||
|
|
||||||
ENDMACRO(_FIND_3RDPARTY_DLL DLL_PATHNAME)
|
ENDMACRO(_FIND_3RDPARTY_DLL DLL_PATHNAME)
|
||||||
|
@ -232,6 +248,22 @@ MACRO(SD_INSTALL_CUSTOM_3RDPARTY)
|
||||||
_FIND_3RDPARTY_DLL("OpenAL" "${OPENAL_LIBRARY}" "OpenAL32" _DLL_PATHNAME)
|
_FIND_3RDPARTY_DLL("OpenAL" "${OPENAL_LIBRARY}" "OpenAL32" _DLL_PATHNAME)
|
||||||
LIST(APPEND _THIRDPARTY_DLL_PATHNAMES "${_DLL_PATHNAME}")
|
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" "${OGG_LIBRARY}" "libogg;libogg-0" _DLL_PATHNAME)
|
||||||
|
LIST(APPEND _THIRDPARTY_DLL_PATHNAMES "${_DLL_PATHNAME}")
|
||||||
|
|
||||||
|
_FIND_3RDPARTY_DLL("VORBIS" "${VORBIS_LIBRARY}" "libvorbis;libvorbis-0" _DLL_PATHNAME)
|
||||||
|
LIST(APPEND _THIRDPARTY_DLL_PATHNAMES "${_DLL_PATHNAME}")
|
||||||
|
|
||||||
|
_FIND_3RDPARTY_DLL("VORBISFILE" "${VORBISFILE_LIBRARY}" "libvorbisfile;libvorbisfile-3" _DLL_PATHNAME)
|
||||||
|
LIST(APPEND _THIRDPARTY_DLL_PATHNAMES "${_DLL_PATHNAME}")
|
||||||
|
|
||||||
|
ENDIF(OPTION_MENU_MUSIC)
|
||||||
|
|
||||||
_FIND_3RDPARTY_DLL("SDL" "${SDL_LIBRARY}" "SDL" _DLL_PATHNAME)
|
_FIND_3RDPARTY_DLL("SDL" "${SDL_LIBRARY}" "SDL" _DLL_PATHNAME)
|
||||||
LIST(APPEND _THIRDPARTY_DLL_PATHNAMES "${_DLL_PATHNAME}")
|
LIST(APPEND _THIRDPARTY_DLL_PATHNAMES "${_DLL_PATHNAME}")
|
||||||
|
|
||||||
|
|
|
@ -64,6 +64,8 @@ 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 false CACHE BOOL "Enable Menu Music")
|
||||||
|
|
||||||
# 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)
|
||||||
|
@ -135,6 +137,10 @@ MACRO(ADD_SD_COMPILE_OPTIONS)
|
||||||
IF(OPTION_3RDPARTY_EXPAT)
|
IF(OPTION_3RDPARTY_EXPAT)
|
||||||
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)
|
||||||
|
@ -165,4 +171,4 @@ MACRO(ADD_SD_COMPILE_OPTIONS)
|
||||||
|
|
||||||
ENDIF(NOT _ALREADY_DONE)
|
ENDIF(NOT _ALREADY_DONE)
|
||||||
|
|
||||||
ENDMACRO(ADD_SD_COMPILE_OPTIONS)
|
ENDMACRO(ADD_SD_COMPILE_OPTIONS)
|
|
@ -148,6 +148,102 @@ MACRO(ADD_OPENAL_LIBRARY TARGET)
|
||||||
|
|
||||||
ENDMACRO(ADD_OPENAL_LIBRARY TARGET)
|
ENDMACRO(ADD_OPENAL_LIBRARY TARGET)
|
||||||
|
|
||||||
|
MACRO(ADD_OGG_INCLUDEDIR)
|
||||||
|
|
||||||
|
IF(OPTION_MENU_MUSIC)
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
ENDMACRO(ADD_OGG_INCLUDEDIR)
|
||||||
|
|
||||||
|
MACRO(ADD_OGG_LIBRARY TARGET)
|
||||||
|
|
||||||
|
IF(OPTION_MENU_MUSIC)
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
ENDMACRO(ADD_OGG_LIBRARY TARGET)
|
||||||
|
|
||||||
|
MACRO(ADD_VORBIS_INCLUDEDIR)
|
||||||
|
|
||||||
|
IF(OPTION_MENU_MUSIC)
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
ENDMACRO(ADD_VORBIS_INCLUDEDIR)
|
||||||
|
|
||||||
|
MACRO(ADD_VORBIS_LIBRARY TARGET)
|
||||||
|
|
||||||
|
IF(OPTION_MENU_MUSIC)
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
ENDMACRO(ADD_VORBIS_LIBRARY TARGET)
|
||||||
|
|
||||||
|
MACRO(ADD_VORBISFILE_INCLUDEDIR)
|
||||||
|
|
||||||
|
IF(OPTION_MENU_MUSIC)
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
ENDMACRO(ADD_VORBISFILE_INCLUDEDIR)
|
||||||
|
|
||||||
|
MACRO(ADD_VORBISFILE_LIBRARY TARGET)
|
||||||
|
|
||||||
|
IF(OPTION_MENU_MUSIC)
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
ENDMACRO(ADD_VORBISFILE_LIBRARY TARGET)
|
||||||
|
|
||||||
MACRO(ADD_ENET_INCLUDEDIR)
|
MACRO(ADD_ENET_INCLUDEDIR)
|
||||||
|
|
||||||
FIND_PACKAGE(ENET)
|
FIND_PACKAGE(ENET)
|
||||||
|
|
|
@ -7,6 +7,8 @@ ADD_SDLIB_INCLUDEDIR(tgf math portability)
|
||||||
ADD_SDL_INCLUDEDIR()
|
ADD_SDL_INCLUDEDIR()
|
||||||
ADD_JPEG_INCLUDEDIR()
|
ADD_JPEG_INCLUDEDIR()
|
||||||
ADD_PLIB_INCLUDEDIR()
|
ADD_PLIB_INCLUDEDIR()
|
||||||
|
ADD_OPENAL_INCLUDEDIR()
|
||||||
|
ADD_VORBIS_INCLUDEDIR()
|
||||||
|
|
||||||
|
|
||||||
SET(TGFCLIENT_SOURCES control.cpp glfeatures.cpp guibutton.cpp guifont.cpp
|
SET(TGFCLIENT_SOURCES control.cpp glfeatures.cpp guibutton.cpp guifont.cpp
|
||||||
|
@ -15,9 +17,18 @@ SET(TGFCLIENT_SOURCES control.cpp glfeatures.cpp guibutton.cpp guifont.cpp
|
||||||
guilabel.cpp guiobject.cpp guiscrollist.cpp
|
guilabel.cpp guiobject.cpp guiscrollist.cpp
|
||||||
guicombobox.cpp guicheckbox.cpp guiprogresbar.cpp
|
guicombobox.cpp guicheckbox.cpp guiprogresbar.cpp
|
||||||
guiscreen.cpp guieventloop.cpp guiapplication.cpp
|
guiscreen.cpp guieventloop.cpp guiapplication.cpp
|
||||||
|
musicplayer.cpp musicplayer.h
|
||||||
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(TGFCLIENT_OTHER_SOURCES guimenutest.xml screen.xml)
|
SET(TGFCLIENT_OTHER_SOURCES guimenutest.xml screen.xml)
|
||||||
|
|
||||||
|
# Note: Menu music sources needed ONLY if menu music enabled.
|
||||||
|
IF(OPTION_MENU_MUSIC)
|
||||||
|
SET(TGFCLIENT_SOURCES ${TGFCLIENT_SOURCES}
|
||||||
|
soundstream.cpp soundstream.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)
|
||||||
CMAKE_POLICY(SET CMP0003 NEW)
|
CMAKE_POLICY(SET CMP0003 NEW)
|
||||||
|
@ -52,6 +63,22 @@ IF(OPENGL_FOUND)
|
||||||
TARGET_LINK_LIBRARIES(tgfclient ${OPENGL_LIBRARY})
|
TARGET_LINK_LIBRARIES(tgfclient ${OPENGL_LIBRARY})
|
||||||
ENDIF(OPENGL_FOUND)
|
ENDIF(OPENGL_FOUND)
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
ADD_PLIB_LIBRARY(tgfclient ul sg js)
|
ADD_PLIB_LIBRARY(tgfclient ul sg js)
|
||||||
ADD_SDL_LIBRARY(tgfclient)
|
ADD_SDL_LIBRARY(tgfclient)
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include "tgfclient.h"
|
#include "tgfclient.h"
|
||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
#include "guimenu.h"
|
#include "guimenu.h"
|
||||||
|
#include "musicplayer.h"
|
||||||
|
|
||||||
|
|
||||||
tGfuiScreen *GfuiScreen; /* current screen */
|
tGfuiScreen *GfuiScreen; /* current screen */
|
||||||
|
@ -115,6 +116,7 @@ gfuiInit(void)
|
||||||
gfuiInitLabel();
|
gfuiInitLabel();
|
||||||
gfuiInitHelp();
|
gfuiInitHelp();
|
||||||
gfuiInitMenu();
|
gfuiInitMenu();
|
||||||
|
startMenuMusic();
|
||||||
|
|
||||||
//gfctrlJoyInit(); // Not here ; done later on the fly, when really needed.
|
//gfctrlJoyInit(); // Not here ; done later on the fly, when really needed.
|
||||||
}
|
}
|
||||||
|
@ -123,6 +125,7 @@ void
|
||||||
gfuiShutdown(void)
|
gfuiShutdown(void)
|
||||||
{
|
{
|
||||||
gfctrlJoyShutdown();
|
gfctrlJoyShutdown();
|
||||||
|
stopMenuMusic();
|
||||||
}
|
}
|
||||||
|
|
||||||
GfuiColor
|
GfuiColor
|
||||||
|
@ -1098,5 +1101,4 @@ void
|
||||||
GfuiSwapBuffers(void)
|
GfuiSwapBuffers(void)
|
||||||
{
|
{
|
||||||
SDL_GL_SwapBuffers();
|
SDL_GL_SwapBuffers();
|
||||||
}
|
}
|
||||||
|
|
|
@ -319,9 +319,9 @@ static void gfScrReshapeViewport(int width, int height)
|
||||||
bool GfScrInit(int nWinWidth, int nWinHeight, int nFullScreen)
|
bool GfScrInit(int nWinWidth, int nWinHeight, int nFullScreen)
|
||||||
{
|
{
|
||||||
// Initialize SDL video subsystem (and exit if not supported).
|
// Initialize SDL video subsystem (and exit if not supported).
|
||||||
if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0)
|
if (SDL_InitSubSystem(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0)
|
||||||
{
|
{
|
||||||
GfLogError("Couldn't initialize SDL video sub-system (%s)\n", SDL_GetError());
|
GfLogError("Couldn't initialize SDL audio/video sub-system (%s)\n", SDL_GetError());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -815,4 +815,4 @@ int GfScrCaptureAsPNG(const char *filename)
|
||||||
GfLogError("Failed to capture screen to %s\n", filename);
|
GfLogError("Failed to capture screen to %s\n", filename);
|
||||||
|
|
||||||
return nStatus;
|
return nStatus;
|
||||||
}
|
}
|
|
@ -17,19 +17,28 @@
|
||||||
* *
|
* *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "musicplayer.h"
|
#include "musicplayer.h"
|
||||||
|
|
||||||
#include <GL/glut.h>
|
//#include <GL/glut.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <tgf.h>
|
#include <tgf.h>
|
||||||
|
#include "tgfclient.h"
|
||||||
#include <portability.h>
|
#include <portability.h>
|
||||||
|
|
||||||
#include "OggSoundStream.h"
|
#if MENU_MUSIC
|
||||||
#include "OpenALMusicPlayer.h"
|
#include "oggsoundstream.h"
|
||||||
|
#include "openalmusicplayer.h"
|
||||||
|
|
||||||
|
|
||||||
|
static void playMenuMusic(int /* value */);
|
||||||
|
|
||||||
|
|
||||||
static bool isEnabled()
|
static bool isEnabled()
|
||||||
{
|
{
|
||||||
|
// TODO - fix this (needs UI)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
#if 0
|
||||||
const int BUFSIZE = 1024;
|
const int BUFSIZE = 1024;
|
||||||
char buf[BUFSIZE];
|
char buf[BUFSIZE];
|
||||||
snprintf(buf, BUFSIZE, "%s%s", GetLocalDir(), MM_SOUND_PARM_CFG);
|
snprintf(buf, BUFSIZE, "%s%s", GetLocalDir(), MM_SOUND_PARM_CFG);
|
||||||
|
@ -43,11 +52,13 @@ static bool isEnabled()
|
||||||
}
|
}
|
||||||
|
|
||||||
GfParmReleaseHandle(handle);
|
GfParmReleaseHandle(handle);
|
||||||
|
|
||||||
return enabled;
|
return enabled;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Path relative to CWD, e.g "data/music/torcs1.ogg"
|
// Path relative to CWD, e.g "data/music/main.ogg"
|
||||||
static SoundStream* getMenuSoundStream(char* oggFilePath)
|
static SoundStream* getMenuSoundStream(char* oggFilePath)
|
||||||
{
|
{
|
||||||
static OggSoundStream stream(oggFilePath);
|
static OggSoundStream stream(oggFilePath);
|
||||||
|
@ -59,37 +70,80 @@ static OpenALMusicPlayer* getMusicPlayer()
|
||||||
{
|
{
|
||||||
const int BUFSIZE = 1024;
|
const int BUFSIZE = 1024;
|
||||||
char oggFilePath[BUFSIZE];
|
char oggFilePath[BUFSIZE];
|
||||||
strncpy(oggFilePath, "data/music/torcs1.ogg", BUFSIZE);
|
|
||||||
|
// TODO - get from config??
|
||||||
|
strncpy(oggFilePath, "data/music/main.ogg", BUFSIZE);
|
||||||
|
|
||||||
static OpenALMusicPlayer player(getMenuSoundStream(oggFilePath));
|
static OpenALMusicPlayer player(getMenuSoundStream(oggFilePath));
|
||||||
return &player;
|
return &player;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO rethink...
|
||||||
|
static Uint32 sdlTimerFunc(Uint32 interval, void* /* pEvLoopPriv */)
|
||||||
|
{
|
||||||
|
playMenuMusic(0);
|
||||||
|
return 1;
|
||||||
|
//return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO clean this up
|
||||||
|
SDL_TimerID timerId = 0;
|
||||||
static void playMenuMusic(int /* value */)
|
static void playMenuMusic(int /* value */)
|
||||||
{
|
{
|
||||||
const int nextcallinms = 100;
|
const int nextcallinms = 200;
|
||||||
|
|
||||||
OpenALMusicPlayer* player = getMusicPlayer();
|
OpenALMusicPlayer* player = getMusicPlayer();
|
||||||
if (player->playAndManageBuffer()) {
|
if (player->playAndManageBuffer()) {
|
||||||
glutTimerFunc(nextcallinms, playMenuMusic, 0);
|
if(timerId == 0){
|
||||||
|
timerId = SDL_AddTimer(nextcallinms, sdlTimerFunc, (void*)NULL);
|
||||||
|
}
|
||||||
|
//glutTimerFunc(nextcallinms, playMenuMusic, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void startMenuMusic()
|
void startMenuMusic()
|
||||||
{
|
{
|
||||||
|
#if MENU_MUSIC
|
||||||
if (isEnabled()) {
|
if (isEnabled()) {
|
||||||
OpenALMusicPlayer* player = getMusicPlayer();
|
OpenALMusicPlayer* player = getMusicPlayer();
|
||||||
player->start();
|
player->start();
|
||||||
playMenuMusic(0);
|
playMenuMusic(0);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void stopMenuMusic()
|
void stopMenuMusic()
|
||||||
{
|
{
|
||||||
|
#if MENU_MUSIC
|
||||||
|
if(timerId != 0){
|
||||||
|
SDL_RemoveTimer(timerId);
|
||||||
|
timerId = 0;
|
||||||
|
}
|
||||||
OpenALMusicPlayer* player = getMusicPlayer();
|
OpenALMusicPlayer* player = getMusicPlayer();
|
||||||
player->stop();
|
player->stop();
|
||||||
player->rewind();
|
player->rewind();
|
||||||
}
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void pauseMenuMusic()
|
||||||
|
{
|
||||||
|
#if MENU_MUSIC
|
||||||
|
if(timerId != 0){
|
||||||
|
SDL_RemoveTimer(timerId);
|
||||||
|
timerId = 0;
|
||||||
|
}
|
||||||
|
OpenALMusicPlayer* player = getMusicPlayer();
|
||||||
|
player->pause();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void resumeMenuMusic(int sourceId)
|
||||||
|
{
|
||||||
|
#if MENU_MUSIC
|
||||||
|
if (isEnabled()) {
|
||||||
|
getMusicPlayer()->resume(sourceId);
|
||||||
|
playMenuMusic(0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
|
@ -26,7 +26,20 @@
|
||||||
#define MM_VAL_SOUND_ENABLED "enabled"
|
#define MM_VAL_SOUND_ENABLED "enabled"
|
||||||
#define MM_VAL_SOUND_DISABLED "disabled"
|
#define MM_VAL_SOUND_DISABLED "disabled"
|
||||||
|
|
||||||
extern void startMenuMusic();
|
// DLL exported symbols declarator for Windows.
|
||||||
extern void stopMenuMusic();
|
#ifdef WIN32
|
||||||
|
# ifdef TGFCLIENT_DLL
|
||||||
|
# define TGFCLIENT_API __declspec(dllexport)
|
||||||
|
# else
|
||||||
|
# define TGFCLIENT_API __declspec(dllimport)
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# define TGFCLIENT_API
|
||||||
|
#endif
|
||||||
|
|
||||||
|
TGFCLIENT_API void startMenuMusic();
|
||||||
|
TGFCLIENT_API void stopMenuMusic();
|
||||||
|
TGFCLIENT_API void pauseMenuMusic();
|
||||||
|
TGFCLIENT_API void resumeMenuMusic(int sourceId);
|
||||||
|
|
||||||
#endif //__musicplayer_h__
|
#endif //__musicplayer_h__
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
/* Concrete implementation for ogg sound streams */
|
/* Concrete implementation for ogg sound streams */
|
||||||
|
|
||||||
#include "OggSoundStream.h"
|
#include "oggsoundstream.h"
|
||||||
#include <tgf.h>
|
#include <tgf.h>
|
||||||
|
|
||||||
OggSoundStream::OggSoundStream(char* path):
|
OggSoundStream::OggSoundStream(char* path):
|
||||||
|
@ -62,7 +62,7 @@ OggSoundStream::~OggSoundStream()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool OggSoundStream::read(char* buffer, const int bufferSize, int* resultSize, const char* error)
|
bool OggSoundStream::read(char* buffer, const int bufferSize, int* resultSize, const char*& error)
|
||||||
{
|
{
|
||||||
if (!isValid()) {
|
if (!isValid()) {
|
||||||
error = "OggSoundStream: Invalid, no data available.";
|
error = "OggSoundStream: Invalid, no data available.";
|
||||||
|
@ -157,4 +157,4 @@ const char* OggSoundStream::errorString(int code)
|
||||||
default:
|
default:
|
||||||
return "OggSoundStream: Unknown Ogg error.";
|
return "OggSoundStream: Unknown Ogg error.";
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -21,11 +21,11 @@
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
/* Concrete implementation for ogg sound streams */
|
/* Concrete implementation for ogg sound streams */
|
||||||
|
|
||||||
#define OV_EXCLUDE_STATIC_CALLBACKS
|
#define OV_EXCLUDE_STATIC_CALLBACKS
|
||||||
|
|
||||||
#include <vorbis/vorbisfile.h>
|
#include <vorbis/vorbisfile.h>
|
||||||
#include "SoundStream.h"
|
#include "soundstream.h"
|
||||||
|
|
||||||
class OggSoundStream : public SoundStream
|
class OggSoundStream : public SoundStream
|
||||||
{
|
{
|
||||||
|
@ -36,7 +36,7 @@ class OggSoundStream : public SoundStream
|
||||||
virtual int getRateInHz() { return rateInHz; }
|
virtual int getRateInHz() { return rateInHz; }
|
||||||
virtual SoundFormat getSoundFormat() { return format; }
|
virtual SoundFormat getSoundFormat() { return format; }
|
||||||
|
|
||||||
virtual bool read(char* buffer, const int bufferSize, int* resultSize, const char* error);
|
virtual bool read(char* buffer, const int bufferSize, int* resultSize, const char*& error);
|
||||||
virtual void rewind();
|
virtual void rewind();
|
||||||
virtual void display();
|
virtual void display();
|
||||||
virtual bool isValid() { return valid; }
|
virtual bool isValid() { return valid; }
|
||||||
|
@ -52,4 +52,4 @@ class OggSoundStream : public SoundStream
|
||||||
SoundFormat format;
|
SoundFormat format;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __OggSoundStream_h__
|
#endif // __OggSoundStream_h__
|
||||||
|
|
|
@ -19,13 +19,14 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <tgf.h>
|
#include <tgf.h>
|
||||||
#include "OpenALMusicPlayer.h"
|
#include "openalmusicplayer.h"
|
||||||
|
|
||||||
const int OpenALMusicPlayer::BUFFERSIZE = 4096*64;
|
const int OpenALMusicPlayer::BUFFERSIZE = 4096*64;
|
||||||
|
|
||||||
OpenALMusicPlayer::OpenALMusicPlayer(SoundStream* soundStream):
|
OpenALMusicPlayer::OpenALMusicPlayer(SoundStream* soundStream):
|
||||||
device(NULL),
|
device(NULL),
|
||||||
context(NULL),
|
context(NULL),
|
||||||
|
previouscontext(NULL),
|
||||||
source(0),
|
source(0),
|
||||||
stream(soundStream),
|
stream(soundStream),
|
||||||
ready(false)
|
ready(false)
|
||||||
|
@ -55,7 +56,7 @@ void OpenALMusicPlayer::stop()
|
||||||
|
|
||||||
alSourceStop(source);
|
alSourceStop(source);
|
||||||
|
|
||||||
int queued;
|
int queued = 0;
|
||||||
|
|
||||||
alGetSourcei(source, AL_BUFFERS_QUEUED, &queued);
|
alGetSourcei(source, AL_BUFFERS_QUEUED, &queued);
|
||||||
while (queued--) {
|
while (queued--) {
|
||||||
|
@ -69,7 +70,8 @@ void OpenALMusicPlayer::stop()
|
||||||
alDeleteBuffers(2, buffers);
|
alDeleteBuffers(2, buffers);
|
||||||
check();
|
check();
|
||||||
|
|
||||||
alcMakeContextCurrent(NULL);
|
//alcMakeContextCurrent(previouscontext);
|
||||||
|
// previouscontext = NULL;
|
||||||
alcDestroyContext(context);
|
alcDestroyContext(context);
|
||||||
alcCloseDevice(device);
|
alcCloseDevice(device);
|
||||||
|
|
||||||
|
@ -93,7 +95,7 @@ bool OpenALMusicPlayer::initContext()
|
||||||
GfError("OpenALMusicPlayer: OpenAL could not create contect for device\n");
|
GfError("OpenALMusicPlayer: OpenAL could not create contect for device\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
previouscontext = alcGetCurrentContext();
|
||||||
alcMakeContextCurrent(context);
|
alcMakeContextCurrent(context);
|
||||||
alcGetError(device);
|
alcGetError(device);
|
||||||
|
|
||||||
|
@ -205,9 +207,25 @@ void OpenALMusicPlayer::start()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OpenALMusicPlayer::pause()
|
||||||
|
{
|
||||||
|
alSourceStop(source);
|
||||||
|
if(previouscontext == NULL){
|
||||||
|
previouscontext = alcGetCurrentContext();
|
||||||
|
}
|
||||||
|
alcMakeContextCurrent(previouscontext);
|
||||||
|
//previouscontext = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OpenALMusicPlayer::resume(int flag)
|
||||||
|
{
|
||||||
|
alcMakeContextCurrent(context);
|
||||||
|
alSourcePlay(source);
|
||||||
|
if(flag == 1){
|
||||||
|
previouscontext = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
void OpenALMusicPlayer::rewind()
|
void OpenALMusicPlayer::rewind()
|
||||||
{
|
{
|
||||||
stream->rewind();
|
stream->rewind();
|
||||||
|
@ -222,7 +240,7 @@ bool OpenALMusicPlayer::playAndManageBuffer()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int processed;
|
int processed = 0;
|
||||||
bool active = true;
|
bool active = true;
|
||||||
|
|
||||||
alGetSourcei(source, AL_BUFFERS_PROCESSED, &processed);
|
alGetSourcei(source, AL_BUFFERS_PROCESSED, &processed);
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
#include <AL/al.h>
|
#include <AL/al.h>
|
||||||
#include <AL/alc.h>
|
#include <AL/alc.h>
|
||||||
#include "SoundStream.h"
|
#include "soundstream.h"
|
||||||
|
|
||||||
class OpenALMusicPlayer
|
class OpenALMusicPlayer
|
||||||
{
|
{
|
||||||
|
@ -32,6 +32,8 @@ class OpenALMusicPlayer
|
||||||
|
|
||||||
virtual void start();
|
virtual void start();
|
||||||
virtual void stop();
|
virtual void stop();
|
||||||
|
virtual void pause();
|
||||||
|
virtual void resume(int flag);
|
||||||
virtual void rewind();
|
virtual void rewind();
|
||||||
virtual bool playAndManageBuffer();
|
virtual bool playAndManageBuffer();
|
||||||
|
|
||||||
|
@ -46,6 +48,7 @@ class OpenALMusicPlayer
|
||||||
|
|
||||||
ALCdevice* device;
|
ALCdevice* device;
|
||||||
ALCcontext* context;
|
ALCcontext* context;
|
||||||
|
ALCcontext* previouscontext;
|
||||||
ALuint source; // audio source
|
ALuint source; // audio source
|
||||||
ALuint buffers[2]; // front and back buffers
|
ALuint buffers[2]; // front and back buffers
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,6 @@
|
||||||
* *
|
* *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
/* Intherface for sound streams */
|
/* Interface for sound streams */
|
||||||
|
|
||||||
#include "SoundStream.h"
|
#include "soundstream.h"
|
|
@ -37,12 +37,12 @@ class SoundStream
|
||||||
virtual int getRateInHz() = 0;
|
virtual int getRateInHz() = 0;
|
||||||
virtual SoundFormat getSoundFormat() = 0;
|
virtual SoundFormat getSoundFormat() = 0;
|
||||||
|
|
||||||
virtual bool read(char* buffer, const int bufferSize, int* resultSize, const char* error) = 0;
|
virtual bool read(char* buffer, const int bufferSize, int* resultSize, const char*& error) = 0;
|
||||||
virtual void rewind() = 0;
|
virtual void rewind() = 0;
|
||||||
virtual void display() = 0;
|
virtual void display() = 0;
|
||||||
// isValid is not nice, but I do not want to introduce exceptions into TORCS at this time
|
// isValid is not nice, but I do not want to introduce exceptions at this time
|
||||||
virtual bool isValid() = 0;
|
virtual bool isValid() = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __SoundStream_h__
|
#endif // __SoundStream_h__
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include <tgf.hpp>
|
#include <tgf.hpp>
|
||||||
#include <portability.h>
|
#include <portability.h>
|
||||||
#include <tgfclient.h>
|
#include <tgfclient.h>
|
||||||
|
#include <musicplayer.h>
|
||||||
|
|
||||||
#include <race.h>
|
#include <race.h>
|
||||||
#include <racemanagers.h>
|
#include <racemanagers.h>
|
||||||
|
@ -302,6 +303,7 @@ void LegacyMenu::onRaceSimulationReady() {
|
||||||
|
|
||||||
loadCarsGraphics(_piRaceEngine->outData()->s);
|
loadCarsGraphics(_piRaceEngine->outData()->s);
|
||||||
_piSoundEngine->init(_piRaceEngine->outData()->s);
|
_piSoundEngine->init(_piRaceEngine->outData()->s);
|
||||||
|
pauseMenuMusic();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -332,6 +334,7 @@ void LegacyMenu::onRaceInterrupted() {
|
||||||
void LegacyMenu::onRaceFinishing() {
|
void LegacyMenu::onRaceFinishing() {
|
||||||
if (_piRaceEngine->inData()->_displayMode == RM_DISP_MODE_NORMAL) {
|
if (_piRaceEngine->inData()->_displayMode == RM_DISP_MODE_NORMAL) {
|
||||||
shutdownSound();
|
shutdownSound();
|
||||||
|
resumeMenuMusic(1);
|
||||||
unloadCarsGraphics();
|
unloadCarsGraphics();
|
||||||
shutdownGraphicsView();
|
shutdownGraphicsView();
|
||||||
unloadTrackGraphics();
|
unloadTrackGraphics();
|
||||||
|
|
|
@ -180,6 +180,8 @@ RmCheckPitRequest()
|
||||||
// Mute sound.
|
// Mute sound.
|
||||||
if (LegacyMenu::self().soundEngine())
|
if (LegacyMenu::self().soundEngine())
|
||||||
LegacyMenu::self().soundEngine()->mute(true);
|
LegacyMenu::self().soundEngine()->mute(true);
|
||||||
|
|
||||||
|
// TODO pit music??
|
||||||
|
|
||||||
// First, stop the race engine.
|
// First, stop the race engine.
|
||||||
LmRaceEngine().stop();
|
LmRaceEngine().stop();
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include <portability.h>
|
#include <portability.h>
|
||||||
#include <tgf.hpp>
|
#include <tgf.hpp>
|
||||||
#include <tgfclient.h>
|
#include <tgfclient.h>
|
||||||
|
#include <musicplayer.h>
|
||||||
|
|
||||||
#include <isoundengine.h>
|
#include <isoundengine.h>
|
||||||
#include <raceman.h>
|
#include <raceman.h>
|
||||||
|
@ -390,6 +391,8 @@ rmScreenActivate(void * /* dummy */)
|
||||||
// If not paused ...
|
// If not paused ...
|
||||||
if (!rmRacePaused)
|
if (!rmRacePaused)
|
||||||
{
|
{
|
||||||
|
pauseMenuMusic();
|
||||||
|
|
||||||
// Reset normal sound volume.
|
// Reset normal sound volume.
|
||||||
if (LegacyMenu::self().soundEngine())
|
if (LegacyMenu::self().soundEngine())
|
||||||
LegacyMenu::self().soundEngine()->mute(false);
|
LegacyMenu::self().soundEngine()->mute(false);
|
||||||
|
@ -410,6 +413,8 @@ rmRacePause(void * /* vboard */)
|
||||||
{
|
{
|
||||||
if (rmRacePaused)
|
if (rmRacePaused)
|
||||||
{
|
{
|
||||||
|
pauseMenuMusic();
|
||||||
|
|
||||||
if (LegacyMenu::self().soundEngine())
|
if (LegacyMenu::self().soundEngine())
|
||||||
LegacyMenu::self().soundEngine()->mute(false);
|
LegacyMenu::self().soundEngine()->mute(false);
|
||||||
|
|
||||||
|
@ -430,6 +435,8 @@ rmRacePause(void * /* vboard */)
|
||||||
if (LegacyMenu::self().soundEngine())
|
if (LegacyMenu::self().soundEngine())
|
||||||
LegacyMenu::self().soundEngine()->mute(true);
|
LegacyMenu::self().soundEngine()->mute(true);
|
||||||
|
|
||||||
|
resumeMenuMusic(0);
|
||||||
|
|
||||||
LmRaceEngine().stop();
|
LmRaceEngine().stop();
|
||||||
|
|
||||||
// Show the "Pause" label.
|
// Show the "Pause" label.
|
||||||
|
@ -537,6 +544,8 @@ rmOpenHelpScreen(void * /* dummy */)
|
||||||
if (LegacyMenu::self().soundEngine())
|
if (LegacyMenu::self().soundEngine())
|
||||||
LegacyMenu::self().soundEngine()->mute(true);
|
LegacyMenu::self().soundEngine()->mute(true);
|
||||||
|
|
||||||
|
resumeMenuMusic(0);
|
||||||
|
|
||||||
GfuiHelpScreen(rmScreenHandle, RmBackToRaceHookInit());
|
GfuiHelpScreen(rmScreenHandle, RmBackToRaceHookInit());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include <tgfclient.h>
|
#include <tgfclient.h>
|
||||||
|
#include <musicplayer.h>
|
||||||
|
|
||||||
#include <isoundengine.h>
|
#include <isoundengine.h>
|
||||||
|
|
||||||
|
@ -238,6 +239,8 @@ RmStopRaceMenu()
|
||||||
// Mute sound.
|
// Mute sound.
|
||||||
if (LegacyMenu::self().soundEngine())
|
if (LegacyMenu::self().soundEngine())
|
||||||
LegacyMenu::self().soundEngine()->mute();
|
LegacyMenu::self().soundEngine()->mute();
|
||||||
|
|
||||||
|
resumeMenuMusic(0);
|
||||||
|
|
||||||
if (!strcmp(GfParmGetStr(params, pszRaceName, RM_ATTR_ALLOW_RESTART, RM_VAL_NO), RM_VAL_NO))
|
if (!strcmp(GfParmGetStr(params, pszRaceName, RM_ATTR_ALLOW_RESTART, RM_VAL_NO), RM_VAL_NO))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue