diff options
| author | SND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2010-02-17 10:12:15 +0000 |
|---|---|---|
| committer | SND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2010-02-17 10:12:15 +0000 |
| commit | c4cef2e7680c53efb13d9a214b8cc8c299e9d9e8 (patch) | |
| tree | e429a571a8bd1a0265d8dc506388a038fe5717d4 | |
| parent | 09deb6a2c3adf334af3e1888c5c2c4b5326cb87d (diff) | |
| download | pcsxr-c4cef2e7680c53efb13d9a214b8cc8c299e9d9e8.tar.gz | |
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@41645 e17a0e51-4ae3-4d35-97c3-1a29b211df97
| -rw-r--r-- | ChangeLog | 8 | ||||
| -rwxr-xr-x | configure | 183 | ||||
| -rw-r--r-- | configure.ac | 6 | ||||
| -rw-r--r-- | plugins/dfsound/Makefile.am | 7 | ||||
| -rw-r--r-- | plugins/dfsound/Makefile.in | 24 | ||||
| -rw-r--r-- | plugins/dfsound/nullsnd.c | 2 | ||||
| -rw-r--r-- | plugins/dfsound/pulseaudio.c | 270 | ||||
| -rw-r--r-- | plugins/dfsound/pulseaudiosimple.c | 111 |
8 files changed, 211 insertions, 400 deletions
@@ -1,3 +1,11 @@ +February 17, 2010 Tristin Celestin <cetris1@umbc.edu> + + * configure.ac: Removed PulseAudio Simple API support. + * plugins/dfsound/Makefile.am: Likewise. + * plugins/dfsound/nullsnd.c: Likewise. + * plugins/dfsound/pulseaudiosimple.c: Removed. + * plugins/dfsound/pulseaudio.c: Fixed high-compatibility (SPUasync) mode. + February 15, 2010 Wei Mingzhi <whistler_wmz@users.sf.net> * libpcsxcore/psxhw.c: Don't skip calls to psxDman() when TR flag of CHCR is @@ -802,8 +802,6 @@ PULSEAUDIO_LIBS PULSEAUDIO_CFLAGS ALSA_LIBS ALSA_CFLAGS -HAVE_PULSEAUDIOSIMPLE_FALSE -HAVE_PULSEAUDIOSIMPLE_TRUE HAVE_PULSEAUDIO_FALSE HAVE_PULSEAUDIO_TRUE HAVE_OSS_FALSE @@ -972,7 +970,6 @@ with_sdl_exec_prefix enable_sdltest enable_alsa enable_pulseaudio -enable_pasimple enable_opengl enable_dynarec ' @@ -1643,7 +1640,6 @@ Optional Features: --disable-sdltest Do not try to compile and run a test SDL program --enable-alsa use ALSA sound output (default=no) --enable-pulseaudio use PulseAudio sound output (default=no) - --enable-pasimple use PulseAudio simple sound output (default=no) --enable-opengl build OpenGL plugin (default=no) --enable-dynarec=... force selection of dynamic recompiler platform (x86, x86_64, ppc) (default: autodetect) @@ -4624,13 +4620,13 @@ if test "${lt_cv_nm_interface+set}" = set; then else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:4627: $ac_compile\"" >&5) + (eval echo "\"\$as_me:4623: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:4630: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:4626: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:4633: output\"" >&5) + (eval echo "\"\$as_me:4629: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -5836,7 +5832,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 5839 "configure"' > conftest.$ac_ext + echo '#line 5835 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -7659,11 +7655,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7662: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7658: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7666: \$? = $ac_status" >&5 + echo "$as_me:7662: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7998,11 +7994,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8001: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7997: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:8005: \$? = $ac_status" >&5 + echo "$as_me:8001: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -8103,11 +8099,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8106: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8102: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:8110: \$? = $ac_status" >&5 + echo "$as_me:8106: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -8158,11 +8154,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8161: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8157: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:8165: \$? = $ac_status" >&5 + echo "$as_me:8161: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -10971,7 +10967,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10974 "configure" +#line 10970 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11067,7 +11063,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11070 "configure" +#line 11066 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -14591,14 +14587,6 @@ else HAVE_PULSEAUDIO_FALSE= fi - if false; then - HAVE_PULSEAUDIOSIMPLE_TRUE= - HAVE_PULSEAUDIOSIMPLE_FALSE='#' -else - HAVE_PULSEAUDIOSIMPLE_TRUE='#' - HAVE_PULSEAUDIOSIMPLE_FALSE= -fi - # Check whether --enable-alsa was given. @@ -14615,13 +14603,6 @@ else BUILD_PULSEAUDIO="no" fi -# Check whether --enable-pasimple was given. -if test "${enable_pasimple+set}" = set; then - enableval=$enable_pasimple; BUILD_PULSEAUDIOSIMPLE="$enableval" -else - BUILD_PULSEAUDIOSIMPLE="no" -fi - if test "$BUILD_ALSA" = "yes"; then @@ -14695,120 +14676,6 @@ else $as_echo "yes" >&6; } have_alsa=yes fi -elif test "$BUILD_PULSEAUDIOSIMPLE" = "yes"; then - -pkg_failed=no -{ $as_echo "$as_me:$LINENO: checking for PULSEAUDIO" >&5 -$as_echo_n "checking for PULSEAUDIO... " >&6; } - -if test -n "$PKG_CONFIG"; then - if test -n "$PULSEAUDIO_CFLAGS"; then - pkg_cv_PULSEAUDIO_CFLAGS="$PULSEAUDIO_CFLAGS" - else - if test -n "$PKG_CONFIG" && \ - { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libpulse-simple >= 0.9.16\"") >&5 - ($PKG_CONFIG --exists --print-errors "libpulse-simple >= 0.9.16") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - pkg_cv_PULSEAUDIO_CFLAGS=`$PKG_CONFIG --cflags "libpulse-simple >= 0.9.16" 2>/dev/null` -else - pkg_failed=yes -fi - fi -else - pkg_failed=untried -fi -if test -n "$PKG_CONFIG"; then - if test -n "$PULSEAUDIO_LIBS"; then - pkg_cv_PULSEAUDIO_LIBS="$PULSEAUDIO_LIBS" - else - if test -n "$PKG_CONFIG" && \ - { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libpulse-simple >= 0.9.16\"") >&5 - ($PKG_CONFIG --exists --print-errors "libpulse-simple >= 0.9.16") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - pkg_cv_PULSEAUDIO_LIBS=`$PKG_CONFIG --libs "libpulse-simple >= 0.9.16" 2>/dev/null` -else - pkg_failed=yes -fi - fi -else - pkg_failed=untried -fi - - - -if test $pkg_failed = yes; then - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - PULSEAUDIO_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "libpulse-simple >= 0.9.16"` - else - PULSEAUDIO_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libpulse-simple >= 0.9.16"` - fi - # Put the nasty error message in config.log where it belongs - echo "$PULSEAUDIO_PKG_ERRORS" >&5 - - { { $as_echo "$as_me:$LINENO: error: Package requirements (libpulse-simple >= 0.9.16) were not met: - -$PULSEAUDIO_PKG_ERRORS - -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. - -Alternatively, you may set the environment variables PULSEAUDIO_CFLAGS -and PULSEAUDIO_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details. -" >&5 -$as_echo "$as_me: error: Package requirements (libpulse-simple >= 0.9.16) were not met: - -$PULSEAUDIO_PKG_ERRORS - -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. - -Alternatively, you may set the environment variables PULSEAUDIO_CFLAGS -and PULSEAUDIO_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details. -" >&2;} - { (exit 1); exit 1; }; } -elif test $pkg_failed = untried; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. - -Alternatively, you may set the environment variables PULSEAUDIO_CFLAGS -and PULSEAUDIO_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details. - -To get pkg-config, see <http://pkg-config.freedesktop.org/>. -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. - -Alternatively, you may set the environment variables PULSEAUDIO_CFLAGS -and PULSEAUDIO_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details. - -To get pkg-config, see <http://pkg-config.freedesktop.org/>. -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } -else - PULSEAUDIO_CFLAGS=$pkg_cv_PULSEAUDIO_CFLAGS - PULSEAUDIO_LIBS=$pkg_cv_PULSEAUDIO_LIBS - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } - have_pulseaudiosimple=yes -fi elif test "$BUILD_PULSEAUDIO" = "yes"; then pkg_failed=no @@ -15082,14 +14949,6 @@ else fi - if test "x$have_pulseaudiosimple" = xyes; then - HAVE_PULSEAUDIOSIMPLE_TRUE= - HAVE_PULSEAUDIOSIMPLE_FALSE='#' -else - HAVE_PULSEAUDIOSIMPLE_TRUE='#' - HAVE_PULSEAUDIOSIMPLE_FALSE= -fi - if test "x$have_pulseaudio" = xyes; then HAVE_PULSEAUDIO_TRUE= HAVE_PULSEAUDIO_FALSE='#' @@ -16776,13 +16635,6 @@ $as_echo "$as_me: error: conditional \"HAVE_PULSEAUDIO\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi -if test -z "${HAVE_PULSEAUDIOSIMPLE_TRUE}" && test -z "${HAVE_PULSEAUDIOSIMPLE_FALSE}"; then - { { $as_echo "$as_me:$LINENO: error: conditional \"HAVE_PULSEAUDIOSIMPLE\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -$as_echo "$as_me: error: conditional \"HAVE_PULSEAUDIOSIMPLE\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi if test -z "${HAVE_OSS_TRUE}" && test -z "${HAVE_OSS_FALSE}"; then { { $as_echo "$as_me:$LINENO: error: conditional \"HAVE_OSS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 @@ -16797,13 +16649,6 @@ $as_echo "$as_me: error: conditional \"HAVE_ALSA\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi -if test -z "${HAVE_PULSEAUDIOSIMPLE_TRUE}" && test -z "${HAVE_PULSEAUDIOSIMPLE_FALSE}"; then - { { $as_echo "$as_me:$LINENO: error: conditional \"HAVE_PULSEAUDIOSIMPLE\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -$as_echo "$as_me: error: conditional \"HAVE_PULSEAUDIOSIMPLE\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi if test -z "${HAVE_PULSEAUDIO_TRUE}" && test -z "${HAVE_PULSEAUDIO_FALSE}"; then { { $as_echo "$as_me:$LINENO: error: conditional \"HAVE_PULSEAUDIO\" was never defined. Usually this means the macro was only invoked conditionally." >&5 diff --git a/configure.ac b/configure.ac index 0c509154..23638b28 100644 --- a/configure.ac +++ b/configure.ac @@ -49,7 +49,6 @@ fi AM_CONDITIONAL(HAVE_OSS, false) AM_CONDITIONAL(HAVE_PULSEAUDIO, false) -AM_CONDITIONAL(HAVE_PULSEAUDIOSIMPLE, false) dnl Check for ALSA 1.x, OSS, or PulseAudio @@ -57,13 +56,9 @@ AC_ARG_ENABLE(alsa, [ --enable-alsa use ALSA sound output (default=no [ BUILD_ALSA="$enableval" ],[ BUILD_ALSA="no" ]) AC_ARG_ENABLE(pulseaudio, [ --enable-pulseaudio use PulseAudio sound output (default=no)], [ BUILD_PULSEAUDIO="$enableval" ],[ BUILD_PULSEAUDIO="no" ]) -AC_ARG_ENABLE(pasimple, [ --enable-pasimple use PulseAudio simple sound output (default=no)], -[ BUILD_PULSEAUDIOSIMPLE="$enableval" ],[ BUILD_PULSEAUDIOSIMPLE="no" ]) if test "$BUILD_ALSA" = "yes"; then PKG_CHECK_MODULES(ALSA, alsa >= 1.0.0, have_alsa=yes, have_alsa=no) -elif test "$BUILD_PULSEAUDIOSIMPLE" = "yes"; then - PKG_CHECK_MODULES(PULSEAUDIO, libpulse-simple >= 0.9.16, have_pulseaudiosimple=yes) elif test "$BUILD_PULSEAUDIO" = "yes"; then PKG_CHECK_MODULES(PULSEAUDIO, libpulse >= 0.9.16, have_pulseaudio=yes) else @@ -77,7 +72,6 @@ fi AM_CONDITIONAL(HAVE_ALSA,test "x$have_alsa" = xyes) AC_SUBST(ALSA_LIBS) -AM_CONDITIONAL(HAVE_PULSEAUDIOSIMPLE,test "x$have_pulseaudiosimple" = xyes) AM_CONDITIONAL(HAVE_PULSEAUDIO,test "x$have_pulseaudio" = xyes) AC_SUBST(PULSEAUDIO_CFLAGS) AC_SUBST(PULSEAUDIO_LIBS) diff --git a/plugins/dfsound/Makefile.am b/plugins/dfsound/Makefile.am index 91788212..690d38bd 100644 --- a/plugins/dfsound/Makefile.am +++ b/plugins/dfsound/Makefile.am @@ -10,7 +10,7 @@ libdir = @libdir@/games/psemu/ lib_LTLIBRARIES = libDFSound.la libDFSound_la_SOURCES = spu.c cfg.c dma.c freeze.c psemu.c registers.c \ - alsa.c oss.c pulseaudio.c pulseaudiosimple.c nullsnd.c + alsa.c oss.c pulseaudio.c nullsnd.c libDFSound_la_CFLAGS = libDFSound_la_LDFLAGS = -module -avoid-version -lpthread -lm @@ -24,11 +24,6 @@ if HAVE_OSS libDFSound_la_CFLAGS += -DUSEOSS=1 endif -if HAVE_PULSEAUDIOSIMPLE -libDFSound_la_CFLAGS += $(PULSEAUDIO_CFLAGS) -DUSEPULSEAUDIOSIMPLE=1 -libDFSound_la_LDFLAGS += $(PULSEAUDIO_LIBS) -endif - if HAVE_PULSEAUDIO libDFSound_la_CFLAGS += $(PULSEAUDIO_CFLAGS) -DUSEPULSEAUDIO=1 libDFSound_la_LDFLAGS += $(PULSEAUDIO_LIBS) diff --git a/plugins/dfsound/Makefile.in b/plugins/dfsound/Makefile.in index b304dfe0..a744c341 100644 --- a/plugins/dfsound/Makefile.in +++ b/plugins/dfsound/Makefile.in @@ -38,10 +38,8 @@ target_triplet = @target@ @HAVE_ALSA_TRUE@am__append_1 = -DUSEALSA=1 @HAVE_ALSA_TRUE@am__append_2 = $(ALSA_LIBS) @HAVE_OSS_TRUE@am__append_3 = -DUSEOSS=1 -@HAVE_PULSEAUDIOSIMPLE_TRUE@am__append_4 = $(PULSEAUDIO_CFLAGS) -DUSEPULSEAUDIOSIMPLE=1 -@HAVE_PULSEAUDIOSIMPLE_TRUE@am__append_5 = $(PULSEAUDIO_LIBS) -@HAVE_PULSEAUDIO_TRUE@am__append_6 = $(PULSEAUDIO_CFLAGS) -DUSEPULSEAUDIO=1 -@HAVE_PULSEAUDIO_TRUE@am__append_7 = $(PULSEAUDIO_LIBS) +@HAVE_PULSEAUDIO_TRUE@am__append_4 = $(PULSEAUDIO_CFLAGS) -DUSEPULSEAUDIO=1 +@HAVE_PULSEAUDIO_TRUE@am__append_5 = $(PULSEAUDIO_LIBS) bin_PROGRAMS = cfgDFSound$(EXEEXT) subdir = plugins/dfsound DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in @@ -67,8 +65,7 @@ am_libDFSound_la_OBJECTS = libDFSound_la-spu.lo libDFSound_la-cfg.lo \ libDFSound_la-dma.lo libDFSound_la-freeze.lo \ libDFSound_la-psemu.lo libDFSound_la-registers.lo \ libDFSound_la-alsa.lo libDFSound_la-oss.lo \ - libDFSound_la-pulseaudio.lo libDFSound_la-pulseaudiosimple.lo \ - libDFSound_la-nullsnd.lo + libDFSound_la-pulseaudio.lo libDFSound_la-nullsnd.lo libDFSound_la_OBJECTS = $(am_libDFSound_la_OBJECTS) libDFSound_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libDFSound_la_CFLAGS) \ @@ -258,12 +255,11 @@ INCLUDES = -DPIXMAPDIR=\"${datadir}/pixmaps/\" \ lib_LTLIBRARIES = libDFSound.la libDFSound_la_SOURCES = spu.c cfg.c dma.c freeze.c psemu.c registers.c \ - alsa.c oss.c pulseaudio.c pulseaudiosimple.c nullsnd.c + alsa.c oss.c pulseaudio.c nullsnd.c -libDFSound_la_CFLAGS = $(am__append_1) $(am__append_3) $(am__append_4) \ - $(am__append_6) +libDFSound_la_CFLAGS = $(am__append_1) $(am__append_3) $(am__append_4) libDFSound_la_LDFLAGS = -module -avoid-version -lpthread -lm \ - $(am__append_2) $(am__append_5) $(am__append_7) + $(am__append_2) $(am__append_5) cfgDFSound_SOURCES = spucfg-0.1df/main.c cfgDFSound_LDADD = $(GTK2_LIBS) $(GLADE2_LIBS) glade_DATA = spucfg-0.1df/dfsound.glade2 @@ -377,7 +373,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libDFSound_la-oss.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libDFSound_la-psemu.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libDFSound_la-pulseaudio.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libDFSound_la-pulseaudiosimple.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libDFSound_la-registers.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libDFSound_la-spu.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ @@ -466,13 +461,6 @@ libDFSound_la-pulseaudio.lo: pulseaudio.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libDFSound_la_CFLAGS) $(CFLAGS) -c -o libDFSound_la-pulseaudio.lo `test -f 'pulseaudio.c' || echo '$(srcdir)/'`pulseaudio.c -libDFSound_la-pulseaudiosimple.lo: pulseaudiosimple.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libDFSound_la_CFLAGS) $(CFLAGS) -MT libDFSound_la-pulseaudiosimple.lo -MD -MP -MF $(DEPDIR)/libDFSound_la-pulseaudiosimple.Tpo -c -o libDFSound_la-pulseaudiosimple.lo `test -f 'pulseaudiosimple.c' || echo '$(srcdir)/'`pulseaudiosimple.c -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libDFSound_la-pulseaudiosimple.Tpo $(DEPDIR)/libDFSound_la-pulseaudiosimple.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pulseaudiosimple.c' object='libDFSound_la-pulseaudiosimple.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libDFSound_la_CFLAGS) $(CFLAGS) -c -o libDFSound_la-pulseaudiosimple.lo `test -f 'pulseaudiosimple.c' || echo '$(srcdir)/'`pulseaudiosimple.c - libDFSound_la-nullsnd.lo: nullsnd.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libDFSound_la_CFLAGS) $(CFLAGS) -MT libDFSound_la-nullsnd.lo -MD -MP -MF $(DEPDIR)/libDFSound_la-nullsnd.Tpo -c -o libDFSound_la-nullsnd.lo `test -f 'nullsnd.c' || echo '$(srcdir)/'`nullsnd.c @am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libDFSound_la-nullsnd.Tpo $(DEPDIR)/libDFSound_la-nullsnd.Plo diff --git a/plugins/dfsound/nullsnd.c b/plugins/dfsound/nullsnd.c index d417136b..3d4662e3 100644 --- a/plugins/dfsound/nullsnd.c +++ b/plugins/dfsound/nullsnd.c @@ -2,7 +2,7 @@ #define _IN_OSS #include "externals.h" -#if !defined (USEALSA) && !defined (USEOSS) && !defined (USEPULSEAUDIO) && !defined(USEPULSEAUDIOSIMPLE) +#if !defined (USEALSA) && !defined (USEOSS) && !defined (USEPULSEAUDIO) #warning "Using NULL sound output..." diff --git a/plugins/dfsound/pulseaudio.c b/plugins/dfsound/pulseaudio.c index c73a7f17..db0fed71 100644 --- a/plugins/dfsound/pulseaudio.c +++ b/plugins/dfsound/pulseaudio.c @@ -4,11 +4,8 @@ begin : Thu Feb 04 2010 copyright : (C) 2010 by Tristin Celestin email : cetris1@umbc.edu -comment : Much of this was taken from pulseaudio.cpp (authored - by slouken) in SDL - (http://lists.libsdl.org/pipermail/svn-libsdl.org/2009-September/001809.html() - and in pulseaudio.cpp (authored by RedDwarf) in bsnes - (http://www.byuu.org/bsnes) +comment : Much of this was taken from simple.c, in the pulseaudio + library ***************************************************************************/ /*************************************************************************** * * @@ -30,21 +27,15 @@ comment : Much of this was taken from pulseaudio.cpp (authored #include <pulse/pulseaudio.h> //////////////////////////////////////////////////////////////////////// -// declarations for pulseaudio callbacks -//////////////////////////////////////////////////////////////////////// -void connection_state_callback (pa_context *context, const char *name, pa_proplist *property_list, void *user_data); - -//////////////////////////////////////////////////////////////////////// // pulseaudio structs //////////////////////////////////////////////////////////////////////// typedef struct { - pa_mainloop *mainloop; + pa_threaded_mainloop *mainloop; pa_context *context; pa_mainloop_api *api; pa_stream *stream; pa_sample_spec spec; - pa_buffer_attr buffer_attr; int first; } Device; @@ -66,9 +57,81 @@ static Device device = { static Settings settings = { .frequency = 44100, - .latency_in_msec = 40, + .latency_in_msec = 20, }; +// the number of bytes written in SoundFeedStreamData +const int mixlen = 3240; + +// used to calculate how much space is used in the buffer, for debugging purposes +//int maxlength = 0; + +//////////////////////////////////////////////////////////////////////// +// CALLBACKS FOR THREADED MAINLOOP +//////////////////////////////////////////////////////////////////////// +static void context_state_cb (pa_context *context, void *userdata) +{ + Device *dev = userdata; + + if ((context == NULL) || (dev == NULL)) + return; + + switch (pa_context_get_state (context)) + { + case PA_CONTEXT_READY: + case PA_CONTEXT_TERMINATED: + case PA_CONTEXT_FAILED: + pa_threaded_mainloop_signal (dev->mainloop, 0); + break; + + case PA_CONTEXT_UNCONNECTED: + case PA_CONTEXT_CONNECTING: + case PA_CONTEXT_AUTHORIZING: + case PA_CONTEXT_SETTING_NAME: + break; + } +} + +static void stream_state_cb (pa_stream *stream, void * userdata) +{ + Device *dev = userdata; + + if ((stream == NULL) || (dev == NULL)) + return; + + switch (pa_stream_get_state (stream)) + { + case PA_STREAM_READY: + case PA_STREAM_FAILED: + case PA_STREAM_TERMINATED: + pa_threaded_mainloop_signal (dev->mainloop, 0); + break; + + case PA_STREAM_UNCONNECTED: + case PA_STREAM_CREATING: + break; + } +} + +static void stream_latency_update_cb (pa_stream *stream, void *userdata) +{ + Device *dev = userdata; + + if ((stream == NULL) || (dev == NULL)) + return; + + pa_threaded_mainloop_signal (dev->mainloop, 0); +} + +static void stream_request_cb (pa_stream *stream, size_t length, void *userdata) +{ + Device *dev = userdata; + + if ((stream == NULL) || (dev == NULL)) + return; + pa_threaded_mainloop_signal (dev->mainloop, 0); +} + //////////////////////////////////////////////////////////////////////// // SETUP SOUND //////////////////////////////////////////////////////////////////////// @@ -78,7 +141,7 @@ void SetupSound (void) int error_number; // Acquire mainloop /////////////////////////////////////////////////////// - device.mainloop = pa_mainloop_new (); + device.mainloop = pa_threaded_mainloop_new (); if (device.mainloop == NULL) { fprintf (stderr, "Could not acquire PulseAudio main loop\n"); @@ -86,8 +149,10 @@ void SetupSound (void) } // Acquire context //////////////////////////////////////////////////////// - device.api = pa_mainloop_get_api (device.mainloop); + device.api = pa_threaded_mainloop_get_api (device.mainloop); device.context = pa_context_new (device.api, "PCSX"); + pa_context_set_state_callback (device.context, context_state_cb, &device); + if (device.context == NULL) { fprintf (stderr, "Could not acquire PulseAudio device context\n"); @@ -95,37 +160,38 @@ void SetupSound (void) } // Connect to PulseAudio server /////////////////////////////////////////// - error_number = pa_context_connect (device.context, NULL, 0, NULL); - if (error_number < 0) { + if (pa_context_connect (device.context, NULL, 0, NULL) < 0) + { + error_number = pa_context_errno (device.context); fprintf (stderr, "Could not connect to PulseAudio server: %s\n", pa_strerror(error_number)); return; } - else + + // Run mainloop until sever context is ready ////////////////////////////// + pa_threaded_mainloop_lock (device.mainloop); + if (pa_threaded_mainloop_start (device.mainloop) < 0) { - fprintf (stderr, "Connected to PulseAudio asynchronously.\n"); + fprintf (stderr, "Could not start mainloop\n"); + return; } - // Run mainloop until sever is ready ////////////////////////////////////// pa_context_state_t context_state; - do + context_state = pa_context_get_state (device.context); + while (context_state != PA_CONTEXT_READY) { - error_number = pa_mainloop_iterate (device.mainloop, 1, NULL); - if (error_number < 0) { - fprintf (stderr, "Could not run pa_mainloop_iterate ():%s\n", pa_strerror (error_number)); - return; - } - context_state = pa_context_get_state (device.context); if (! PA_CONTEXT_IS_GOOD (context_state)) { - fprintf (stderr, "Context state is not good.\n"); + error_number = pa_context_errno (device.context); + fprintf (stderr, "Context state is not good: %s\n", pa_strerror (error_number)); return; } + else if (context_state == PA_CONTEXT_READY) + break; else - { fprintf (stderr, "PulseAudio context state is %d\n", context_state); - } - } while (context_state != PA_CONTEXT_READY); + pa_threaded_mainloop_wait (device.mainloop); + } // Set sample spec //////////////////////////////////////////////////////// device.spec.format = PA_SAMPLE_S16LE; @@ -135,69 +201,84 @@ void SetupSound (void) device.spec.channels = 2; device.spec.rate = settings.frequency; - // Set buffer attributes ////////////////////////////////////////////////// - int mixlen = pa_usec_to_bytes (settings.latency_in_msec * PA_USEC_PER_MSEC, &device.spec); - fprintf (stderr, "Size of buffer is: %ld\n", mixlen); - device.buffer_attr.maxlength = (uint32_t) -1; - device.buffer_attr.tlength = mixlen; - device.buffer_attr.prebuf = 0; - device.buffer_attr.minreq = (uint32_t) -1; - //device.buffer_attr.minreq = mixlen; + pa_buffer_attr buffer_attributes; + buffer_attributes.tlength = pa_bytes_per_second (& device.spec) / 5; + buffer_attributes.maxlength = buffer_attributes.tlength * 3; + buffer_attributes.minreq = buffer_attributes.tlength / 3; + buffer_attributes.prebuf = buffer_attributes.tlength; + + //maxlength = buffer_attributes.maxlength; + //fprintf (stderr, "Total space: %u\n", buffer_attributes.maxlength); + //fprintf (stderr, "Minimum request size: %u\n", buffer_attributes.minreq); + //fprintf (stderr, "Bytes needed before playback: %u\n", buffer_attributes.prebuf); + //fprintf (stderr, "Target buffer size: %lu\n", buffer_attributes.tlength); - // Acquire new stream using spec and buffer attributes //////////////////// + // Acquire new stream using spec ////////////////////////////////////////// device.stream = pa_stream_new (device.context, "PCSX", &device.spec, NULL); if (device.stream == NULL) { - fprintf (stderr, "Could not get new PulseAudio stream.\n"); + error_number = pa_context_errno (device.context); + fprintf (stderr, "Could not acquire new PulseAudio stream: %s\n", pa_strerror (error_number)); return; } - pa_stream_flags_t flags = (pa_stream_flags_t) (PA_STREAM_ADJUST_LATENCY | PA_STREAM_VARIABLE_RATE); - error_number = pa_stream_connect_playback (device.stream, NULL, &device.buffer_attr, flags, NULL, NULL); - if (error_number < 0) { - fprintf (stderr, "Could not connect for playback successfully :%s\n", pa_strerror (error_number)); + // Set callbacks for server events //////////////////////////////////////// + pa_stream_set_state_callback (device.stream, stream_state_cb, &device); + pa_stream_set_write_callback (device.stream, stream_request_cb, &device); + pa_stream_set_latency_update_callback (device.stream, stream_latency_update_cb, &device); + + // Ready stream for playback ////////////////////////////////////////////// + pa_stream_flags_t flags = (pa_stream_flags_t) (PA_STREAM_ADJUST_LATENCY | PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_AUTO_TIMING_UPDATE); + //pa_stream_flags_t flags = (pa_stream_flags_t) (PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_AUTO_TIMING_UPDATE | PA_STREAM_EARLY_REQUESTS); + if (pa_stream_connect_playback (device.stream, NULL, &buffer_attributes, flags, NULL, NULL) < 0) + { + pa_context_errno (device.context); + fprintf (stderr, "Could not connect for playback: %s\n", pa_strerror (error_number)); return; } // Run mainloop until stream is ready ///////////////////////////////////// pa_stream_state_t stream_state; - do { - error_number = pa_mainloop_iterate (device.mainloop, 1, NULL); - if (error_number < 0) { - fprintf (stderr, "Could not run pa_mainloop_iterate ():%s\n", pa_strerror (error_number)); - return; - } - + stream_state = pa_stream_get_state (device.stream); + while (stream_state != PA_STREAM_READY) + { stream_state = pa_stream_get_state (device.stream); - if (! PA_STREAM_IS_GOOD (stream_state)) + + if (stream_state == PA_STREAM_READY) + break; + + else if (! PA_STREAM_IS_GOOD (stream_state)) { - fprintf (stderr, "Could not acquire PulseAudio stream.\n"); + error_number = pa_context_errno (device.context); + fprintf (stderr, "Stream state is not good: %s\n", pa_strerror (error_number)); return; } else - { - fprintf (stderr, "PulseAudio stream state is %d.\n", stream_state); - } - } while (stream_state != PA_STREAM_READY); + fprintf (stderr, "PulseAudio stream state is %d\n", stream_state); + pa_threaded_mainloop_wait (device.mainloop); + } - fprintf (stderr, "PulseAudio should be connected.\n"); + pa_threaded_mainloop_unlock (device.mainloop); + + fprintf (stderr, "PulseAudio should be connected\n"); return; } //////////////////////////////////////////////////////////////////////// // REMOVE SOUND //////////////////////////////////////////////////////////////////////// - void RemoveSound (void) { + if (device.mainloop != NULL) + pa_threaded_mainloop_stop (device.mainloop); + // Release in reverse order of acquisition if (device.stream != NULL) { - pa_stream_disconnect (device.stream); pa_stream_unref (device.stream); device.stream = NULL; - } + } if (device.context != NULL) { pa_context_disconnect (device.context); @@ -207,9 +288,10 @@ void RemoveSound (void) if (device.mainloop != NULL) { - pa_mainloop_free (device.mainloop); + pa_threaded_mainloop_free (device.mainloop); device.mainloop = NULL; } + } //////////////////////////////////////////////////////////////////////// @@ -218,24 +300,32 @@ void RemoveSound (void) unsigned long SoundGetBytesBuffered (void) { - int size; + int free_space; int error_code; + long latency; + int playing = 0; - size = pa_stream_writable_size (device.stream); - fprintf (stderr, "Writable size: %d\n", size); + if ((device.mainloop == NULL) || (device.api == NULL) || ( device.context == NULL) || (device.stream == NULL)) + return SOUNDSIZE; - while (size < device.buffer_attr.tlength) + pa_threaded_mainloop_lock (device.mainloop); + free_space = pa_stream_writable_size (device.stream); + pa_threaded_mainloop_unlock (device.mainloop); + + //fprintf (stderr, "Free space: %d\n", free_space); + //fprintf (stderr, "Used space: %d\n", maxlength - free_space); + if (free_space < mixlen * 3) { - size = pa_stream_writable_size (device.stream); - fprintf (stderr, "Looping - Writable size: %d\n", size); - pa_mainloop_iterate (device.mainloop, 1, &error_code); - if (error_code < 0) - { - fprintf (stderr, "Error on iterating loop while getting bytes buffered: %s\n", pa_strerror (error_code)); - return SOUNDSIZE; - } + // Don't buffer anymore, just play + //fprintf (stderr, "Not buffering.\n"); + return SOUNDSIZE; + } + else + { + // Buffer some sound + //fprintf (stderr, "Buffering.\n"); + return 0; } - return 0; } //////////////////////////////////////////////////////////////////////// @@ -244,19 +334,21 @@ unsigned long SoundGetBytesBuffered (void) void SoundFeedStreamData (unsigned char *pSound, long lBytes) { - fprintf (stderr, "Number of bytes to write: %ld\n", lBytes); - - if (pa_stream_write (device.stream, pSound, lBytes, NULL, 0LL, PA_SEEK_RELATIVE) < 0) - fprintf (stderr, "Error: Could not perform write with PulseAudio\n"); -} - -/////////////////////////////////////////////////////////////////////// -// CALLBACK TO NOTIFY US OF PA CONTEXT CHANGES -/////////////////////////////////////////////////////////////////////// + int error_code; + int size; -void connection_state_callback (pa_context *context, const char *name, pa_proplist *property_list, void *user_data) -{ - return; + if (device.mainloop != NULL) + { + pa_threaded_mainloop_lock (device.mainloop); + if (pa_stream_write (device.stream, pSound, lBytes, NULL, 0LL, PA_SEEK_RELATIVE) < 0) + { + fprintf (stderr, "Could not perform write\n"); + } + else + { + //fprintf (stderr, "Wrote %d bytes\n", lBytes); + pa_threaded_mainloop_unlock (device.mainloop); + } + } } - #endif diff --git a/plugins/dfsound/pulseaudiosimple.c b/plugins/dfsound/pulseaudiosimple.c deleted file mode 100644 index 0ca92a4b..00000000 --- a/plugins/dfsound/pulseaudiosimple.c +++ /dev/null @@ -1,111 +0,0 @@ -/*************************************************************************** - pulseaudiosimple.c - description - ------------------- -begin : Thu Feb 04 2010 -copyright : (C) 2010 by Tristin Celestin -email : cetris1@umbc.edu -***************************************************************************/ -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. See also the license.txt file for * - * additional informations. * - * * - ***************************************************************************/ - -#include "stdafx.h" - -#ifdef USEPULSEAUDIOSIMPLE - -#define _IN_OSS - -#include "externals.h" -#include <pulse/simple.h> -#include <pulse/error.h> -#include <pulse/timeval.h> - -//////////////////////////////////////////////////////////////////////// -// pulseaudio globals -//////////////////////////////////////////////////////////////////////// - -#define PLAYBACK_RATE 44100 -#define LATENCY_IN_MS 20 - -static pa_simple *playback_stream; -static pa_sample_spec sample_specification; - -//////////////////////////////////////////////////////////////////////// -// SETUP SOUND -//////////////////////////////////////////////////////////////////////// - -void SetupSound(void) -{ - int error_number = 0; - int buffer_length; - pa_buffer_attr buffer_attributes; - - // Set sample specification /////////////////////////////////////////////// - sample_specification.format = PA_SAMPLE_S16LE; - sample_specification.rate = PLAYBACK_RATE; - if (iDisStereo) - sample_specification.channels = 1; - else - sample_specification.channels = 2; - - // Set buffer attributes ////////////////////////////////////////////////// - // See http://0pointer.de/lennart/projects/pulseaudio/doxygen/streams.html - // for parameter explanations - /////////////////////////////////////////////////////////////////////////// - int mixlen = pa_usec_to_bytes(LATENCY_IN_MS * PA_USEC_PER_MSEC, &sample_specification); - buffer_attributes.maxlength = -1; - buffer_attributes.tlength = mixlen; - buffer_attributes.prebuf = -1; - buffer_attributes.minreq = -1; - - // Get connection from PulseAudio server - playback_stream = pa_simple_new(NULL, "PCSX", PA_STREAM_PLAYBACK, NULL, "PCSX", &sample_specification, NULL, &buffer_attributes, &error_number); - if (playback_stream == NULL) - { - fprintf(stderr, "Failed to connect to Pulseaudio server with pa_simple_new(): %s\n", pa_strerror(error_number)); - return; - } -} - -//////////////////////////////////////////////////////////////////////// -// REMOVE SOUND -//////////////////////////////////////////////////////////////////////// - -void RemoveSound(void) -{ - int error_number = 0; - - if (pa_simple_drain(playback_stream, &error_number) < 0) - fprintf(stderr, "Unable to drain audio: %s\n", pa_strerror (error_number)); - if (playback_stream) - pa_simple_free(playback_stream); -} - -//////////////////////////////////////////////////////////////////////// -// GET BYTES BUFFERED -//////////////////////////////////////////////////////////////////////// - -unsigned long SoundGetBytesBuffered(void) -{ - return 0; -} - -//////////////////////////////////////////////////////////////////////// -// FEED SOUND DATA -//////////////////////////////////////////////////////////////////////// - -void SoundFeedStreamData(unsigned char *pSound, long lBytes) -{ - int error_number = 0; - - if (pa_simple_write(playback_stream, pSound, (ssize_t)lBytes, &error_number) < 0) - fprintf(stderr, "Could not write - pa_simple_write() failed: %s\n", pa_strerror(error_number)); -} - -#endif |
