remove SDL_Sound support

This commit is contained in:
Jonathan Campbell 2013-10-20 01:02:14 -07:00
parent 4fdcba96c9
commit 093cfedb53
5 changed files with 1 additions and 246 deletions

View File

@ -92,9 +92,6 @@
/* Define to 1 to use opengl display output support */
#undef C_OPENGL
/* Define to 1 to enable SDL_sound support */
#undef C_SDL_SOUND
/* Define to 1 if you have setpriority support */
#undef C_SET_PRIORITY

141
configure vendored
View File

@ -7377,147 +7377,6 @@ $as_echo "$as_me: WARNING: fluidsynth MIDI synthesis not available" >&2;}
fi
ac_fn_c_check_header_mongrel "$LINENO" "SDL_sound.h" "ac_cv_header_SDL_sound_h" "$ac_includes_default"
if test "x$ac_cv_header_SDL_sound_h" = xyes; then :
have_SDL_sound_h=yes
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Sound_Init in -lSDL_sound" >&5
$as_echo_n "checking for Sound_Init in -lSDL_sound... " >&6; }
if ${ac_cv_lib_SDL_sound_Sound_Init+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lSDL_sound $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char Sound_Init ();
int
main ()
{
return Sound_Init ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_SDL_sound_Sound_Init=yes
else
ac_cv_lib_SDL_sound_Sound_Init=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_SDL_sound_Sound_Init" >&5
$as_echo "$ac_cv_lib_SDL_sound_Sound_Init" >&6; }
if test "x$ac_cv_lib_SDL_sound_Sound_Init" = xyes; then :
have_SDL_sound_init=yes
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Sound_Seek in -lSDL_sound" >&5
$as_echo_n "checking for Sound_Seek in -lSDL_sound... " >&6; }
if ${ac_cv_lib_SDL_sound_Sound_Seek+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lSDL_sound $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char Sound_Seek ();
int
main ()
{
return Sound_Seek ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_SDL_sound_Sound_Seek=yes
else
ac_cv_lib_SDL_sound_Sound_Seek=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_SDL_sound_Sound_Seek" >&5
$as_echo "$ac_cv_lib_SDL_sound_Sound_Seek" >&6; }
if test "x$ac_cv_lib_SDL_sound_Sound_Seek" = xyes; then :
have_SDL_sound_seek=yes
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Sound_GetDuration in -lSDL_sound" >&5
$as_echo_n "checking for Sound_GetDuration in -lSDL_sound... " >&6; }
if ${ac_cv_lib_SDL_sound_Sound_GetDuration+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lSDL_sound $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char Sound_GetDuration ();
int
main ()
{
return Sound_GetDuration ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_SDL_sound_Sound_GetDuration=yes
else
ac_cv_lib_SDL_sound_Sound_GetDuration=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_SDL_sound_Sound_GetDuration" >&5
$as_echo "$ac_cv_lib_SDL_sound_Sound_GetDuration" >&6; }
if test "x$ac_cv_lib_SDL_sound_Sound_GetDuration" = xyes; then :
have_SDL_sound_getduration=yes
fi
if test x$have_SDL_sound_h = xyes -a x$have_SDL_sound_init = xyes -a x$have_SDL_sound_getduration = xyes ; then
if test x$have_SDL_sound_seek = xyes ; then
LIBS="-lSDL_sound $LIBS"
$as_echo "#define C_SDL_SOUND 1" >>confdefs.h
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Can't find SoundSeek in libSDL_Sound, libSDL_sound support disabled" >&5
$as_echo "$as_me: WARNING: Can't find SoundSeek in libSDL_Sound, libSDL_sound support disabled" >&2;}
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Can't find libSDL_sound, libSDL_sound support disabled" >&5
$as_echo "$as_me: WARNING: Can't find libSDL_sound, libSDL_sound support disabled" >&2;}
fi
ac_fn_c_check_header_mongrel "$LINENO" "sys/mman.h" "ac_cv_header_sys_mman_h" "$ac_includes_default"
if test "x$ac_cv_header_sys_mman_h" = xyes; then :

View File

