Added mpg123 file reader

actorid
Nicolay Korslund 15 years ago
parent ebcbff255e
commit 912c8b1f2d

@ -2,7 +2,8 @@ project(OpenMW)
# Sound source selection # Sound source selection
option(USE_AUDIERE "use Audiere for sound" OFF) option(USE_AUDIERE "use Audiere for sound" OFF)
option(USE_FFMPEG "use ffmpeg for sound" ON) option(USE_FFMPEG "use ffmpeg for sound" OFF)
option(USE_MPG123 "use mpg123 for sound" ON)
# We probably support older versions than this. # We probably support older versions than this.
cmake_minimum_required(VERSION 2.6) cmake_minimum_required(VERSION 2.6)
@ -106,7 +107,7 @@ if (USE_AUDIERE)
find_package(Audiere REQUIRED) find_package(Audiere REQUIRED)
set(SOUND_INPUT_INCLUDES ${AUDIERE_INCLUDE_DIR}) set(SOUND_INPUT_INCLUDES ${AUDIERE_INCLUDE_DIR})
set(SOUND_INPUT_LIBRARY ${AUDIERE_LIBRARY}) set(SOUND_INPUT_LIBRARY ${AUDIERE_LIBRARY})
add_definitions(-DOPENMW_USE_AUDIERE) set(SOUND_DEFINE -DOPENMW_USE_AUDIERE)
endif (USE_AUDIERE) endif (USE_AUDIERE)
if (USE_FFMPEG) if (USE_FFMPEG)
@ -115,9 +116,18 @@ if (USE_FFMPEG)
find_package(FFMPEG REQUIRED) find_package(FFMPEG REQUIRED)
set(SOUND_INPUT_INCLUDES ${FFMPEG_INCLUDE_DIR}) set(SOUND_INPUT_INCLUDES ${FFMPEG_INCLUDE_DIR})
set(SOUND_INPUT_LIBRARY ${FFMPEG_LIBRARIES}) set(SOUND_INPUT_LIBRARY ${FFMPEG_LIBRARIES})
add_definitions(-DOPENMW_USE_FFMPEG) set(SOUND_DEFINE -DOPENMW_USE_FFMPEG)
endif (USE_FFMPEG) endif (USE_FFMPEG)
if (USE_MPG123)
set(MANGLE_SOUND_OUTPUT
${LIBDIR}/mangle/sound/sources/mpg123_source.cpp)
find_package(MPG123 REQUIRED)
set(SOUND_INPUT_INCLUDES ${MPG123_INCLUDE_DIR})
set(SOUND_INPUT_LIBRARY ${MPG123_LIBRARY})
set(SOUND_DEFINE -DOPENMW_USE_MPG123)
endif (USE_MPG123)
set(OENGINE_SOUND set(OENGINE_SOUND
# Mangle and OEngine sound files are sort of intertwined, so put # Mangle and OEngine sound files are sort of intertwined, so put
# them together here # them together here
@ -150,7 +160,6 @@ include_directories("."
${OGRE_INCLUDE_DIR} ${OGRE_INCLUDE_DIR}/Ogre ${OGRE_INCLUDE_DIR} ${OGRE_INCLUDE_DIR}/Ogre
${OIS_INCLUDE_DIR} ${Boost_INCLUDE_DIR} ${OIS_INCLUDE_DIR} ${Boost_INCLUDE_DIR}
${ICONV_INCLUDE_DIR} ${ICONV_INCLUDE_DIR}
${SOUND_INPUT_INCLUDES}
${PLATFORM_INCLUDE_DIR} ${PLATFORM_INCLUDE_DIR}
${CMAKE_HOME_DIRECTORY}/extern/caelum/include ${CMAKE_HOME_DIRECTORY}/extern/caelum/include
${CMAKE_HOME_DIRECTORY}/extern/mygui_3.0.1/MyGUIEngine/include ${CMAKE_HOME_DIRECTORY}/extern/mygui_3.0.1/MyGUIEngine/include

@ -179,6 +179,11 @@ add_executable(openmw
${APPLE_BUNDLE_RESOURCES} ${APPLE_BUNDLE_RESOURCES}
) )
# Sound stuff - here so CMake doesn't stupidly recompile EVERYTHING
# when we change the backend.
include_directories(${SOUND_INPUT_INCLUDES})
add_definitions(${SOUND_DEFINE})
target_link_libraries(openmw target_link_libraries(openmw
${OGRE_LIBRARIES} ${OGRE_LIBRARIES}
${OIS_LIBRARIES} ${OIS_LIBRARIES}

@ -18,6 +18,11 @@
#define SOUND_FACTORY OpenAL_FFMpeg_Factory #define SOUND_FACTORY OpenAL_FFMpeg_Factory
#endif #endif
#ifdef OPENMW_USE_MPG123
#include <mangle/sound/filters/openal_mpg123.hpp>
#define SOUND_FACTORY OpenAL_Mpg123_Factory
#endif
using namespace Mangle::Sound; using namespace Mangle::Sound;
typedef OEngine::Sound::SoundManager OEManager; typedef OEngine::Sound::SoundManager OEManager;
typedef OEngine::Sound::SoundManagerPtr OEManagerPtr; typedef OEngine::Sound::SoundManagerPtr OEManagerPtr;

@ -5,6 +5,9 @@ project(SoundTest)
# Main executable # Main executable
add_executable(sound_test main.cpp ${OENGINE_SOUND}) add_executable(sound_test main.cpp ${OENGINE_SOUND})
include_directories(${SOUND_INPUT_INCLUDES})
add_definitions(${SOUND_DEFINE})
target_link_libraries(sound_test target_link_libraries(sound_test
${OPENAL_LIBRARY} ${OPENAL_LIBRARY}
${SOUND_INPUT_LIBRARY} ${SOUND_INPUT_LIBRARY}

@ -18,6 +18,11 @@ AudiereLoader loader;
FFMpegLoader loader; FFMpegLoader loader;
#endif #endif
#ifdef OPENMW_USE_MPG123
#include <mangle/sound/filters/openal_mpg123.hpp>
Mpg123Loader loader;
#endif
OpenAL_Factory openal; OpenAL_Factory openal;
void play(const char* name) void play(const char* name)

@ -0,0 +1,47 @@
# Locate MPG123
# This module defines
# MPG123_LIBRARY
# MPG123_FOUND, if false, do not try to link to Mpg123
# MPG123_INCLUDE_DIR, where to find the headers
#
# Created by Nicolay Korslund for OpenMW (http://openmw.com)
#
# Ripped off from other sources. In fact, this file is so generic (I
# just did a search and replace on another file) that I wonder why the
# CMake guys haven't wrapped this entire thing in a single
# function. Do we really need to repeat this stuff for every single
# library when they all work the same? </today's rant>
FIND_PATH(MPG123_INCLUDE_DIR mpg123.h
HINTS
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
)
FIND_LIBRARY(MPG123_LIBRARY
NAMES mpg123
HINTS
PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
/sw
/opt/local
/opt/csw
/opt
)
SET(MPG123_FOUND "NO")
IF(MPG123_LIBRARY AND MPG123_INCLUDE_DIR)
SET(MPG123_FOUND "YES")
ENDIF(MPG123_LIBRARY AND MPG123_INCLUDE_DIR)

@ -1 +1 @@
Subproject commit dc0c026ce054a96cdd4093237031ca63048a7393 Subproject commit 5b8e8d6b48847cd99d14064e8c7a1115efdd4fed
Loading…
Cancel
Save