# HG changeset patch # User Ryan C. Gordon # Date 1021911718 0 # Node ID 5a72981b8cbabfbfe90c3a47e3449affa4fb0b12 # Parent e3ac0d41668c18338061def8506750df00226a01 Added optional, experimental audio conversion routines by Frank Ranostaj. diff -r e3ac0d41668c -r 5a72981b8cba Makefile.am --- a/Makefile.am Mon May 20 16:21:20 2002 +0000 +++ b/Makefile.am Mon May 20 16:21:58 2002 +0000 @@ -6,12 +6,18 @@ libSDL_soundinclude_HEADERS = \ SDL_sound.h +if USE_ALTCVT +CVT_SOURCE = alt_audio_convert.c +else +CVT_SOURCE = audio_convert.c +endif + libSDL_sound_la_SOURCES = \ SDL_sound.c \ SDL_sound_internal.h \ + $(CVT_SOURCE) \ extra_rwops.c \ - extra_rwops.h \ - audio_convert.c + extra_rwops.h if USE_TIMIDITY TIMIDITY_LIB = decoders/timidity/libtimidity.la diff -r e3ac0d41668c -r 5a72981b8cba SDL_sound.c --- a/SDL_sound.c Mon May 20 16:21:20 2002 +0000 +++ b/SDL_sound.c Mon May 20 16:21:58 2002 +0000 @@ -534,6 +534,15 @@ memcpy(&desired, (_desired != NULL) ? _desired : &sample->actual, sizeof (Sound_AudioInfo)); + /* !!! FIXME: Was there a good reason this wasn't here before? */ + /* !!! FIXME: (Maybe we just assumed that it was all or nothing?) */ + if (desired.format == 0) + desired.format = sample->actual.format; + if (desired.channels == 0) + desired.channels = sample->actual.channels; + if (desired.rate == 0) + desired.rate = sample->actual.rate; + if (Sound_BuildAudioCVT(&internal->sdlcvt, sample->actual.format, sample->actual.channels, diff -r e3ac0d41668c -r 5a72981b8cba SDL_sound_internal.h --- a/SDL_sound_internal.h Mon May 20 16:21:20 2002 +0000 +++ b/SDL_sound_internal.h Mon May 20 16:21:58 2002 +0000 @@ -197,7 +197,9 @@ /* A structure to hold a set of audio conversion filters and buffers */ - +#if (defined SOUND_USE_ALTCVT) +#include "alt_audio_convert.h" +#else typedef struct Sound_AudioCVT { int needed; /* Set to 1 if conversion possible */ @@ -212,7 +214,7 @@ void (*filters[20])(struct Sound_AudioCVT *cvt, Uint16 *format); int filter_index; /* Current audio conversion function */ } Sound_AudioCVT; - +#endif typedef struct __SOUND_SAMPLEINTERNAL__ { diff -r e3ac0d41668c -r 5a72981b8cba acconfig.h --- a/acconfig.h Mon May 20 16:21:20 2002 +0000 +++ b/acconfig.h Mon May 20 16:21:58 2002 +0000 @@ -16,3 +16,5 @@ #undef SOUND_SUPPORTS_SEEKABLE_FLAC #undef SOUND_SUPPORTS_SMPEG #undef SOUND_SUPPORTS_MPGLIB +#undef SOUND_USE_ALTCVT + diff -r e3ac0d41668c -r 5a72981b8cba configure.in --- a/configure.in Mon May 20 16:21:20 2002 +0000 +++ b/configure.in Mon May 20 16:21:58 2002 +0000 @@ -245,10 +245,20 @@ AC_CHECK_HEADER(physfs.h, have_physfs_hdr=yes) AC_CHECK_LIB(physfs, PHYSFS_init, have_physfs_lib=yes) if test x$have_physfs_hdr = xyes -a x$have_physfs_lib = xyes; then - use_physicsfs="yes" + enable_physfs="yes" + else + enable_physfs="no" fi fi +dnl Check for PhysicsFS http://icculus.org/physfs/ +AC_ARG_ENABLE(altcvt, +[ --enable-altcvt enable EXPERIMENTAL audio converter [default=no]], + , enable_altcvt=no) +if test x$enable_altcvt = xyes; then + AC_DEFINE(SOUND_USE_ALTCVT) +fi + dnl Check for efence (!!! FIXME : This doesn't work.) dnl AC_ARG_ENABLE(efence, @@ -277,7 +287,8 @@ dnl Add Makefile conditionals AM_CONDITIONAL(USE_TIMIDITY, test x$enable_midi = xyes) AM_CONDITIONAL(USE_MPGLIB, test x$enable_mpglib = xyes) -AM_CONDITIONAL(USE_PHYSICSFS, test x$use_physicsfs = xyes) +AM_CONDITIONAL(USE_PHYSICSFS, test x$enable_physfs = xyes) +AM_CONDITIONAL(USE_ALTCVT, test x$enable_altcvt = xyes) AC_OUTPUT([ Makefile