Skip to content

Commit

Permalink
Added optional, experimental audio conversion routines by Frank Ranos…
Browse files Browse the repository at this point in the history
…taj.
  • Loading branch information
icculus committed May 20, 2002
1 parent fd2b852 commit b6b5957
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 6 deletions.
10 changes: 8 additions & 2 deletions Makefile.am
Expand Up @@ -6,12 +6,18 @@ libSDL_soundincludedir = $(includedir)/SDL
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
Expand Down
9 changes: 9 additions & 0 deletions SDL_sound.c
Expand Up @@ -534,6 +534,15 @@ static int init_sample(const Sound_DecoderFunctions *funcs,
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,
Expand Down
6 changes: 4 additions & 2 deletions SDL_sound_internal.h
Expand Up @@ -197,7 +197,9 @@ typedef struct __SOUND_DECODERFUNCTIONS__


/* 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 */
Expand All @@ -212,7 +214,7 @@ typedef struct Sound_AudioCVT
void (*filters[20])(struct Sound_AudioCVT *cvt, Uint16 *format);
int filter_index; /* Current audio conversion function */
} Sound_AudioCVT;

#endif

typedef struct __SOUND_SAMPLEINTERNAL__
{
Expand Down
2 changes: 2 additions & 0 deletions acconfig.h
Expand Up @@ -16,3 +16,5 @@
#undef SOUND_SUPPORTS_SEEKABLE_FLAC
#undef SOUND_SUPPORTS_SMPEG
#undef SOUND_SUPPORTS_MPGLIB
#undef SOUND_USE_ALTCVT

15 changes: 13 additions & 2 deletions configure.in
Expand Up @@ -245,10 +245,20 @@ if test x$enable_physfs = xyes; then
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,
Expand Down Expand Up @@ -277,7 +287,8 @@ AC_CHECK_FUNCS([memset strrchr])
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
Expand Down

0 comments on commit b6b5957

Please sign in to comment.