diff options
| author | SND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2010-05-21 00:48:30 +0000 |
|---|---|---|
| committer | SND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2010-05-21 00:48:30 +0000 |
| commit | 481093baa83a3f5754c75b0f4a71b57b048bb2d8 (patch) | |
| tree | 1679451ac25e88fe4d7bbc58e3fd6cd44d3b33cd | |
| parent | d8682fcd25a752a4b22ffd8848b80bf62fd31c92 (diff) | |
| download | pcsxr-481093baa83a3f5754c75b0f4a71b57b048bb2d8.tar.gz | |
readded oss/pulseaudio/alsa/null sound backends, added --enable-sound configure flag to specify the backend to be used.
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@48419 e17a0e51-4ae3-4d35-97c3-1a29b211df97
| -rw-r--r-- | ChangeLog | 12 | ||||
| -rw-r--r-- | Makefile.in | 4 | ||||
| -rwxr-xr-x | configure | 359 | ||||
| -rw-r--r-- | configure.ac | 34 | ||||
| -rw-r--r-- | data/Makefile.in | 4 | ||||
| -rw-r--r-- | doc/Makefile.in | 4 | ||||
| -rw-r--r-- | gui/Makefile.in | 4 | ||||
| -rw-r--r-- | libpcsxcore/Makefile.in | 4 | ||||
| -rw-r--r-- | libpcsxcore/psxbios.c | 4 | ||||
| -rw-r--r-- | pixmaps/Makefile.in | 4 | ||||
| -rw-r--r-- | plugins/dfcdrom/Makefile.in | 4 | ||||
| -rw-r--r-- | plugins/dfinput/Makefile.in | 4 | ||||
| -rw-r--r-- | plugins/dfnet/Makefile.in | 4 | ||||
| -rw-r--r-- | plugins/dfsound/Makefile.am | 31 | ||||
| -rw-r--r-- | plugins/dfsound/Makefile.in | 70 | ||||
| -rw-r--r-- | plugins/dfsound/alsa.c | 158 | ||||
| -rw-r--r-- | plugins/dfsound/nullsnd.c | 24 | ||||
| -rw-r--r-- | plugins/dfsound/oss.c | 159 | ||||
| -rw-r--r-- | plugins/dfsound/pulseaudio.c | 354 | ||||
| -rw-r--r-- | plugins/dfsound/spu.c | 10 | ||||
| -rw-r--r-- | plugins/dfxvideo/Makefile.in | 4 | ||||
| -rw-r--r-- | plugins/peopsxgl/Makefile.in | 4 | ||||
| -rw-r--r-- | po/it.po | 34 | ||||
| -rw-r--r-- | po/pcsx.pot | 24 | ||||
| -rw-r--r-- | po/pt_BR.po | 31 | ||||
| -rw-r--r-- | po/ru_RU.po | 27 | ||||
| -rw-r--r-- | po/zh_CN.po | 33 | ||||
| -rw-r--r-- | po/zh_TW.po | 33 |
28 files changed, 1360 insertions, 81 deletions
@@ -1,3 +1,15 @@ +May 21, 2010 Wei Mingzhi <whistler_wmz@users.sf.net> + + * plugins/dfsound/oss.c: Readded OSS, PulseAudio, ALSA & NULL backends. + * plugins/dfsound/pulseaudio.c: Likewise. + * plugins/dfsound/nullsnd.c: Likewise. + * plugins/dfsound/alsa.c: Likewise. + * plugins/dfsound/spu.c: Likewise. + * configure.ac: Added an option --enable-sound to specify the sound backend. + * plugins/dfsound/Makefile.am: Likewise. + * po/pt_BR.po, po/it.po, po/zh_TW.po, po/ru_RU.po, po/pcsx.pot, po/zh_CN.po: + Updated. + May 20, 2010 Wei Mingzhi <whistler_wmz@users.sf.net> * macosx/main.m: Removed obsolete code, added const to function definations. diff --git a/Makefile.in b/Makefile.in index 9e54ef69..beb2ed58 100644 --- a/Makefile.in +++ b/Makefile.in @@ -104,6 +104,8 @@ GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ @@ -183,6 +185,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PEOPSXGL = @PEOPSXGL@ PKG_CONFIG = @PKG_CONFIG@ POSUB = @POSUB@ +PULSEAUDIO_CFLAGS = @PULSEAUDIO_CFLAGS@ +PULSEAUDIO_LIBS = @PULSEAUDIO_LIBS@ RANLIB = @RANLIB@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ @@ -754,6 +754,20 @@ NASM X86_NASM_FALSE X86_NASM_TRUE PEOPSXGL +SOUND_PULSEAUDIO_FALSE +SOUND_PULSEAUDIO_TRUE +SOUND_ALSA_FALSE +SOUND_ALSA_TRUE +PULSEAUDIO_LIBS +PULSEAUDIO_CFLAGS +ALSA_LIBS +ALSA_CFLAGS +SOUND_NULL_FALSE +SOUND_NULL_TRUE +SOUND_SDL_FALSE +SOUND_SDL_TRUE +SOUND_OSS_FALSE +SOUND_OSS_TRUE SDL_LIBS SDL_CFLAGS SDL_CONFIG @@ -917,6 +931,7 @@ with_libintl_prefix with_sdl_prefix with_sdl_exec_prefix enable_sdltest +enable_sound enable_opengl enable_dynarec ' @@ -937,7 +952,11 @@ GLIB2_LIBS GTK2_CFLAGS GTK2_LIBS GLADE2_CFLAGS -GLADE2_LIBS' +GLADE2_LIBS +ALSA_CFLAGS +ALSA_LIBS +PULSEAUDIO_CFLAGS +PULSEAUDIO_LIBS' # Initialize some variables set by options. @@ -1570,6 +1589,7 @@ Optional Features: --disable-nls do not use Native Language Support --disable-rpath do not hardcode runtime library paths --disable-sdltest Do not try to compile and run a test SDL program + --enable-sound=... force selection of sound backend (alsa, null, oss, pulseaudio, sdl) (default: sdl) --enable-opengl build OpenGL plugin (default=no) --enable-dynarec=... force selection of dynamic recompiler platform (x86, x86_64, ppc) (default: autodetect) @@ -1607,6 +1627,12 @@ Some influential environment variables: GLADE2_CFLAGS C compiler flags for GLADE2, overriding pkg-config GLADE2_LIBS linker flags for GLADE2, overriding pkg-config + ALSA_CFLAGS C compiler flags for ALSA, overriding pkg-config + ALSA_LIBS linker flags for ALSA, overriding pkg-config + PULSEAUDIO_CFLAGS + C compiler flags for PULSEAUDIO, overriding pkg-config + PULSEAUDIO_LIBS + linker flags for PULSEAUDIO, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -4738,13 +4764,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:4741: $ac_compile\"" >&5) + (eval echo "\"\$as_me:4767: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:4744: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:4770: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:4747: output\"" >&5) + (eval echo "\"\$as_me:4773: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -5950,7 +5976,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 5953 "configure"' > conftest.$ac_ext + echo '#line 5979 "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -7446,11 +7472,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:7449: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7475: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7453: \$? = $ac_status" >&5 + echo "$as_me:7479: \$? = $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. @@ -7785,11 +7811,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:7788: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7814: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7792: \$? = $ac_status" >&5 + echo "$as_me:7818: \$? = $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. @@ -7890,11 +7916,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:7893: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7919: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7897: \$? = $ac_status" >&5 + echo "$as_me:7923: \$? = $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 @@ -7945,11 +7971,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:7948: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7974: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7952: \$? = $ac_status" >&5 + echo "$as_me:7978: \$? = $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 @@ -10329,7 +10355,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10332 "configure" +#line 10358 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -10425,7 +10451,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10428 "configure" +#line 10454 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -13439,6 +13465,273 @@ then CFLAGS="$CFLAGS -fno-dse" fi + if false; then + SOUND_OSS_TRUE= + SOUND_OSS_FALSE='#' +else + SOUND_OSS_TRUE='#' + SOUND_OSS_FALSE= +fi + + if false; then + SOUND_SDL_TRUE= + SOUND_SDL_FALSE='#' +else + SOUND_SDL_TRUE='#' + SOUND_SDL_FALSE= +fi + + if false; then + SOUND_NULL_TRUE= + SOUND_NULL_FALSE='#' +else + SOUND_NULL_TRUE='#' + SOUND_NULL_FALSE= +fi + + + +# Check whether --enable-sound was given. +if test "${enable_sound+set}" = set; then : + enableval=$enable_sound; SOUND="$enableval" +else + SOUND="sdl" +fi + + +if test "x$SOUND" = xalsa; then + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ALSA" >&5 +$as_echo_n "checking for ALSA... " >&6; } + +if test -n "$PKG_CONFIG"; then + if test -n "$ALSA_CFLAGS"; then + pkg_cv_ALSA_CFLAGS="$ALSA_CFLAGS" + else + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"alsa >= 1.0.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "alsa >= 1.0.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_ALSA_CFLAGS=`$PKG_CONFIG --cflags "alsa >= 1.0.0" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi +if test -n "$PKG_CONFIG"; then + if test -n "$ALSA_LIBS"; then + pkg_cv_ALSA_LIBS="$ALSA_LIBS" + else + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"alsa >= 1.0.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "alsa >= 1.0.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_ALSA_LIBS=`$PKG_CONFIG --libs "alsa >= 1.0.0" 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 + ALSA_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "alsa >= 1.0.0"` + else + ALSA_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "alsa >= 1.0.0"` + fi + # Put the nasty error message in config.log where it belongs + echo "$ALSA_PKG_ERRORS" >&5 + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + have_alsa=no +elif test $pkg_failed = untried; then + have_alsa=no +else + ALSA_CFLAGS=$pkg_cv_ALSA_CFLAGS + ALSA_LIBS=$pkg_cv_ALSA_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + have_alsa=yes +fi +elif test "x$SOUND" = xpulseaudio; then + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$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:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpulse >= 0.9.16\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libpulse >= 0.9.16") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_PULSEAUDIO_CFLAGS=`$PKG_CONFIG --cflags "libpulse >= 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:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpulse >= 0.9.16\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libpulse >= 0.9.16") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_PULSEAUDIO_LIBS=`$PKG_CONFIG --libs "libpulse >= 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 >= 0.9.16"` + else + PULSEAUDIO_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libpulse >= 0.9.16"` + fi + # Put the nasty error message in config.log where it belongs + echo "$PULSEAUDIO_PKG_ERRORS" >&5 + + as_fn_error "Package requirements (libpulse >= 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. +" "$LINENO" 5 +elif test $pkg_failed = untried; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_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." "$LINENO" 5; } +else + PULSEAUDIO_CFLAGS=$pkg_cv_PULSEAUDIO_CFLAGS + PULSEAUDIO_LIBS=$pkg_cv_PULSEAUDIO_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + have_pulseaudio=yes +fi +elif test "x$SOUND" = xoss; then + ac_fn_c_check_header_mongrel "$LINENO" "sys/soundcard.h" "ac_cv_header_sys_soundcard_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_soundcard_h" = x""yes; then : + have_oss=yes +else + have_oss=no +fi + + + if test "x$have_oss" = xno; then + as_fn_error "sys/soundcard.h not found!" "$LINENO" 5 + else + if true; then + SOUND_OSS_TRUE= + SOUND_OSS_FALSE='#' +else + SOUND_OSS_TRUE='#' + SOUND_OSS_FALSE= +fi + + fi +elif test "x$SOUND" = xno; then + if true; then + SOUND_NULL_TRUE= + SOUND_NULL_FALSE='#' +else + SOUND_NULL_TRUE='#' + SOUND_NULL_FALSE= +fi + +elif test "x$SOUND" = xnull; then + if true; then + SOUND_NULL_TRUE= + SOUND_NULL_FALSE='#' +else + SOUND_NULL_TRUE='#' + SOUND_NULL_FALSE= +fi + +else + if true; then + SOUND_SDL_TRUE= + SOUND_SDL_FALSE='#' +else + SOUND_SDL_TRUE='#' + SOUND_SDL_FALSE= +fi + +fi + + if test "x$have_alsa" = xyes; then + SOUND_ALSA_TRUE= + SOUND_ALSA_FALSE='#' +else + SOUND_ALSA_TRUE='#' + SOUND_ALSA_FALSE= +fi + + + if test "x$have_pulseaudio" = xyes; then + SOUND_PULSEAUDIO_TRUE= + SOUND_PULSEAUDIO_FALSE='#' +else + SOUND_PULSEAUDIO_TRUE='#' + SOUND_PULSEAUDIO_FALSE= +fi + + + + ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default" if test "x$ac_cv_header_zlib_h" = x""yes; then : have_zlib=yes @@ -14078,6 +14371,42 @@ if test -z "${am__fastdepCCAS_TRUE}" && test -z "${am__fastdepCCAS_FALSE}"; then as_fn_error "conditional \"am__fastdepCCAS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${SOUND_OSS_TRUE}" && test -z "${SOUND_OSS_FALSE}"; then + as_fn_error "conditional \"SOUND_OSS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${SOUND_SDL_TRUE}" && test -z "${SOUND_SDL_FALSE}"; then + as_fn_error "conditional \"SOUND_SDL\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${SOUND_NULL_TRUE}" && test -z "${SOUND_NULL_FALSE}"; then + as_fn_error "conditional \"SOUND_NULL\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${SOUND_OSS_TRUE}" && test -z "${SOUND_OSS_FALSE}"; then + as_fn_error "conditional \"SOUND_OSS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${SOUND_NULL_TRUE}" && test -z "${SOUND_NULL_FALSE}"; then + as_fn_error "conditional \"SOUND_NULL\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${SOUND_NULL_TRUE}" && test -z "${SOUND_NULL_FALSE}"; then + as_fn_error "conditional \"SOUND_NULL\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${SOUND_SDL_TRUE}" && test -z "${SOUND_SDL_FALSE}"; then + as_fn_error "conditional \"SOUND_SDL\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${SOUND_ALSA_TRUE}" && test -z "${SOUND_ALSA_FALSE}"; then + as_fn_error "conditional \"SOUND_ALSA\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${SOUND_PULSEAUDIO_TRUE}" && test -z "${SOUND_PULSEAUDIO_FALSE}"; then + as_fn_error "conditional \"SOUND_PULSEAUDIO\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${X86_NASM_TRUE}" && test -z "${X86_NASM_FALSE}"; then as_fn_error "conditional \"X86_NASM\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 diff --git a/configure.ac b/configure.ac index defef36e..9c1b8124 100644 --- a/configure.ac +++ b/configure.ac @@ -47,6 +47,40 @@ then CFLAGS="$CFLAGS -fno-dse" fi +AM_CONDITIONAL(SOUND_OSS, false) +AM_CONDITIONAL(SOUND_SDL, false) +AM_CONDITIONAL(SOUND_NULL, false) + +dnl Check for ALSA 1.x, OSS, or PulseAudio + +AC_ARG_ENABLE(sound, [ --enable-sound=... force selection of sound backend (alsa, null, oss, pulseaudio, sdl) (default: sdl)], +[ SOUND="$enableval" ],[ SOUND="sdl" ]) + +if test "x$SOUND" = xalsa; then + PKG_CHECK_MODULES(ALSA, alsa >= 1.0.0, have_alsa=yes, have_alsa=no) +elif test "x$SOUND" = xpulseaudio; then + PKG_CHECK_MODULES(PULSEAUDIO, libpulse >= 0.9.16, have_pulseaudio=yes) +elif test "x$SOUND" = xoss; then + AC_CHECK_HEADER(sys/soundcard.h, have_oss=yes, have_oss=no) + if test "x$have_oss" = xno; then + AC_MSG_ERROR([sys/soundcard.h not found!]) + else + AM_CONDITIONAL(SOUND_OSS, true) + fi +elif test "x$SOUND" = xno; then + AM_CONDITIONAL(SOUND_NULL, true) +elif test "x$SOUND" = xnull; then + AM_CONDITIONAL(SOUND_NULL, true) +else + AM_CONDITIONAL(SOUND_SDL, true) +fi + +AM_CONDITIONAL(SOUND_ALSA, test "x$have_alsa" = xyes) +AC_SUBST(ALSA_LIBS) +AM_CONDITIONAL(SOUND_PULSEAUDIO, test "x$have_pulseaudio" = xyes) +AC_SUBST(PULSEAUDIO_CFLAGS) +AC_SUBST(PULSEAUDIO_LIBS) + AC_CHECK_HEADER(zlib.h, have_zlib=yes, have_zlib=no) if test "x$have_zlib" = xno; then AC_MSG_ERROR([unable to find libz headers]) diff --git a/data/Makefile.in b/data/Makefile.in index 4b2c8501..b17caad9 100644 --- a/data/Makefile.in +++ b/data/Makefile.in @@ -72,6 +72,8 @@ am__installdirs = "$(DESTDIR)$(desktopdir)" "$(DESTDIR)$(gladedir)" DATA = $(desktop_DATA) $(glade_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ @@ -151,6 +153,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PEOPSXGL = @PEOPSXGL@ PKG_CONFIG = @PKG_CONFIG@ POSUB = @POSUB@ +PULSEAUDIO_CFLAGS = @PULSEAUDIO_CFLAGS@ +PULSEAUDIO_LIBS = @PULSEAUDIO_LIBS@ RANLIB = @RANLIB@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ diff --git a/doc/Makefile.in b/doc/Makefile.in index a26ac961..a09aa2c1 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -73,6 +73,8 @@ NROFF = nroff MANS = $(man_MANS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ @@ -152,6 +154,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PEOPSXGL = @PEOPSXGL@ PKG_CONFIG = @PKG_CONFIG@ POSUB = @POSUB@ +PULSEAUDIO_CFLAGS = @PULSEAUDIO_CFLAGS@ +PULSEAUDIO_LIBS = @PULSEAUDIO_LIBS@ RANLIB = @RANLIB@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ diff --git a/gui/Makefile.in b/gui/Makefile.in index b9dbeeda..c262c296 100644 --- a/gui/Makefile.in +++ b/gui/Makefile.in @@ -74,6 +74,8 @@ ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ @@ -153,6 +155,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PEOPSXGL = @PEOPSXGL@ PKG_CONFIG = @PKG_CONFIG@ POSUB = @POSUB@ +PULSEAUDIO_CFLAGS = @PULSEAUDIO_CFLAGS@ +PULSEAUDIO_LIBS = @PULSEAUDIO_LIBS@ RANLIB = @RANLIB@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ diff --git a/libpcsxcore/Makefile.in b/libpcsxcore/Makefile.in index fb8a7b8e..923f99b9 100644 --- a/libpcsxcore/Makefile.in +++ b/libpcsxcore/Makefile.in @@ -173,6 +173,8 @@ ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ @@ -252,6 +254,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PEOPSXGL = @PEOPSXGL@ PKG_CONFIG = @PKG_CONFIG@ POSUB = @POSUB@ +PULSEAUDIO_CFLAGS = @PULSEAUDIO_CFLAGS@ +PULSEAUDIO_LIBS = @PULSEAUDIO_LIBS@ RANLIB = @RANLIB@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ diff --git a/libpcsxcore/psxbios.c b/libpcsxcore/psxbios.c index ff436252..05ca610d 100644 --- a/libpcsxcore/psxbios.c +++ b/libpcsxcore/psxbios.c @@ -18,14 +18,12 @@ ***************************************************************************/ /* -* Internal emulated HLE BIOS. +* Internal simulated HLE BIOS. */ #include "psxbios.h" #include "psxhw.h" -//We try to emulate bios :) HELP US :P - char *biosA0n[256] = { // 0x00 "open", "lseek", "read", "write", diff --git a/pixmaps/Makefile.in b/pixmaps/Makefile.in index 5cc1514c..1e9040c9 100644 --- a/pixmaps/Makefile.in +++ b/pixmaps/Makefile.in @@ -72,6 +72,8 @@ am__installdirs = "$(DESTDIR)$(icondir)" "$(DESTDIR)$(pixmapdir)" DATA = $(icon_DATA) $(pixmap_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ @@ -151,6 +153,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PEOPSXGL = @PEOPSXGL@ PKG_CONFIG = @PKG_CONFIG@ POSUB = @POSUB@ +PULSEAUDIO_CFLAGS = @PULSEAUDIO_CFLAGS@ +PULSEAUDIO_LIBS = @PULSEAUDIO_LIBS@ RANLIB = @RANLIB@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ diff --git a/plugins/dfcdrom/Makefile.in b/plugins/dfcdrom/Makefile.in index 1a4fb201..2ab426ee 100644 --- a/plugins/dfcdrom/Makefile.in +++ b/plugins/dfcdrom/Makefile.in @@ -103,6 +103,8 @@ ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ @@ -182,6 +184,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PEOPSXGL = @PEOPSXGL@ PKG_CONFIG = @PKG_CONFIG@ POSUB = @POSUB@ +PULSEAUDIO_CFLAGS = @PULSEAUDIO_CFLAGS@ +PULSEAUDIO_LIBS = @PULSEAUDIO_LIBS@ RANLIB = @RANLIB@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ diff --git a/plugins/dfinput/Makefile.in b/plugins/dfinput/Makefile.in index da23e1d9..8a7db8dc 100644 --- a/plugins/dfinput/Makefile.in +++ b/plugins/dfinput/Makefile.in @@ -106,6 +106,8 @@ ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ @@ -185,6 +187,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PEOPSXGL = @PEOPSXGL@ PKG_CONFIG = @PKG_CONFIG@ POSUB = @POSUB@ +PULSEAUDIO_CFLAGS = @PULSEAUDIO_CFLAGS@ +PULSEAUDIO_LIBS = @PULSEAUDIO_LIBS@ RANLIB = @RANLIB@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ diff --git a/plugins/dfnet/Makefile.in b/plugins/dfnet/Makefile.in index 78c1803c..23f17f4b 100644 --- a/plugins/dfnet/Makefile.in +++ b/plugins/dfnet/Makefile.in @@ -103,6 +103,8 @@ ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ @@ -182,6 +184,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PEOPSXGL = @PEOPSXGL@ PKG_CONFIG = @PKG_CONFIG@ POSUB = @POSUB@ +PULSEAUDIO_CFLAGS = @PULSEAUDIO_CFLAGS@ +PULSEAUDIO_LIBS = @PULSEAUDIO_LIBS@ RANLIB = @RANLIB@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ diff --git a/plugins/dfsound/Makefile.am b/plugins/dfsound/Makefile.am index 5324e169..25689bd4 100644 --- a/plugins/dfsound/Makefile.am +++ b/plugins/dfsound/Makefile.am @@ -9,11 +9,38 @@ libdir = @libdir@/games/psemu/ lib_LTLIBRARIES = libDFSound.la -libDFSound_la_SOURCES = spu.c cfg.c dma.c freeze.c psemu.c registers.c sdl.c +libDFSound_la_SOURCES = spu.c cfg.c dma.c freeze.c psemu.c registers.c -libDFSound_la_CFLAGS = $(SDL_CFLAGS) +libDFSound_la_CFLAGS = libDFSound_la_LDFLAGS = -module -avoid-version -lpthread -lm + +if SOUND_ALSA +libDFSound_la_SOURCES += alsa.c +libDFSound_la_CFLAGS += -DUSEALSA=1 +libDFSound_la_LDFLAGS += $(ALSA_LIBS) +endif + +if SOUND_OSS +libDFSound_la_SOURCES += oss.c +libDFSound_la_CFLAGS += -DUSEOSS=1 +endif + +if SOUND_PULSEAUDIO +libDFSound_la_SOURCES += pulseaudio.c +libDFSound_la_CFLAGS += -DUSEPULSEAUDIO=1 $(PULSEAUDIO_CFLAGS) +libDFSound_la_LDFLAGS += $(PULSEAUDIO_LIBS) +endif + +if SOUND_SDL +libDFSound_la_SOURCES += sdl.c +libDFSound_la_CFLAGS += -DUSESDL=1 $(SDL_CFLAGS) libDFSound_la_LDFLAGS += $(SDL_LIBS) +endif + +if SOUND_NULL +libDFSound_la_SOURCES += nullsnd.c +libDFSound_la_CFLAGS += -DUSENULL=1 +endif bin_PROGRAMS = cfgDFSound cfgDFSound_SOURCES = spucfg-0.1df/main.c diff --git a/plugins/dfsound/Makefile.in b/plugins/dfsound/Makefile.in index a02374ea..2d450e94 100644 --- a/plugins/dfsound/Makefile.in +++ b/plugins/dfsound/Makefile.in @@ -37,6 +37,19 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ +@SOUND_ALSA_TRUE@am__append_1 = alsa.c +@SOUND_ALSA_TRUE@am__append_2 = -DUSEALSA=1 +@SOUND_ALSA_TRUE@am__append_3 = $(ALSA_LIBS) +@SOUND_OSS_TRUE@am__append_4 = oss.c +@SOUND_OSS_TRUE@am__append_5 = -DUSEOSS=1 +@SOUND_PULSEAUDIO_TRUE@am__append_6 = pulseaudio.c +@SOUND_PULSEAUDIO_TRUE@am__append_7 = -DUSEPULSEAUDIO=1 $(PULSEAUDIO_CFLAGS) +@SOUND_PULSEAUDIO_TRUE@am__append_8 = $(PULSEAUDIO_LIBS) +@SOUND_SDL_TRUE@am__append_9 = sdl.c +@SOUND_SDL_TRUE@am__append_10 = -DUSESDL=1 $(SDL_CFLAGS) +@SOUND_SDL_TRUE@am__append_11 = $(SDL_LIBS) +@SOUND_NULL_TRUE@am__append_12 = nullsnd.c +@SOUND_NULL_TRUE@am__append_13 = -DUSENULL=1 bin_PROGRAMS = cfgDFSound$(EXEEXT) subdir = plugins/dfsound DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in @@ -73,10 +86,18 @@ am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \ "$(DESTDIR)$(gladedir)" LTLIBRARIES = $(lib_LTLIBRARIES) libDFSound_la_LIBADD = +am__libDFSound_la_SOURCES_DIST = spu.c cfg.c dma.c freeze.c psemu.c \ + registers.c alsa.c oss.c pulseaudio.c sdl.c nullsnd.c +@SOUND_ALSA_TRUE@am__objects_1 = libDFSound_la-alsa.lo +@SOUND_OSS_TRUE@am__objects_2 = libDFSound_la-oss.lo +@SOUND_PULSEAUDIO_TRUE@am__objects_3 = libDFSound_la-pulseaudio.lo +@SOUND_SDL_TRUE@am__objects_4 = libDFSound_la-sdl.lo +@SOUND_NULL_TRUE@am__objects_5 = libDFSound_la-nullsnd.lo 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-sdl.lo + $(am__objects_1) $(am__objects_2) $(am__objects_3) \ + $(am__objects_4) $(am__objects_5) libDFSound_la_OBJECTS = $(am_libDFSound_la_OBJECTS) libDFSound_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libDFSound_la_CFLAGS) \ @@ -100,12 +121,14 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libDFSound_la_SOURCES) $(cfgDFSound_SOURCES) -DIST_SOURCES = $(libDFSound_la_SOURCES) $(cfgDFSound_SOURCES) +DIST_SOURCES = $(am__libDFSound_la_SOURCES_DIST) $(cfgDFSound_SOURCES) DATA = $(glade_DATA) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ @@ -185,6 +208,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PEOPSXGL = @PEOPSXGL@ PKG_CONFIG = @PKG_CONFIG@ POSUB = @POSUB@ +PULSEAUDIO_CFLAGS = @PULSEAUDIO_CFLAGS@ +PULSEAUDIO_LIBS = @PULSEAUDIO_LIBS@ RANLIB = @RANLIB@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ @@ -261,10 +286,13 @@ INCLUDES = -DPIXMAPDIR=\"${datadir}/pixmaps/\" \ -I../../include lib_LTLIBRARIES = libDFSound.la -libDFSound_la_SOURCES = spu.c cfg.c dma.c freeze.c psemu.c registers.c sdl.c -libDFSound_la_CFLAGS = $(SDL_CFLAGS) +libDFSound_la_SOURCES = spu.c cfg.c dma.c freeze.c psemu.c registers.c \ + $(am__append_1) $(am__append_4) $(am__append_6) \ + $(am__append_9) $(am__append_12) +libDFSound_la_CFLAGS = $(am__append_2) $(am__append_5) $(am__append_7) \ + $(am__append_10) $(am__append_13) libDFSound_la_LDFLAGS = -module -avoid-version -lpthread -lm \ - $(SDL_LIBS) + $(am__append_3) $(am__append_8) $(am__append_11) cfgDFSound_SOURCES = spucfg-0.1df/main.c cfgDFSound_LDADD = $(GTK2_LIBS) $(GLADE2_LIBS) glade_DATA = spucfg-0.1df/dfsound.glade2 @@ -390,10 +418,14 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libDFSound_la-alsa.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libDFSound_la-cfg.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libDFSound_la-dma.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libDFSound_la-freeze.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libDFSound_la-nullsnd.Plo@am__quote@ +@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-registers.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libDFSound_la-sdl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libDFSound_la-spu.Plo@am__quote@ @@ -462,6 +494,27 @@ libDFSound_la-registers.lo: registers.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-registers.lo `test -f 'registers.c' || echo '$(srcdir)/'`registers.c +libDFSound_la-alsa.lo: alsa.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-alsa.lo -MD -MP -MF $(DEPDIR)/libDFSound_la-alsa.Tpo -c -o libDFSound_la-alsa.lo `test -f 'alsa.c' || echo '$(srcdir)/'`alsa.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libDFSound_la-alsa.Tpo $(DEPDIR)/libDFSound_la-alsa.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='alsa.c' object='libDFSound_la-alsa.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-alsa.lo `test -f 'alsa.c' || echo '$(srcdir)/'`alsa.c + +libDFSound_la-oss.lo: oss.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-oss.lo -MD -MP -MF $(DEPDIR)/libDFSound_la-oss.Tpo -c -o libDFSound_la-oss.lo `test -f 'oss.c' || echo '$(srcdir)/'`oss.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libDFSound_la-oss.Tpo $(DEPDIR)/libDFSound_la-oss.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='oss.c' object='libDFSound_la-oss.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-oss.lo `test -f 'oss.c' || echo '$(srcdir)/'`oss.c + +libDFSound_la-pulseaudio.lo: pulseaudio.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-pulseaudio.lo -MD -MP -MF $(DEPDIR)/libDFSound_la-pulseaudio.Tpo -c -o libDFSound_la-pulseaudio.lo `test -f 'pulseaudio.c' || echo '$(srcdir)/'`pulseaudio.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libDFSound_la-pulseaudio.Tpo $(DEPDIR)/libDFSound_la-pulseaudio.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pulseaudio.c' object='libDFSound_la-pulseaudio.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-pulseaudio.lo `test -f 'pulseaudio.c' || echo '$(srcdir)/'`pulseaudio.c + libDFSound_la-sdl.lo: sdl.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-sdl.lo -MD -MP -MF $(DEPDIR)/libDFSound_la-sdl.Tpo -c -o libDFSound_la-sdl.lo `test -f 'sdl.c' || echo '$(srcdir)/'`sdl.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libDFSound_la-sdl.Tpo $(DEPDIR)/libDFSound_la-sdl.Plo @@ -469,6 +522,13 @@ libDFSound_la-sdl.lo: sdl.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-sdl.lo `test -f 'sdl.c' || echo '$(srcdir)/'`sdl.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@ $(am__mv) $(DEPDIR)/libDFSound_la-nullsnd.Tpo $(DEPDIR)/libDFSound_la-nullsnd.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nullsnd.c' object='libDFSound_la-nullsnd.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-nullsnd.lo `test -f 'nullsnd.c' || echo '$(srcdir)/'`nullsnd.c + main.o: spucfg-0.1df/main.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT main.o -MD -MP -MF $(DEPDIR)/main.Tpo -c -o main.o `test -f 'spucfg-0.1df/main.c' || echo '$(srcdir)/'`spucfg-0.1df/main.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/main.Tpo $(DEPDIR)/main.Po diff --git a/plugins/dfsound/alsa.c b/plugins/dfsound/alsa.c new file mode 100644 index 00000000..2eba878a --- /dev/null +++ b/plugins/dfsound/alsa.c @@ -0,0 +1,158 @@ +/*************************************************************************** + alsa.c - description + ------------------- + begin : Sat Mar 01 2003 + copyright : (C) 2002 by Pete Bernert + email : BlackDove@addcom.de + ***************************************************************************/ +/*************************************************************************** + * * + * 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" + +#define _IN_OSS + +#include "externals.h" + +#define ALSA_PCM_NEW_HW_PARAMS_API +#define ALSA_PCM_NEW_SW_PARAMS_API +#include <alsa/asoundlib.h> + +static snd_pcm_t *handle = NULL; +static snd_pcm_uframes_t buffer_size; + +// SETUP SOUND +void SetupSound(void) +{ + snd_pcm_hw_params_t *hwparams; + snd_pcm_status_t *status; + unsigned int pspeed; + int pchannels; + int format; + unsigned int buffer_time = 100000; + unsigned int period_time = buffer_time / 4; + int err; + + if (iDisStereo) pchannels = 1; + else pchannels=2; + + pspeed = 44100; + format = SND_PCM_FORMAT_S16; + + if ((err = snd_pcm_open(&handle, "default", + SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK)) < 0) + { + printf("Audio open error: %s\n", snd_strerror(err)); + return; + } + + if((err = snd_pcm_nonblock(handle, 0))<0) + { + printf("Can't set blocking moded: %s\n", snd_strerror(err)); + return; + } + + snd_pcm_hw_params_alloca(&hwparams); + + if((err=snd_pcm_hw_params_any(handle, hwparams))<0) + { + printf("Broken configuration for this PCM: %s\n", snd_strerror(err)); + return; + } + + if((err=snd_pcm_hw_params_set_access(handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED))<0) + { + printf("Access type not available: %s\n", snd_strerror(err)); + return; + } + + if((err=snd_pcm_hw_params_set_format(handle, hwparams, format))<0) + { + printf("Sample format not available: %s\n", snd_strerror(err)); + return; + } + + if((err=snd_pcm_hw_params_set_channels(handle, hwparams, pchannels))<0) + { + printf("Channels count not available: %s\n", snd_strerror(err)); + return; + } + + if((err=snd_pcm_hw_params_set_rate_near(handle, hwparams, &pspeed, 0))<0) + { + printf("Rate not available: %s\n", snd_strerror(err)); + return; + } + + if((err=snd_pcm_hw_params_set_buffer_time_near(handle, hwparams, &buffer_time, 0))<0) + { + printf("Buffer time error: %s\n", snd_strerror(err)); + return; + } + + if((err=snd_pcm_hw_params_set_period_time_near(handle, hwparams, &period_time, 0))<0) + { + printf("Period time error: %s\n", snd_strerror(err)); + return; + } + + if((err=snd_pcm_hw_params(handle, hwparams))<0) + { + printf("Unable to install hw params: %s\n", snd_strerror(err)); + return; + } + + snd_pcm_status_alloca(&status); + if((err=snd_pcm_status(handle, status))<0) + { + printf("Unable to get status: %s\n", snd_strerror(err)); + return; + } + + buffer_size = snd_pcm_status_get_avail(status); +} + +// REMOVE SOUND +void RemoveSound(void) +{ + if(handle != NULL) + { + snd_pcm_drop(handle); + snd_pcm_close(handle); + handle = NULL; + } +} + +// GET BYTES BUFFERED +unsigned long SoundGetBytesBuffered(void) +{ + unsigned long l; + + if (handle == NULL) // failed to open? + return SOUNDSIZE; + l = snd_pcm_avail(handle); + if (l < 0) return 0; + if (l < buffer_size / 2) // can we write in at least the half of fragments? + l = SOUNDSIZE; // -> no? wait + else l = 0; // -> else go on + + return l; +} + +// FEED SOUND DATA +void SoundFeedStreamData(unsigned char* pSound,long lBytes) +{ + if (handle == NULL) return; + + if (snd_pcm_state(handle) == SND_PCM_STATE_XRUN) + snd_pcm_prepare(handle); + snd_pcm_writei(handle,pSound, + iDisStereo ? lBytes / 2 : lBytes / 4); +} diff --git a/plugins/dfsound/nullsnd.c b/plugins/dfsound/nullsnd.c new file mode 100644 index 00000000..bf079094 --- /dev/null +++ b/plugins/dfsound/nullsnd.c @@ -0,0 +1,24 @@ +#include "stdafx.h" +#define _IN_OSS +#include "externals.h" + +// SETUP SOUND +void SetupSound(void) +{ +} + +// REMOVE SOUND +void RemoveSound(void) +{ +} + +// GET BYTES BUFFERED +unsigned long SoundGetBytesBuffered(void) +{ + return 0; +} + +// FEED SOUND DATA +void SoundFeedStreamData(unsigned char* pSound,long lBytes) +{ +} diff --git a/plugins/dfsound/oss.c b/plugins/dfsound/oss.c new file mode 100644 index 00000000..f4dd215d --- /dev/null +++ b/plugins/dfsound/oss.c @@ -0,0 +1,159 @@ +/*************************************************************************** + oss.c - description + ------------------- + begin : Wed May 15 2002 + copyright : (C) 2002 by Pete Bernert + email : BlackDove@addcom.de + ***************************************************************************/ +/*************************************************************************** + * * + * 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" + +#define _IN_OSS + +#include "externals.h" + +//////////////////////////////////////////////////////////////////////// +// oss globals +//////////////////////////////////////////////////////////////////////// + +#define OSS_MODE_STEREO 1 +#define OSS_MODE_MONO 0 + +#define OSS_SPEED_44100 44100 + +static int oss_audio_fd = -1; +extern int errno; + +//////////////////////////////////////////////////////////////////////// +// SETUP SOUND +//////////////////////////////////////////////////////////////////////// + +void SetupSound(void) +{ + int pspeed=44100; + int pstereo; + int format; + int fragsize = 0; + int myfrag; + int oss_speed, oss_stereo; + + if(iDisStereo) pstereo=OSS_MODE_MONO; + else pstereo=OSS_MODE_STEREO; + + oss_speed = pspeed; + oss_stereo = pstereo; + + if((oss_audio_fd=open("/dev/dsp",O_WRONLY,0))==-1) + { + printf("Sound device not available!\n"); + return; + } + + if(ioctl(oss_audio_fd,SNDCTL_DSP_RESET,0)==-1) + { + printf("Sound reset failed\n"); + return; + } + + // we use 64 fragments with 1024 bytes each + + fragsize=10; + myfrag=(63<<16)|fragsize; + + if(ioctl(oss_audio_fd,SNDCTL_DSP_SETFRAGMENT,&myfrag)==-1) + { + printf("Sound set fragment failed!\n"); + return; + } + + format = AFMT_S16_NE; + + if(ioctl(oss_audio_fd,SNDCTL_DSP_SETFMT,&format) == -1) + { + printf("Sound format not supported!\n"); + return; + } + + if(format!=AFMT_S16_NE) + { + printf("Sound format not supported!\n"); + return; + } + + if(ioctl(oss_audio_fd,SNDCTL_DSP_STEREO,&oss_stereo)==-1) + { + printf("Stereo mode not supported!\n"); + return; + } + + if(oss_stereo!=1) + { + iDisStereo=1; + } + + if(ioctl(oss_audio_fd,SNDCTL_DSP_SPEED,&oss_speed)==-1) + { + printf("Sound frequency not supported\n"); + return; + } + + if(oss_speed!=pspeed) + { + printf("Sound frequency not supported\n"); + return; + } +} + +//////////////////////////////////////////////////////////////////////// +// REMOVE SOUND +//////////////////////////////////////////////////////////////////////// + +void RemoveSound(void) +{ + if(oss_audio_fd != -1 ) + { + close(oss_audio_fd); + oss_audio_fd = -1; + } +} + +//////////////////////////////////////////////////////////////////////// +// GET BYTES BUFFERED +//////////////////////////////////////////////////////////////////////// + +unsigned long SoundGetBytesBuffered(void) +{ + audio_buf_info info; + unsigned long l; + + if(oss_audio_fd == -1) return SOUNDSIZE; + if(ioctl(oss_audio_fd,SNDCTL_DSP_GETOSPACE,&info)==-1) + l=0; + else + { + if(info.fragments<(info.fragstotal>>1)) // can we write in at least the half of fragments? + l=SOUNDSIZE; // -> no? wait + else l=0; // -> else go on + } + + return l; +} + +//////////////////////////////////////////////////////////////////////// +// FEED SOUND DATA +//////////////////////////////////////////////////////////////////////// + +void SoundFeedStreamData(unsigned char* pSound,long lBytes) +{ + if(oss_audio_fd == -1) return; + write(oss_audio_fd,pSound,lBytes); +} diff --git a/plugins/dfsound/pulseaudio.c b/plugins/dfsound/pulseaudio.c new file mode 100644 index 00000000..db0fed71 --- /dev/null +++ b/plugins/dfsound/pulseaudio.c @@ -0,0 +1,354 @@ +/*************************************************************************** + pulseaudio.c - description + ------------------- +begin : Thu Feb 04 2010 +copyright : (C) 2010 by Tristin Celestin +email : cetris1@umbc.edu +comment : Much of this was taken from simple.c, in the pulseaudio + library +***************************************************************************/ +/*************************************************************************** + * * + * 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 USEPULSEAUDIO + +#define _IN_OSS + +#include "externals.h" +#include <pulse/pulseaudio.h> + +//////////////////////////////////////////////////////////////////////// +// pulseaudio structs +//////////////////////////////////////////////////////////////////////// + +typedef struct { + pa_threaded_mainloop *mainloop; + pa_context *context; + pa_mainloop_api *api; + pa_stream *stream; + pa_sample_spec spec; + int first; +} Device; + +typedef struct { + unsigned int frequency; + unsigned int latency_in_msec; +} Settings; + +//////////////////////////////////////////////////////////////////////// +// pulseaudio globals +//////////////////////////////////////////////////////////////////////// + +static Device device = { + .mainloop = NULL, + .api = NULL, + .context = NULL, + .stream = NULL +}; + +static Settings settings = { + .frequency = 44100, + .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 +//////////////////////////////////////////////////////////////////////// + +void SetupSound (void) +{ + int error_number; + + // Acquire mainloop /////////////////////////////////////////////////////// + device.mainloop = pa_threaded_mainloop_new (); + if (device.mainloop == NULL) + { + fprintf (stderr, "Could not acquire PulseAudio main loop\n"); + return; + } + + // Acquire context //////////////////////////////////////////////////////// + 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"); + return; + } + + // Connect to PulseAudio server /////////////////////////////////////////// + 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; + } + + // Run mainloop until sever context is ready ////////////////////////////// + pa_threaded_mainloop_lock (device.mainloop); + if (pa_threaded_mainloop_start (device.mainloop) < 0) + { + fprintf (stderr, "Could not start mainloop\n"); + return; + } + + pa_context_state_t context_state; + context_state = pa_context_get_state (device.context); + while (context_state != PA_CONTEXT_READY) + { + context_state = pa_context_get_state (device.context); + if (! PA_CONTEXT_IS_GOOD (context_state)) + { + 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); + pa_threaded_mainloop_wait (device.mainloop); + } + + // Set sample spec //////////////////////////////////////////////////////// + device.spec.format = PA_SAMPLE_S16LE; + if (iDisStereo) + device.spec.channels = 1; + else + device.spec.channels = 2; + device.spec.rate = settings.frequency; + + 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 ////////////////////////////////////////// + device.stream = pa_stream_new (device.context, "PCSX", &device.spec, NULL); + if (device.stream == NULL) + { + error_number = pa_context_errno (device.context); + fprintf (stderr, "Could not acquire new PulseAudio stream: %s\n", pa_strerror (error_number)); + return; + } + + // 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; + stream_state = pa_stream_get_state (device.stream); + while (stream_state != PA_STREAM_READY) + { + stream_state = pa_stream_get_state (device.stream); + + if (stream_state == PA_STREAM_READY) + break; + + else if (! PA_STREAM_IS_GOOD (stream_state)) + { + 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); + pa_threaded_mainloop_wait (device.mainloop); + } + + 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_unref (device.stream); + device.stream = NULL; + + } + if (device.context != NULL) + { + pa_context_disconnect (device.context); + pa_context_unref (device.context); + device.context = NULL; + } + + if (device.mainloop != NULL) + { + pa_threaded_mainloop_free (device.mainloop); + device.mainloop = NULL; + } + +} + +//////////////////////////////////////////////////////////////////////// +// GET BYTES BUFFERED +//////////////////////////////////////////////////////////////////////// + +unsigned long SoundGetBytesBuffered (void) +{ + int free_space; + int error_code; + long latency; + int playing = 0; + + if ((device.mainloop == NULL) || (device.api == NULL) || ( device.context == NULL) || (device.stream == NULL)) + return SOUNDSIZE; + + 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) + { + // Don't buffer anymore, just play + //fprintf (stderr, "Not buffering.\n"); + return SOUNDSIZE; + } + else + { + // Buffer some sound + //fprintf (stderr, "Buffering.\n"); + return 0; + } +} + +//////////////////////////////////////////////////////////////////////// +// FEED SOUND DATA +//////////////////////////////////////////////////////////////////////// + +void SoundFeedStreamData (unsigned char *pSound, long lBytes) +{ + int error_code; + int size; + + 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/spu.c b/plugins/dfsound/spu.c index 5dd54126..9e532cb0 100644 --- a/plugins/dfsound/spu.c +++ b/plugins/dfsound/spu.c @@ -36,8 +36,16 @@ #if defined (USEMACOSX) static char * libraryName = N_("Mac OS X Sound"); -#else +#elif defined (USEALSA) +static char * libraryName = N_("ALSA Sound"); +#elif defined (USEOSS) +static char * libraryName = N_("OSS Sound"); +#elif defined (USESDL) static char * libraryName = N_("SDL Sound"); +#elif defined (USEPULSEAUDIO) +static char * libraryName = N_("PulseAudio Sound"); +#else +static char * libraryName = N_("NULL Sound"); #endif static char * libraryInfo = N_("P.E.Op.S. Sound Driver V1.7\nCoded by Pete Bernert and the P.E.Op.S. team\n"); diff --git a/plugins/dfxvideo/Makefile.in b/plugins/dfxvideo/Makefile.in index a84f060e..411b7add 100644 --- a/plugins/dfxvideo/Makefile.in +++ b/plugins/dfxvideo/Makefile.in @@ -110,6 +110,8 @@ ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ @@ -189,6 +191,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PEOPSXGL = @PEOPSXGL@ PKG_CONFIG = @PKG_CONFIG@ POSUB = @POSUB@ +PULSEAUDIO_CFLAGS = @PULSEAUDIO_CFLAGS@ +PULSEAUDIO_LIBS = @PULSEAUDIO_LIBS@ RANLIB = @RANLIB@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ diff --git a/plugins/peopsxgl/Makefile.in b/plugins/peopsxgl/Makefile.in index ad45ee69..f4d4725a 100644 --- a/plugins/peopsxgl/Makefile.in +++ b/plugins/peopsxgl/Makefile.in @@ -102,6 +102,8 @@ ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ @@ -181,6 +183,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PEOPSXGL = @PEOPSXGL@ PKG_CONFIG = @PKG_CONFIG@ POSUB = @POSUB@ +PULSEAUDIO_CFLAGS = @PULSEAUDIO_CFLAGS@ +PULSEAUDIO_LIBS = @PULSEAUDIO_LIBS@ RANLIB = @RANLIB@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: pcsxr 1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-05-19 16:31+0800\n" +"POT-Creation-Date: 2010-05-21 08:44+0800\n" "PO-Revision-Date: 2010-03-15 16:00+0200\n" "Last-Translator: Giovanni Scafora <giovanni@archlinux.org>\n" "Language-Team: Arch Linux Italian Team <giovanni@archlinux.org>\n" @@ -1565,11 +1565,11 @@ msgstr "Versione PPF non supportata (%d).\n" msgid "Loaded PPF %d.0 patch: %s.\n" msgstr "Caricata la patch PPF %d.0: %s.\n" -#: ../libpcsxcore/psxmem.c:76 +#: ../libpcsxcore/psxmem.c:78 msgid "Error allocating memory!" msgstr "Si è verificato un errore durante l'allocazione della memoria!" -#: ../libpcsxcore/psxmem.c:114 +#: ../libpcsxcore/psxmem.c:119 #, c-format msgid "Could not open BIOS:\"%s\". Enabling HLE Bios!\n" msgstr "Impossibile aprire il BIOS:\"%s\". Sto abilitando il bios HLE!\n" @@ -2226,11 +2226,28 @@ msgid "Mac OS X Sound" msgstr "Audio Mac OS X" #: ../plugins/dfsound/spu.c:40 +msgid "ALSA Sound" +msgstr "Audio ALSA" + +#: ../plugins/dfsound/spu.c:42 +#, fuzzy +msgid "OSS Sound" +msgstr "Audio OSS" + +#: ../plugins/dfsound/spu.c:44 #, fuzzy msgid "SDL Sound" msgstr "Audio OSS" -#: ../plugins/dfsound/spu.c:43 +#: ../plugins/dfsound/spu.c:46 +msgid "PulseAudio Sound" +msgstr "Audio PulseAudio" + +#: ../plugins/dfsound/spu.c:48 +msgid "NULL Sound" +msgstr "Senza audio" + +#: ../plugins/dfsound/spu.c:51 #, fuzzy msgid "" "P.E.Op.S. Sound Driver V1.7\n" @@ -3057,15 +3074,6 @@ msgstr "Tasto Start" msgid "Play Offline" msgstr "" -#~ msgid "ALSA Sound" -#~ msgstr "Audio ALSA" - -#~ msgid "PulseAudio Sound" -#~ msgstr "Audio PulseAudio" - -#~ msgid "NULL Sound" -#~ msgstr "Senza audio" - #, fuzzy #~ msgid "Dump Memory..." #~ msgstr "&Memory card..." diff --git a/po/pcsx.pot b/po/pcsx.pot index 961cb884..4d889347 100644 --- a/po/pcsx.pot +++ b/po/pcsx.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-05-19 16:31+0800\n" +"POT-Creation-Date: 2010-05-21 08:44+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -1489,11 +1489,11 @@ msgstr "" msgid "Loaded PPF %d.0 patch: %s.\n" msgstr "" -#: ../libpcsxcore/psxmem.c:76 +#: ../libpcsxcore/psxmem.c:78 msgid "Error allocating memory!" msgstr "" -#: ../libpcsxcore/psxmem.c:114 +#: ../libpcsxcore/psxmem.c:119 #, c-format msgid "Could not open BIOS:\"%s\". Enabling HLE Bios!\n" msgstr "" @@ -2110,10 +2110,26 @@ msgid "Mac OS X Sound" msgstr "" #: ../plugins/dfsound/spu.c:40 +msgid "ALSA Sound" +msgstr "" + +#: ../plugins/dfsound/spu.c:42 +msgid "OSS Sound" +msgstr "" + +#: ../plugins/dfsound/spu.c:44 msgid "SDL Sound" msgstr "" -#: ../plugins/dfsound/spu.c:43 +#: ../plugins/dfsound/spu.c:46 +msgid "PulseAudio Sound" +msgstr "" + +#: ../plugins/dfsound/spu.c:48 +msgid "NULL Sound" +msgstr "" + +#: ../plugins/dfsound/spu.c:51 msgid "" "P.E.Op.S. Sound Driver V1.7\n" "Coded by Pete Bernert and the P.E.Op.S. team\n" diff --git a/po/pt_BR.po b/po/pt_BR.po index b2872d91..600d68c0 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: pcsx-df\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-05-19 16:31+0800\n" +"POT-Creation-Date: 2010-05-21 08:44+0800\n" "PO-Revision-Date: 2009-11-28 23:57+0700\n" "Last-Translator: Wei Mingzhi <whistler@openoffice.org>\n" "Language-Team: PoBRE <romhackers@gmail.com>\n" @@ -1541,11 +1541,11 @@ msgstr "" msgid "Loaded PPF %d.0 patch: %s.\n" msgstr "Arquivo de estado \"%s\" carregado." -#: ../libpcsxcore/psxmem.c:76 +#: ../libpcsxcore/psxmem.c:78 msgid "Error allocating memory!" msgstr "Erro ao alocar memória!" -#: ../libpcsxcore/psxmem.c:114 +#: ../libpcsxcore/psxmem.c:119 #, c-format msgid "Could not open BIOS:\"%s\". Enabling HLE Bios!\n" msgstr "Não conseguiu abrir a BIOS\"%s\". Usando BIOS HLE!\n" @@ -2198,11 +2198,28 @@ msgid "Mac OS X Sound" msgstr "" #: ../plugins/dfsound/spu.c:40 +msgid "ALSA Sound" +msgstr "Sistema ALSA" + +#: ../plugins/dfsound/spu.c:42 +#, fuzzy +msgid "OSS Sound" +msgstr "Sistema OSS" + +#: ../plugins/dfsound/spu.c:44 #, fuzzy msgid "SDL Sound" msgstr "Sistema OSS" -#: ../plugins/dfsound/spu.c:43 +#: ../plugins/dfsound/spu.c:46 +msgid "PulseAudio Sound" +msgstr "" + +#: ../plugins/dfsound/spu.c:48 +msgid "NULL Sound" +msgstr "Sem som" + +#: ../plugins/dfsound/spu.c:51 #, fuzzy msgid "" "P.E.Op.S. Sound Driver V1.7\n" @@ -3008,12 +3025,6 @@ msgstr "" msgid "Play Offline" msgstr "" -#~ msgid "ALSA Sound" -#~ msgstr "Sistema ALSA" - -#~ msgid "NULL Sound" -#~ msgstr "Sem som" - #, fuzzy #~ msgid "Dump Memory..." #~ msgstr "&Cartões de memória..." diff --git a/po/ru_RU.po b/po/ru_RU.po index 752730dd..c4b88bd9 100644 --- a/po/ru_RU.po +++ b/po/ru_RU.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: pcsxr 1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-05-19 16:31+0800\n" +"POT-Creation-Date: 2010-05-21 08:44+0800\n" "PO-Revision-Date: 2010-05-14 06:01+0400\n" "Last-Translator: Blade_Arma <edgbla@yandex.ru>\n" "Language-Team: American English <kde-i18n-doc@kde.org>\n" @@ -1509,11 +1509,11 @@ msgstr "Неподдерживаемая версия PPF(%d).\n" msgid "Loaded PPF %d.0 patch: %s.\n" msgstr "Загружен PPF %d.0 патч: %s。\n" -#: ../libpcsxcore/psxmem.c:76 +#: ../libpcsxcore/psxmem.c:78 msgid "Error allocating memory!" msgstr "Ошибка выделения памяти!" -#: ../libpcsxcore/psxmem.c:114 +#: ../libpcsxcore/psxmem.c:119 #, c-format msgid "Could not open BIOS:\"%s\". Enabling HLE Bios!\n" msgstr "Could not open BIOS:\"%s\". Enabling HLE Bios!\n" @@ -2157,10 +2157,29 @@ msgstr "" #: ../plugins/dfsound/spu.c:40 #, fuzzy +msgid "ALSA Sound" +msgstr "Звук" + +#: ../plugins/dfsound/spu.c:42 +#, fuzzy +msgid "OSS Sound" +msgstr "Звук" + +#: ../plugins/dfsound/spu.c:44 +#, fuzzy msgid "SDL Sound" msgstr "Звук" -#: ../plugins/dfsound/spu.c:43 +#: ../plugins/dfsound/spu.c:46 +msgid "PulseAudio Sound" +msgstr "" + +#: ../plugins/dfsound/spu.c:48 +#, fuzzy +msgid "NULL Sound" +msgstr "Звук" + +#: ../plugins/dfsound/spu.c:51 msgid "" "P.E.Op.S. Sound Driver V1.7\n" "Coded by Pete Bernert and the P.E.Op.S. team\n" diff --git a/po/zh_CN.po b/po/zh_CN.po index c0a4620b..c55861fa 100644 --- a/po/zh_CN.po +++ b/po/zh_CN.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: pcsxr 1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-05-19 16:31+0800\n" -"PO-Revision-Date: 2010-05-19 16:31+0800\n" +"POT-Creation-Date: 2010-05-21 08:44+0800\n" +"PO-Revision-Date: 2010-05-21 08:45+0800\n" "Last-Translator: Wei Mingzhi <whistler_wmz@users.sourceforge.net>\n" "Language-Team: Simplified Chinese <whistler@openoffice.org>\n" "MIME-Version: 1.0\n" @@ -1618,11 +1618,11 @@ msgstr "不支持的 PPF 补丁版本 (%d)。\n" msgid "Loaded PPF %d.0 patch: %s.\n" msgstr "已加载 PPF %d.0 补丁文件: %s。\n" -#: ../libpcsxcore/psxmem.c:76 +#: ../libpcsxcore/psxmem.c:78 msgid "Error allocating memory!" msgstr "分配内存错误!" -#: ../libpcsxcore/psxmem.c:114 +#: ../libpcsxcore/psxmem.c:119 #, c-format msgid "Could not open BIOS:\"%s\". Enabling HLE Bios!\n" msgstr "无法打开 BIOS: \"%s\"。使用内部 HLE Bios。\n" @@ -2291,10 +2291,26 @@ msgid "Mac OS X Sound" msgstr "Mac OS X 声音" #: ../plugins/dfsound/spu.c:40 +msgid "ALSA Sound" +msgstr "ALSA 声音" + +#: ../plugins/dfsound/spu.c:42 +msgid "OSS Sound" +msgstr "OSS 声音" + +#: ../plugins/dfsound/spu.c:44 msgid "SDL Sound" msgstr "SDL 声音" -#: ../plugins/dfsound/spu.c:43 +#: ../plugins/dfsound/spu.c:46 +msgid "PulseAudio Sound" +msgstr "PulseAudio 声音" + +#: ../plugins/dfsound/spu.c:48 +msgid "NULL Sound" +msgstr "空声音" + +#: ../plugins/dfsound/spu.c:51 msgid "" "P.E.Op.S. Sound Driver V1.7\n" "Coded by Pete Bernert and the P.E.Op.S. team\n" @@ -3139,10 +3155,3 @@ msgstr "开始游戏" msgid "Play Offline" msgstr "离线运行" -#~ msgid "ALSA Sound" -#~ msgstr "ALSA 声音" -#~ msgid "PulseAudio Sound" -#~ msgstr "PulseAudio 声音" -#~ msgid "NULL Sound" -#~ msgstr "空声音" - diff --git a/po/zh_TW.po b/po/zh_TW.po index bc8c7c14..43bdcb74 100644 --- a/po/zh_TW.po +++ b/po/zh_TW.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: pcsxr 1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-05-19 16:31+0800\n" -"PO-Revision-Date: 2010-05-19 16:32+0800\n" +"POT-Creation-Date: 2010-05-21 08:44+0800\n" +"PO-Revision-Date: 2010-05-21 08:45+0800\n" "Last-Translator: Wei Mingzhi <whistler_wmz@users.sourceforge.net>\n" "Language-Team: Traditional Chinese <whistler@openoffice.org>\n" "MIME-Version: 1.0\n" @@ -1618,11 +1618,11 @@ msgstr "不支援的 PPF 補丁版本 (%d)。\n" msgid "Loaded PPF %d.0 patch: %s.\n" msgstr "已加載 PPF %d.0 補丁: %s。\n" -#: ../libpcsxcore/psxmem.c:76 +#: ../libpcsxcore/psxmem.c:78 msgid "Error allocating memory!" msgstr "分配記憶體錯誤!" -#: ../libpcsxcore/psxmem.c:114 +#: ../libpcsxcore/psxmem.c:119 #, c-format msgid "Could not open BIOS:\"%s\". Enabling HLE Bios!\n" msgstr "無法開啟 BIOS: \"%s\"。使用內部 HLE Bios。\n" @@ -2291,10 +2291,26 @@ msgid "Mac OS X Sound" msgstr "Mac OS X 聲音" #: ../plugins/dfsound/spu.c:40 +msgid "ALSA Sound" +msgstr "ALSA 聲音" + +#: ../plugins/dfsound/spu.c:42 +msgid "OSS Sound" +msgstr "OSS 聲音" + +#: ../plugins/dfsound/spu.c:44 msgid "SDL Sound" msgstr "SDL 聲音" -#: ../plugins/dfsound/spu.c:43 +#: ../plugins/dfsound/spu.c:46 +msgid "PulseAudio Sound" +msgstr "PulseAudio 聲音" + +#: ../plugins/dfsound/spu.c:48 +msgid "NULL Sound" +msgstr "NULL 聲音" + +#: ../plugins/dfsound/spu.c:51 msgid "" "P.E.Op.S. Sound Driver V1.7\n" "Coded by Pete Bernert and the P.E.Op.S. team\n" @@ -3139,10 +3155,3 @@ msgstr "開始遊戲" msgid "Play Offline" msgstr "離線遊戲" -#~ msgid "ALSA Sound" -#~ msgstr "ALSA 聲音" -#~ msgid "PulseAudio Sound" -#~ msgstr "PulseAudio 聲音" -#~ msgid "NULL Sound" -#~ msgstr "NULL 聲音" - |