@ -443,22 +443,6 @@ else
AC_MSG_WARN([fluidsynth MIDI synthesis not available])
fi
AH_TEMPLATE(C_SDL_SOUND,[Define to 1 to enable SDL_sound support])
AC_CHECK_HEADER(SDL_sound.h,have_SDL_sound_h=yes,)
AC_CHECK_LIB(SDL_sound, Sound_Init, have_SDL_sound_init=yes,,)
AC_CHECK_LIB(SDL_sound, Sound_Seek, have_SDL_sound_seek=yes,,)
AC_CHECK_LIB(SDL_sound, Sound_GetDuration, have_SDL_sound_getduration=yes,,)
if test x$have_SDL_sound_h = xyes -a x$have_SDL_sound_init = xyes -a x$have_SDL_sound_getduration = xyes ; then
if test x$have_SDL_sound_seek = xyes ; then
LIBS="-lSDL_sound $LIBS"
AC_DEFINE(C_SDL_SOUND,1)
else
AC_MSG_WARN([Can't find SoundSeek in libSDL_Sound, libSDL_sound support disabled])
fi
else
AC_MSG_WARN([Can't find libSDL_sound, libSDL_sound support disabled])
fi
dnl Check for mprotect. Needed for 64 bits linux
AH_TEMPLATE(C_HAVE_MPROTECT,[Define to 1 if you have the mprotect function])
AC_CHECK_HEADER([sys/mman.h], [

View File

@ -34,10 +34,6 @@
#include "SDL.h"
#include "SDL_thread.h"
#if defined(C_SDL_SOUND)
#include "SDL_sound.h"
#endif
#define RAW_SECTOR_SIZE 2352
#define COOKED_SECTOR_SIZE 2048
@ -159,22 +155,7 @@ private:
BinaryFile();
std::ifstream *file;
};
#if defined(C_SDL_SOUND)
class AudioFile : public TrackFile {
public:
AudioFile(const char *filename, bool &error);
~AudioFile();
bool read(Bit8u *buffer, int seek, int count);
int getLength();
private:
AudioFile();
Sound_Sample *sample;
int lastCount;
int lastSeek;
};
#endif
struct Track {
int number;
int attr;

View File

@ -68,50 +68,6 @@ int CDROM_Interface_Image::BinaryFile::getLength()
return length;
}
#if defined(C_SDL_SOUND)
CDROM_Interface_Image::AudioFile::AudioFile(const char *filename, bool &error)
{
Sound_AudioInfo desired = {AUDIO_S16, 2, 44100};
sample = Sound_NewSampleFromFile(filename, &desired, RAW_SECTOR_SIZE);
lastCount = RAW_SECTOR_SIZE;
lastSeek = 0;
error = (sample == NULL);
}
CDROM_Interface_Image::AudioFile::~AudioFile()
{
Sound_FreeSample(sample);
}
bool CDROM_Interface_Image::AudioFile::read(Bit8u *buffer, int seek, int count)
{
if (lastCount != count) {
int success = Sound_SetBufferSize(sample, count);
if (!success) return false;
}
if (lastSeek != (seek - count)) {
int success = Sound_Seek(sample, (int)((double)(seek) / 176.4f));
if (!success) return false;
}
lastSeek = seek;
int bytes = Sound_Decode(sample);
if (bytes < count) {
memcpy(buffer, sample->buffer, bytes);
memset(buffer + bytes, 0, count - bytes);
} else {
memcpy(buffer, sample->buffer, count);
}
return !(sample->flags & SOUND_SAMPLEFLAG_ERROR);
}
int CDROM_Interface_Image::AudioFile::getLength()
{
int length = Sound_GetDuration(sample);
return (int)floor((length * 176.4) + 0.5);
}
#endif
// initialize static members
int CDROM_Interface_Image::refCount = 0;
CDROM_Interface_Image* CDROM_Interface_Image::images[26];
@ -535,21 +491,6 @@ bool CDROM_Interface_Image::LoadCueSheet(char *cuefile)
if (type == "BINARY") {
track.file = new BinaryFile(filename.c_str(), error);
}
#if defined(C_SDL_SOUND)
//The next if has been surpassed by the else, but leaving it in as not
//to break existing cue sheets that depend on this.(mine with OGG tracks specifying MP3 as type)
else if (type == "WAVE" || type == "AIFF" || type == "MP3") {
track.file = new AudioFile(filename.c_str(), error);
} else {
const Sound_DecoderInfo **i;
for (i = Sound_AvailableDecoders(); *i != NULL; i++) {
if (*(*i)->extensions == type) {
track.file = new AudioFile(filename.c_str(), error);
break;
}
}
}
#endif
if (error) {
delete track.file;
success = false;
@ -749,14 +690,7 @@ void CDROM_Interface_Image::ClearTracks()
}
void CDROM_Image_Destroy(Section*) {
#if defined(C_SDL_SOUND)
Sound_Quit();
#endif
}
void CDROM_Image_Init(Section* section) {
#if defined(C_SDL_SOUND)
Sound_Init();
section->AddDestroyFunction(CDROM_Image_Destroy, false);
#endif
}