Linux version now defaults back to SDL_mixer (with no longer needing SDL_sound), also 3DO musics are now used by default
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@149 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
+6
-6
@@ -27,8 +27,8 @@ AM_MAINTAINER_MODE
|
|||||||
|
|
||||||
# Configurables
|
# Configurables
|
||||||
|
|
||||||
CFLAGS="$CFLAGS -g -W -Wall -DHAVE_OPENGL -DSDL_PTHREADS -DGFXMODULE_SDL -DSOUNDMODULE_OPENAL"
|
CFLAGS="$CFLAGS -g -W -Wall -DHAVE_OPENGL -DSDL_PTHREADS -DGFXMODULE_SDL -DSOUNDMODULE_SDL"
|
||||||
CPPFLAGS="$CPPFLAGS -g -W -Wall -DHAVE_OPENGL -DSDL_PTHREADS -DGFXMODULE_SDL -DSOUNDMODULE_OPENAL"
|
CPPFLAGS="$CPPFLAGS -g -W -Wall -DHAVE_OPENGL -DSDL_PTHREADS -DGFXMODULE_SDL -DSOUNDMODULE_SDL"
|
||||||
|
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -69,9 +69,9 @@ AC_CHECK_FUNCS([strupr])
|
|||||||
SDL_VERSION=1.2.2
|
SDL_VERSION=1.2.2
|
||||||
AM_PATH_SDL($SDL_VERSION, , AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]))
|
AM_PATH_SDL($SDL_VERSION, , AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]))
|
||||||
AC_CHECK_LIB(SDL_image, main, , AC_MSG_ERROR([Your system is missing libSDL_image!]),`sdl-config --libs`)
|
AC_CHECK_LIB(SDL_image, main, , AC_MSG_ERROR([Your system is missing libSDL_image!]),`sdl-config --libs`)
|
||||||
AC_CHECK_LIB(SDL_sound, main, , AC_MSG_ERROR([Your system is missing libSDL_sound!]),`sdl-config --libs`)
|
AC_CHECK_LIB(SDL_mixer, main, , AC_MSG_ERROR([Your system is missing libSDL_mixer!]),`sdl-config --libs`)
|
||||||
AC_CHECK_LIB(openal, main, , AC_MSG_ERROR([Your system is missing libopenal!]),"-lm")
|
#AC_CHECK_LIB(SDL_sound, main, , AC_MSG_ERROR([Your system is missing libSDL_sound!]),`sdl-config --libs`)
|
||||||
#AC_CHECK_LIB(SDL_mixer, main, , AC_MSG_ERROR([Your system is missing libSDL_mixer!]),`sdl-config --libs`)
|
#AC_CHECK_LIB(openal, main, , AC_MSG_ERROR([Your system is missing libopenal!]),"-lm")
|
||||||
#AC_CHECK_HEADERS(SDL/SDL_image.h, , AC_MSG_ERROR([Your system is missing SDL_image.h!]))
|
#AC_CHECK_HEADERS(SDL/SDL_image.h, , AC_MSG_ERROR([Your system is missing SDL_image.h!]))
|
||||||
|
|
||||||
# Select platform dependent OpenGL libs.. (tweak your platform here)
|
# Select platform dependent OpenGL libs.. (tweak your platform here)
|
||||||
@@ -211,7 +211,7 @@ AC_CONFIG_FILES([
|
|||||||
src/sc2code/libs/input/Makefile
|
src/sc2code/libs/input/Makefile
|
||||||
src/sc2code/libs/input/sdl/Makefile
|
src/sc2code/libs/input/sdl/Makefile
|
||||||
src/sc2code/libs/sound/Makefile
|
src/sc2code/libs/sound/Makefile
|
||||||
src/sc2code/libs/sound/openal/Makefile
|
src/sc2code/libs/sound/sdl/Makefile
|
||||||
src/sc2code/libs/graphics/Makefile
|
src/sc2code/libs/graphics/Makefile
|
||||||
src/sc2code/libs/graphics/sdl/Makefile
|
src/sc2code/libs/graphics/sdl/Makefile
|
||||||
src/sc2code/libs/task/Makefile
|
src/sc2code/libs/task/Makefile
|
||||||
|
|||||||
+1
-1
@@ -24,7 +24,7 @@
|
|||||||
#include "compiler.h"
|
#include "compiler.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
|
||||||
int optWhichMusic = MUSIC_PC;
|
int optWhichMusic = MUSIC_3DO;
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN FileExists (char *filename)
|
BOOLEAN FileExists (char *filename)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
# Written by Mudry <mudry@user.sf.net>, protected by GNU GPL.
|
# Written by Mudry <mudry@user.sf.net>, protected by GNU GPL.
|
||||||
# CVS $ Id: $
|
# CVS $ Id: $
|
||||||
|
|
||||||
SUBDIRS = openal
|
SUBDIRS = sdl
|
||||||
|
|
||||||
INCLUDES = @SDL_CFLAGS@ \
|
INCLUDES = @SDL_CFLAGS@ \
|
||||||
-I$(top_srcdir)/src \
|
-I$(top_srcdir)/src \
|
||||||
@@ -12,6 +12,6 @@ INCLUDES = @SDL_CFLAGS@ \
|
|||||||
|
|
||||||
noinst_LTLIBRARIES = libsound.la
|
noinst_LTLIBRARIES = libsound.la
|
||||||
libsound_la_SOURCES = fileinst.c resinst.c sound_common.c
|
libsound_la_SOURCES = fileinst.c resinst.c sound_common.c
|
||||||
libsound_la_LIBADD = openal/libopenalsound.la
|
libsound_la_LIBADD = sdl/libsdlsound.la
|
||||||
noinst_HEADERS = play.h redbook.h sndintrn.h trackplayer.h sound_common.h
|
noinst_HEADERS = play.h redbook.h sndintrn.h trackplayer.h sound_common.h
|
||||||
|
|
||||||
|
|||||||
@@ -18,16 +18,17 @@
|
|||||||
|
|
||||||
#ifdef SOUNDMODULE_SDL
|
#ifdef SOUNDMODULE_SDL
|
||||||
|
|
||||||
#include "libs/strings/strintrn.h"
|
|
||||||
#include "libs/sound/sndintrn.h"
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#endif
|
#endif
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
#include "libs/strings/strintrn.h"
|
||||||
|
#include "libs/sound/sndintrn.h"
|
||||||
#include "libs/graphics/sdl/sdl_common.h"
|
#include "libs/graphics/sdl/sdl_common.h"
|
||||||
#include "libs/sound/sound_common.h"
|
#include "libs/sound/sound_common.h"
|
||||||
#include "SDL_mixer.h"
|
#include "options.h"
|
||||||
|
#include <SDL/SDL_mixer.h>
|
||||||
|
|
||||||
|
|
||||||
MEM_HANDLE
|
MEM_HANDLE
|
||||||
@@ -156,31 +157,52 @@ _ReleaseSoundBankData (MEM_HANDLE Snd)
|
|||||||
MEM_HANDLE
|
MEM_HANDLE
|
||||||
_GetMusicData (FILE *fp, DWORD length)
|
_GetMusicData (FILE *fp, DWORD length)
|
||||||
{
|
{
|
||||||
MEM_HANDLE h;
|
MEM_HANDLE h;
|
||||||
extern char *_cur_resfile_name;
|
extern char *_cur_resfile_name;
|
||||||
|
|
||||||
h = 0;
|
h = 0;
|
||||||
if (_cur_resfile_name && (h = AllocMusicData (sizeof (void *))))
|
if (_cur_resfile_name && (h = AllocMusicData (sizeof (void *))))
|
||||||
|
{
|
||||||
|
char filename[1000];
|
||||||
|
Mix_Music **pmus;
|
||||||
|
|
||||||
|
LockMusicData (h, &pmus);
|
||||||
|
|
||||||
|
strcpy (filename, _cur_resfile_name);
|
||||||
|
switch (optWhichMusic)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
case MUSIC_3DO:
|
||||||
|
{
|
||||||
|
char threedoname[1000];
|
||||||
|
|
||||||
|
strcpy (threedoname, filename);
|
||||||
|
strcpy (&threedoname[strlen (threedoname)-3], "ogg");
|
||||||
|
if (FileExists (threedoname))
|
||||||
|
{
|
||||||
|
strcpy (filename, threedoname);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case MUSIC_PC:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf (stderr, "_GetMusicData(): loading %s\n", filename);
|
||||||
|
if (pmus == 0 || (*pmus = Mix_LoadMUS (filename)) == 0)
|
||||||
{
|
{
|
||||||
Mix_Music **pmus;
|
UnlockMusicData (h);
|
||||||
|
mem_release (h);
|
||||||
|
h = 0;
|
||||||
|
}
|
||||||
|
UnlockMusicData (h);
|
||||||
|
}
|
||||||
|
|
||||||
LockMusicData (h, &pmus);
|
(void) fp; /* satisfy compiler (unused parameter) */
|
||||||
if (pmus == 0 || (*pmus = Mix_LoadMUS (_cur_resfile_name)) == 0)
|
(void) length; /* satisfy compiler (unused parameter) */
|
||||||
{
|
return (h);
|
||||||
UnlockMusicData (h);
|
|
||||||
mem_release (h);
|
|
||||||
h = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
UnlockMusicData (h);
|
|
||||||
}
|
|
||||||
|
|
||||||
(void) fp; /* satisfy compiler (unused parameter) */
|
|
||||||
(void) length; /* satisfy compiler (unused parameter) */
|
|
||||||
return (h);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "libs/graphics/sdl/sdl_common.h"
|
#include "libs/graphics/sdl/sdl_common.h"
|
||||||
#include "libs/sound/sound_common.h"
|
#include "libs/sound/sound_common.h"
|
||||||
#include "SDL_mixer.h"
|
#include <SDL/SDL_mixer.h>
|
||||||
|
|
||||||
static MUSIC_REF curMusicRef;
|
static MUSIC_REF curMusicRef;
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,7 @@
|
|||||||
|
|
||||||
#include "libs/graphics/sdl/sdl_common.h"
|
#include "libs/graphics/sdl/sdl_common.h"
|
||||||
#include "libs/sound/sound_common.h"
|
#include "libs/sound/sound_common.h"
|
||||||
#include "SDL_mixer.h"
|
#include <SDL/SDL_mixer.h>
|
||||||
#include "SDL_sound.h"
|
|
||||||
|
|
||||||
int
|
int
|
||||||
TFB_InitSound (int driver, int flags, int frequency)
|
TFB_InitSound (int driver, int flags, int frequency)
|
||||||
@@ -67,16 +66,6 @@ TFB_InitSound (int driver, int flags, int frequency)
|
|||||||
Mix_Linked_Version()->minor,
|
Mix_Linked_Version()->minor,
|
||||||
Mix_Linked_Version()->patch);
|
Mix_Linked_Version()->patch);
|
||||||
|
|
||||||
fprintf (stderr, "Initializing SDL_sound.\n");
|
|
||||||
fprintf (stderr, "(NOTE: if this locks up, compile SDL_sound without libmikmod support)\n");
|
|
||||||
fflush (stderr);
|
|
||||||
if (!Sound_Init())
|
|
||||||
{
|
|
||||||
fprintf(stderr, "Sound_Init() failed: %s\n", Sound_GetError());
|
|
||||||
exit (-1);
|
|
||||||
}
|
|
||||||
fprintf (stderr, "SDL_sound initialized.\n");
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,8 +21,7 @@
|
|||||||
#include "libs/graphics/sdl/sdl_common.h"
|
#include "libs/graphics/sdl/sdl_common.h"
|
||||||
#include "libs/sound/sound_common.h"
|
#include "libs/sound/sound_common.h"
|
||||||
#include "libs/sound/trackplayer.h"
|
#include "libs/sound/trackplayer.h"
|
||||||
#include "SDL_mixer.h"
|
#include <SDL/SDL_mixer.h>
|
||||||
#include "SDL_sound.h"
|
|
||||||
|
|
||||||
|
|
||||||
#define VOICE_CHANNEL 0
|
#define VOICE_CHANNEL 0
|
||||||
@@ -36,52 +35,8 @@ static struct
|
|||||||
int text_spliced;
|
int text_spliced;
|
||||||
UNICODE *text;
|
UNICODE *text;
|
||||||
Mix_Chunk *chunk;
|
Mix_Chunk *chunk;
|
||||||
Uint8 *speechdata;
|
|
||||||
Uint32 speechlen;
|
|
||||||
|
|
||||||
} track_clip[MAX_CLIPS];
|
} track_clip[MAX_CLIPS];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Uint8* Sound_Own_DecodeAll (Sound_Sample *sample, Uint32 bufsize, Uint32 *decoded_bytes)
|
|
||||||
{
|
|
||||||
Uint8 *buf = NULL;
|
|
||||||
|
|
||||||
*decoded_bytes = 0;
|
|
||||||
buf = (Uint8*) malloc (bufsize);
|
|
||||||
if (!buf)
|
|
||||||
{
|
|
||||||
fprintf (stderr, "Sound_Own_DecodeAll(): cannot allocate %d bytes\n", bufsize);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
while ( ((sample->flags & SOUND_SAMPLEFLAG_EOF) == 0) &&
|
|
||||||
((sample->flags & SOUND_SAMPLEFLAG_ERROR) == 0) )
|
|
||||||
{
|
|
||||||
Uint32 br = Sound_Decode (sample);
|
|
||||||
|
|
||||||
if (*decoded_bytes + br >= bufsize)
|
|
||||||
{
|
|
||||||
Uint8 *newbuf;
|
|
||||||
|
|
||||||
bufsize *= 2;
|
|
||||||
newbuf = (Uint8*) realloc (buf, bufsize);
|
|
||||||
if (!newbuf)
|
|
||||||
{
|
|
||||||
fprintf (stderr, "Sound_Own_DecodeAll(): cannot realloc %d bytes\n", bufsize);
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
buf = newbuf;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy (&buf[*decoded_bytes], sample->buffer, br);
|
|
||||||
*decoded_bytes += br;
|
|
||||||
}
|
|
||||||
|
|
||||||
//fprintf(stderr, "Sound_Own_DecodeAll(): decoded %d bytes, allocated memory size %d\n", *decoded_bytes, bufsize);
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
JumpTrack (int abort)
|
JumpTrack (int abort)
|
||||||
{
|
{
|
||||||
@@ -167,13 +122,6 @@ StopTrack ()
|
|||||||
Mix_FreeChunk (track_clip[tct].chunk);
|
Mix_FreeChunk (track_clip[tct].chunk);
|
||||||
track_clip[tct].chunk = 0;
|
track_clip[tct].chunk = 0;
|
||||||
}
|
}
|
||||||
if (track_clip[tct].speechdata)
|
|
||||||
{
|
|
||||||
//fprintf (stderr, "StopTrack(): freeing atleast %d bytes\n", track_clip[tct].speechlen);
|
|
||||||
free (track_clip[tct].speechdata);
|
|
||||||
track_clip[tct].speechdata = 0;
|
|
||||||
track_clip[tct].speechlen = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
tct = tcur = 0;
|
tct = tcur = 0;
|
||||||
no_voice = 0;
|
no_voice = 0;
|
||||||
@@ -208,59 +156,13 @@ SpliceTrack (UNICODE *TrackName, UNICODE *TrackText)
|
|||||||
}
|
}
|
||||||
else if (tct < MAX_CLIPS)
|
else if (tct < MAX_CLIPS)
|
||||||
{
|
{
|
||||||
Sound_AudioInfo sound_desired;
|
fprintf(stderr, "SpliceTrack(): loading %s\n", TrackName);
|
||||||
Sound_Sample *sample;
|
|
||||||
Uint16 format;
|
|
||||||
int rate, channels;
|
|
||||||
|
|
||||||
//fprintf(stderr, "SpliceTrack(): trackname %s\n", TrackName);
|
track_clip[tct].chunk = Mix_LoadWAV (TrackName);
|
||||||
|
if (!track_clip[tct].chunk)
|
||||||
// this is needed because sample must be converted to mixer
|
|
||||||
// format or it doesn't play right
|
|
||||||
Mix_QuerySpec (&rate, &format, &channels);
|
|
||||||
sound_desired.rate = rate;
|
|
||||||
sound_desired.format = format;
|
|
||||||
sound_desired.channels = channels;
|
|
||||||
|
|
||||||
sample = Sound_NewSampleFromFile (TrackName, &sound_desired, 16384);
|
|
||||||
|
|
||||||
if (!sample)
|
|
||||||
{
|
{
|
||||||
fprintf (stderr, "SpliceTrack(): couldn't load %s: %s\n",
|
fprintf (stderr, "SpliceTrack(): Mix_LoadWAV failed for %s: %s\n",
|
||||||
TrackName, Sound_GetError());
|
TrackName, Mix_GetError());
|
||||||
track_clip[tct].chunk = NULL;
|
|
||||||
track_clip[tct].speechdata = NULL;
|
|
||||||
track_clip[tct].speechlen = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
track_clip[tct].speechdata = Sound_Own_DecodeAll (sample, 1048576,
|
|
||||||
&track_clip[tct].speechlen);
|
|
||||||
|
|
||||||
if (track_clip[tct].speechdata)
|
|
||||||
{
|
|
||||||
track_clip[tct].chunk = Mix_QuickLoad_RAW (track_clip[tct].speechdata,
|
|
||||||
track_clip[tct].speechlen);
|
|
||||||
|
|
||||||
if (!track_clip[tct].chunk)
|
|
||||||
{
|
|
||||||
fprintf (stderr, "SpliceTrack(): Mix_QuickLoad_RAW failed for %s: %s\n",
|
|
||||||
TrackName, Mix_GetError());
|
|
||||||
|
|
||||||
free (track_clip[tct].speechdata);
|
|
||||||
track_clip[tct].speechdata = NULL;
|
|
||||||
track_clip[tct].speechlen = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fprintf (stderr, "SpliceTrack(): Sound_Own_DecodeAll failed for %s\n", TrackName);
|
|
||||||
track_clip[tct].chunk = NULL;
|
|
||||||
track_clip[tct].speechdata = NULL;
|
|
||||||
track_clip[tct].speechlen = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
Sound_FreeSample (sample);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
track_clip[tct].text = TrackText;
|
track_clip[tct].text = TrackText;
|
||||||
|
|||||||
Reference in New Issue
Block a user