[PATCH 2/5] dsound: Add support for enumerating capture devices through openal, try 2
Maarten Lankhorst
m.b.lankhorst at gmail.com
Tue Dec 1 05:02:58 CST 2009
---
configure | 227 ++++---
configure.ac | 6 +-
dlls/dsound/Makefile.in | 1 +
dlls/dsound/capture.c | 1499 +-----------------------------------------
dlls/dsound/dsound_main.c | 447 +++++++++++--
dlls/dsound/dsound_private.h | 213 ++++---
include/config.h.in | 55 +-
7 files changed, 717 insertions(+), 1731 deletions(-)
diff --git a/configure b/configure
index 80036e2..f3fa9c8 100755
--- a/configure
+++ b/configure
@@ -1,12 +1,14 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.64 for Wine 1.1.33.
+# Generated by GNU Autoconf 2.65 for Wine 1.1.33.
#
# Report bugs to <wine-devel at winehq.org>.
#
+#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software
-# Foundation, Inc.
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+#
#
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
@@ -527,7 +529,8 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-exec 7<&0 </dev/null 6>&1
+test -n "$DJDIR" || exec 7<&0 </dev/null
+exec 6>&1
# Name of the host.
# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
@@ -654,6 +657,7 @@ CROSSTARGETFLAGS
CROSSTEST
CROSSCC
CARBONLIB
+DSOUND_OPENAL
LIBOPENAL
COREAUDIO
DISKARBITRATIONLIB
@@ -1506,7 +1510,7 @@ Some influential environment variables:
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
LIBS libraries to pass to the linker, e.g. -l<library>
- CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
+ CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
CXX C++ compiler command
CXXFLAGS C++ compiler flags
@@ -1581,7 +1585,7 @@ test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
Wine configure 1.1.33
-generated by GNU Autoconf 2.64
+generated by GNU Autoconf 2.65
Copyright (C) 2009 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
@@ -1628,7 +1632,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
- return $ac_retval
+ as_fn_set_status $ac_retval
} # ac_fn_c_try_compile
@@ -1666,7 +1670,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
- return $ac_retval
+ as_fn_set_status $ac_retval
} # ac_fn_cxx_try_compile
@@ -1712,7 +1716,7 @@ fi
# left behind by Apple's compiler. We do this before executing the actions.
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
- return $ac_retval
+ as_fn_set_status $ac_retval
} # ac_fn_c_try_link
@@ -1749,7 +1753,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
- return $ac_retval
+ as_fn_set_status $ac_retval
} # ac_fn_c_try_cpp
@@ -1884,7 +1888,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
- return $ac_retval
+ as_fn_set_status $ac_retval
} # ac_fn_c_try_run
@@ -2101,7 +2105,7 @@ This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by Wine $as_me 1.1.33, which was
-generated by GNU Autoconf 2.64. Invocation command line was
+generated by GNU Autoconf 2.65. Invocation command line was
$ $0 $@
@@ -2354,7 +2358,7 @@ fi
for ac_site_file in "$ac_site_file1" "$ac_site_file2"
do
test "x$ac_site_file" = xNONE && continue
- if test -r "$ac_site_file"; then
+ if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
$as_echo "$as_me: loading site script $ac_site_file" >&6;}
sed 's/^/| /' "$ac_site_file" >&5
@@ -2363,9 +2367,9 @@ $as_echo "$as_me: loading site script $ac_site_file" >&6;}
done
if test -r "$cache_file"; then
- # Some versions of bash will fail to source /dev/null (special
- # files actually), so we avoid doing that.
- if test -f "$cache_file"; then
+ # Some versions of bash will fail to source /dev/null (special files
+ # actually), so we avoid doing that. DJGPP emulates it as a regular file.
+ if test /dev/null != "$cache_file" && test -f "$cache_file"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
$as_echo "$as_me: loading cache $cache_file" >&6;}
case $cache_file in
@@ -3175,32 +3179,30 @@ $as_echo "$ac_try_echo"; } >&5
... rest of stderr output deleted ...
10q' conftest.err >conftest.er1
cat conftest.er1 >&5
- rm -f conftest.er1 conftest.err
fi
+ rm -f conftest.er1 conftest.err
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
done
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-#include <stdio.h>
+
int
main ()
{
-FILE *f = fopen ("conftest.out", "w");
- return ferror (f) || fclose (f) != 0;
;
return 0;
}
_ACEOF
ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out conftest.out"
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
# Try to create an executable without -o first, disregard a.out.
# It will help us diagnose broken compilers, and finding out an intuition
# of exeext.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
-$as_echo_n "checking for C compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
# The possible output files:
@@ -3262,10 +3264,10 @@ test "$ac_cv_exeext" = no && ac_cv_exeext=
else
ac_file=''
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
-$as_echo "$ac_file" >&6; }
if test -z "$ac_file"; then :
- $as_echo "$as_me: failed program was:" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
@@ -3273,51 +3275,18 @@ $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
{ as_fn_set_status 77
as_fn_error "C compiler cannot create executables
See \`config.log' for more details." "$LINENO" 5; }; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
ac_exeext=$ac_cv_exeext
-# Check that the compiler produces executables we can run. If not, either
-# the compiler is broken, or we cross compile.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
-$as_echo_n "checking whether the C compiler works... " >&6; }
-# If not cross compiling, check that we can run a simple program.
-if test "$cross_compiling" != yes; then
- if { ac_try='./$ac_file'
- { { case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then
- cross_compiling=no
- else
- if test "$cross_compiling" = maybe; then
- cross_compiling=yes
- else
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." "$LINENO" 5; }
- fi
- fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
-rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out conftest.out
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
ac_clean_files=$ac_clean_files_save
-# Check that the compiler produces executables we can run. If not, either
-# the compiler is broken, or we cross compile.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
-$as_echo_n "checking whether we are cross compiling... " >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
-$as_echo "$cross_compiling" >&6; }
-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
$as_echo_n "checking for suffix of executables... " >&6; }
if { { ac_try="$ac_link"
@@ -3350,13 +3319,72 @@ $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error "cannot compute suffix of executables: cannot compile and link
See \`config.log' for more details." "$LINENO" 5; }
fi
-rm -f conftest$ac_cv_exeext
+rm -f conftest conftest$ac_cv_exeext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
$as_echo "$ac_cv_exeext" >&6; }
rm -f conftest.$ac_ext
EXEEXT=$ac_cv_exeext
ac_exeext=$EXEEXT
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdio.h>
+int
+main ()
+{
+FILE *f = fopen ("conftest.out", "w");
+ return ferror (f) || fclose (f) != 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files="$ac_clean_files conftest.out"
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+if test "$cross_compiling" != yes; then
+ { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ if { ac_try='./conftest$ac_cv_exeext'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error "cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." "$LINENO" 5; }
+ fi
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
+ac_clean_files=$ac_clean_files_save
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
$as_echo_n "checking for suffix of object files... " >&6; }
if test "${ac_cv_objext+set}" = set; then :
@@ -3750,8 +3778,8 @@ $as_echo "$ac_try_echo"; } >&5
... rest of stderr output deleted ...
10q' conftest.err >conftest.er1
cat conftest.er1 >&5
- rm -f conftest.er1 conftest.err
fi
+ rm -f conftest.er1 conftest.err
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
done
@@ -6503,6 +6531,11 @@ fi
then
LIBOPENAL="-framework OpenAL"
+ DSOUND_OPENAL="-framework OpenAL"
+
+
+$as_echo "#define SONAME_LIBOPENAL RTLD_DEFAULT" >>confdefs.h
+
ac_cv_lib_openal_alGetSource3i=yes
fi
if test "$ac_cv_header_IOKit_hid_IOHIDLib_h" = "yes"
@@ -11278,14 +11311,14 @@ test "x$ac_cv_lib_mpg123_mpg123_feed" = xyes || enable_winemp3_acm=${enable_wine
if test "$ac_cv_header_AL_al_h" = "yes"
then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for alGetSource3i in -lopenal" >&5
-$as_echo_n "checking for alGetSource3i in -lopenal... " >&6; }
-if test "${ac_cv_lib_openal_alGetSource3i+set}" = set; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -lopenal" >&5
+$as_echo_n "checking for -lopenal... " >&6; }
+if test "${ac_cv_lib_soname_openal+set}" = set; then :
$as_echo_n "(cached) " >&6
else
- ac_check_lib_save_LIBS=$LIBS
+ ac_check_soname_save_LIBS=$LIBS
LIBS="-lopenal $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
@@ -11304,27 +11337,37 @@ return alGetSource3i ();
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_openal_alGetSource3i=yes
-else
- ac_cv_lib_openal_alGetSource3i=no
+ case "$LIBEXT" in
+ dll) ;;
+ dylib) ac_cv_lib_soname_openal=`otool -L conftest$ac_exeext | grep "libopenal\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libopenal\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;;
+ *) ac_cv_lib_soname_openal=`$ac_cv_path_LDD conftest$ac_exeext | grep "libopenal\\.$LIBEXT" | sed -e "s/^.*\(libopenal\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'` ;;
+ esac
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+ LIBS=$ac_check_soname_save_LIBS
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_openal_alGetSource3i" >&5
-$as_echo "$ac_cv_lib_openal_alGetSource3i" >&6; }
-if test "x$ac_cv_lib_openal_alGetSource3i" = x""yes; then :
- LIBOPENAL="-lopenal"
+if test "x$ac_cv_lib_soname_openal" = "x"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
-fi
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_openal" >&5
+$as_echo "$ac_cv_lib_soname_openal" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define SONAME_LIBOPENAL "$ac_cv_lib_soname_openal"
+_ACEOF
+ LIBOPENAL="-lopenal"
+
+fi
fi
if test "x$ac_cv_lib_openal_alGetSource3i" != xyes; then :
case "x$with_openal" in
- x) wine_notices="$wine_notices|libopenal ${notice_platform}development files not found (or too old), OpenAL won't be supported." ;;
+ x) wine_notices="$wine_notices|libopenal ${notice_platform}development files not found (or too old), OpenAL won't be supported, and DirectSound will not be available." ;;
xno) ;;
- *) as_fn_error "libopenal ${notice_platform}development files not found (or too old), OpenAL won't be supported.
+ *) as_fn_error "libopenal ${notice_platform}development files not found (or too old), OpenAL won't be supported, and DirectSound will not be available.
This is an error since --with-openal was requested." "$LINENO" 5 ;;
esac
fi
@@ -18612,7 +18655,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# values after options handling.
ac_log="
This file was extended by Wine $as_me 1.1.33, which was
-generated by GNU Autoconf 2.64. Invocation command line was
+generated by GNU Autoconf 2.65. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
@@ -18652,6 +18695,7 @@ Usage: $0 [OPTION]... [TAG]...
-h, --help print this help, then exit
-V, --version print version number and configuration settings, then exit
+ --config print configuration, then exit
-q, --quiet, --silent
do not print progress messages
-d, --debug don't remove temporary files
@@ -18675,10 +18719,11 @@ Wine home page: <http://www.winehq.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
Wine config.status 1.1.33
-configured by $0, generated by GNU Autoconf 2.64,
- with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+configured by $0, generated by GNU Autoconf 2.65,
+ with options \\"\$ac_cs_config\\"
Copyright (C) 2009 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
@@ -18714,6 +18759,8 @@ do
ac_cs_recheck=: ;;
--version | --versio | --versi | --vers | --ver | --ve | --v | -V )
$as_echo "$ac_cs_version"; exit ;;
+ --config | --confi | --conf | --con | --co | --c )
+ $as_echo "$ac_cs_config"; exit ;;
--debug | --debu | --deb | --de | --d | -d )
debug=: ;;
--file | --fil | --fi | --f )
@@ -19462,7 +19509,7 @@ s/'"$ac_delim"'$//
t delim
:nl
h
-s/\(.\{148\}\).*/\1/
+s/\(.\{148\}\)..*/\1/
t more1
s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
p
@@ -19476,7 +19523,7 @@ s/.\{148\}//
t nl
:delim
h
-s/\(.\{148\}\).*/\1/
+s/\(.\{148\}\)..*/\1/
t more2
s/["\\]/\\&/g; s/^/"/; s/$/"/
p
diff --git a/configure.ac b/configure.ac
index f178089..51665f2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -634,6 +634,8 @@ case $host_os in
if test "$ac_cv_header_OpenAL_al_h" = "yes"
then
AC_SUBST(LIBOPENAL,"-framework OpenAL")
+ AC_SUBST(DSOUND_OPENAL,"-framework OpenAL")
+ AC_DEFINE(SONAME_LIBOPENAL,RTLD_DEFAULT,[ Define to the soname of the libopenal library.])
ac_cv_lib_openal_alGetSource3i=yes
fi
if test "$ac_cv_header_IOKit_hid_IOHIDLib_h" = "yes"
@@ -1432,10 +1434,10 @@ test "x$ac_cv_lib_mpg123_mpg123_feed" = xyes || enable_winemp3_acm=${enable_wine
dnl **** Check for OpenAL 1.1 ****
if test "$ac_cv_header_AL_al_h" = "yes"
then
- AC_CHECK_LIB(openal,alGetSource3i,[AC_SUBST(LIBOPENAL,"-lopenal")])
+ WINE_CHECK_SONAME(openal,alGetSource3i,[AC_SUBST(LIBOPENAL,"-lopenal")],,)
fi
WINE_NOTICE_WITH(openal,[test "x$ac_cv_lib_openal_alGetSource3i" != xyes],
- [libopenal ${notice_platform}development files not found (or too old), OpenAL won't be supported.])
+ [libopenal ${notice_platform}development files not found (or too old), OpenAL won't be supported, and DirectSound will not be available.])
test "x$ac_cv_lib_openal_alGetSource3i" = xyes || enable_openal32=${enable_openal32:-no}
dnl **** Check for libkstat ****
diff --git a/dlls/dsound/Makefile.in b/dlls/dsound/Makefile.in
index 0b370dc..bb18a68 100644
--- a/dlls/dsound/Makefile.in
+++ b/dlls/dsound/Makefile.in
@@ -5,6 +5,7 @@ VPATH = @srcdir@
MODULE = dsound.dll
IMPORTLIB = dsound
IMPORTS = dxguid uuid winmm ole32 advapi32 kernel32 ntdll
+EXTRALIBS = @DSOUND_OPENAL@
C_SRCS = \
buffer.c \
diff --git a/dlls/dsound/capture.c b/dlls/dsound/capture.c
index 93c711d..19df4fc 100644
--- a/dlls/dsound/capture.c
+++ b/dlls/dsound/capture.c
@@ -1,8 +1,6 @@
-/* DirectSoundCapture
+/* DirectSound capture buffer interface
*
- * Copyright 1998 Marcus Meissner
- * Copyright 1998 Rob Riggs
- * Copyright 2000-2001 TransGaming Technologies, Inc.
+ * Copyright 2009 Maarten Lankhorst
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -18,1502 +16,41 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
-/*
- * TODO:
- * Implement FX support.
- * Implement both IDirectSoundCaptureBuffer and IDirectSoundCaptureBuffer8
- * Make DirectSoundCaptureCreate and DirectSoundCaptureCreate8 behave differently
- */
-
+#include "config.h"
#include <stdarg.h>
+#define COBJMACROS
#define NONAMELESSSTRUCT
#define NONAMELESSUNION
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
+#include "winnls.h"
+#include "winreg.h"
#include "mmsystem.h"
-#include "mmddk.h"
#include "winternl.h"
-#include "winnls.h"
+#include "mmddk.h"
#include "wine/debug.h"
#include "dsound.h"
-#include "dsdriver.h"
#include "dsound_private.h"
-WINE_DEFAULT_DEBUG_CHANNEL(dsound);
-
-/*****************************************************************************
- * IDirectSoundCapture implementation structure
- */
-struct IDirectSoundCaptureImpl
-{
- /* IUnknown fields */
- const IDirectSoundCaptureVtbl *lpVtbl;
- LONG ref;
-
- DirectSoundCaptureDevice *device;
-};
-
-static HRESULT IDirectSoundCaptureImpl_Create(LPDIRECTSOUNDCAPTURE8 * ppds);
-
-
-/*****************************************************************************
- * IDirectSoundCaptureNotify implementation structure
- */
-struct IDirectSoundCaptureNotifyImpl
-{
- /* IUnknown fields */
- const IDirectSoundNotifyVtbl *lpVtbl;
- LONG ref;
- IDirectSoundCaptureBufferImpl* dscb;
-};
-
-static HRESULT IDirectSoundCaptureNotifyImpl_Create(IDirectSoundCaptureBufferImpl *dscb,
- IDirectSoundCaptureNotifyImpl ** pdscn);
-
-
-DirectSoundCaptureDevice * DSOUND_capture[MAXWAVEDRIVERS];
-
-static HRESULT DirectSoundCaptureDevice_Create(DirectSoundCaptureDevice ** ppDevice);
-
-static const char * const captureStateString[] = {
- "STATE_STOPPED",
- "STATE_STARTING",
- "STATE_CAPTURING",
- "STATE_STOPPING"
-};
-
-HRESULT DSOUND_CaptureCreate(
- REFIID riid,
- LPDIRECTSOUNDCAPTURE *ppDSC)
-{
- LPDIRECTSOUNDCAPTURE pDSC;
- HRESULT hr;
- TRACE("(%s, %p)\n", debugstr_guid(riid), ppDSC);
-
- if (!IsEqualIID(riid, &IID_IUnknown) &&
- !IsEqualIID(riid, &IID_IDirectSoundCapture)) {
- *ppDSC = 0;
- return E_NOINTERFACE;
- }
-
- /* Get dsound configuration */
- setup_dsound_options();
-
- hr = IDirectSoundCaptureImpl_Create(&pDSC);
- if (hr == DS_OK) {
- IDirectSoundCapture_AddRef(pDSC);
- *ppDSC = pDSC;
- } else {
- WARN("IDirectSoundCaptureImpl_Create failed\n");
- *ppDSC = 0;
- }
-
- return hr;
-}
-
-HRESULT DSOUND_CaptureCreate8(
- REFIID riid,
- LPDIRECTSOUNDCAPTURE8 *ppDSC8)
-{
- LPDIRECTSOUNDCAPTURE8 pDSC8;
- HRESULT hr;
- TRACE("(%s, %p)\n", debugstr_guid(riid), ppDSC8);
-
- if (!IsEqualIID(riid, &IID_IUnknown) &&
- !IsEqualIID(riid, &IID_IDirectSoundCapture8)) {
- *ppDSC8 = 0;
- return E_NOINTERFACE;
- }
-
- /* Get dsound configuration */
- setup_dsound_options();
-
- hr = IDirectSoundCaptureImpl_Create(&pDSC8);
- if (hr == DS_OK) {
- IDirectSoundCapture_AddRef(pDSC8);
- *ppDSC8 = pDSC8;
- } else {
- WARN("IDirectSoundCaptureImpl_Create failed\n");
- *ppDSC8 = 0;
- }
-
- return hr;
-}
-
-/***************************************************************************
- * DirectSoundCaptureCreate [DSOUND.6]
- *
- * Create and initialize a DirectSoundCapture interface.
- *
- * PARAMS
- * lpcGUID [I] Address of the GUID that identifies the sound capture device.
- * lplpDSC [O] Address of a variable to receive the interface pointer.
- * pUnkOuter [I] Must be NULL.
- *
- * RETURNS
- * Success: DS_OK
- * Failure: DSERR_NOAGGREGATION, DSERR_ALLOCATED, DSERR_INVALIDPARAM,
- * DSERR_OUTOFMEMORY
- *
- * NOTES
- * lpcGUID must be one of the values returned from DirectSoundCaptureEnumerate
- * or NULL for the default device or DSDEVID_DefaultCapture or
- * DSDEVID_DefaultVoiceCapture.
- *
- * DSERR_ALLOCATED is returned for sound devices that do not support full duplex.
- */
-HRESULT WINAPI DirectSoundCaptureCreate(
- LPCGUID lpcGUID,
- LPDIRECTSOUNDCAPTURE *ppDSC,
- LPUNKNOWN pUnkOuter)
-{
- HRESULT hr;
- LPDIRECTSOUNDCAPTURE pDSC;
- TRACE("(%s,%p,%p)\n", debugstr_guid(lpcGUID), ppDSC, pUnkOuter);
-
- if (ppDSC == NULL) {
- WARN("invalid parameter: ppDSC == NULL\n");
- return DSERR_INVALIDPARAM;
- }
-
- if (pUnkOuter) {
- WARN("invalid parameter: pUnkOuter != NULL\n");
- *ppDSC = NULL;
- return DSERR_NOAGGREGATION;
- }
-
- hr = DSOUND_CaptureCreate(&IID_IDirectSoundCapture, &pDSC);
- if (hr == DS_OK) {
- hr = IDirectSoundCapture_Initialize(pDSC, lpcGUID);
- if (hr != DS_OK) {
- IDirectSoundCapture_Release(pDSC);
- pDSC = 0;
- }
- }
-
- *ppDSC = pDSC;
-
- return hr;
-}
-
-/***************************************************************************
- * DirectSoundCaptureCreate8 [DSOUND.12]
- *
- * Create and initialize a DirectSoundCapture interface.
- *
- * PARAMS
- * lpcGUID [I] Address of the GUID that identifies the sound capture device.
- * lplpDSC [O] Address of a variable to receive the interface pointer.
- * pUnkOuter [I] Must be NULL.
- *
- * RETURNS
- * Success: DS_OK
- * Failure: DSERR_NOAGGREGATION, DSERR_ALLOCATED, DSERR_INVALIDPARAM,
- * DSERR_OUTOFMEMORY
- *
- * NOTES
- * lpcGUID must be one of the values returned from DirectSoundCaptureEnumerate
- * or NULL for the default device or DSDEVID_DefaultCapture or
- * DSDEVID_DefaultVoiceCapture.
- *
- * DSERR_ALLOCATED is returned for sound devices that do not support full duplex.
- */
-HRESULT WINAPI DirectSoundCaptureCreate8(
- LPCGUID lpcGUID,
- LPDIRECTSOUNDCAPTURE8 *ppDSC8,
- LPUNKNOWN pUnkOuter)
-{
- HRESULT hr;
- LPDIRECTSOUNDCAPTURE8 pDSC8;
- TRACE("(%s,%p,%p)\n", debugstr_guid(lpcGUID), ppDSC8, pUnkOuter);
-
- if (ppDSC8 == NULL) {
- WARN("invalid parameter: ppDSC8 == NULL\n");
- return DSERR_INVALIDPARAM;
- }
-
- if (pUnkOuter) {
- WARN("invalid parameter: pUnkOuter != NULL\n");
- *ppDSC8 = NULL;
- return DSERR_NOAGGREGATION;
- }
-
- hr = DSOUND_CaptureCreate8(&IID_IDirectSoundCapture8, &pDSC8);
- if (hr == DS_OK) {
- hr = IDirectSoundCapture_Initialize(pDSC8, lpcGUID);
- if (hr != DS_OK) {
- IDirectSoundCapture_Release(pDSC8);
- pDSC8 = 0;
- }
- }
-
- *ppDSC8 = pDSC8;
-
- return hr;
-}
-
-static void capture_CheckNotify(IDirectSoundCaptureBufferImpl *This, DWORD from, DWORD len)
-{
- int i;
- for (i = 0; i < This->nrofnotifies; ++i) {
- LPDSBPOSITIONNOTIFY event = This->notifies + i;
- DWORD offset = event->dwOffset;
- TRACE("checking %d, position %d, event = %p\n", i, offset, event->hEventNotify);
-
- if (offset == DSBPN_OFFSETSTOP) {
- if (!from && !len) {
- SetEvent(event->hEventNotify);
- TRACE("signalled event %p (%d)\n", event->hEventNotify, i);
- return;
- }
- else return;
- }
-
- if (offset >= from && offset < (from + len))
- {
- TRACE("signalled event %p (%d)\n", event->hEventNotify, i);
- SetEvent(event->hEventNotify);
- }
- }
-}
-
-static void CALLBACK
-DSOUND_capture_callback(HWAVEIN hwi, UINT msg, DWORD_PTR dwUser, DWORD_PTR dw1,
- DWORD_PTR dw2)
-{
- DirectSoundCaptureDevice * This = (DirectSoundCaptureDevice*)dwUser;
- IDirectSoundCaptureBufferImpl * Moi = This->capture_buffer;
- TRACE("(%p,%08x(%s),%08lx,%08lx,%08lx) entering at %d\n",hwi,msg,
- msg == MM_WIM_OPEN ? "MM_WIM_OPEN" : msg == MM_WIM_CLOSE ? "MM_WIM_CLOSE" :
- msg == MM_WIM_DATA ? "MM_WIM_DATA" : "UNKNOWN",dwUser,dw1,dw2,GetTickCount());
-
- if (msg == MM_WIM_DATA) {
- EnterCriticalSection( &(This->lock) );
- TRACE("DirectSoundCapture msg=MM_WIM_DATA, old This->state=%s, old This->index=%d\n",
- captureStateString[This->state],This->index);
- if (This->state != STATE_STOPPED) {
- int index = This->index;
- if (This->state == STATE_STARTING)
- This->state = STATE_CAPTURING;
- capture_CheckNotify(Moi, (DWORD_PTR)This->pwave[index].lpData - (DWORD_PTR)This->buffer, This->pwave[index].dwBufferLength);
- This->index = (This->index + 1) % This->nrofpwaves;
- if ( (This->index == 0) && !(This->capture_buffer->flags & DSCBSTART_LOOPING) ) {
- TRACE("end of buffer\n");
- This->state = STATE_STOPPED;
- capture_CheckNotify(Moi, 0, 0);
- } else {
- if (This->state == STATE_CAPTURING) {
- waveInUnprepareHeader(hwi, &(This->pwave[index]), sizeof(WAVEHDR));
- waveInPrepareHeader(hwi, &(This->pwave[index]), sizeof(WAVEHDR));
- waveInAddBuffer(hwi, &(This->pwave[index]), sizeof(WAVEHDR));
- } else if (This->state == STATE_STOPPING) {
- TRACE("stopping\n");
- This->state = STATE_STOPPED;
- }
- }
- }
- TRACE("DirectSoundCapture new This->state=%s, new This->index=%d\n",
- captureStateString[This->state],This->index);
- LeaveCriticalSection( &(This->lock) );
- }
-
- TRACE("completed\n");
-}
-
-/***************************************************************************
- * IDirectSoundCaptureImpl
- */
-static HRESULT WINAPI
-IDirectSoundCaptureImpl_QueryInterface(
- LPDIRECTSOUNDCAPTURE iface,
- REFIID riid,
- LPVOID* ppobj )
-{
- IDirectSoundCaptureImpl *This = (IDirectSoundCaptureImpl *)iface;
- TRACE( "(%p,%s,%p)\n", This, debugstr_guid(riid), ppobj );
-
- if (ppobj == NULL) {
- WARN("invalid parameter\n");
- return E_INVALIDARG;
- }
-
- *ppobj = NULL;
-
- if (IsEqualIID(riid, &IID_IUnknown)) {
- IDirectSoundCapture_AddRef((LPDIRECTSOUNDCAPTURE)This);
- *ppobj = This;
- return DS_OK;
- } else if (IsEqualIID(riid, &IID_IDirectSoundCapture)) {
- IDirectSoundCapture_AddRef((LPDIRECTSOUNDCAPTURE)This);
- *ppobj = This;
- return DS_OK;
- }
-
- WARN("unsupported riid: %s\n", debugstr_guid(riid));
- return E_NOINTERFACE;
-}
-
-static ULONG WINAPI
-IDirectSoundCaptureImpl_AddRef( LPDIRECTSOUNDCAPTURE iface )
-{
- IDirectSoundCaptureImpl *This = (IDirectSoundCaptureImpl *)iface;
- ULONG ref = InterlockedIncrement(&(This->ref));
- TRACE("(%p) ref was %d\n", This, ref - 1);
- return ref;
-}
-
-static ULONG WINAPI
-IDirectSoundCaptureImpl_Release( LPDIRECTSOUNDCAPTURE iface )
-{
- IDirectSoundCaptureImpl *This = (IDirectSoundCaptureImpl *)iface;
- ULONG ref = InterlockedDecrement(&(This->ref));
- TRACE("(%p) ref was %d\n", This, ref + 1);
-
- if (!ref) {
- if (This->device)
- DirectSoundCaptureDevice_Release(This->device);
-
- HeapFree( GetProcessHeap(), 0, This );
- TRACE("(%p) released\n", This);
- }
- return ref;
-}
-
-HRESULT WINAPI IDirectSoundCaptureImpl_CreateCaptureBuffer(
- LPDIRECTSOUNDCAPTURE iface,
- LPCDSCBUFFERDESC lpcDSCBufferDesc,
- LPDIRECTSOUNDCAPTUREBUFFER* lplpDSCaptureBuffer,
- LPUNKNOWN pUnk )
-{
- HRESULT hr;
- IDirectSoundCaptureImpl *This = (IDirectSoundCaptureImpl *)iface;
-
- TRACE( "(%p,%p,%p,%p)\n",iface,lpcDSCBufferDesc,lplpDSCaptureBuffer,pUnk);
-
- if (lpcDSCBufferDesc == NULL) {
- WARN("invalid parameter: lpcDSCBufferDesc == NULL)\n");
- return DSERR_INVALIDPARAM;
- }
-
- if (lplpDSCaptureBuffer == NULL) {
- WARN("invalid parameter: lplpDSCaptureBuffer == NULL\n");
- return DSERR_INVALIDPARAM;
- }
-
- if (pUnk != NULL) {
- WARN("invalid parameter: pUnk != NULL\n");
- return DSERR_INVALIDPARAM;
- }
-
- /* FIXME: We can only have one buffer so what do we do here? */
- if (This->device->capture_buffer) {
- WARN("lnvalid parameter: already has buffer\n");
- return DSERR_INVALIDPARAM; /* DSERR_GENERIC ? */
- }
-
- hr = IDirectSoundCaptureBufferImpl_Create(This->device,
- (IDirectSoundCaptureBufferImpl **)lplpDSCaptureBuffer, lpcDSCBufferDesc);
-
- if (hr != DS_OK)
- WARN("IDirectSoundCaptureBufferImpl_Create failed\n");
-
- return hr;
-}
-
-HRESULT WINAPI IDirectSoundCaptureImpl_GetCaps(
- LPDIRECTSOUNDCAPTURE iface,
- LPDSCCAPS lpDSCCaps )
-{
- IDirectSoundCaptureImpl *This = (IDirectSoundCaptureImpl *)iface;
- TRACE("(%p,%p)\n",This,lpDSCCaps);
-
- if (This->device == NULL) {
- WARN("not initialized\n");
- return DSERR_UNINITIALIZED;
- }
-
- if (lpDSCCaps== NULL) {
- WARN("invalid parameter: lpDSCCaps== NULL\n");
- return DSERR_INVALIDPARAM;
- }
-
- if (lpDSCCaps->dwSize < sizeof(*lpDSCCaps)) {
- WARN("invalid parameter: lpDSCCaps->dwSize = %d\n", lpDSCCaps->dwSize);
- return DSERR_INVALIDPARAM;
- }
-
- lpDSCCaps->dwFlags = This->device->drvcaps.dwFlags;
- lpDSCCaps->dwFormats = This->device->drvcaps.dwFormats;
- lpDSCCaps->dwChannels = This->device->drvcaps.dwChannels;
-
- TRACE("(flags=0x%08x,format=0x%08x,channels=%d)\n",lpDSCCaps->dwFlags,
- lpDSCCaps->dwFormats, lpDSCCaps->dwChannels);
-
- return DS_OK;
-}
-
-HRESULT WINAPI IDirectSoundCaptureImpl_Initialize(
- LPDIRECTSOUNDCAPTURE iface,
- LPCGUID lpcGUID )
-{
- IDirectSoundCaptureImpl *This = (IDirectSoundCaptureImpl *)iface;
- TRACE("(%p,%s)\n", This, debugstr_guid(lpcGUID));
-
- if (This->device != NULL) {
- WARN("already initialized\n");
- return DSERR_ALREADYINITIALIZED;
- }
- return DirectSoundCaptureDevice_Initialize(&This->device, lpcGUID);
-}
-
-static const IDirectSoundCaptureVtbl dscvt =
-{
- /* IUnknown methods */
- IDirectSoundCaptureImpl_QueryInterface,
- IDirectSoundCaptureImpl_AddRef,
- IDirectSoundCaptureImpl_Release,
-
- /* IDirectSoundCapture methods */
- IDirectSoundCaptureImpl_CreateCaptureBuffer,
- IDirectSoundCaptureImpl_GetCaps,
- IDirectSoundCaptureImpl_Initialize
-};
-
-static HRESULT IDirectSoundCaptureImpl_Create(
- LPDIRECTSOUNDCAPTURE8 * ppDSC)
-{
- IDirectSoundCaptureImpl *pDSC;
- TRACE("(%p)\n", ppDSC);
-
- /* Allocate memory */
- pDSC = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirectSoundCaptureImpl));
- if (pDSC == NULL) {
- WARN("out of memory\n");
- *ppDSC = NULL;
- return DSERR_OUTOFMEMORY;
- }
-
- pDSC->lpVtbl = &dscvt;
- pDSC->ref = 0;
- pDSC->device = NULL;
-
- *ppDSC = (LPDIRECTSOUNDCAPTURE8)pDSC;
-
- return DS_OK;
-}
-
-/*******************************************************************************
- * IDirectSoundCaptureNotify
- */
-static HRESULT WINAPI IDirectSoundCaptureNotifyImpl_QueryInterface(
- LPDIRECTSOUNDNOTIFY iface,
- REFIID riid,
- LPVOID *ppobj)
-{
- IDirectSoundCaptureNotifyImpl *This = (IDirectSoundCaptureNotifyImpl *)iface;
- TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
-
- if (This->dscb == NULL) {
- WARN("invalid parameter\n");
- return E_INVALIDARG;
- }
-
- return IDirectSoundCaptureBuffer_QueryInterface((LPDIRECTSOUNDCAPTUREBUFFER)This->dscb, riid, ppobj);
-}
-
-static ULONG WINAPI IDirectSoundCaptureNotifyImpl_AddRef(LPDIRECTSOUNDNOTIFY iface)
-{
- IDirectSoundCaptureNotifyImpl *This = (IDirectSoundCaptureNotifyImpl *)iface;
- ULONG ref = InterlockedIncrement(&(This->ref));
- TRACE("(%p) ref was %d\n", This, ref - 1);
- return ref;
-}
-
-static ULONG WINAPI IDirectSoundCaptureNotifyImpl_Release(LPDIRECTSOUNDNOTIFY iface)
-{
- IDirectSoundCaptureNotifyImpl *This = (IDirectSoundCaptureNotifyImpl *)iface;
- ULONG ref = InterlockedDecrement(&(This->ref));
- TRACE("(%p) ref was %d\n", This, ref + 1);
-
- if (!ref) {
- if (This->dscb->hwnotify)
- IDsDriverNotify_Release(This->dscb->hwnotify);
- This->dscb->notify=NULL;
- IDirectSoundCaptureBuffer_Release((LPDIRECTSOUNDCAPTUREBUFFER)This->dscb);
- HeapFree(GetProcessHeap(),0,This);
- TRACE("(%p) released\n", This);
- }
- return ref;
-}
-
-static HRESULT WINAPI IDirectSoundCaptureNotifyImpl_SetNotificationPositions(
- LPDIRECTSOUNDNOTIFY iface,
- DWORD howmuch,
- LPCDSBPOSITIONNOTIFY notify)
-{
- IDirectSoundCaptureNotifyImpl *This = (IDirectSoundCaptureNotifyImpl *)iface;
- TRACE("(%p,0x%08x,%p)\n",This,howmuch,notify);
-
- if (howmuch > 0 && notify == NULL) {
- WARN("invalid parameter: notify == NULL\n");
- return DSERR_INVALIDPARAM;
- }
-
- if (TRACE_ON(dsound)) {
- unsigned int i;
- for (i=0;i<howmuch;i++)
- TRACE("notify at %d to %p\n",
- notify[i].dwOffset,notify[i].hEventNotify);
- }
-
- if (This->dscb->hwnotify) {
- HRESULT hres;
- hres = IDsDriverNotify_SetNotificationPositions(This->dscb->hwnotify, howmuch, notify);
- if (hres != DS_OK)
- WARN("IDsDriverNotify_SetNotificationPositions failed\n");
- return hres;
- } else if (howmuch > 0) {
- /* Make an internal copy of the caller-supplied array.
- * Replace the existing copy if one is already present. */
- if (This->dscb->notifies)
- This->dscb->notifies = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
- This->dscb->notifies, howmuch * sizeof(DSBPOSITIONNOTIFY));
- else
- This->dscb->notifies = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
- howmuch * sizeof(DSBPOSITIONNOTIFY));
-
- if (This->dscb->notifies == NULL) {
- WARN("out of memory\n");
- return DSERR_OUTOFMEMORY;
- }
- CopyMemory(This->dscb->notifies, notify, howmuch * sizeof(DSBPOSITIONNOTIFY));
- This->dscb->nrofnotifies = howmuch;
- } else {
- HeapFree(GetProcessHeap(), 0, This->dscb->notifies);
- This->dscb->notifies = NULL;
- This->dscb->nrofnotifies = 0;
- }
-
- return S_OK;
-}
-
-static const IDirectSoundNotifyVtbl dscnvt =
-{
- IDirectSoundCaptureNotifyImpl_QueryInterface,
- IDirectSoundCaptureNotifyImpl_AddRef,
- IDirectSoundCaptureNotifyImpl_Release,
- IDirectSoundCaptureNotifyImpl_SetNotificationPositions,
-};
-
-static HRESULT IDirectSoundCaptureNotifyImpl_Create(
- IDirectSoundCaptureBufferImpl *dscb,
- IDirectSoundCaptureNotifyImpl **pdscn)
-{
- IDirectSoundCaptureNotifyImpl * dscn;
- TRACE("(%p,%p)\n",dscb,pdscn);
-
- dscn = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*dscn));
-
- if (dscn == NULL) {
- WARN("out of memory\n");
- return DSERR_OUTOFMEMORY;
- }
-
- dscn->ref = 0;
- dscn->lpVtbl = &dscnvt;
- dscn->dscb = dscb;
- dscb->notify = dscn;
- IDirectSoundCaptureBuffer_AddRef((LPDIRECTSOUNDCAPTUREBUFFER)dscb);
-
- *pdscn = dscn;
- return DS_OK;
-}
-
-/*******************************************************************************
- * IDirectSoundCaptureBuffer
- */
-static HRESULT WINAPI
-IDirectSoundCaptureBufferImpl_QueryInterface(
- LPDIRECTSOUNDCAPTUREBUFFER8 iface,
- REFIID riid,
- LPVOID* ppobj )
-{
- IDirectSoundCaptureBufferImpl *This = (IDirectSoundCaptureBufferImpl *)iface;
- HRESULT hres;
- TRACE( "(%p,%s,%p)\n", This, debugstr_guid(riid), ppobj );
-
- if (ppobj == NULL) {
- WARN("invalid parameter\n");
- return E_INVALIDARG;
- }
-
- *ppobj = NULL;
-
- if ( IsEqualGUID( &IID_IDirectSoundNotify, riid ) ) {
- if (!This->notify)
- hres = IDirectSoundCaptureNotifyImpl_Create(This, &This->notify);
- if (This->notify) {
- IDirectSoundNotify_AddRef((LPDIRECTSOUNDNOTIFY)This->notify);
- if (This->device->hwbuf && !This->hwnotify) {
- hres = IDsCaptureDriverBuffer_QueryInterface(This->device->hwbuf,
- &IID_IDsDriverNotify, (LPVOID*)&(This->hwnotify));
- if (hres != DS_OK) {
- WARN("IDsCaptureDriverBuffer_QueryInterface failed\n");
- IDirectSoundNotify_Release((LPDIRECTSOUNDNOTIFY)This->notify);
- *ppobj = 0;
- return hres;
- }
- }
-
- *ppobj = This->notify;
- return DS_OK;
- }
+#include "ks.h"
+#include "ksmedia.h"
- WARN("IID_IDirectSoundNotify\n");
- return E_FAIL;
- }
-
- if ( IsEqualGUID( &IID_IDirectSoundCaptureBuffer, riid ) ||
- IsEqualGUID( &IID_IDirectSoundCaptureBuffer8, riid ) ) {
- IDirectSoundCaptureBuffer8_AddRef(iface);
- *ppobj = This;
- return NO_ERROR;
- }
-
- FIXME("(%p,%s,%p) unsupported GUID\n", This, debugstr_guid(riid), ppobj);
- return E_NOINTERFACE;
-}
-
-static ULONG WINAPI
-IDirectSoundCaptureBufferImpl_AddRef( LPDIRECTSOUNDCAPTUREBUFFER8 iface )
-{
- IDirectSoundCaptureBufferImpl *This = (IDirectSoundCaptureBufferImpl *)iface;
- ULONG ref = InterlockedIncrement(&(This->ref));
- TRACE("(%p) ref was %d\n", This, ref - 1);
- return ref;
-}
-
-static ULONG WINAPI
-IDirectSoundCaptureBufferImpl_Release( LPDIRECTSOUNDCAPTUREBUFFER8 iface )
-{
- IDirectSoundCaptureBufferImpl *This = (IDirectSoundCaptureBufferImpl *)iface;
- ULONG ref = InterlockedDecrement(&(This->ref));
- TRACE("(%p) ref was %d\n", This, ref + 1);
-
- if (!ref) {
- TRACE("deleting object\n");
- if (This->device->state == STATE_CAPTURING)
- This->device->state = STATE_STOPPING;
-
- HeapFree(GetProcessHeap(),0, This->pdscbd);
-
- if (This->device->hwi) {
- waveInReset(This->device->hwi);
- waveInClose(This->device->hwi);
- HeapFree(GetProcessHeap(),0, This->device->pwave);
- This->device->pwave = 0;
- This->device->hwi = 0;
- }
-
- if (This->device->hwbuf)
- IDsCaptureDriverBuffer_Release(This->device->hwbuf);
-
- /* remove from DirectSoundCaptureDevice */
- This->device->capture_buffer = NULL;
-
- if (This->notify)
- IDirectSoundNotify_Release((LPDIRECTSOUNDNOTIFY)This->notify);
-
- /* If driver manages its own buffer, IDsCaptureDriverBuffer_Release
- should have freed the buffer. Prevent freeing it again in
- IDirectSoundCaptureBufferImpl_Create */
- if (!(This->device->drvdesc.dwFlags & DSDDESC_USESYSTEMMEMORY))
- This->device->buffer = NULL;
-
- HeapFree(GetProcessHeap(), 0, This->notifies);
- HeapFree( GetProcessHeap(), 0, This );
- TRACE("(%p) released\n", This);
- }
- return ref;
-}
-
-static HRESULT WINAPI
-IDirectSoundCaptureBufferImpl_GetCaps(
- LPDIRECTSOUNDCAPTUREBUFFER8 iface,
- LPDSCBCAPS lpDSCBCaps )
-{
- IDirectSoundCaptureBufferImpl *This = (IDirectSoundCaptureBufferImpl *)iface;
- TRACE( "(%p,%p)\n", This, lpDSCBCaps );
-
- if (lpDSCBCaps == NULL) {
- WARN("invalid parameter: lpDSCBCaps == NULL\n");
- return DSERR_INVALIDPARAM;
- }
-
- if (lpDSCBCaps->dwSize < sizeof(DSCBCAPS)) {
- WARN("invalid parameter: lpDSCBCaps->dwSize = %d\n", lpDSCBCaps->dwSize);
- return DSERR_INVALIDPARAM;
- }
-
- if (This->device == NULL) {
- WARN("invalid parameter: This->device == NULL\n");
- return DSERR_INVALIDPARAM;
- }
-
- lpDSCBCaps->dwSize = sizeof(DSCBCAPS);
- lpDSCBCaps->dwFlags = This->flags;
- lpDSCBCaps->dwBufferBytes = This->pdscbd->dwBufferBytes;
- lpDSCBCaps->dwReserved = 0;
-
- TRACE("returning DS_OK\n");
- return DS_OK;
-}
-
-static HRESULT WINAPI
-IDirectSoundCaptureBufferImpl_GetCurrentPosition(
- LPDIRECTSOUNDCAPTUREBUFFER8 iface,
- LPDWORD lpdwCapturePosition,
- LPDWORD lpdwReadPosition )
-{
- IDirectSoundCaptureBufferImpl *This = (IDirectSoundCaptureBufferImpl *)iface;
- HRESULT hres = DS_OK;
- TRACE( "(%p,%p,%p)\n", This, lpdwCapturePosition, lpdwReadPosition );
-
- if (This->device == NULL) {
- WARN("invalid parameter: This->device == NULL\n");
- return DSERR_INVALIDPARAM;
- }
-
- if (This->device->driver) {
- hres = IDsCaptureDriverBuffer_GetPosition(This->device->hwbuf, lpdwCapturePosition, lpdwReadPosition );
- if (hres != DS_OK)
- WARN("IDsCaptureDriverBuffer_GetPosition failed\n");
- } else if (This->device->hwi) {
- DWORD pos;
-
- EnterCriticalSection(&This->device->lock);
- pos = (DWORD_PTR)This->device->pwave[This->device->index].lpData - (DWORD_PTR)This->device->buffer;
- if (lpdwCapturePosition)
- *lpdwCapturePosition = (This->device->pwave[This->device->index].dwBufferLength + pos) % This->device->buflen;
- if (lpdwReadPosition)
- *lpdwReadPosition = pos;
- LeaveCriticalSection(&This->device->lock);
-
- } else {
- WARN("no driver\n");
- hres = DSERR_NODRIVER;
- }
-
- TRACE("cappos=%d readpos=%d\n", (lpdwCapturePosition?*lpdwCapturePosition:-1), (lpdwReadPosition?*lpdwReadPosition:-1));
- TRACE("returning %08x\n", hres);
- return hres;
-}
-
-static HRESULT WINAPI
-IDirectSoundCaptureBufferImpl_GetFormat(
- LPDIRECTSOUNDCAPTUREBUFFER8 iface,
- LPWAVEFORMATEX lpwfxFormat,
- DWORD dwSizeAllocated,
- LPDWORD lpdwSizeWritten )
-{
- IDirectSoundCaptureBufferImpl *This = (IDirectSoundCaptureBufferImpl *)iface;
- HRESULT hres = DS_OK;
- TRACE( "(%p,%p,0x%08x,%p)\n", This, lpwfxFormat, dwSizeAllocated,
- lpdwSizeWritten );
-
- if (This->device == NULL) {
- WARN("invalid parameter: This->device == NULL\n");
- return DSERR_INVALIDPARAM;
- }
-
- if (dwSizeAllocated > (sizeof(WAVEFORMATEX) + This->device->pwfx->cbSize))
- dwSizeAllocated = sizeof(WAVEFORMATEX) + This->device->pwfx->cbSize;
-
- if (lpwfxFormat) { /* NULL is valid (just want size) */
- CopyMemory(lpwfxFormat, This->device->pwfx, dwSizeAllocated);
- if (lpdwSizeWritten)
- *lpdwSizeWritten = dwSizeAllocated;
- } else {
- if (lpdwSizeWritten)
- *lpdwSizeWritten = sizeof(WAVEFORMATEX) + This->device->pwfx->cbSize;
- else {
- TRACE("invalid parameter: lpdwSizeWritten = NULL\n");
- hres = DSERR_INVALIDPARAM;
- }
- }
-
- TRACE("returning %08x\n", hres);
- return hres;
-}
-
-static HRESULT WINAPI
-IDirectSoundCaptureBufferImpl_GetStatus(
- LPDIRECTSOUNDCAPTUREBUFFER8 iface,
- LPDWORD lpdwStatus )
-{
- IDirectSoundCaptureBufferImpl *This = (IDirectSoundCaptureBufferImpl *)iface;
- TRACE( "(%p, %p), thread is %04x\n", This, lpdwStatus, GetCurrentThreadId() );
-
- if (This->device == NULL) {
- WARN("invalid parameter: This->device == NULL\n");
- return DSERR_INVALIDPARAM;
- }
-
- if (lpdwStatus == NULL) {
- WARN("invalid parameter: lpdwStatus == NULL\n");
- return DSERR_INVALIDPARAM;
- }
-
- *lpdwStatus = 0;
- EnterCriticalSection(&(This->device->lock));
-
- TRACE("old This->device->state=%s, old lpdwStatus=%08x\n",
- captureStateString[This->device->state],*lpdwStatus);
- if ((This->device->state == STATE_STARTING) ||
- (This->device->state == STATE_CAPTURING)) {
- *lpdwStatus |= DSCBSTATUS_CAPTURING;
- if (This->flags & DSCBSTART_LOOPING)
- *lpdwStatus |= DSCBSTATUS_LOOPING;
- }
- TRACE("new This->device->state=%s, new lpdwStatus=%08x\n",
- captureStateString[This->device->state],*lpdwStatus);
- LeaveCriticalSection(&(This->device->lock));
-
- TRACE("status=%x\n", *lpdwStatus);
- TRACE("returning DS_OK\n");
- return DS_OK;
-}
-
-static HRESULT WINAPI
-IDirectSoundCaptureBufferImpl_Initialize(
- LPDIRECTSOUNDCAPTUREBUFFER8 iface,
- LPDIRECTSOUNDCAPTURE lpDSC,
- LPCDSCBUFFERDESC lpcDSCBDesc )
-{
- IDirectSoundCaptureBufferImpl *This = (IDirectSoundCaptureBufferImpl *)iface;
-
- FIXME( "(%p,%p,%p): stub\n", This, lpDSC, lpcDSCBDesc );
-
- return DS_OK;
-}
-
-static HRESULT WINAPI
-IDirectSoundCaptureBufferImpl_Lock(
- LPDIRECTSOUNDCAPTUREBUFFER8 iface,
- DWORD dwReadCusor,
- DWORD dwReadBytes,
- LPVOID* lplpvAudioPtr1,
- LPDWORD lpdwAudioBytes1,
- LPVOID* lplpvAudioPtr2,
- LPDWORD lpdwAudioBytes2,
- DWORD dwFlags )
-{
- HRESULT hres = DS_OK;
- IDirectSoundCaptureBufferImpl *This = (IDirectSoundCaptureBufferImpl *)iface;
- TRACE( "(%p,%08u,%08u,%p,%p,%p,%p,0x%08x) at %d\n", This, dwReadCusor,
- dwReadBytes, lplpvAudioPtr1, lpdwAudioBytes1, lplpvAudioPtr2,
- lpdwAudioBytes2, dwFlags, GetTickCount() );
-
- if (This->device == NULL) {
- WARN("invalid parameter: This->device == NULL\n");
- return DSERR_INVALIDPARAM;
- }
-
- if (lplpvAudioPtr1 == NULL) {
- WARN("invalid parameter: lplpvAudioPtr1 == NULL\n");
- return DSERR_INVALIDPARAM;
- }
-
- if (lpdwAudioBytes1 == NULL) {
- WARN("invalid parameter: lpdwAudioBytes1 == NULL\n");
- return DSERR_INVALIDPARAM;
- }
-
- EnterCriticalSection(&(This->device->lock));
-
- if (This->device->driver) {
- hres = IDsCaptureDriverBuffer_Lock(This->device->hwbuf, lplpvAudioPtr1,
- lpdwAudioBytes1, lplpvAudioPtr2,
- lpdwAudioBytes2, dwReadCusor,
- dwReadBytes, dwFlags);
- if (hres != DS_OK)
- WARN("IDsCaptureDriverBuffer_Lock failed\n");
- } else if (This->device->hwi) {
- *lplpvAudioPtr1 = This->device->buffer + dwReadCusor;
- if ( (dwReadCusor + dwReadBytes) > This->device->buflen) {
- *lpdwAudioBytes1 = This->device->buflen - dwReadCusor;
- if (lplpvAudioPtr2)
- *lplpvAudioPtr2 = This->device->buffer;
- if (lpdwAudioBytes2)
- *lpdwAudioBytes2 = dwReadBytes - *lpdwAudioBytes1;
- } else {
- *lpdwAudioBytes1 = dwReadBytes;
- if (lplpvAudioPtr2)
- *lplpvAudioPtr2 = 0;
- if (lpdwAudioBytes2)
- *lpdwAudioBytes2 = 0;
- }
- } else {
- TRACE("invalid call\n");
- hres = DSERR_INVALIDCALL; /* DSERR_NODRIVER ? */
- }
-
- LeaveCriticalSection(&(This->device->lock));
-
- TRACE("returning %08x\n", hres);
- return hres;
-}
-
-static HRESULT WINAPI
-IDirectSoundCaptureBufferImpl_Start(
- LPDIRECTSOUNDCAPTUREBUFFER8 iface,
- DWORD dwFlags )
-{
- HRESULT hres = DS_OK;
- IDirectSoundCaptureBufferImpl *This = (IDirectSoundCaptureBufferImpl *)iface;
- TRACE( "(%p,0x%08x)\n", This, dwFlags );
-
- if (This->device == NULL) {
- WARN("invalid parameter: This->device == NULL\n");
- return DSERR_INVALIDPARAM;
- }
-
- if ( (This->device->driver == 0) && (This->device->hwi == 0) ) {
- WARN("no driver\n");
- return DSERR_NODRIVER;
- }
-
- EnterCriticalSection(&(This->device->lock));
-
- This->flags = dwFlags;
- TRACE("old This->state=%s\n",captureStateString[This->device->state]);
- if (This->device->state == STATE_STOPPED)
- This->device->state = STATE_STARTING;
- else if (This->device->state == STATE_STOPPING)
- This->device->state = STATE_CAPTURING;
- TRACE("new This->device->state=%s\n",captureStateString[This->device->state]);
-
- LeaveCriticalSection(&(This->device->lock));
-
- if (This->device->driver) {
- hres = IDsCaptureDriverBuffer_Start(This->device->hwbuf, dwFlags);
- if (hres != DS_OK)
- WARN("IDsCaptureDriverBuffer_Start failed\n");
- } else if (This->device->hwi) {
- DirectSoundCaptureDevice *device = This->device;
-
- if (device->buffer) {
- int c;
- DWORD blocksize = DSOUND_fraglen(device->pwfx->nSamplesPerSec, device->pwfx->nBlockAlign);
- device->nrofpwaves = device->buflen / blocksize + !!(device->buflen % blocksize);
- TRACE("nrofpwaves=%d\n", device->nrofpwaves);
-
- /* prepare headers */
- if (device->pwave)
- device->pwave = HeapReAlloc(GetProcessHeap(), 0,device->pwave, device->nrofpwaves*sizeof(WAVEHDR));
- else
- device->pwave = HeapAlloc(GetProcessHeap(), 0, device->nrofpwaves*sizeof(WAVEHDR));
-
- for (c = 0; c < device->nrofpwaves; ++c) {
- device->pwave[c].lpData = (char *)device->buffer + c * blocksize;
- if (c + 1 == device->nrofpwaves)
- device->pwave[c].dwBufferLength = device->buflen - c * blocksize;
- else
- device->pwave[c].dwBufferLength = blocksize;
- device->pwave[c].dwBytesRecorded = 0;
- device->pwave[c].dwUser = (DWORD_PTR)device;
- device->pwave[c].dwFlags = 0;
- device->pwave[c].dwLoops = 0;
- hres = mmErr(waveInPrepareHeader(device->hwi, &(device->pwave[c]),sizeof(WAVEHDR)));
- if (hres != DS_OK) {
- WARN("waveInPrepareHeader failed\n");
- while (c--)
- waveInUnprepareHeader(device->hwi, &(device->pwave[c]),sizeof(WAVEHDR));
- break;
- }
-
- hres = mmErr(waveInAddBuffer(device->hwi, &(device->pwave[c]), sizeof(WAVEHDR)));
- if (hres != DS_OK) {
- WARN("waveInAddBuffer failed\n");
- while (c--)
- waveInUnprepareHeader(device->hwi, &(device->pwave[c]),sizeof(WAVEHDR));
- break;
- }
- }
-
- FillMemory(device->buffer, device->buflen, (device->pwfx->wBitsPerSample == 8) ? 128 : 0);
- }
-
- device->index = 0;
-
- if (hres == DS_OK) {
- /* start filling the first buffer */
- hres = mmErr(waveInStart(device->hwi));
- if (hres != DS_OK)
- WARN("waveInStart failed\n");
- }
-
- if (hres != DS_OK) {
- WARN("calling waveInClose because of error\n");
- waveInClose(device->hwi);
- device->hwi = 0;
- }
- } else {
- WARN("no driver\n");
- hres = DSERR_NODRIVER;
- }
-
- TRACE("returning %08x\n", hres);
- return hres;
-}
-
-static HRESULT WINAPI
-IDirectSoundCaptureBufferImpl_Stop( LPDIRECTSOUNDCAPTUREBUFFER8 iface )
-{
- HRESULT hres = DS_OK;
- IDirectSoundCaptureBufferImpl *This = (IDirectSoundCaptureBufferImpl *)iface;
- TRACE( "(%p)\n", This );
-
- if (This->device == NULL) {
- WARN("invalid parameter: This->device == NULL\n");
- return DSERR_INVALIDPARAM;
- }
-
- EnterCriticalSection(&(This->device->lock));
-
- TRACE("old This->device->state=%s\n",captureStateString[This->device->state]);
- if (This->device->state == STATE_CAPTURING)
- This->device->state = STATE_STOPPING;
- else if (This->device->state == STATE_STARTING)
- This->device->state = STATE_STOPPED;
- TRACE("new This->device->state=%s\n",captureStateString[This->device->state]);
-
- LeaveCriticalSection(&(This->device->lock));
-
- if (This->device->driver) {
- hres = IDsCaptureDriverBuffer_Stop(This->device->hwbuf);
- if (hres != DS_OK)
- WARN("IDsCaptureDriverBuffer_Stop() failed\n");
- } else if (This->device->hwi) {
- hres = mmErr(waveInReset(This->device->hwi));
- if (hres != DS_OK)
- WARN("waveInReset() failed\n");
- } else {
- WARN("no driver\n");
- hres = DSERR_NODRIVER;
- }
-
- TRACE("returning %08x\n", hres);
- return hres;
-}
-
-static HRESULT WINAPI
-IDirectSoundCaptureBufferImpl_Unlock(
- LPDIRECTSOUNDCAPTUREBUFFER8 iface,
- LPVOID lpvAudioPtr1,
- DWORD dwAudioBytes1,
- LPVOID lpvAudioPtr2,
- DWORD dwAudioBytes2 )
-{
- HRESULT hres = DS_OK;
- IDirectSoundCaptureBufferImpl *This = (IDirectSoundCaptureBufferImpl *)iface;
- TRACE( "(%p,%p,%08u,%p,%08u)\n", This, lpvAudioPtr1, dwAudioBytes1,
- lpvAudioPtr2, dwAudioBytes2 );
-
- if (lpvAudioPtr1 == NULL) {
- WARN("invalid parameter: lpvAudioPtr1 == NULL\n");
- return DSERR_INVALIDPARAM;
- }
-
- if (This->device->driver) {
- hres = IDsCaptureDriverBuffer_Unlock(This->device->hwbuf, lpvAudioPtr1,
- dwAudioBytes1, lpvAudioPtr2, dwAudioBytes2);
- if (hres != DS_OK)
- WARN("IDsCaptureDriverBuffer_Unlock failed\n");
- } else if (!This->device->hwi) {
- WARN("invalid call\n");
- hres = DSERR_INVALIDCALL;
- }
-
- TRACE("returning %08x\n", hres);
- return hres;
-}
-
-static HRESULT WINAPI
-IDirectSoundCaptureBufferImpl_GetObjectInPath(
- LPDIRECTSOUNDCAPTUREBUFFER8 iface,
- REFGUID rguidObject,
- DWORD dwIndex,
- REFGUID rguidInterface,
- LPVOID* ppObject )
-{
- IDirectSoundCaptureBufferImpl *This = (IDirectSoundCaptureBufferImpl *)iface;
-
- FIXME( "(%p,%s,%u,%s,%p): stub\n", This, debugstr_guid(rguidObject),
- dwIndex, debugstr_guid(rguidInterface), ppObject );
-
- return DS_OK;
-}
-
-static HRESULT WINAPI
-IDirectSoundCaptureBufferImpl_GetFXStatus(
- LPDIRECTSOUNDCAPTUREBUFFER8 iface,
- DWORD dwFXCount,
- LPDWORD pdwFXStatus )
-{
- IDirectSoundCaptureBufferImpl *This = (IDirectSoundCaptureBufferImpl *)iface;
-
- FIXME( "(%p,%u,%p): stub\n", This, dwFXCount, pdwFXStatus );
-
- return DS_OK;
-}
-
-static const IDirectSoundCaptureBuffer8Vtbl dscbvt =
-{
- /* IUnknown methods */
- IDirectSoundCaptureBufferImpl_QueryInterface,
- IDirectSoundCaptureBufferImpl_AddRef,
- IDirectSoundCaptureBufferImpl_Release,
-
- /* IDirectSoundCaptureBuffer methods */
- IDirectSoundCaptureBufferImpl_GetCaps,
- IDirectSoundCaptureBufferImpl_GetCurrentPosition,
- IDirectSoundCaptureBufferImpl_GetFormat,
- IDirectSoundCaptureBufferImpl_GetStatus,
- IDirectSoundCaptureBufferImpl_Initialize,
- IDirectSoundCaptureBufferImpl_Lock,
- IDirectSoundCaptureBufferImpl_Start,
- IDirectSoundCaptureBufferImpl_Stop,
- IDirectSoundCaptureBufferImpl_Unlock,
-
- /* IDirectSoundCaptureBuffer methods */
- IDirectSoundCaptureBufferImpl_GetObjectInPath,
- IDirectSoundCaptureBufferImpl_GetFXStatus
-};
-
-HRESULT IDirectSoundCaptureBufferImpl_Create(
- DirectSoundCaptureDevice *device,
- IDirectSoundCaptureBufferImpl ** ppobj,
- LPCDSCBUFFERDESC lpcDSCBufferDesc)
-{
- LPWAVEFORMATEX wfex;
- TRACE( "(%p,%p,%p)\n", device, ppobj, lpcDSCBufferDesc);
-
- if (ppobj == NULL) {
- WARN("invalid parameter: ppobj == NULL\n");
- return DSERR_INVALIDPARAM;
- }
-
- if (!device) {
- WARN("not initialized\n");
- *ppobj = NULL;
- return DSERR_UNINITIALIZED;
- }
-
- if (lpcDSCBufferDesc == NULL) {
- WARN("invalid parameter: lpcDSCBufferDesc == NULL\n");
- *ppobj = NULL;
- return DSERR_INVALIDPARAM;
- }
-
- if ( ((lpcDSCBufferDesc->dwSize != sizeof(DSCBUFFERDESC)) &&
- (lpcDSCBufferDesc->dwSize != sizeof(DSCBUFFERDESC1))) ||
- (lpcDSCBufferDesc->dwBufferBytes == 0) ||
- (lpcDSCBufferDesc->lpwfxFormat == NULL) ) { /* FIXME: DSERR_BADFORMAT ? */
- WARN("invalid lpcDSCBufferDesc\n");
- *ppobj = NULL;
- return DSERR_INVALIDPARAM;
- }
-
- wfex = lpcDSCBufferDesc->lpwfxFormat;
-
- TRACE("(formattag=0x%04x,chans=%d,samplerate=%d,"
- "bytespersec=%d,blockalign=%d,bitspersamp=%d,cbSize=%d)\n",
- wfex->wFormatTag, wfex->nChannels, wfex->nSamplesPerSec,
- wfex->nAvgBytesPerSec, wfex->nBlockAlign,
- wfex->wBitsPerSample, wfex->cbSize);
-
- device->pwfx = DSOUND_CopyFormat(wfex);
- if ( device->pwfx == NULL ) {
- *ppobj = NULL;
- return DSERR_OUTOFMEMORY;
- }
-
- *ppobj = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,
- sizeof(IDirectSoundCaptureBufferImpl));
-
- if ( *ppobj == NULL ) {
- WARN("out of memory\n");
- *ppobj = NULL;
- return DSERR_OUTOFMEMORY;
- } else {
- HRESULT err = DS_OK;
- LPBYTE newbuf;
- DWORD buflen;
- IDirectSoundCaptureBufferImpl *This = *ppobj;
-
- This->ref = 1;
- This->device = device;
- This->device->capture_buffer = This;
- This->notify = NULL;
- This->nrofnotifies = 0;
- This->hwnotify = NULL;
-
- This->pdscbd = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,
- lpcDSCBufferDesc->dwSize);
- if (This->pdscbd)
- CopyMemory(This->pdscbd, lpcDSCBufferDesc, lpcDSCBufferDesc->dwSize);
- else {
- WARN("no memory\n");
- This->device->capture_buffer = 0;
- HeapFree( GetProcessHeap(), 0, This );
- *ppobj = NULL;
- return DSERR_OUTOFMEMORY;
- }
-
- This->lpVtbl = &dscbvt;
-
- if (device->driver) {
- if (This->device->drvdesc.dwFlags & DSDDESC_DOMMSYSTEMOPEN)
- FIXME("DSDDESC_DOMMSYSTEMOPEN not supported\n");
-
- if (This->device->drvdesc.dwFlags & DSDDESC_USESYSTEMMEMORY) {
- /* allocate buffer from system memory */
- buflen = lpcDSCBufferDesc->dwBufferBytes;
- TRACE("desired buflen=%d, old buffer=%p\n", buflen, device->buffer);
- if (device->buffer)
- newbuf = HeapReAlloc(GetProcessHeap(),0,device->buffer,buflen);
- else
- newbuf = HeapAlloc(GetProcessHeap(),0,buflen);
-
- if (newbuf == NULL) {
- WARN("failed to allocate capture buffer\n");
- err = DSERR_OUTOFMEMORY;
- /* but the old buffer might still exist and must be re-prepared */
- } else {
- device->buffer = newbuf;
- device->buflen = buflen;
- }
- } else {
- /* let driver allocate memory */
- device->buflen = lpcDSCBufferDesc->dwBufferBytes;
- /* FIXME: */
- HeapFree( GetProcessHeap(), 0, device->buffer);
- device->buffer = NULL;
- }
-
- err = IDsCaptureDriver_CreateCaptureBuffer(device->driver,
- device->pwfx,0,0,&(device->buflen),&(device->buffer),(LPVOID*)&(device->hwbuf));
- if (err != DS_OK) {
- WARN("IDsCaptureDriver_CreateCaptureBuffer failed\n");
- This->device->capture_buffer = 0;
- HeapFree( GetProcessHeap(), 0, This );
- *ppobj = NULL;
- return err;
- }
- } else {
- DWORD flags = CALLBACK_FUNCTION;
- err = mmErr(waveInOpen(&(device->hwi),
- device->drvdesc.dnDevNode, device->pwfx,
- (DWORD_PTR)DSOUND_capture_callback, (DWORD_PTR)device, flags));
- if (err != DS_OK) {
- WARN("waveInOpen failed\n");
- This->device->capture_buffer = 0;
- HeapFree( GetProcessHeap(), 0, This );
- *ppobj = NULL;
- return err;
- }
-
- buflen = lpcDSCBufferDesc->dwBufferBytes;
- TRACE("desired buflen=%d, old buffer=%p\n", buflen, device->buffer);
- if (device->buffer)
- newbuf = HeapReAlloc(GetProcessHeap(),0,device->buffer,buflen);
- else
- newbuf = HeapAlloc(GetProcessHeap(),0,buflen);
- if (newbuf == NULL) {
- WARN("failed to allocate capture buffer\n");
- err = DSERR_OUTOFMEMORY;
- /* but the old buffer might still exist and must be re-prepared */
- } else {
- device->buffer = newbuf;
- device->buflen = buflen;
- }
- }
- }
-
- TRACE("returning DS_OK\n");
- return DS_OK;
-}
-
-/*******************************************************************************
- * DirectSoundCaptureDevice
- */
-HRESULT DirectSoundCaptureDevice_Initialize(
- DirectSoundCaptureDevice ** ppDevice,
- LPCGUID lpcGUID)
-{
- HRESULT err = DSERR_INVALIDPARAM;
- unsigned wid, widn;
- BOOLEAN found = FALSE;
- GUID devGUID;
- DirectSoundCaptureDevice *device = *ppDevice;
- TRACE("(%p, %s)\n", ppDevice, debugstr_guid(lpcGUID));
-
- /* Default device? */
- if ( !lpcGUID || IsEqualGUID(lpcGUID, &GUID_NULL) )
- lpcGUID = &DSDEVID_DefaultCapture;
-
- if (GetDeviceID(lpcGUID, &devGUID) != DS_OK) {
- WARN("invalid parameter: lpcGUID\n");
- return DSERR_INVALIDPARAM;
- }
-
- widn = waveInGetNumDevs();
- if (!widn) {
- WARN("no audio devices found\n");
- return DSERR_NODRIVER;
- }
-
- /* enumerate WINMM audio devices and find the one we want */
- for (wid=0; wid<widn; wid++) {
- if (IsEqualGUID( &devGUID, &DSOUND_capture_guids[wid]) ) {
- found = TRUE;
- break;
- }
- }
-
- if (found == FALSE) {
- WARN("No device found matching given ID!\n");
- return DSERR_NODRIVER;
- }
-
- if (DSOUND_capture[wid]) {
- WARN("already in use\n");
- return DSERR_ALLOCATED;
- }
-
- err = DirectSoundCaptureDevice_Create(&(device));
- if (err != DS_OK) {
- WARN("DirectSoundCaptureDevice_Create failed\n");
- return err;
- }
-
- *ppDevice = device;
- device->guid = devGUID;
-
- /* Disable the direct sound driver to force emulation if requested. */
- device->driver = NULL;
- if (ds_hw_accel != DS_HW_ACCEL_EMULATION)
- {
- err = mmErr(waveInMessage(UlongToHandle(wid),DRV_QUERYDSOUNDIFACE,(DWORD_PTR)&device->driver,0));
- if ( (err != DS_OK) && (err != DSERR_UNSUPPORTED) ) {
- WARN("waveInMessage failed; err=%x\n",err);
- return err;
- }
- }
- err = DS_OK;
-
- /* Get driver description */
- if (device->driver) {
- TRACE("using DirectSound driver\n");
- err = IDsCaptureDriver_GetDriverDesc(device->driver, &(device->drvdesc));
- if (err != DS_OK) {
- WARN("IDsCaptureDriver_GetDriverDesc failed\n");
- return err;
- }
- } else {
- TRACE("using WINMM\n");
- /* if no DirectSound interface available, use WINMM API instead */
- device->drvdesc.dwFlags = DSDDESC_DOMMSYSTEMOPEN |
- DSDDESC_DOMMSYSTEMSETFORMAT;
- }
-
- device->drvdesc.dnDevNode = wid;
-
- /* open the DirectSound driver if available */
- if (device->driver && (err == DS_OK))
- err = IDsCaptureDriver_Open(device->driver);
-
- if (err == DS_OK) {
- *ppDevice = device;
-
- /* the driver is now open, so it's now allowed to call GetCaps */
- if (device->driver) {
- device->drvcaps.dwSize = sizeof(device->drvcaps);
- err = IDsCaptureDriver_GetCaps(device->driver,&(device->drvcaps));
- if (err != DS_OK) {
- WARN("IDsCaptureDriver_GetCaps failed\n");
- return err;
- }
- } else /*if (device->hwi)*/ {
- WAVEINCAPSA wic;
- err = mmErr(waveInGetDevCapsA((UINT)device->drvdesc.dnDevNode, &wic, sizeof(wic)));
-
- if (err == DS_OK) {
- device->drvcaps.dwFlags = 0;
- lstrcpynA(device->drvdesc.szDrvname, wic.szPname,
- sizeof(device->drvdesc.szDrvname));
-
- device->drvcaps.dwFlags |= DSCCAPS_EMULDRIVER;
- device->drvcaps.dwFormats = wic.dwFormats;
- device->drvcaps.dwChannels = wic.wChannels;
- }
- }
- }
-
- return err;
-}
+WINE_DEFAULT_DEBUG_CHANNEL(dsound);
-static HRESULT DirectSoundCaptureDevice_Create(
- DirectSoundCaptureDevice ** ppDevice)
+/* IDirectSoundCapture and IDirectSoundCapture8 are aliases */
+HRESULT DSOUND_CaptureCreate(REFIID riid, IDirectSoundCapture **cap)
{
- DirectSoundCaptureDevice * device;
- TRACE("(%p)\n", ppDevice);
-
- /* Allocate memory */
- device = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DirectSoundCaptureDevice));
-
- if (device == NULL) {
- WARN("out of memory\n");
- return DSERR_OUTOFMEMORY;
- }
-
- device->ref = 1;
- device->state = STATE_STOPPED;
-
- InitializeCriticalSection( &(device->lock) );
- device->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": DirectSoundCaptureDevice.lock");
-
- *ppDevice = device;
-
- return DS_OK;
+ return DSOUND_CaptureCreate8(riid, cap);
}
-ULONG DirectSoundCaptureDevice_Release(
- DirectSoundCaptureDevice * device)
+HRESULT DSOUND_CaptureCreate8(REFIID riid, IDirectSoundCapture8 **cap)
{
- ULONG ref = InterlockedDecrement(&(device->ref));
- TRACE("(%p) ref was %d\n", device, ref + 1);
-
- if (!ref) {
- TRACE("deleting object\n");
- if (device->capture_buffer)
- IDirectSoundCaptureBufferImpl_Release(
- (LPDIRECTSOUNDCAPTUREBUFFER8) device->capture_buffer);
+ *cap = NULL;
- if (device->driver) {
- IDsCaptureDriver_Close(device->driver);
- IDsCaptureDriver_Release(device->driver);
- }
+ ERR("Attempting to create a sound buffer without OpenAL support\n");
+ ERR("Please recompile wine with OpenAL\n");
- HeapFree(GetProcessHeap(), 0, device->pwfx);
- device->lock.DebugInfo->Spare[0] = 0;
- DeleteCriticalSection( &(device->lock) );
- DSOUND_capture[device->drvdesc.dnDevNode] = NULL;
- HeapFree(GetProcessHeap(), 0, device);
- TRACE("(%p) released\n", device);
- }
- return ref;
+ return DSERR_NODRIVER;
}
diff --git a/dlls/dsound/dsound_main.c b/dlls/dsound/dsound_main.c
index f52a6e9..496f80f 100644
--- a/dlls/dsound/dsound_main.c
+++ b/dlls/dsound/dsound_main.c
@@ -32,7 +32,10 @@
* Remove DS_HEL_FRAGS and use mixer fragment length for it
*/
+#include "config.h"
+#include "wine/port.h"
#include <stdarg.h>
+#include "wine/library.h"
#define COBJMACROS
#define NONAMELESSSTRUCT
@@ -59,7 +62,243 @@ WINE_DEFAULT_DEBUG_CHANNEL(dsound);
DirectSoundDevice* DSOUND_renderer[MAXWAVEDRIVERS];
GUID DSOUND_renderer_guids[MAXWAVEDRIVERS];
-GUID DSOUND_capture_guids[MAXWAVEDRIVERS];
+GUID DSOUND_capture_guid = { 0xbd6dd71b, 0x3deb, 0x11d1, { 0xb1, 0x71, 0x00, 0xc0, 0x4f, 0xc2, 0x00, 0x00 } };
+
+#ifdef SONAME_LIBOPENAL
+
+static CRITICAL_SECTION_DEBUG openal_crst_debug =
+{
+ 0, 0, &openal_crst,
+ { &openal_crst_debug.ProcessLocksList,
+ &openal_crst_debug.ProcessLocksList },
+ 0, 0, { (DWORD_PTR)(__FILE__ ": openal_crst_debug") }
+};
+CRITICAL_SECTION openal_crst = { &openal_crst_debug, -1, 0, 0, 0, 0 };
+
+void *openal_handle = NULL;
+LPALCCREATECONTEXT palcCreateContext = NULL;
+LPALCMAKECONTEXTCURRENT palcMakeContextCurrent = NULL;
+LPALCPROCESSCONTEXT palcProcessContext = NULL;
+LPALCSUSPENDCONTEXT palcSuspendContext = NULL;
+LPALCDESTROYCONTEXT palcDestroyContext = NULL;
+LPALCGETCURRENTCONTEXT palcGetCurrentContext = NULL;
+LPALCGETCONTEXTSDEVICE palcGetContextsDevice = NULL;
+LPALCOPENDEVICE palcOpenDevice = NULL;
+LPALCCLOSEDEVICE palcCloseDevice = NULL;
+LPALCGETERROR palcGetError = NULL;
+LPALCISEXTENSIONPRESENT palcIsExtensionPresent = NULL;
+LPALCGETPROCADDRESS palcGetProcAddress = NULL;
+LPALCGETENUMVALUE palcGetEnumValue = NULL;
+LPALCGETSTRING palcGetString = NULL;
+LPALCGETINTEGERV palcGetIntegerv = NULL;
+LPALCCAPTUREOPENDEVICE palcCaptureOpenDevice = NULL;
+LPALCCAPTURECLOSEDEVICE palcCaptureCloseDevice = NULL;
+LPALCCAPTURESTART palcCaptureStart = NULL;
+LPALCCAPTURESTOP palcCaptureStop = NULL;
+LPALCCAPTURESAMPLES palcCaptureSamples = NULL;
+LPALENABLE palEnable = NULL;
+LPALDISABLE palDisable = NULL;
+LPALISENABLED palIsEnabled = NULL;
+LPALGETSTRING palGetString = NULL;
+LPALGETBOOLEANV palGetBooleanv = NULL;
+LPALGETINTEGERV palGetIntegerv = NULL;
+LPALGETFLOATV palGetFloatv = NULL;
+LPALGETDOUBLEV palGetDoublev = NULL;
+LPALGETBOOLEAN palGetBoolean = NULL;
+LPALGETINTEGER palGetInteger = NULL;
+LPALGETFLOAT palGetFloat = NULL;
+LPALGETDOUBLE palGetDouble = NULL;
+LPALGETERROR palGetError = NULL;
+LPALISEXTENSIONPRESENT palIsExtensionPresent = NULL;
+LPALGETPROCADDRESS palGetProcAddress = NULL;
+LPALGETENUMVALUE palGetEnumValue = NULL;
+LPALLISTENERF palListenerf = NULL;
+LPALLISTENER3F palListener3f = NULL;
+LPALLISTENERFV palListenerfv = NULL;
+LPALLISTENERI palListeneri = NULL;
+LPALLISTENER3I palListener3i = NULL;
+LPALLISTENERIV palListeneriv = NULL;
+LPALGETLISTENERF palGetListenerf = NULL;
+LPALGETLISTENER3F palGetListener3f = NULL;
+LPALGETLISTENERFV palGetListenerfv = NULL;
+LPALGETLISTENERI palGetListeneri = NULL;
+LPALGETLISTENER3I palGetListener3i = NULL;
+LPALGETLISTENERIV palGetListeneriv = NULL;
+LPALGENSOURCES palGenSources = NULL;
+LPALDELETESOURCES palDeleteSources = NULL;
+LPALISSOURCE palIsSource = NULL;
+LPALSOURCEF palSourcef = NULL;
+LPALSOURCE3F palSource3f = NULL;
+LPALSOURCEFV palSourcefv = NULL;
+LPALSOURCEI palSourcei = NULL;
+LPALSOURCE3I palSource3i = NULL;
+LPALSOURCEIV palSourceiv = NULL;
+LPALGETSOURCEF palGetSourcef = NULL;
+LPALGETSOURCE3F palGetSource3f = NULL;
+LPALGETSOURCEFV palGetSourcefv = NULL;
+LPALGETSOURCEI palGetSourcei = NULL;
+LPALGETSOURCE3I palGetSource3i = NULL;
+LPALGETSOURCEIV palGetSourceiv = NULL;
+LPALSOURCEPLAYV palSourcePlayv = NULL;
+LPALSOURCESTOPV palSourceStopv = NULL;
+LPALSOURCEREWINDV palSourceRewindv = NULL;
+LPALSOURCEPAUSEV palSourcePausev = NULL;
+LPALSOURCEPLAY palSourcePlay = NULL;
+LPALSOURCESTOP palSourceStop = NULL;
+LPALSOURCEREWIND palSourceRewind = NULL;
+LPALSOURCEPAUSE palSourcePause = NULL;
+LPALSOURCEQUEUEBUFFERS palSourceQueueBuffers = NULL;
+LPALSOURCEUNQUEUEBUFFERS palSourceUnqueueBuffers = NULL;
+LPALGENBUFFERS palGenBuffers = NULL;
+LPALDELETEBUFFERS palDeleteBuffers = NULL;
+LPALISBUFFER palIsBuffer = NULL;
+LPALBUFFERF palBufferf = NULL;
+LPALBUFFER3F palBuffer3f = NULL;
+LPALBUFFERFV palBufferfv = NULL;
+LPALBUFFERI palBufferi = NULL;
+LPALBUFFER3I palBuffer3i = NULL;
+LPALBUFFERIV palBufferiv = NULL;
+LPALGETBUFFERF palGetBufferf = NULL;
+LPALGETBUFFER3F palGetBuffer3f = NULL;
+LPALGETBUFFERFV palGetBufferfv = NULL;
+LPALGETBUFFERI palGetBufferi = NULL;
+LPALGETBUFFER3I palGetBuffer3i = NULL;
+LPALGETBUFFERIV palGetBufferiv = NULL;
+LPALBUFFERDATA palBufferData = NULL;
+LPALDOPPLERFACTOR palDopplerFactor = NULL;
+LPALDOPPLERVELOCITY palDopplerVelocity = NULL;
+LPALDISTANCEMODEL palDistanceModel = NULL;
+LPALSPEEDOFSOUND palSpeedOfSound = NULL;
+
+static void load_libopenal(void)
+{
+ DWORD failed = 0;
+#ifdef HAVE_AL_AL_H
+ char error[128];
+ openal_handle = wine_dlopen(SONAME_LIBOPENAL, RTLD_NOW, error, sizeof(error));
+ if (!openal_handle)
+ ERR("Couldn't load " SONAME_LIBOPENAL ": %s\n", error);
+#else
+ /* Mac is special.. */
+ openal_handle = RTLD_DEFAULT;
+#endif
+
+#define LOAD_FUNCPTR(f) \
+ if((p##f = wine_dlsym(openal_handle, #f, NULL, 0)) == NULL) { \
+ ERR("Couldn't lookup %s in libopenal\n", #f); \
+ failed = 1; \
+ }
+ LOAD_FUNCPTR(alcCreateContext);
+ LOAD_FUNCPTR(alcMakeContextCurrent);
+ LOAD_FUNCPTR(alcProcessContext);
+ LOAD_FUNCPTR(alcSuspendContext);
+ LOAD_FUNCPTR(alcDestroyContext);
+ LOAD_FUNCPTR(alcGetCurrentContext);
+ LOAD_FUNCPTR(alcGetContextsDevice);
+ LOAD_FUNCPTR(alcOpenDevice);
+ LOAD_FUNCPTR(alcCloseDevice);
+ LOAD_FUNCPTR(alcGetError);
+ LOAD_FUNCPTR(alcIsExtensionPresent);
+ LOAD_FUNCPTR(alcGetProcAddress);
+ LOAD_FUNCPTR(alcGetEnumValue);
+ LOAD_FUNCPTR(alcGetString);
+ LOAD_FUNCPTR(alcGetIntegerv);
+ LOAD_FUNCPTR(alcCaptureOpenDevice);
+ LOAD_FUNCPTR(alcCaptureCloseDevice);
+ LOAD_FUNCPTR(alcCaptureStart);
+ LOAD_FUNCPTR(alcCaptureStop);
+ LOAD_FUNCPTR(alcCaptureSamples);
+ LOAD_FUNCPTR(alEnable);
+ LOAD_FUNCPTR(alDisable);
+ LOAD_FUNCPTR(alIsEnabled);
+ LOAD_FUNCPTR(alGetString);
+ LOAD_FUNCPTR(alGetBooleanv);
+ LOAD_FUNCPTR(alGetIntegerv);
+ LOAD_FUNCPTR(alGetFloatv);
+ LOAD_FUNCPTR(alGetDoublev);
+ LOAD_FUNCPTR(alGetBoolean);
+ LOAD_FUNCPTR(alGetInteger);
+ LOAD_FUNCPTR(alGetFloat);
+ LOAD_FUNCPTR(alGetDouble);
+ LOAD_FUNCPTR(alGetError);
+ LOAD_FUNCPTR(alIsExtensionPresent);
+ LOAD_FUNCPTR(alGetProcAddress);
+ LOAD_FUNCPTR(alGetEnumValue);
+ LOAD_FUNCPTR(alListenerf);
+ LOAD_FUNCPTR(alListener3f);
+ LOAD_FUNCPTR(alListenerfv);
+ LOAD_FUNCPTR(alListeneri);
+ LOAD_FUNCPTR(alListener3i);
+ LOAD_FUNCPTR(alListeneriv);
+ LOAD_FUNCPTR(alGetListenerf);
+ LOAD_FUNCPTR(alGetListener3f);
+ LOAD_FUNCPTR(alGetListenerfv);
+ LOAD_FUNCPTR(alGetListeneri);
+ LOAD_FUNCPTR(alGetListener3i);
+ LOAD_FUNCPTR(alGetListeneriv);
+ LOAD_FUNCPTR(alGenSources);
+ LOAD_FUNCPTR(alDeleteSources);
+ LOAD_FUNCPTR(alIsSource);
+ LOAD_FUNCPTR(alSourcef);
+ LOAD_FUNCPTR(alSource3f);
+ LOAD_FUNCPTR(alSourcefv);
+ LOAD_FUNCPTR(alSourcei);
+ LOAD_FUNCPTR(alSource3i);
+ LOAD_FUNCPTR(alSourceiv);
+ LOAD_FUNCPTR(alGetSourcef);
+ LOAD_FUNCPTR(alGetSource3f);
+ LOAD_FUNCPTR(alGetSourcefv);
+ LOAD_FUNCPTR(alGetSourcei);
+ LOAD_FUNCPTR(alGetSource3i);
+ LOAD_FUNCPTR(alGetSourceiv);
+ LOAD_FUNCPTR(alSourcePlayv);
+ LOAD_FUNCPTR(alSourceStopv);
+ LOAD_FUNCPTR(alSourceRewindv);
+ LOAD_FUNCPTR(alSourcePausev);
+ LOAD_FUNCPTR(alSourcePlay);
+ LOAD_FUNCPTR(alSourceStop);
+ LOAD_FUNCPTR(alSourceRewind);
+ LOAD_FUNCPTR(alSourcePause);
+ LOAD_FUNCPTR(alSourceQueueBuffers);
+ LOAD_FUNCPTR(alSourceUnqueueBuffers);
+ LOAD_FUNCPTR(alGenBuffers);
+ LOAD_FUNCPTR(alDeleteBuffers);
+ LOAD_FUNCPTR(alIsBuffer);
+ LOAD_FUNCPTR(alBufferf);
+ LOAD_FUNCPTR(alBuffer3f);
+ LOAD_FUNCPTR(alBufferfv);
+ LOAD_FUNCPTR(alBufferi);
+ LOAD_FUNCPTR(alBuffer3i);
+ LOAD_FUNCPTR(alBufferiv);
+ LOAD_FUNCPTR(alGetBufferf);
+ LOAD_FUNCPTR(alGetBuffer3f);
+ LOAD_FUNCPTR(alGetBufferfv);
+ LOAD_FUNCPTR(alGetBufferi);
+ LOAD_FUNCPTR(alGetBuffer3i);
+ LOAD_FUNCPTR(alGetBufferiv);
+ LOAD_FUNCPTR(alBufferData);
+ LOAD_FUNCPTR(alDopplerFactor);
+ LOAD_FUNCPTR(alDopplerVelocity);
+ LOAD_FUNCPTR(alDistanceModel);
+ LOAD_FUNCPTR(alSpeedOfSound);
+#undef LOAD_FUNCPTR
+ if (failed)
+ {
+ WARN("Unloading openal\n");
+ if (openal_handle != RTLD_DEFAULT)
+ wine_dlclose(openal_handle, NULL, 0);
+ openal_handle = NULL;
+ }
+}
+
+const ALCchar *DSOUND_getcapturedevicestrings(void)
+{
+ const ALCchar *str = NULL;
+ str = palcGetString(NULL, ALC_CAPTURE_DEVICE_SPECIFIER);
+ return str;
+}
+
+#endif /*SONAME_LIBOPENAL*/
HRESULT mmErr(UINT err)
{
@@ -261,8 +500,8 @@ HRESULT WINAPI GetDeviceID(LPCGUID pGuidSrc, LPGUID pGuidDest)
if ( IsEqualGUID( &DSDEVID_DefaultCapture, pGuidSrc ) ||
IsEqualGUID( &DSDEVID_DefaultVoiceCapture, pGuidSrc ) ) {
- *pGuidDest = DSOUND_capture_guids[ds_default_capture];
- TRACE("returns %s\n", get_device_id(pGuidDest));
+ *pGuidDest = DSOUND_capture_guid;
+ TRACE("returns %s\n", debugstr_guid(pGuidDest));
return DS_OK;
}
@@ -435,55 +674,57 @@ DirectSoundCaptureEnumerateW(
LPDSENUMCALLBACKW lpDSEnumCallback,
LPVOID lpContext)
{
- unsigned devs, wid;
- DSDRIVERDESC desc;
- GUID guid;
- int err;
- WCHAR wDesc[MAXPNAMELEN];
- WCHAR wName[MAXPNAMELEN];
-
TRACE("(%p,%p)\n", lpDSEnumCallback, lpContext );
if (lpDSEnumCallback == NULL) {
WARN("invalid parameter: lpDSEnumCallback == NULL\n");
return DSERR_INVALIDPARAM;
}
-
- devs = waveInGetNumDevs();
- if (devs > 0) {
- if (GetDeviceID(&DSDEVID_DefaultCapture, &guid) == DS_OK) {
- for (wid = 0; wid < devs; ++wid) {
- if (IsEqualGUID( &guid, &DSOUND_capture_guids[wid] ) ) {
- err = mmErr(waveInMessage(UlongToHandle(wid),DRV_QUERYDSOUNDDESC,(DWORD_PTR)&desc,0));
- if (err == DS_OK) {
- TRACE("calling lpDSEnumCallback(NULL,\"%s\",\"%s\",%p)\n",
- "Primary Sound Capture Driver",desc.szDrvname,lpContext);
- MultiByteToWideChar( CP_ACP, 0, "Primary Sound Capture Driver", -1,
- wDesc, sizeof(wDesc)/sizeof(WCHAR) );
- MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1,
- wName, sizeof(wName)/sizeof(WCHAR) );
- if (lpDSEnumCallback(NULL, wDesc, wName, lpContext) == FALSE)
- return DS_OK;
- }
- }
- }
- }
- }
-
- for (wid = 0; wid < devs; ++wid) {
- err = mmErr(waveInMessage(UlongToHandle(wid),DRV_QUERYDSOUNDDESC,(DWORD_PTR)&desc,0));
- if (err == DS_OK) {
+#ifdef SONAME_LIBOPENAL
+ else if (openal_handle)
+ {
+ GUID guid;
+ WCHAR wDesc[MAXPNAMELEN];
+ WCHAR wName[MAXPNAMELEN];
+ const ALCchar *devstr;
+ static const WCHAR empty[] = { 0 };
+
+ EnterCriticalSection(&openal_crst);
+ devstr = DSOUND_getcapturedevicestrings();
+ if (!devstr || !*devstr)
+ goto out;
+
+ TRACE("calling lpDSEnumCallback(NULL,\"%s\",\"%s\",%p)\n",
+ "Primary Sound Capture Driver","",lpContext);
+ MultiByteToWideChar( CP_ACP, 0, "Primary Sound Driver", -1,
+ wDesc, sizeof(wDesc)/sizeof(WCHAR) );
+ if (lpDSEnumCallback(NULL, wDesc, empty, lpContext) == FALSE)
+ goto out;
+
+ guid = DSOUND_capture_guid;
+ do {
TRACE("calling lpDSEnumCallback(%s,\"%s\",\"%s\",%p)\n",
- debugstr_guid(&DSOUND_capture_guids[wid]),desc.szDesc,desc.szDrvname,lpContext);
- MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1,
- wDesc, sizeof(wDesc)/sizeof(WCHAR) );
- MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1,
- wName, sizeof(wName)/sizeof(WCHAR) );
- if (lpDSEnumCallback(&DSOUND_capture_guids[wid], wDesc, wName, lpContext) == FALSE)
- return DS_OK;
- }
+ debugstr_guid(&guid),devstr,"wineal.drv",lpContext);
+ MultiByteToWideChar( CP_UNIXCP, 0, devstr, -1,
+ wDesc, sizeof(wDesc)/sizeof(WCHAR)-1 );
+ wDesc[sizeof(wDesc)/sizeof(WCHAR)-1] = 0;
+ MultiByteToWideChar( CP_ACP, 0, "wineal.drv", -1,
+ wName, sizeof(wName)/sizeof(WCHAR)-1 );
+ if (lpDSEnumCallback(&guid, wDesc, wName, lpContext) == FALSE)
+ goto out;
+ guid.Data4[7]++;
+ devstr += strlen(devstr)+1;
+ } while (*devstr);
+
+out:
+ LeaveCriticalSection(&openal_crst);
+ }
+ else
+#endif
+ {
+ ERR("Attempting to enumerate sound cards without OpenAL support\n");
+ ERR("Please recompile wine with OpenAL for sound to work\n");
}
-
return DS_OK;
}
@@ -576,6 +817,118 @@ HRESULT IKsPrivatePropertySetImpl_Create(REFIID riid, IKsPropertySet **piks)
return E_NOTIMPL;
}
+/***************************************************************************
+ * DirectSoundCaptureCreate [DSOUND.6]
+ *
+ * Create and initialize a DirectSoundCapture interface.
+ *
+ * PARAMS
+ * lpcGUID [I] Address of the GUID that identifies the sound capture device.
+ * lplpDSC [O] Address of a variable to receive the interface pointer.
+ * pUnkOuter [I] Must be NULL.
+ *
+ * RETURNS
+ * Success: DS_OK
+ * Failure: DSERR_NOAGGREGATION, DSERR_ALLOCATED, DSERR_INVALIDPARAM,
+ * DSERR_OUTOFMEMORY
+ *
+ * NOTES
+ * lpcGUID must be one of the values returned from DirectSoundCaptureEnumerate
+ * or NULL for the default device or DSDEVID_DefaultCapture or
+ * DSDEVID_DefaultVoiceCapture.
+ *
+ * DSERR_ALLOCATED is returned for sound devices that do not support full duplex.
+ */
+HRESULT WINAPI DirectSoundCaptureCreate(
+ LPCGUID lpcGUID,
+ LPDIRECTSOUNDCAPTURE *ppDSC,
+ LPUNKNOWN pUnkOuter)
+{
+ HRESULT hr;
+ LPDIRECTSOUNDCAPTURE pDSC;
+ TRACE("(%s,%p,%p)\n", debugstr_guid(lpcGUID), ppDSC, pUnkOuter);
+
+ if (ppDSC == NULL) {
+ WARN("invalid parameter: ppDSC == NULL\n");
+ return DSERR_INVALIDPARAM;
+ }
+
+ if (pUnkOuter) {
+ WARN("invalid parameter: pUnkOuter != NULL\n");
+ *ppDSC = NULL;
+ return DSERR_NOAGGREGATION;
+ }
+
+ hr = DSOUND_CaptureCreate(&IID_IDirectSoundCapture, &pDSC);
+ if (hr == DS_OK) {
+ hr = IDirectSoundCapture_Initialize(pDSC, lpcGUID);
+ if (hr != DS_OK) {
+ IDirectSoundCapture_Release(pDSC);
+ pDSC = 0;
+ }
+ }
+
+ *ppDSC = pDSC;
+
+ return hr;
+}
+
+/***************************************************************************
+ * DirectSoundCaptureCreate8 [DSOUND.12]
+ *
+ * Create and initialize a DirectSoundCapture interface.
+ *
+ * PARAMS
+ * lpcGUID [I] Address of the GUID that identifies the sound capture device.
+ * lplpDSC [O] Address of a variable to receive the interface pointer.
+ * pUnkOuter [I] Must be NULL.
+ *
+ * RETURNS
+ * Success: DS_OK
+ * Failure: DSERR_NOAGGREGATION, DSERR_ALLOCATED, DSERR_INVALIDPARAM,
+ * DSERR_OUTOFMEMORY
+ *
+ * NOTES
+ * lpcGUID must be one of the values returned from DirectSoundCaptureEnumerate
+ * or NULL for the default device or DSDEVID_DefaultCapture or
+ * DSDEVID_DefaultVoiceCapture.
+ *
+ * DSERR_ALLOCATED is returned for sound devices that do not support full duplex.
+ */
+HRESULT WINAPI DirectSoundCaptureCreate8(
+ LPCGUID lpcGUID,
+ LPDIRECTSOUNDCAPTURE8 *ppDSC8,
+ LPUNKNOWN pUnkOuter)
+{
+ HRESULT hr;
+ LPDIRECTSOUNDCAPTURE8 pDSC8;
+ TRACE("(%s,%p,%p)\n", debugstr_guid(lpcGUID), ppDSC8, pUnkOuter);
+
+ if (ppDSC8 == NULL) {
+ WARN("invalid parameter: ppDSC8 == NULL\n");
+ return DSERR_INVALIDPARAM;
+ }
+
+ if (pUnkOuter) {
+ WARN("invalid parameter: pUnkOuter != NULL\n");
+ *ppDSC8 = NULL;
+ return DSERR_NOAGGREGATION;
+ }
+
+ hr = DSOUND_CaptureCreate8(&IID_IDirectSoundCapture8, &pDSC8);
+ if (hr == DS_OK) {
+ hr = IDirectSoundCapture_Initialize(pDSC8, lpcGUID);
+ if (hr != DS_OK) {
+ IDirectSoundCapture_Release(pDSC8);
+ pDSC8 = 0;
+ }
+ }
+
+ *ppDSC8 = pDSC8;
+
+ return hr;
+}
+
static IClassFactoryImpl DSOUND_CF[] = {
{ &DSCF_Vtbl, 1, &CLSID_DirectSound, (FnCreateInstance)DSOUND_Create },
{ &DSCF_Vtbl, 1, &CLSID_DirectSound8, (FnCreateInstance)DSOUND_Create8 },
@@ -666,12 +1019,12 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)
switch (fdwReason) {
case DLL_PROCESS_ATTACH:
- TRACE("DLL_PROCESS_ATTACH\n");
+#ifdef SONAME_LIBOPENAL
+ load_libopenal();
+#endif /*SONAME_LIBOPENAL*/
for (i = 0; i < MAXWAVEDRIVERS; i++) {
DSOUND_renderer[i] = NULL;
- DSOUND_capture[i] = NULL;
INIT_GUID(DSOUND_renderer_guids[i], 0xbd6dd71a, 0x3deb, 0x11d1, 0xb1, 0x71, 0x00, 0xc0, 0x4f, 0xc2, 0x00, 0x00 + i);
- INIT_GUID(DSOUND_capture_guids[i], 0xbd6dd71b, 0x3deb, 0x11d1, 0xb1, 0x71, 0x00, 0xc0, 0x4f, 0xc2, 0x00, 0x00 + i);
}
DisableThreadLibraryCalls(hInstDLL);
/* Increase refcount on dsound by 1 */
diff --git a/dlls/dsound/dsound_private.h b/dlls/dsound/dsound_private.h
index 565cb63..0b4187f 100644
--- a/dlls/dsound/dsound_private.h
+++ b/dlls/dsound/dsound_private.h
@@ -22,9 +22,136 @@
/* Linux does not support better timing than 10ms */
#define DS_TIME_RES 2 /* Resolution of multimedia timer */
#define DS_TIME_DEL 10 /* Delay of multimedia timer callback, and duration of HEL fragment */
+/* Default refresh count, can be overridden */
+#define FAKE_REFRESH_COUNT (1000/DS_TIME_DEL/2)
#include "wine/list.h"
+/* TODO: Get me removed */
+#include "dsdriver.h"
+
+#ifdef SONAME_LIBOPENAL
+
+#define AL_NO_PROTOTYPES
+#define ALC_NO_PROTOTYPES
+
+#ifdef HAVE_AL_AL_H
+#include <AL/al.h>
+#include <AL/alc.h>
+#elif defined(HAVE_OPENAL_AL_H)
+#include <OpenAL/al.h>
+#include <OpenAL/alc.h>
+#else
+#error No OpenAL headers found?
+#endif
+
+/* All openal functions */
+extern void *openal_handle;
+extern LPALCCREATECONTEXT palcCreateContext;
+extern LPALCMAKECONTEXTCURRENT palcMakeContextCurrent;
+extern LPALCPROCESSCONTEXT palcProcessContext;
+extern LPALCSUSPENDCONTEXT palcSuspendContext;
+extern LPALCDESTROYCONTEXT palcDestroyContext;
+extern LPALCGETCURRENTCONTEXT palcGetCurrentContext;
+extern LPALCGETCONTEXTSDEVICE palcGetContextsDevice;
+extern LPALCOPENDEVICE palcOpenDevice;
+extern LPALCCLOSEDEVICE palcCloseDevice;
+extern LPALCGETERROR palcGetError;
+extern LPALCISEXTENSIONPRESENT palcIsExtensionPresent;
+extern LPALCGETPROCADDRESS palcGetProcAddress;
+extern LPALCGETENUMVALUE palcGetEnumValue;
+extern LPALCGETSTRING palcGetString;
+extern LPALCGETINTEGERV palcGetIntegerv;
+extern LPALCCAPTUREOPENDEVICE palcCaptureOpenDevice;
+extern LPALCCAPTURECLOSEDEVICE palcCaptureCloseDevice;
+extern LPALCCAPTURESTART palcCaptureStart;
+extern LPALCCAPTURESTOP palcCaptureStop;
+extern LPALCCAPTURESAMPLES palcCaptureSamples;
+extern LPALENABLE palEnable;
+extern LPALDISABLE palDisable;
+extern LPALISENABLED palIsEnabled;
+extern LPALGETSTRING palGetString;
+extern LPALGETBOOLEANV palGetBooleanv;
+extern LPALGETINTEGERV palGetIntegerv;
+extern LPALGETFLOATV palGetFloatv;
+extern LPALGETDOUBLEV palGetDoublev;
+extern LPALGETBOOLEAN palGetBoolean;
+extern LPALGETINTEGER palGetInteger;
+extern LPALGETFLOAT palGetFloat;
+extern LPALGETDOUBLE palGetDouble;
+extern LPALGETERROR palGetError;
+extern LPALISEXTENSIONPRESENT palIsExtensionPresent;
+extern LPALGETPROCADDRESS palGetProcAddress;
+extern LPALGETENUMVALUE palGetEnumValue;
+extern LPALLISTENERF palListenerf;
+extern LPALLISTENER3F palListener3f;
+extern LPALLISTENERFV palListenerfv;
+extern LPALLISTENERI palListeneri;
+extern LPALLISTENER3I palListener3i;
+extern LPALLISTENERIV palListeneriv;
+extern LPALGETLISTENERF palGetListenerf;
+extern LPALGETLISTENER3F palGetListener3f;
+extern LPALGETLISTENERFV palGetListenerfv;
+extern LPALGETLISTENERI palGetListeneri;
+extern LPALGETLISTENER3I palGetListener3i;
+extern LPALGETLISTENERIV palGetListeneriv;
+extern LPALGENSOURCES palGenSources;
+extern LPALDELETESOURCES palDeleteSources;
+extern LPALISSOURCE palIsSource;
+extern LPALSOURCEF palSourcef;
+extern LPALSOURCE3F palSource3f;
+extern LPALSOURCEFV palSourcefv;
+extern LPALSOURCEI palSourcei;
+extern LPALSOURCE3I palSource3i;
+extern LPALSOURCEIV palSourceiv;
+extern LPALGETSOURCEF palGetSourcef;
+extern LPALGETSOURCE3F palGetSource3f;
+extern LPALGETSOURCEFV palGetSourcefv;
+extern LPALGETSOURCEI palGetSourcei;
+extern LPALGETSOURCE3I palGetSource3i;
+extern LPALGETSOURCEIV palGetSourceiv;
+extern LPALSOURCEPLAYV palSourcePlayv;
+extern LPALSOURCESTOPV palSourceStopv;
+extern LPALSOURCEREWINDV palSourceRewindv;
+extern LPALSOURCEPAUSEV palSourcePausev;
+extern LPALSOURCEPLAY palSourcePlay;
+extern LPALSOURCESTOP palSourceStop;
+extern LPALSOURCEREWIND palSourceRewind;
+extern LPALSOURCEPAUSE palSourcePause;
+extern LPALSOURCEQUEUEBUFFERS palSourceQueueBuffers;
+extern LPALSOURCEUNQUEUEBUFFERS palSourceUnqueueBuffers;
+extern LPALGENBUFFERS palGenBuffers;
+extern LPALDELETEBUFFERS palDeleteBuffers;
+extern LPALISBUFFER palIsBuffer;
+extern LPALBUFFERF palBufferf;
+extern LPALBUFFER3F palBuffer3f;
+extern LPALBUFFERFV palBufferfv;
+extern LPALBUFFERI palBufferi;
+extern LPALBUFFER3I palBuffer3i;
+extern LPALBUFFERIV palBufferiv;
+extern LPALGETBUFFERF palGetBufferf;
+extern LPALGETBUFFER3F palGetBuffer3f;
+extern LPALGETBUFFERFV palGetBufferfv;
+extern LPALGETBUFFERI palGetBufferi;
+extern LPALGETBUFFER3I palGetBuffer3i;
+extern LPALGETBUFFERIV palGetBufferiv;
+extern LPALBUFFERDATA palBufferData;
+extern LPALDOPPLERFACTOR palDopplerFactor;
+extern LPALDOPPLERVELOCITY palDopplerVelocity;
+extern LPALDISTANCEMODEL palDistanceModel;
+extern LPALSPEEDOFSOUND palSpeedOfSound;
+
+#include <math.h>
+#include "wingdi.h"
+#include "mmreg.h"
+
+/* OpenAL only allows for 1 single access to the device at the same time */
+extern CRITICAL_SECTION openal_crst;
+
+extern const ALCchar *DSOUND_getcapturedevicestrings(void);
+
+#endif
+
/* direct sound hardware acceleration levels */
#define DS_HW_ACCEL_FULL 0 /* default on Windows 98 */
#define DS_HW_ACCEL_STANDARD 1 /* default on Windows 2000 */
@@ -50,16 +177,12 @@ typedef struct IDirectSound8_IUnknown IDirectSound8_IUnknown;
typedef struct IDirectSound8_IDirectSound IDirectSound8_IDirectSound;
typedef struct IDirectSound8_IDirectSound8 IDirectSound8_IDirectSound8;
typedef struct IDirectSoundBufferImpl IDirectSoundBufferImpl;
-typedef struct IDirectSoundCaptureImpl IDirectSoundCaptureImpl;
-typedef struct IDirectSoundCaptureBufferImpl IDirectSoundCaptureBufferImpl;
typedef struct IDirectSoundNotifyImpl IDirectSoundNotifyImpl;
-typedef struct IDirectSoundCaptureNotifyImpl IDirectSoundCaptureNotifyImpl;
typedef struct IDirectSound3DListenerImpl IDirectSound3DListenerImpl;
typedef struct IDirectSound3DBufferImpl IDirectSound3DBufferImpl;
typedef struct PrimaryBufferImpl PrimaryBufferImpl;
typedef struct SecondaryBufferImpl SecondaryBufferImpl;
typedef struct DirectSoundDevice DirectSoundDevice;
-typedef struct DirectSoundCaptureDevice DirectSoundCaptureDevice;
/* dsound_convert.h */
typedef void (*bitsconvertfunc)(const void *, void *, UINT, UINT, INT, UINT, UINT);
@@ -238,71 +361,6 @@ HRESULT PrimaryBufferImpl_Create(
LPCDSBUFFERDESC dsbd);
/*****************************************************************************
- * DirectSoundCaptureDevice implementation structure
- */
-struct DirectSoundCaptureDevice
-{
- /* IDirectSoundCaptureImpl fields */
- GUID guid;
- LONG ref;
-
- /* DirectSound driver stuff */
- PIDSCDRIVER driver;
- DSDRIVERDESC drvdesc;
- DSCDRIVERCAPS drvcaps;
- PIDSCDRIVERBUFFER hwbuf;
-
- /* wave driver info */
- HWAVEIN hwi;
-
- /* more stuff */
- LPBYTE buffer;
- DWORD buflen;
-
- PWAVEFORMATEX pwfx;
-
- IDirectSoundCaptureBufferImpl* capture_buffer;
- DWORD state;
- LPWAVEHDR pwave;
- int nrofpwaves;
- int index;
- CRITICAL_SECTION lock;
-};
-
-HRESULT DirectSoundCaptureDevice_Initialize(
- DirectSoundCaptureDevice ** ppDevice,
- LPCGUID lpcGUID);
-ULONG DirectSoundCaptureDevice_Release(
- DirectSoundCaptureDevice * device);
-
-/*****************************************************************************
- * IDirectSoundCaptureBuffer implementation structure
- */
-struct IDirectSoundCaptureBufferImpl
-{
- /* IUnknown fields */
- const IDirectSoundCaptureBuffer8Vtbl *lpVtbl;
- LONG ref;
-
- /* IDirectSoundCaptureBufferImpl fields */
- DirectSoundCaptureDevice* device;
- /* FIXME: don't need this */
- LPDSCBUFFERDESC pdscbd;
- DWORD flags;
-
- /* IDirectSoundCaptureNotifyImpl fields */
- IDirectSoundCaptureNotifyImpl* notify;
- LPDSBPOSITIONNOTIFY notifies;
- int nrofnotifies;
- PIDSDRIVERNOTIFY hwnotify;
-};
-
-HRESULT IDirectSoundCaptureBufferImpl_Create(
- DirectSoundCaptureDevice *device,
- IDirectSoundCaptureBufferImpl ** ppobj,
- LPCDSCBUFFERDESC lpcDSCBufferDesc);
-
-/*****************************************************************************
* IDirectSound3DListener implementation structure
*/
struct IDirectSound3DListenerImpl
@@ -376,21 +434,8 @@ void CALLBACK DSOUND_callback(HWAVEOUT hwo, UINT msg, DWORD_PTR dwUser, DWORD_PT
void DSOUND_Calc3DBuffer(IDirectSoundBufferImpl *dsb);
-/* capture.c */
-
HRESULT DSOUND_CaptureCreate(REFIID riid, LPDIRECTSOUNDCAPTURE *ppDSC);
HRESULT DSOUND_CaptureCreate8(REFIID riid, LPDIRECTSOUNDCAPTURE8 *ppDSC8);
-HRESULT WINAPI IDirectSoundCaptureImpl_CreateCaptureBuffer(
- LPDIRECTSOUNDCAPTURE iface,
- LPCDSCBUFFERDESC lpcDSCBufferDesc,
- LPDIRECTSOUNDCAPTUREBUFFER* lplpDSCaptureBuffer,
- LPUNKNOWN pUnk);
-HRESULT WINAPI IDirectSoundCaptureImpl_GetCaps(
- LPDIRECTSOUNDCAPTURE iface,
- LPDSCCAPS lpDSCCaps);
-HRESULT WINAPI IDirectSoundCaptureImpl_Initialize(
- LPDIRECTSOUNDCAPTURE iface,
- LPCGUID lpcGUID);
#define STATE_STOPPED 0
#define STATE_STARTING 1
@@ -402,9 +447,7 @@ HRESULT WINAPI IDirectSoundCaptureImpl_Initialize(
extern DirectSoundDevice* DSOUND_renderer[MAXWAVEDRIVERS];
extern GUID DSOUND_renderer_guids[MAXWAVEDRIVERS];
-
-extern DirectSoundCaptureDevice * DSOUND_capture[MAXWAVEDRIVERS];
-extern GUID DSOUND_capture_guids[MAXWAVEDRIVERS];
+extern GUID DSOUND_capture_guid;
HRESULT mmErr(UINT err);
void setup_dsound_options(void);
diff --git a/include/config.h.in b/include/config.h.in
index 7a77d1f..d6225fd 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -549,7 +549,7 @@
/* Define to 1 if you have the <net/route.h> header file. */
#undef HAVE_NET_ROUTE_H
-/* Define to 1 if `ns_msg' is a member of `_msg_ptr'. */
+/* Define to 1 if `_msg_ptr' is a member of `ns_msg'. */
#undef HAVE_NS_MSG__MSG_PTR
/* Define to 1 if the system has the type `off_t'. */
@@ -660,7 +660,7 @@
/* Define to 1 if you have the `sched_yield' function. */
#undef HAVE_SCHED_YIELD
-/* Define to 1 if `scsireq_t' is a member of `cmd'. */
+/* Define to 1 if `cmd' is a member of `scsireq_t'. */
#undef HAVE_SCSIREQ_T_CMD
/* Define to 1 if you have the <scsi/scsi.h> header file. */
@@ -687,7 +687,7 @@
/* Define to 1 if you have the `settimeofday' function. */
#undef HAVE_SETTIMEOFDAY
-/* Define to 1 if `sg_io_hdr_t' is a member of `interface_id'. */
+/* Define to 1 if `interface_id' is a member of `sg_io_hdr_t'. */
#undef HAVE_SG_IO_HDR_T_INTERFACE_ID
/* Define if sigaddset is supported */
@@ -696,7 +696,7 @@
/* Define to 1 if you have the `sigaltstack' function. */
#undef HAVE_SIGALTSTACK
-/* Define to 1 if `siginfo_t' is a member of `si_fd'. */
+/* Define to 1 if `si_fd' is a member of `siginfo_t'. */
#undef HAVE_SIGINFO_T_SI_FD
/* Define to 1 if you have the `sigprocmask' function. */
@@ -768,67 +768,67 @@
/* Define to 1 if you have the `strtoull' function. */
#undef HAVE_STRTOULL
-/* Define to 1 if `struct ff_effect' is a member of `direction'. */
+/* Define to 1 if `direction' is a member of `struct ff_effect'. */
#undef HAVE_STRUCT_FF_EFFECT_DIRECTION
-/* Define to 1 if `struct icmpstat' is a member of `icps_outhist'. */
+/* Define to 1 if `icps_outhist' is a member of `struct icmpstat'. */
#undef HAVE_STRUCT_ICMPSTAT_ICPS_OUTHIST
-/* Define to 1 if `struct msghdr' is a member of `msg_accrights'. */
+/* Define to 1 if `msg_accrights' is a member of `struct msghdr'. */
#undef HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS
-/* Define to 1 if `struct mtget' is a member of `mt_blkno'. */
+/* Define to 1 if `mt_blkno' is a member of `struct mtget'. */
#undef HAVE_STRUCT_MTGET_MT_BLKNO
-/* Define to 1 if `struct mtget' is a member of `mt_blksiz'. */
+/* Define to 1 if `mt_blksiz' is a member of `struct mtget'. */
#undef HAVE_STRUCT_MTGET_MT_BLKSIZ
-/* Define to 1 if `struct mtget' is a member of `mt_gstat'. */
+/* Define to 1 if `mt_gstat' is a member of `struct mtget'. */
#undef HAVE_STRUCT_MTGET_MT_GSTAT
-/* Define to 1 if `struct option' is a member of `name'. */
+/* Define to 1 if `name' is a member of `struct option'. */
#undef HAVE_STRUCT_OPTION_NAME
-/* Define to 1 if `struct sockaddr_in6' is a member of `sin6_scope_id'. */
+/* Define to 1 if `sin6_scope_id' is a member of `struct sockaddr_in6'. */
#undef HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID
-/* Define to 1 if `struct sockaddr' is a member of `sa_len'. */
+/* Define to 1 if `sa_len' is a member of `struct sockaddr'. */
#undef HAVE_STRUCT_SOCKADDR_SA_LEN
-/* Define to 1 if `struct sockaddr_un' is a member of `sun_len'. */
+/* Define to 1 if `sun_len' is a member of `struct sockaddr_un'. */
#undef HAVE_STRUCT_SOCKADDR_UN_SUN_LEN
-/* Define to 1 if `struct statfs' is a member of `f_bavail'. */
+/* Define to 1 if `f_bavail' is a member of `struct statfs'. */
#undef HAVE_STRUCT_STATFS_F_BAVAIL
-/* Define to 1 if `struct statfs' is a member of `f_bfree'. */
+/* Define to 1 if `f_bfree' is a member of `struct statfs'. */
#undef HAVE_STRUCT_STATFS_F_BFREE
-/* Define to 1 if `struct statfs' is a member of `f_favail'. */
+/* Define to 1 if `f_favail' is a member of `struct statfs'. */
#undef HAVE_STRUCT_STATFS_F_FAVAIL
-/* Define to 1 if `struct statfs' is a member of `f_ffree'. */
+/* Define to 1 if `f_ffree' is a member of `struct statfs'. */
#undef HAVE_STRUCT_STATFS_F_FFREE
-/* Define to 1 if `struct statfs' is a member of `f_frsize'. */
+/* Define to 1 if `f_frsize' is a member of `struct statfs'. */
#undef HAVE_STRUCT_STATFS_F_FRSIZE
-/* Define to 1 if `struct statfs' is a member of `f_namelen'. */
+/* Define to 1 if `f_namelen' is a member of `struct statfs'. */
#undef HAVE_STRUCT_STATFS_F_NAMELEN
-/* Define to 1 if `struct statvfs' is a member of `f_blocks'. */
+/* Define to 1 if `f_blocks' is a member of `struct statvfs'. */
#undef HAVE_STRUCT_STATVFS_F_BLOCKS
-/* Define to 1 if `struct stat' is a member of `st_atim'. */
+/* Define to 1 if `st_atim' is a member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_ATIM
-/* Define to 1 if `struct stat' is a member of `st_blocks'. */
+/* Define to 1 if `st_blocks' is a member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_BLOCKS
-/* Define to 1 if `struct stat' is a member of `st_ctim'. */
+/* Define to 1 if `st_ctim' is a member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_CTIM
-/* Define to 1 if `struct stat' is a member of `st_mtim'. */
+/* Define to 1 if `st_mtim' is a member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_MTIM
/* Define to 1 if the system has the type `struct xinpgen'. */
@@ -1071,7 +1071,7 @@
/* Define to 1 if you have the <X11/Xutil.h> header file. */
#undef HAVE_X11_XUTIL_H
-/* Define to 1 if `XICCallback' is a member of `callback'. */
+/* Define to 1 if `callback' is a member of `XICCallback'. */
#undef HAVE_XICCALLBACK_CALLBACK
/* Define if you have the XKB extension */
@@ -1185,6 +1185,9 @@
/* Define to the soname of the libodbc library. */
#undef SONAME_LIBODBC
+/* Define to the soname of the libopenal library. */
+#undef SONAME_LIBOPENAL
+
/* Define to the soname of the libpng library. */
#undef SONAME_LIBPNG
--
1.6.5.3
More information about the wine-patches
mailing list