diff --git a/sc2/ChangeLog b/sc2/ChangeLog index a2d5fb902..c1e4480fc 100644 --- a/sc2/ChangeLog +++ b/sc2/ChangeLog @@ -1,4 +1,6 @@ Changes towards version 0.5: +- Added support for Tremor for Ogg Vorbis decoding (avoids floating point + math) - SvdB - Fixed T-Pet compulsion graphics (partially); bug #772 - Alex - Doing game-state file I/O in memory instead of temp files; should avoid problems as in bug #752 - Alex diff --git a/sc2/INSTALL b/sc2/INSTALL index 2b4be651c..16341e030 100644 --- a/sc2/INSTALL +++ b/sc2/INSTALL @@ -26,7 +26,7 @@ OpenGL v1.2 (if HAVE_OPENGL is defined, which is the default) http://www.xfree86.org/ Debian package: xlibmesa-dev OR nvidia-glx OR XFree86 4.x comes with Mesa, which is a clone. - Note: Mesa is a software emulation. For enjoyable results + Note: Mesa is a software emulation. For enjoyable results you will need hardware accelerated OpenGL (GLX). These usually conflict with mesa (can result in X server crash). @@ -48,8 +48,8 @@ OpenAL (Win32 only) Homepage: http://www.openal.org/ SDK download: http://developer.creative.com/articles/article.asp?cat=1&sbcat=31&aid=45&file=OpenALSDK.zip -Ogg Vorbis - Audio codec used for music and speech. +libogg and libvorbis + Audio codec to play Ogg Vorbis files, used for music and speech. Homepage: http://www.xiph.org/ogg/vorbis/index.html Download: For Windows: @@ -58,6 +58,14 @@ Ogg Vorbis http://www.vorbis.com/download_unix.psp download libogg and libvorbis. +Tremor (alternative for libogg and libvorbis) + Audio codec to play Ogg Vorbis files, used for music and speech. + This library avoids floating point math and should be used instead + of libogg and libvorbis when floating point support is not available + or slow (on some handhelds and game consoles). + Homepage: http://www.xiph.org/vorbis/ + Download: http://svn.xiph.org/trunk/Tremor (Subversion) + Zlib v1.2 Data compression / decompression library Homepage: http://www.gzip.org/zlib/ @@ -68,5 +76,6 @@ Zlib v1.2 If you find these aren't enough, or if you know the names of the corresponding RPM etc. packages, please report to - or visit + or visit http://sourceforge.net/projects/sc2 + diff --git a/sc2/build/unix/build.config b/sc2/build/unix/build.config index 06fc4d3a4..a7136f020 100644 --- a/sc2/build/unix/build.config +++ b/sc2/build/unix/build.config @@ -28,11 +28,9 @@ uqm_requirements() check_endianness - # Libraries used + # Libraries always used use_library SDL 1.2.3 || exit 1 use_library SDL_image || exit 1 - #have_library vorbis || exit 1 - have_library vorbisfile || exit 1 # Add defines for HAVE_READDIR_R, HAVE_SETENV, HAVE_STRUPR @@ -56,7 +54,7 @@ uqm_requirements() uqm_prepare_config() { # Describe the menu: - MENU_main_ITEMS="debug graphics sound ioformat" + MENU_main_ITEMS="debug graphics sound ovcodec ioformat" case "$HOST_SYSTEM" in Darwin) # Installation directory not modifiable @@ -72,6 +70,7 @@ uqm_prepare_config() MENU_main_ITEM_debug_TYPE=CHOICE MENU_main_ITEM_graphics_TYPE=CHOICE MENU_main_ITEM_sound_TYPE=CHOICE + MENU_main_ITEM_ovcodec_TYPE=CHOICE MENU_main_ITEM_ioformat_TYPE=CHOICE MENU_main_ITEM_link_TYPE=CHOICE MENU_main_ITEM_install_path_TYPE=MENU @@ -149,8 +148,6 @@ uqm_prepare_config() sound_mixsdl_action() { CFLAGS="$CFLAGS -DSOUNDMODULE_SDL" SOUNDMODULE=mixsdl - use_library vorbisfile -# use_library vorbis } CHOICE_sound_OPTION_openal_TITLE="Include OpenAL support (experimental)" CHOICE_sound_OPTION_openal_PRECOND="have_library openal" @@ -159,10 +156,27 @@ uqm_prepare_config() CFLAGS="$CFLAGS -DHAVE_OPENAL -DSOUNDMODULE_SDL" SOUNDMODULE=openal use_library openal + } + CHOICE_sound_DEFAULT=mixsdl + + CHOICE_ovcodec_OPTIONS="standard tremor" + CHOICE_ovcodec_TITLE="Ogg Vorbis codec" + CHOICE_ovcodec_OPTION_standard_TITLE="Xiph libogg + libvorbis" + CHOICE_ovcodec_OPTION_standard_PRECOND="have_library vorbisfile" +# CHOICE_ovcodec_OPTION_standard_PRECOND="have_library vorbisfile && have_library vorbis" + CHOICE_ovcodec_OPTION_standard_ACTION=ovcodec_standard_action + ovcodec_standard_action() { use_library vorbisfile # use_library vorbis } - CHOICE_sound_DEFAULT=mixsdl + CHOICE_ovcodec_OPTION_tremor_TITLE="Tremor (avoids floating point math)" + CHOICE_ovcodec_OPTION_tremor_PRECOND="have_library tremor" + CHOICE_ovcodec_OPTION_tremor_ACTION=ovcodec_tremor_action + ovcodec_tremor_action() { + CFLAGS="$CFLAGS -DOVCODEC_TREMOR" + use_library tremor + } + CHOICE_ovcodec_DEFAULT=standard CHOICE_ioformat_OPTIONS="stdio stdio_zip" CHOICE_ioformat_TITLE="Supported file i/o methods" diff --git a/sc2/build/unix/config_proginfo_host b/sc2/build/unix/config_proginfo_host index e720b29c1..59d8d87ac 100644 --- a/sc2/build/unix/config_proginfo_host +++ b/sc2/build/unix/config_proginfo_host @@ -179,6 +179,26 @@ LIB_vorbisfile_DETECT="try_pkgconfig_lib vorbisfile vorbisfile" LIB_vorbisfile_DEPEND_DETECT_BIN="pkgconfig" +### Tremor ### +LIB_tremor_NAME="tremor" +case "$HOST_SYSTEM" in + FreeBSD|OpenBSD) + LIB_tremor_CFLAGS="-I/usr/local/include" + LIB_tremor_LDFLAGS="-L/usr/local/lib -lvorbisidec" + ;; + Darwin) + # Assumed values - please let me know if you can verify this. + LIB_tremor_CFLAGS="" + LIB_tremor_LDFLAGS="-framework Tremor" + ;; + *) + LIB_tremor_CFLAGS="" + LIB_tremor_LDFLAGS="-lvorbisidec" + ;; +esac +LIB_tremor_VERSION="" + + ### zlib ### LIB_zlib_NAME="zlib" LIB_zlib_CFLAGS="" diff --git a/sc2/src/sc2code/libs/sound/decoders/oggaud.c b/sc2/src/sc2code/libs/sound/decoders/oggaud.c index 4a4020019..f669990a8 100644 --- a/sc2/src/sc2code/libs/sound/decoders/oggaud.c +++ b/sc2/src/sc2code/libs/sound/decoders/oggaud.c @@ -25,8 +25,13 @@ #include "types.h" #include "uio.h" #include "decoder.h" -#include -#include +#ifdef OVCODEC_TREMOR +# include +# include +#else +# include +# include +#endif /* OVCODEC_TREMOR */ #include "oggaud.h" @@ -221,8 +226,12 @@ ova_Decode (THIS_PTR, void* buf, sint32 bufsize) long rc; int bitstream; +#ifdef OVCODEC_TREMOR + rc = ov_read (&ova->vf, buf, bufsize, &bitstream); +#else rc = ov_read (&ova->vf, buf, bufsize, ova_formats->want_big_endian, 2, 1, &bitstream); +#endif /* OVCODEC_TREMOR */ if (rc < 0) ova->last_error = rc; @@ -254,5 +263,10 @@ ova_GetFrame (THIS_PTR) TFB_OggSoundDecoder* ova = (TFB_OggSoundDecoder*) This; // this is the closest to a frame there is in ogg vorbis stream // doesn't seem to be a func to retrive it +#ifdef OVCODEC_TREMOR + return ova->vf.os->pageno; +#else return ova->vf.os.pageno; +#endif /* OVCODEC_TREMOR */ } +