revision 989:7baf5ecd8e98
summary |
tree |
shortlog |
changelog |
graph |
changeset |
raw | bz2 | zip | gz changeset | 989:7baf5ecd8e98 |
parent | 988:23c648e10db3 |
child | 990:ae329de3c8ab |
author | nkeynes |
date | Sat Feb 28 06:26:48 2009 +0000 (15 years ago) |
Add SDL audio driver, thanks to Wahrhaft!
Makefile.in | view | annotate | diff | log | ||
config.h.in | view | annotate | diff | log | ||
configure | view | annotate | diff | log | ||
configure.in | view | annotate | diff | log | ||
src/Makefile.am | view | annotate | diff | log | ||
src/Makefile.in | view | annotate | diff | log | ||
src/aica/audio.c | view | annotate | diff | log | ||
src/drivers/audio_sdl.c | view | annotate | diff | log |
1.1 --- a/Makefile.in Wed Feb 25 09:00:05 2009 +00001.2 +++ b/Makefile.in Sat Feb 28 06:26:48 2009 +00001.3 @@ -104,6 +104,8 @@1.4 AUDIO_OSX_TRUE = @AUDIO_OSX_TRUE@1.5 AUDIO_PULSE_FALSE = @AUDIO_PULSE_FALSE@1.6 AUDIO_PULSE_TRUE = @AUDIO_PULSE_TRUE@1.7 +AUDIO_SDL_FALSE = @AUDIO_SDL_FALSE@1.8 +AUDIO_SDL_TRUE = @AUDIO_SDL_TRUE@1.9 AUTOCONF = @AUTOCONF@1.10 AUTOHEADER = @AUTOHEADER@1.11 AUTOMAKE = @AUTOMAKE@1.12 @@ -193,6 +195,8 @@1.13 PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@1.14 PULSE_CFLAGS = @PULSE_CFLAGS@1.15 PULSE_LIBS = @PULSE_LIBS@1.16 +SDL_CFLAGS = @SDL_CFLAGS@1.17 +SDL_LIBS = @SDL_LIBS@1.18 SED = @SED@1.19 SET_MAKE = @SET_MAKE@1.20 SHCC = @SHCC@
2.1 --- a/config.h.in Wed Feb 25 09:00:05 2009 +00002.2 +++ b/config.h.in Sat Feb 28 06:26:48 2009 +00002.3 @@ -112,6 +112,9 @@2.4 /* Have pulseaudio support */2.5 #undef HAVE_PULSE2.7 +/* Have SDL support */2.8 +#undef HAVE_SDL2.9 +2.10 /* Define to 1 if you have the <stdint.h> header file. */2.11 #undef HAVE_STDINT_H
3.1 --- a/configure Wed Feb 25 09:00:05 2009 +00003.2 +++ b/configure Sat Feb 28 06:26:48 2009 +00003.3 @@ -755,6 +755,10 @@3.4 BUILD_SH4X86_FALSE3.5 AUDIO_OSX_TRUE3.6 AUDIO_OSX_FALSE3.7 +SDL_CFLAGS3.8 +SDL_LIBS3.9 +AUDIO_SDL_TRUE3.10 +AUDIO_SDL_FALSE3.11 PULSE_CFLAGS3.12 PULSE_LIBS3.13 AUDIO_PULSE_TRUE3.14 @@ -820,6 +824,7 @@3.15 with_gtk3.16 with_esd3.17 with_pulse3.18 +with_sdl3.19 '3.20 ac_precious_vars='build_alias3.21 host_alias3.22 @@ -841,6 +846,8 @@3.23 GLIB_LIBS3.24 GTK_CFLAGS3.25 GTK_LIBS3.26 +SDL_CFLAGS3.27 +SDL_LIBS3.28 PULSE_CFLAGS3.29 PULSE_LIBS3.30 ESOUND_CFLAGS3.31 @@ -1498,6 +1505,7 @@3.32 --with-gtk Build with the GTK UI. Default on X11 systems3.33 --with-esd Build with support for the ESounD audio system3.34 --with-pulse Build with support for the PulseAudio audio system3.35 + --with-sdl Build with support for SDL audio3.37 Some influential environment variables:3.38 CC C compiler command3.39 @@ -1520,6 +1528,8 @@3.40 GLIB_LIBS linker flags for GLIB, overriding pkg-config3.41 GTK_CFLAGS C compiler flags for GTK, overriding pkg-config3.42 GTK_LIBS linker flags for GTK, overriding pkg-config3.43 + SDL_CFLAGS C compiler flags for SDL, overriding pkg-config3.44 + SDL_LIBS linker flags for SDL, overriding pkg-config3.45 PULSE_CFLAGS3.46 C compiler flags for PULSE, overriding pkg-config3.47 PULSE_LIBS linker flags for PULSE, overriding pkg-config3.48 @@ -7211,6 +7221,13 @@3.49 fi3.52 +# Check whether --with-sdl was given.3.53 +if test "${with_sdl+set}" = set; then3.54 + withval=$with_sdl;3.55 +fi3.56 +3.57 +3.58 +3.62 @@ -9953,6 +9970,110 @@3.63 fi3.66 +if test "x$with_sdl" != "xno"; then3.67 +3.68 +pkg_failed=no3.69 +{ $as_echo "$as_me:$LINENO: checking for SDL" >&53.70 +$as_echo_n "checking for SDL... " >&6; }3.71 +3.72 +if test -n "$SDL_CFLAGS"; then3.73 + pkg_cv_SDL_CFLAGS="$SDL_CFLAGS"3.74 + elif test -n "$PKG_CONFIG"; then3.75 + if test -n "$PKG_CONFIG" && \3.76 + { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"sdl\"") >&53.77 + ($PKG_CONFIG --exists --print-errors "sdl") 2>&53.78 + ac_status=$?3.79 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&53.80 + (exit $ac_status); }; then3.81 + pkg_cv_SDL_CFLAGS=`$PKG_CONFIG --cflags "sdl" 2>/dev/null`3.82 +else3.83 + pkg_failed=yes3.84 +fi3.85 + else3.86 + pkg_failed=untried3.87 +fi3.88 +if test -n "$SDL_LIBS"; then3.89 + pkg_cv_SDL_LIBS="$SDL_LIBS"3.90 + elif test -n "$PKG_CONFIG"; then3.91 + if test -n "$PKG_CONFIG" && \3.92 + { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"sdl\"") >&53.93 + ($PKG_CONFIG --exists --print-errors "sdl") 2>&53.94 + ac_status=$?3.95 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&53.96 + (exit $ac_status); }; then3.97 + pkg_cv_SDL_LIBS=`$PKG_CONFIG --libs "sdl" 2>/dev/null`3.98 +else3.99 + pkg_failed=yes3.100 +fi3.101 + else3.102 + pkg_failed=untried3.103 +fi3.104 +3.105 +3.106 +3.107 +if test $pkg_failed = yes; then3.108 +3.109 +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then3.110 + _pkg_short_errors_supported=yes3.111 +else3.112 + _pkg_short_errors_supported=no3.113 +fi3.114 + if test $_pkg_short_errors_supported = yes; then3.115 + SDL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "sdl" 2>&1`3.116 + else3.117 + SDL_PKG_ERRORS=`$PKG_CONFIG --print-errors "sdl" 2>&1`3.118 + fi3.119 + # Put the nasty error message in config.log where it belongs3.120 + echo "$SDL_PKG_ERRORS" >&53.121 +3.122 + { $as_echo "$as_me:$LINENO: result: no" >&53.123 +$as_echo "no" >&6; }3.124 +3.125 + if test "x$with_sdl" = "xyes"; then3.126 + { { $as_echo "$as_me:$LINENO: error: \"SDL libraries could not be found (but were required)3.127 +See \`config.log' for more details." >&53.128 +$as_echo "$as_me: error: \"SDL libraries could not be found (but were required)3.129 +See \`config.log' for more details." >&2;}3.130 + { (exit 1); exit 1; }; }3.131 + fi3.132 +3.133 +elif test $pkg_failed = untried; then3.134 +3.135 + if test "x$with_sdl" = "xyes"; then3.136 + { { $as_echo "$as_me:$LINENO: error: \"SDL libraries could not be found (but were required)3.137 +See \`config.log' for more details." >&53.138 +$as_echo "$as_me: error: \"SDL libraries could not be found (but were required)3.139 +See \`config.log' for more details." >&2;}3.140 + { (exit 1); exit 1; }; }3.141 + fi3.142 +3.143 +else3.144 + SDL_CFLAGS=$pkg_cv_SDL_CFLAGS3.145 + SDL_LIBS=$pkg_cv_SDL_LIBS3.146 + { $as_echo "$as_me:$LINENO: result: yes" >&53.147 +$as_echo "yes" >&6; }3.148 +3.149 + HAVE_SDL='yes'3.150 + AUDIO_DRIVERS="$AUDIO_DRIVERS sdl"3.151 +3.152 +cat >>confdefs.h <<\_ACEOF3.153 +#define HAVE_SDL 13.154 +_ACEOF3.155 +3.156 +3.157 +fi3.158 +fi3.159 +3.160 +3.161 +if test "$HAVE_SDL" = 'yes' ; then3.162 + AUDIO_SDL_TRUE=3.163 + AUDIO_SDL_FALSE='#'3.164 +else3.165 + AUDIO_SDL_TRUE='#'3.166 + AUDIO_SDL_FALSE=3.167 +fi3.168 +3.169 +3.170 if test "x$with_pulse" != "xno"; then3.172 pkg_failed=no3.173 @@ -12809,6 +12930,13 @@3.174 Usually this means the macro was only invoked conditionally." >&2;}3.175 { (exit 1); exit 1; }; }3.176 fi3.177 +if test -z "${AUDIO_SDL_TRUE}" && test -z "${AUDIO_SDL_FALSE}"; then3.178 + { { $as_echo "$as_me:$LINENO: error: conditional \"AUDIO_SDL\" was never defined.3.179 +Usually this means the macro was only invoked conditionally." >&53.180 +$as_echo "$as_me: error: conditional \"AUDIO_SDL\" was never defined.3.181 +Usually this means the macro was only invoked conditionally." >&2;}3.182 + { (exit 1); exit 1; }; }3.183 +fi3.184 if test -z "${AUDIO_PULSE_TRUE}" && test -z "${AUDIO_PULSE_FALSE}"; then3.185 { { $as_echo "$as_me:$LINENO: error: conditional \"AUDIO_PULSE\" was never defined.3.186 Usually this means the macro was only invoked conditionally." >&5
4.1 --- a/configure.in Wed Feb 25 09:00:05 2009 +00004.2 +++ b/configure.in Sat Feb 28 06:26:48 2009 +00004.3 @@ -63,6 +63,9 @@4.4 AS_HELP_STRING( [--with-esd], [Build with support for the ESounD audio system]) )4.5 AC_ARG_WITH( pulse,4.6 AS_HELP_STRING( [--with-pulse], [Build with support for the PulseAudio audio system]) )4.7 +AC_ARG_WITH( sdl,4.8 + AS_HELP_STRING( [--with-sdl], [Build with support for SDL audio]) )4.9 +4.11 dnl ------------ Check if we're building on Darwin --------------4.13 @@ -240,6 +243,20 @@4.14 AC_DEFINE([HAVE_CORE_AUDIO], 1, [Have Apple CoreAudio support]) ],[true ])4.15 AM_CONDITIONAL( AUDIO_OSX, [test "$HAVE_CORE_AUDIO" = 'yes'] )4.17 +dnl Check for SDL (only used for audio at the moment)4.18 +if test "x$with_sdl" != "xno"; then4.19 + PKG_CHECK_MODULES(SDL, [sdl], [4.20 + HAVE_SDL='yes'4.21 + AUDIO_DRIVERS="$AUDIO_DRIVERS sdl"4.22 + AC_DEFINE([HAVE_SDL],1,[Have SDL support])4.23 + ], [4.24 + if test "x$with_sdl" = "xyes"; then4.25 + AC_MSG_FAILURE( ["SDL libraries could not be found (but were required)] )4.26 + fi4.27 + ])4.28 +fi4.29 +AM_CONDITIONAL( AUDIO_SDL, [test "$HAVE_SDL" = 'yes'] )4.30 +4.31 dnl Check for pulseaudio4.32 if test "x$with_pulse" != "xno"; then4.33 PKG_CHECK_MODULES(PULSE, [libpulse-simple], [
5.1 --- a/src/Makefile.am Wed Feb 25 09:00:05 2009 +00005.2 +++ b/src/Makefile.am Sat Feb 28 06:26:48 2009 +00005.3 @@ -5,7 +5,7 @@5.4 -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \5.5 -DPACKAGE_CONF_DIR=\""$(sysconfdir)"\" \5.6 -Ish4 \5.7 - @GLIB_CFLAGS@ @GTK_CFLAGS@ @LIBPNG_CFLAGS@ @PULSE_CFLAGS@ @ESOUND_CFLAGS@ @ALSA_CFLAGS@5.8 + @GLIB_CFLAGS@ @GTK_CFLAGS@ @LIBPNG_CFLAGS@ @PULSE_CFLAGS@ @ESOUND_CFLAGS@ @ALSA_CFLAGS@ @SDL_CFLAGS@5.10 bin_PROGRAMS = lxdream5.11 noinst_PROGRAMS = gendec genglsl5.12 @@ -115,6 +115,10 @@5.13 lxdream_SOURCES += drivers/audio_osx.m5.14 endif5.16 +if AUDIO_SDL5.17 +lxdream_SOURCES += drivers/audio_sdl.c5.18 +endif5.19 +5.20 if AUDIO_PULSE5.21 lxdream_SOURCES += drivers/audio_pulse.c5.22 endif5.23 @@ -145,7 +149,7 @@5.24 endif5.27 -lxdream_LDADD = @GLIB_LIBS@ @GTK_LIBS@ @LIBPNG_LIBS@ @PULSE_LIBS@ @ESOUND_LIBS@ @ALSA_LIBS@ $(INTLLIBS)5.28 +lxdream_LDADD = @GLIB_LIBS@ @GTK_LIBS@ @LIBPNG_LIBS@ @PULSE_LIBS@ @ESOUND_LIBS@ @ALSA_LIBS@ @SDL_LIBS@ $(INTLLIBS)5.30 gendec_LDADD = @GLIB_LIBS@ @GTK_LIBS@ $(INTLLIBS)5.31 genglsl_LDADD = @GLIB_LIBS@ @GTK_LIBS@ $(INTLLIBS)
6.1 --- a/src/Makefile.in Wed Feb 25 09:00:05 2009 +00006.2 +++ b/src/Makefile.in Sat Feb 28 06:26:48 2009 +00006.3 @@ -64,13 +64,14 @@6.4 @VIDEO_GLX_TRUE@am__append_7 = drivers/video_glx.c drivers/video_glx.h6.5 @VIDEO_NSGL_TRUE@am__append_8 = drivers/video_nsgl.m drivers/video_nsgl.h6.6 @AUDIO_OSX_TRUE@am__append_9 = drivers/audio_osx.m6.7 -@AUDIO_PULSE_TRUE@am__append_10 = drivers/audio_pulse.c6.8 -@AUDIO_ESOUND_TRUE@am__append_11 = drivers/audio_esd.c6.9 -@AUDIO_ALSA_TRUE@am__append_12 = drivers/audio_alsa.c6.10 -@CDROM_LINUX_TRUE@am__append_13 = drivers/cd_linux.c6.11 -@CDROM_OSX_TRUE@am__append_14 = drivers/cd_osx.c drivers/osx_iokit.m drivers/osx_iokit.h6.12 -@CDROM_NONE_TRUE@am__append_15 = drivers/cd_none.c6.13 -@JOY_LINUX_TRUE@am__append_16 = drivers/joy_linux.c drivers/joy_linux.h6.14 +@AUDIO_SDL_TRUE@am__append_10 = drivers/audio_sdl.c6.15 +@AUDIO_PULSE_TRUE@am__append_11 = drivers/audio_pulse.c6.16 +@AUDIO_ESOUND_TRUE@am__append_12 = drivers/audio_esd.c6.17 +@AUDIO_ALSA_TRUE@am__append_13 = drivers/audio_alsa.c6.18 +@CDROM_LINUX_TRUE@am__append_14 = drivers/cd_linux.c6.19 +@CDROM_OSX_TRUE@am__append_15 = drivers/cd_osx.c drivers/osx_iokit.m drivers/osx_iokit.h6.20 +@CDROM_NONE_TRUE@am__append_16 = drivers/cd_none.c6.21 +@JOY_LINUX_TRUE@am__append_17 = drivers/joy_linux.c drivers/joy_linux.h6.22 subdir = src6.23 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in6.24 ACLOCAL_M4 = $(top_srcdir)/aclocal.m46.25 @@ -135,10 +136,11 @@6.26 drivers/video_osx.m drivers/mac_keymap.h \6.27 drivers/mac_keymap.txt paths_unix.c drivers/video_gdk.c \6.28 drivers/video_glx.c drivers/video_glx.h drivers/video_nsgl.m \6.29 - drivers/video_nsgl.h drivers/audio_osx.m drivers/audio_pulse.c \6.30 - drivers/audio_esd.c drivers/audio_alsa.c drivers/cd_linux.c \6.31 - drivers/cd_osx.c drivers/osx_iokit.m drivers/osx_iokit.h \6.32 - drivers/cd_none.c drivers/joy_linux.c drivers/joy_linux.h6.33 + drivers/video_nsgl.h drivers/audio_osx.m drivers/audio_sdl.c \6.34 + drivers/audio_pulse.c drivers/audio_esd.c drivers/audio_alsa.c \6.35 + drivers/cd_linux.c drivers/cd_osx.c drivers/osx_iokit.m \6.36 + drivers/osx_iokit.h drivers/cd_none.c drivers/joy_linux.c \6.37 + drivers/joy_linux.h6.38 @BUILD_SH4X86_TRUE@am__objects_1 = sh4x86.$(OBJEXT) sh4trans.$(OBJEXT) \6.39 @BUILD_SH4X86_TRUE@ mmux86.$(OBJEXT) x86dasm.$(OBJEXT) \6.40 @BUILD_SH4X86_TRUE@ i386-dis.$(OBJEXT) dis-init.$(OBJEXT) \6.41 @@ -157,13 +159,14 @@6.42 @VIDEO_GLX_TRUE@am__objects_6 = video_glx.$(OBJEXT)6.43 @VIDEO_NSGL_TRUE@am__objects_7 = video_nsgl.$(OBJEXT)6.44 @AUDIO_OSX_TRUE@am__objects_8 = audio_osx.$(OBJEXT)6.45 -@AUDIO_PULSE_TRUE@am__objects_9 = audio_pulse.$(OBJEXT)6.46 -@AUDIO_ESOUND_TRUE@am__objects_10 = audio_esd.$(OBJEXT)6.47 -@AUDIO_ALSA_TRUE@am__objects_11 = audio_alsa.$(OBJEXT)6.48 -@CDROM_LINUX_TRUE@am__objects_12 = cd_linux.$(OBJEXT)6.49 -@CDROM_OSX_TRUE@am__objects_13 = cd_osx.$(OBJEXT) osx_iokit.$(OBJEXT)6.50 -@CDROM_NONE_TRUE@am__objects_14 = cd_none.$(OBJEXT)6.51 -@JOY_LINUX_TRUE@am__objects_15 = joy_linux.$(OBJEXT)6.52 +@AUDIO_SDL_TRUE@am__objects_9 = audio_sdl.$(OBJEXT)6.53 +@AUDIO_PULSE_TRUE@am__objects_10 = audio_pulse.$(OBJEXT)6.54 +@AUDIO_ESOUND_TRUE@am__objects_11 = audio_esd.$(OBJEXT)6.55 +@AUDIO_ALSA_TRUE@am__objects_12 = audio_alsa.$(OBJEXT)6.56 +@CDROM_LINUX_TRUE@am__objects_13 = cd_linux.$(OBJEXT)6.57 +@CDROM_OSX_TRUE@am__objects_14 = cd_osx.$(OBJEXT) osx_iokit.$(OBJEXT)6.58 +@CDROM_NONE_TRUE@am__objects_15 = cd_none.$(OBJEXT)6.59 +@JOY_LINUX_TRUE@am__objects_16 = joy_linux.$(OBJEXT)6.60 am_lxdream_OBJECTS = main.$(OBJEXT) version.$(OBJEXT) config.$(OBJEXT) \6.61 mem.$(OBJEXT) sdram.$(OBJEXT) watch.$(OBJEXT) asic.$(OBJEXT) \6.62 syscall.$(OBJEXT) bios.$(OBJEXT) dcload.$(OBJEXT) \6.63 @@ -189,7 +192,7 @@6.64 $(am__objects_6) $(am__objects_7) $(am__objects_8) \6.65 $(am__objects_9) $(am__objects_10) $(am__objects_11) \6.66 $(am__objects_12) $(am__objects_13) $(am__objects_14) \6.67 - $(am__objects_15)6.68 + $(am__objects_15) $(am__objects_16)6.69 lxdream_OBJECTS = $(am_lxdream_OBJECTS)6.70 lxdream_DEPENDENCIES = $(am__DEPENDENCIES_1)6.71 am__test_testsh4x86_SOURCES_DIST = test/testsh4x86.c x86dasm/x86dasm.c \6.72 @@ -245,6 +248,8 @@6.73 AUDIO_OSX_TRUE = @AUDIO_OSX_TRUE@6.74 AUDIO_PULSE_FALSE = @AUDIO_PULSE_FALSE@6.75 AUDIO_PULSE_TRUE = @AUDIO_PULSE_TRUE@6.76 +AUDIO_SDL_FALSE = @AUDIO_SDL_FALSE@6.77 +AUDIO_SDL_TRUE = @AUDIO_SDL_TRUE@6.78 AUTOCONF = @AUTOCONF@6.79 AUTOHEADER = @AUTOHEADER@6.80 AUTOMAKE = @AUTOMAKE@6.81 @@ -334,6 +339,8 @@6.82 PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@6.83 PULSE_CFLAGS = @PULSE_CFLAGS@6.84 PULSE_LIBS = @PULSE_LIBS@6.85 +SDL_CFLAGS = @SDL_CFLAGS@6.86 +SDL_LIBS = @SDL_LIBS@6.87 SED = @SED@6.88 SET_MAKE = @SET_MAKE@6.89 SHCC = @SHCC@6.90 @@ -402,7 +409,7 @@6.91 -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \6.92 -DPACKAGE_CONF_DIR=\""$(sysconfdir)"\" \6.93 -Ish4 \6.94 - @GLIB_CFLAGS@ @GTK_CFLAGS@ @LIBPNG_CFLAGS@ @PULSE_CFLAGS@ @ESOUND_CFLAGS@ @ALSA_CFLAGS@6.95 + @GLIB_CFLAGS@ @GTK_CFLAGS@ @LIBPNG_CFLAGS@ @PULSE_CFLAGS@ @ESOUND_CFLAGS@ @ALSA_CFLAGS@ @SDL_CFLAGS@6.97 EXTRA_DIST = drivers/genkeymap.pl checkver.pl6.98 AM_CFLAGS = -D__EXTENSIONS__ -D_BSD_SOURCE -D_GNU_SOURCE6.99 @@ -449,7 +456,7 @@6.100 $(am__append_6) $(am__append_7) $(am__append_8) \6.101 $(am__append_9) $(am__append_10) $(am__append_11) \6.102 $(am__append_12) $(am__append_13) $(am__append_14) \6.103 - $(am__append_15) $(am__append_16)6.104 + $(am__append_15) $(am__append_16) $(am__append_17)6.105 @BUILD_SH4X86_TRUE@test_testsh4x86_LDADD = @GLIB_LIBS@ @GTK_LIBS@ @LIBPNG_LIBS@6.106 @BUILD_SH4X86_TRUE@test_testsh4x86_SOURCES = test/testsh4x86.c x86dasm/x86dasm.c \6.107 @BUILD_SH4X86_TRUE@ x86dasm/x86dasm.h x86dasm/i386-dis.c x86dasm/dis-init.c \6.108 @@ -457,7 +464,7 @@6.109 @BUILD_SH4X86_TRUE@ sh4/sh4trans.c sh4/sh4x86.c sh4/xltcache.c \6.110 @BUILD_SH4X86_TRUE@ sh4/xltcache.h mem.c util.c6.112 -lxdream_LDADD = @GLIB_LIBS@ @GTK_LIBS@ @LIBPNG_LIBS@ @PULSE_LIBS@ @ESOUND_LIBS@ @ALSA_LIBS@ $(INTLLIBS)6.113 +lxdream_LDADD = @GLIB_LIBS@ @GTK_LIBS@ @LIBPNG_LIBS@ @PULSE_LIBS@ @ESOUND_LIBS@ @ALSA_LIBS@ @SDL_LIBS@ $(INTLLIBS)6.114 gendec_LDADD = @GLIB_LIBS@ @GTK_LIBS@ $(INTLLIBS)6.115 genglsl_LDADD = @GLIB_LIBS@ @GTK_LIBS@ $(INTLLIBS)6.116 test_testxlt_SOURCES = test/testxlt.c sh4/xltcache.c sh4/xltcache.h6.117 @@ -561,6 +568,7 @@6.118 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audio_null.Po@am__quote@6.119 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audio_osx.Po@am__quote@6.120 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audio_pulse.Po@am__quote@6.121 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audio_sdl.Po@am__quote@6.122 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bios.Po@am__quote@6.123 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bootstrap.Po@am__quote@6.124 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cache.Po@am__quote@6.125 @@ -1667,6 +1675,20 @@6.126 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.127 @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o video_glx.obj `if test -f 'drivers/video_glx.c'; then $(CYGPATH_W) 'drivers/video_glx.c'; else $(CYGPATH_W) '$(srcdir)/drivers/video_glx.c'; fi`6.129 +audio_sdl.o: drivers/audio_sdl.c6.130 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT audio_sdl.o -MD -MP -MF "$(DEPDIR)/audio_sdl.Tpo" -c -o audio_sdl.o `test -f 'drivers/audio_sdl.c' || echo '$(srcdir)/'`drivers/audio_sdl.c; \6.131 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/audio_sdl.Tpo" "$(DEPDIR)/audio_sdl.Po"; else rm -f "$(DEPDIR)/audio_sdl.Tpo"; exit 1; fi6.132 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/audio_sdl.c' object='audio_sdl.o' libtool=no @AMDEPBACKSLASH@6.133 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.134 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o audio_sdl.o `test -f 'drivers/audio_sdl.c' || echo '$(srcdir)/'`drivers/audio_sdl.c6.135 +6.136 +audio_sdl.obj: drivers/audio_sdl.c6.137 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT audio_sdl.obj -MD -MP -MF "$(DEPDIR)/audio_sdl.Tpo" -c -o audio_sdl.obj `if test -f 'drivers/audio_sdl.c'; then $(CYGPATH_W) 'drivers/audio_sdl.c'; else $(CYGPATH_W) '$(srcdir)/drivers/audio_sdl.c'; fi`; \6.138 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/audio_sdl.Tpo" "$(DEPDIR)/audio_sdl.Po"; else rm -f "$(DEPDIR)/audio_sdl.Tpo"; exit 1; fi6.139 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/audio_sdl.c' object='audio_sdl.obj' libtool=no @AMDEPBACKSLASH@6.140 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.141 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o audio_sdl.obj `if test -f 'drivers/audio_sdl.c'; then $(CYGPATH_W) 'drivers/audio_sdl.c'; else $(CYGPATH_W) '$(srcdir)/drivers/audio_sdl.c'; fi`6.142 +6.143 audio_pulse.o: drivers/audio_pulse.c6.144 @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT audio_pulse.o -MD -MP -MF "$(DEPDIR)/audio_pulse.Tpo" -c -o audio_pulse.o `test -f 'drivers/audio_pulse.c' || echo '$(srcdir)/'`drivers/audio_pulse.c; \6.145 @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/audio_pulse.Tpo" "$(DEPDIR)/audio_pulse.Po"; else rm -f "$(DEPDIR)/audio_pulse.Tpo"; exit 1; fi
7.1 --- a/src/aica/audio.c Wed Feb 25 09:00:05 2009 +00007.2 +++ b/src/aica/audio.c Sat Feb 28 06:26:48 2009 +00007.3 @@ -30,11 +30,15 @@7.4 extern struct audio_driver audio_pulse_driver;7.5 extern struct audio_driver audio_esd_driver;7.6 extern struct audio_driver audio_alsa_driver;7.7 +extern struct audio_driver audio_sdl_driver;7.9 audio_driver_t audio_driver_list[] = {7.10 #ifdef HAVE_CORE_AUDIO7.11 &audio_osx_driver,7.12 #endif7.13 +#ifdef HAVE_SDL7.14 + &audio_sdl_driver,7.15 +#endif7.16 #ifdef HAVE_PULSE7.17 &audio_pulse_driver,7.18 #endif
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +00008.2 +++ b/src/drivers/audio_sdl.c Sat Feb 28 06:26:48 2009 +00008.3 @@ -0,0 +1,137 @@8.4 +/**8.5 + * $Id: audio_pulse.c 754 2008-07-14 07:44:42Z nkeynes $8.6 + *8.7 + * The SDL sound driver8.8 + *8.9 + * Copyright (c) 2009 wahrhaft8.10 + *8.11 + * This program is free software; you can redistribute it and/or modify8.12 + * it under the terms of the GNU General Public License as published by8.13 + * the Free Software Foundation; either version 2 of the License, or8.14 + * (at your option) any later version.8.15 + *8.16 + * This program is distributed in the hope that it will be useful,8.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of8.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8.19 + * GNU General Public License for more details.8.20 + */8.21 +#include <stdio.h>8.22 +#include <unistd.h>8.23 +#include <SDL/SDL.h>8.24 +#include <SDL/SDL_audio.h>8.25 +#include "aica/audio.h"8.26 +#include "lxdream.h"8.27 +8.28 +#define SDL_SAMPLES 512 //tweaking this value may help with audio dropouts8.29 +#define BYTES_PER_SAMPLE 4 //should be changed if samples are not S16 stereo8.30 +8.31 +#define BUFFER_MIN_SIZE SDL_SAMPLES * BYTES_PER_SAMPLE * 48.32 +#define BUFFER_MAX_SIZE SDL_SAMPLES * BYTES_PER_SAMPLE * 168.33 +8.34 +char *audio_buffer;8.35 +int buffer_pos;8.36 +8.37 +void mix_audio(void *userdata, Uint8 *stream, int len);8.38 +8.39 +gboolean audio_sdl_init( )8.40 +{8.41 + int rate = DEFAULT_SAMPLE_RATE;8.42 + int format = DEFAULT_SAMPLE_FORMAT;8.43 +8.44 + SDL_AudioSpec fmt;8.45 + fmt.freq = rate;8.46 + if (format & AUDIO_FMT_16BIT)8.47 + fmt.format = AUDIO_S16;8.48 + else8.49 + fmt.format = AUDIO_U8;8.50 + if (format & AUDIO_FMT_STEREO)8.51 + fmt.channels = 2;8.52 + else8.53 + fmt.channels = 1;8.54 +8.55 + fmt.samples = SDL_SAMPLES;8.56 + fmt.callback = mix_audio;8.57 + fmt.userdata = NULL;8.58 +8.59 + if (SDL_OpenAudio(&fmt, NULL) < 0)8.60 + {8.61 + ERROR("Unable to open audio output (SDL)");8.62 + return FALSE;8.63 + }8.64 + buffer_pos = 0;8.65 + audio_buffer = (char*)malloc(BUFFER_MAX_SIZE * sizeof(char));8.66 + if (audio_buffer == NULL)8.67 + {8.68 + ERROR("Could not allocate audio buffer (SDL)");8.69 + return FALSE;8.70 + }8.71 +8.72 + //hmm, this doesn't seem to get called externally...8.73 + audio_sdl_start();8.74 +8.75 + return TRUE;8.76 +}8.77 +8.78 +gboolean audio_sdl_process_buffer( audio_buffer_t buffer )8.79 +{8.80 + SDL_LockAudio();8.81 + if (buffer_pos + buffer->length >= BUFFER_MAX_SIZE)8.82 + {8.83 + printf("Audio buffer full, dropping a chunk\n");8.84 + }8.85 + else8.86 + {8.87 + memcpy(audio_buffer, buffer->data, buffer->length);8.88 + buffer_pos += buffer->length;8.89 + }8.90 + SDL_UnlockAudio();8.91 +8.92 + return TRUE;8.93 +}8.94 +8.95 +void mix_audio(void *userdata, Uint8 *stream, int len)8.96 +{8.97 + if (len < buffer_pos)8.98 + {8.99 + memcpy(stream, audio_buffer, len);8.100 + }8.101 + if (buffer_pos > BUFFER_MIN_SIZE)8.102 + {8.103 + memcpy(audio_buffer, &audio_buffer[len], buffer_pos - len);8.104 + buffer_pos -= len;8.105 + }8.106 + else8.107 + {8.108 + //printf("Audio buffer low, repeating a chunk\n");8.109 + }8.110 +}8.111 +8.112 +gboolean audio_sdl_shutdown()8.113 +{8.114 + SDL_CloseAudio();8.115 + free(audio_buffer);8.116 + return TRUE;8.117 +}8.118 +8.119 +void audio_sdl_start()8.120 +{8.121 + SDL_PauseAudio(0);8.122 +}8.123 +8.124 +void audio_sdl_stop()8.125 +{8.126 + SDL_PauseAudio(1);8.127 +}8.128 +8.129 +struct audio_driver audio_sdl_driver = {8.130 + "sdl",8.131 + N_("SDL sound driver"),8.132 + DEFAULT_SAMPLE_RATE,8.133 + DEFAULT_SAMPLE_FORMAT,8.134 + audio_sdl_init,8.135 + audio_sdl_start,8.136 + audio_sdl_process_buffer,8.137 + audio_sdl_stop,8.138 + audio_sdl_shutdown8.139 +};8.140 +
.