Search
lxdream.org :: lxdream :: r989:7baf5ecd8e98
lxdream 0.9.1
released Jun 29
Download Now
changeset989:7baf5ecd8e98
parent988:23c648e10db3
child990:ae329de3c8ab
authornkeynes
dateSat Feb 28 06:26:48 2009 +0000 (15 years ago)
Add SDL audio driver, thanks to Wahrhaft!
Makefile.in
config.h.in
configure
configure.in
src/Makefile.am
src/Makefile.in
src/aica/audio.c
src/drivers/audio_sdl.c
1.1 --- a/Makefile.in Wed Feb 25 09:00:05 2009 +0000
1.2 +++ b/Makefile.in Sat Feb 28 06:26:48 2009 +0000
1.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 +0000
2.2 +++ b/config.h.in Sat Feb 28 06:26:48 2009 +0000
2.3 @@ -112,6 +112,9 @@
2.4 /* Have pulseaudio support */
2.5 #undef HAVE_PULSE
2.6
2.7 +/* Have SDL support */
2.8 +#undef HAVE_SDL
2.9 +
2.10 /* Define to 1 if you have the <stdint.h> header file. */
2.11 #undef HAVE_STDINT_H
2.12
3.1 --- a/configure Wed Feb 25 09:00:05 2009 +0000
3.2 +++ b/configure Sat Feb 28 06:26:48 2009 +0000
3.3 @@ -755,6 +755,10 @@
3.4 BUILD_SH4X86_FALSE
3.5 AUDIO_OSX_TRUE
3.6 AUDIO_OSX_FALSE
3.7 +SDL_CFLAGS
3.8 +SDL_LIBS
3.9 +AUDIO_SDL_TRUE
3.10 +AUDIO_SDL_FALSE
3.11 PULSE_CFLAGS
3.12 PULSE_LIBS
3.13 AUDIO_PULSE_TRUE
3.14 @@ -820,6 +824,7 @@
3.15 with_gtk
3.16 with_esd
3.17 with_pulse
3.18 +with_sdl
3.19 '
3.20 ac_precious_vars='build_alias
3.21 host_alias
3.22 @@ -841,6 +846,8 @@
3.23 GLIB_LIBS
3.24 GTK_CFLAGS
3.25 GTK_LIBS
3.26 +SDL_CFLAGS
3.27 +SDL_LIBS
3.28 PULSE_CFLAGS
3.29 PULSE_LIBS
3.30 ESOUND_CFLAGS
3.31 @@ -1498,6 +1505,7 @@
3.32 --with-gtk Build with the GTK UI. Default on X11 systems
3.33 --with-esd Build with support for the ESounD audio system
3.34 --with-pulse Build with support for the PulseAudio audio system
3.35 + --with-sdl Build with support for SDL audio
3.36
3.37 Some influential environment variables:
3.38 CC C compiler command
3.39 @@ -1520,6 +1528,8 @@
3.40 GLIB_LIBS linker flags for GLIB, overriding pkg-config
3.41 GTK_CFLAGS C compiler flags for GTK, overriding pkg-config
3.42 GTK_LIBS linker flags for GTK, overriding pkg-config
3.43 + SDL_CFLAGS C compiler flags for SDL, overriding pkg-config
3.44 + SDL_LIBS linker flags for SDL, overriding pkg-config
3.45 PULSE_CFLAGS
3.46 C compiler flags for PULSE, overriding pkg-config
3.47 PULSE_LIBS linker flags for PULSE, overriding pkg-config
3.48 @@ -7211,6 +7221,13 @@
3.49 fi
3.50
3.51
3.52 +# Check whether --with-sdl was given.
3.53 +if test "${with_sdl+set}" = set; then
3.54 + withval=$with_sdl;
3.55 +fi
3.56 +
3.57 +
3.58 +
3.59
3.60
3.61
3.62 @@ -9953,6 +9970,110 @@
3.63 fi
3.64
3.65
3.66 +if test "x$with_sdl" != "xno"; then
3.67 +
3.68 +pkg_failed=no
3.69 +{ $as_echo "$as_me:$LINENO: checking for SDL" >&5
3.70 +$as_echo_n "checking for SDL... " >&6; }
3.71 +
3.72 +if test -n "$SDL_CFLAGS"; then
3.73 + pkg_cv_SDL_CFLAGS="$SDL_CFLAGS"
3.74 + elif test -n "$PKG_CONFIG"; then
3.75 + if test -n "$PKG_CONFIG" && \
3.76 + { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"sdl\"") >&5
3.77 + ($PKG_CONFIG --exists --print-errors "sdl") 2>&5
3.78 + ac_status=$?
3.79 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
3.80 + (exit $ac_status); }; then
3.81 + pkg_cv_SDL_CFLAGS=`$PKG_CONFIG --cflags "sdl" 2>/dev/null`
3.82 +else
3.83 + pkg_failed=yes
3.84 +fi
3.85 + else
3.86 + pkg_failed=untried
3.87 +fi
3.88 +if test -n "$SDL_LIBS"; then
3.89 + pkg_cv_SDL_LIBS="$SDL_LIBS"
3.90 + elif test -n "$PKG_CONFIG"; then
3.91 + if test -n "$PKG_CONFIG" && \
3.92 + { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"sdl\"") >&5
3.93 + ($PKG_CONFIG --exists --print-errors "sdl") 2>&5
3.94 + ac_status=$?
3.95 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
3.96 + (exit $ac_status); }; then
3.97 + pkg_cv_SDL_LIBS=`$PKG_CONFIG --libs "sdl" 2>/dev/null`
3.98 +else
3.99 + pkg_failed=yes
3.100 +fi
3.101 + else
3.102 + pkg_failed=untried
3.103 +fi
3.104 +
3.105 +
3.106 +
3.107 +if test $pkg_failed = yes; then
3.108 +
3.109 +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
3.110 + _pkg_short_errors_supported=yes
3.111 +else
3.112 + _pkg_short_errors_supported=no
3.113 +fi
3.114 + if test $_pkg_short_errors_supported = yes; then
3.115 + SDL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "sdl" 2>&1`
3.116 + else
3.117 + SDL_PKG_ERRORS=`$PKG_CONFIG --print-errors "sdl" 2>&1`
3.118 + fi
3.119 + # Put the nasty error message in config.log where it belongs
3.120 + echo "$SDL_PKG_ERRORS" >&5
3.121 +
3.122 + { $as_echo "$as_me:$LINENO: result: no" >&5
3.123 +$as_echo "no" >&6; }
3.124 +
3.125 + if test "x$with_sdl" = "xyes"; then
3.126 + { { $as_echo "$as_me:$LINENO: error: \"SDL libraries could not be found (but were required)
3.127 +See \`config.log' for more details." >&5
3.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 + fi
3.132 +
3.133 +elif test $pkg_failed = untried; then
3.134 +
3.135 + if test "x$with_sdl" = "xyes"; then
3.136 + { { $as_echo "$as_me:$LINENO: error: \"SDL libraries could not be found (but were required)
3.137 +See \`config.log' for more details." >&5
3.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 + fi
3.142 +
3.143 +else
3.144 + SDL_CFLAGS=$pkg_cv_SDL_CFLAGS
3.145 + SDL_LIBS=$pkg_cv_SDL_LIBS
3.146 + { $as_echo "$as_me:$LINENO: result: yes" >&5
3.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 <<\_ACEOF
3.153 +#define HAVE_SDL 1
3.154 +_ACEOF
3.155 +
3.156 +
3.157 +fi
3.158 +fi
3.159 +
3.160 +
3.161 +if test "$HAVE_SDL" = 'yes' ; then
3.162 + AUDIO_SDL_TRUE=
3.163 + AUDIO_SDL_FALSE='#'
3.164 +else
3.165 + AUDIO_SDL_TRUE='#'
3.166 + AUDIO_SDL_FALSE=
3.167 +fi
3.168 +
3.169 +
3.170 if test "x$with_pulse" != "xno"; then
3.171
3.172 pkg_failed=no
3.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 fi
3.177 +if test -z "${AUDIO_SDL_TRUE}" && test -z "${AUDIO_SDL_FALSE}"; then
3.178 + { { $as_echo "$as_me:$LINENO: error: conditional \"AUDIO_SDL\" was never defined.
3.179 +Usually this means the macro was only invoked conditionally." >&5
3.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 +fi
3.184 if test -z "${AUDIO_PULSE_TRUE}" && test -z "${AUDIO_PULSE_FALSE}"; then
3.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 +0000
4.2 +++ b/configure.in Sat Feb 28 06:26:48 2009 +0000
4.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.10
4.11 dnl ------------ Check if we're building on Darwin --------------
4.12
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.16
4.17 +dnl Check for SDL (only used for audio at the moment)
4.18 +if test "x$with_sdl" != "xno"; then
4.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"; then
4.25 + AC_MSG_FAILURE( ["SDL libraries could not be found (but were required)] )
4.26 + fi
4.27 + ])
4.28 +fi
4.29 +AM_CONDITIONAL( AUDIO_SDL, [test "$HAVE_SDL" = 'yes'] )
4.30 +
4.31 dnl Check for pulseaudio
4.32 if test "x$with_pulse" != "xno"; then
4.33 PKG_CHECK_MODULES(PULSE, [libpulse-simple], [
5.1 --- a/src/Makefile.am Wed Feb 25 09:00:05 2009 +0000
5.2 +++ b/src/Makefile.am Sat Feb 28 06:26:48 2009 +0000
5.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.9
5.10 bin_PROGRAMS = lxdream
5.11 noinst_PROGRAMS = gendec genglsl
5.12 @@ -115,6 +115,10 @@
5.13 lxdream_SOURCES += drivers/audio_osx.m
5.14 endif
5.15
5.16 +if AUDIO_SDL
5.17 +lxdream_SOURCES += drivers/audio_sdl.c
5.18 +endif
5.19 +
5.20 if AUDIO_PULSE
5.21 lxdream_SOURCES += drivers/audio_pulse.c
5.22 endif
5.23 @@ -145,7 +149,7 @@
5.24 endif
5.25
5.26
5.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.29
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 +0000
6.2 +++ b/src/Makefile.in Sat Feb 28 06:26:48 2009 +0000
6.3 @@ -64,13 +64,14 @@
6.4 @VIDEO_GLX_TRUE@am__append_7 = drivers/video_glx.c drivers/video_glx.h
6.5 @VIDEO_NSGL_TRUE@am__append_8 = drivers/video_nsgl.m drivers/video_nsgl.h
6.6 @AUDIO_OSX_TRUE@am__append_9 = drivers/audio_osx.m
6.7 -@AUDIO_PULSE_TRUE@am__append_10 = drivers/audio_pulse.c
6.8 -@AUDIO_ESOUND_TRUE@am__append_11 = drivers/audio_esd.c
6.9 -@AUDIO_ALSA_TRUE@am__append_12 = drivers/audio_alsa.c
6.10 -@CDROM_LINUX_TRUE@am__append_13 = drivers/cd_linux.c
6.11 -@CDROM_OSX_TRUE@am__append_14 = drivers/cd_osx.c drivers/osx_iokit.m drivers/osx_iokit.h
6.12 -@CDROM_NONE_TRUE@am__append_15 = drivers/cd_none.c
6.13 -@JOY_LINUX_TRUE@am__append_16 = drivers/joy_linux.c drivers/joy_linux.h
6.14 +@AUDIO_SDL_TRUE@am__append_10 = drivers/audio_sdl.c
6.15 +@AUDIO_PULSE_TRUE@am__append_11 = drivers/audio_pulse.c
6.16 +@AUDIO_ESOUND_TRUE@am__append_12 = drivers/audio_esd.c
6.17 +@AUDIO_ALSA_TRUE@am__append_13 = drivers/audio_alsa.c
6.18 +@CDROM_LINUX_TRUE@am__append_14 = drivers/cd_linux.c
6.19 +@CDROM_OSX_TRUE@am__append_15 = drivers/cd_osx.c drivers/osx_iokit.m drivers/osx_iokit.h
6.20 +@CDROM_NONE_TRUE@am__append_16 = drivers/cd_none.c
6.21 +@JOY_LINUX_TRUE@am__append_17 = drivers/joy_linux.c drivers/joy_linux.h
6.22 subdir = src
6.23 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
6.24 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
6.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.h
6.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.h
6.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.96
6.97 EXTRA_DIST = drivers/genkeymap.pl checkver.pl
6.98 AM_CFLAGS = -D__EXTENSIONS__ -D_BSD_SOURCE -D_GNU_SOURCE
6.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.c
6.111
6.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.h
6.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.128
6.129 +audio_sdl.o: drivers/audio_sdl.c
6.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; fi
6.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.c
6.135 +
6.136 +audio_sdl.obj: drivers/audio_sdl.c
6.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; fi
6.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.c
6.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 +0000
7.2 +++ b/src/aica/audio.c Sat Feb 28 06:26:48 2009 +0000
7.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.8
7.9 audio_driver_t audio_driver_list[] = {
7.10 #ifdef HAVE_CORE_AUDIO
7.11 &audio_osx_driver,
7.12 #endif
7.13 +#ifdef HAVE_SDL
7.14 + &audio_sdl_driver,
7.15 +#endif
7.16 #ifdef HAVE_PULSE
7.17 &audio_pulse_driver,
7.18 #endif
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/src/drivers/audio_sdl.c Sat Feb 28 06:26:48 2009 +0000
8.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 driver
8.8 + *
8.9 + * Copyright (c) 2009 wahrhaft
8.10 + *
8.11 + * This program is free software; you can redistribute it and/or modify
8.12 + * it under the terms of the GNU General Public License as published by
8.13 + * the Free Software Foundation; either version 2 of the License, or
8.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 of
8.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8.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 dropouts
8.29 +#define BYTES_PER_SAMPLE 4 //should be changed if samples are not S16 stereo
8.30 +
8.31 +#define BUFFER_MIN_SIZE SDL_SAMPLES * BYTES_PER_SAMPLE * 4
8.32 +#define BUFFER_MAX_SIZE SDL_SAMPLES * BYTES_PER_SAMPLE * 16
8.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 + else
8.49 + fmt.format = AUDIO_U8;
8.50 + if (format & AUDIO_FMT_STEREO)
8.51 + fmt.channels = 2;
8.52 + else
8.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 + else
8.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 + else
8.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_shutdown
8.139 +};
8.140 +
.