# commands through without removal of \ escapes.
if test -n "${ZSH_VERSION+set}" ; then
setopt NO_GLOB_SUBST
- fi
+fi
cfgfile="${ofile}T"
trap "$RM \"$cfgfile\"; exit 1" 1 2 15
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
if test -z "$lt_ECHO"; then
- if test "X${echo_test_string+set}" != Xset; then
- # find a string as large as possible, as long as the shell can cope with it
- for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
- # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+if test "X${echo_test_string+set}" != Xset; then
+# find a string as large as possible, as long as the shell can cope with it
+ for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
+ # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
if { echo_test_string=`eval $cmd`; } 2>/dev/null &&
{ test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null
- then
- break
- fi
- done
- fi
+ then
+ break
+ fi
+ done
+fi
if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
- test "X$echo_testing_string" = "X$echo_test_string"; then
- :
- else
- # The Solaris, AIX, and Digital Unix default echo programs unquote
- # backslashes. This makes it impossible to quote backslashes using
- # echo "$something" | sed 's/\\/\\\\/g'
- #
- # So, first we look for a working echo in the user's PATH.
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ :
+else
+ # The Solaris, AIX, and Digital Unix default echo programs unquote
+ # backslashes. This makes it impossible to quote backslashes using
+ # echo "$something" | sed 's/\\/\\\\/g'
+ #
+ # So, first we look for a working echo in the user's PATH.
- lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
- for dir in $PATH /usr/ucb; do
- IFS="$lt_save_ifs"
- if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
- test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
- echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
- test "X$echo_testing_string" = "X$echo_test_string"; then
- ECHO="$dir/echo"
- break
- fi
- done
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for dir in $PATH /usr/ucb; do
IFS="$lt_save_ifs"
+ if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+ test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ ECHO="$dir/echo"
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
if test "X$ECHO" = Xecho; then
- # We didn't find a better echo, so look for alternatives.
+ # We didn't find a better echo, so look for alternatives.
if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' &&
echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` &&
- test "X$echo_testing_string" = "X$echo_test_string"; then
- # This shell has a builtin print -r that does the trick.
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ # This shell has a builtin print -r that does the trick.
ECHO='print -r'
elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } &&
- test "X$CONFIG_SHELL" != X/bin/ksh; then
- # If we have ksh, try running configure again with it.
- ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
- export ORIGINAL_CONFIG_SHELL
- CONFIG_SHELL=/bin/ksh
- export CONFIG_SHELL
- exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
- else
- # Try using printf.
+ test "X$CONFIG_SHELL" != X/bin/ksh; then
+ # If we have ksh, try running configure again with it.
+ ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+ export ORIGINAL_CONFIG_SHELL
+ CONFIG_SHELL=/bin/ksh
+ export CONFIG_SHELL
+ exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
+ else
+ # Try using printf.
ECHO='printf %s\n'
if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ # Cool, printf works
+ :
+ elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+ test "X$echo_testing_string" = 'X\t' &&
+ echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
test "X$echo_testing_string" = "X$echo_test_string"; then
- # Cool, printf works
- :
- elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
- test "X$echo_testing_string" = 'X\t' &&
- echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
- test "X$echo_testing_string" = "X$echo_test_string"; then
- CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
- export CONFIG_SHELL
- SHELL="$CONFIG_SHELL"
- export SHELL
+ CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+ export CONFIG_SHELL
+ SHELL="$CONFIG_SHELL"
+ export SHELL
ECHO="$CONFIG_SHELL [$]0 --fallback-echo"
- elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
- test "X$echo_testing_string" = 'X\t' &&
- echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
- test "X$echo_testing_string" = "X$echo_test_string"; then
+ elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+ test "X$echo_testing_string" = 'X\t' &&
+ echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
ECHO="$CONFIG_SHELL [$]0 --fallback-echo"
- else
- # maybe with a smaller string...
- prev=:
+ else
+ # maybe with a smaller string...
+ prev=:
- for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
+ for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null
- then
- break
- fi
- prev="$cmd"
- done
+ then
+ break
+ fi
+ prev="$cmd"
+ done
- if test "$prev" != 'sed 50q "[$]0"'; then
- echo_test_string=`eval $prev`
- export echo_test_string
- exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
- else
- # Oops. We lost completely, so just stick with echo.
+ if test "$prev" != 'sed 50q "[$]0"'; then
+ echo_test_string=`eval $prev`
+ export echo_test_string
+ exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
+ else
+ # Oops. We lost completely, so just stick with echo.
ECHO=echo
- fi
- fi
+ fi
fi
fi
fi
fi
+fi
# Copy echo and quote the copy suitably for passing to libtool from
# the Makefile, instead of quoting the original, which is used later.
m4_defun([_LT_ENABLE_LOCK],
[AC_ARG_ENABLE([libtool-lock],
[AS_HELP_STRING([--disable-libtool-lock],
- [avoid locking (might break parallel builds)])])
+ [avoid locking (might break parallel builds)])])
test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
# Some flags need to be propagated to the compiler or linker for good
echo 'int i;' > conftest.$ac_ext
if AC_TRY_EVAL(ac_compile); then
case `/usr/bin/file conftest.$ac_objext` in
- *ELF-32*)
- HPUX_IA64_MODE="32"
- ;;
- *ELF-64*)
- HPUX_IA64_MODE="64"
- ;;
+ *ELF-32*)
+ HPUX_IA64_MODE="32"
+ ;;
+ *ELF-64*)
+ HPUX_IA64_MODE="64"
+ ;;
esac
fi
rm -rf conftest*
# Find out which ABI we are using.
echo '[#]line __oline__ "configure"' > conftest.$ac_ext
if AC_TRY_EVAL(ac_compile); then
- if test "$lt_cv_prog_gnu_ld" = yes; then
- case `/usr/bin/file conftest.$ac_objext` in
- *32-bit*)
- LD="${LD-ld} -melf32bsmip"
- ;;
- *N32*)
- LD="${LD-ld} -melf32bmipn32"
- ;;
- *64-bit*)
- LD="${LD-ld} -melf64bmip"
- ;;
- esac
- else
- case `/usr/bin/file conftest.$ac_objext` in
- *32-bit*)
- LD="${LD-ld} -32"
- ;;
- *N32*)
- LD="${LD-ld} -n32"
- ;;
- *64-bit*)
- LD="${LD-ld} -64"
- ;;
- esac
- fi
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -melf32bsmip"
+ ;;
+ *N32*)
+ LD="${LD-ld} -melf32bmipn32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -melf64bmip"
+ ;;
+ esac
+ else
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
fi
rm -rf conftest*
;;
echo 'int i;' > conftest.$ac_ext
if AC_TRY_EVAL(ac_compile); then
case `/usr/bin/file conftest.o` in
- *32-bit*)
- case $host in
+ *32-bit*)
+ case $host in
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_i386_fbsd"
;;
- x86_64-*linux*)
- LD="${LD-ld} -m elf_i386"
- ;;
- ppc64-*linux*|powerpc64-*linux*)
- LD="${LD-ld} -m elf32ppclinux"
- ;;
- s390x-*linux*)
- LD="${LD-ld} -m elf_s390"
- ;;
- sparc64-*linux*)
- LD="${LD-ld} -m elf32_sparc"
- ;;
- esac
- ;;
- *64-bit*)
- case $host in
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_i386"
+ ;;
+ ppc64-*linux*|powerpc64-*linux*)
+ LD="${LD-ld} -m elf32ppclinux"
+ ;;
+ s390x-*linux*)
+ LD="${LD-ld} -m elf_s390"
+ ;;
+ sparc64-*linux*)
+ LD="${LD-ld} -m elf32_sparc"
+ ;;
+ esac
+ ;;
+ *64-bit*)
+ case $host in
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_x86_64_fbsd"
;;
- x86_64-*linux*)
- LD="${LD-ld} -m elf_x86_64"
- ;;
- ppc*-*linux*|powerpc*-*linux*)
- LD="${LD-ld} -m elf64ppc"
- ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ ppc*-*linux*|powerpc*-*linux*)
+ LD="${LD-ld} -m elf64ppc"
+ ;;
s390*-*linux*|s390*-*tpf*)
- LD="${LD-ld} -m elf64_s390"
- ;;
- sparc*-*linux*)
- LD="${LD-ld} -m elf64_sparc"
- ;;
- esac
- ;;
+ LD="${LD-ld} -m elf64_s390"
+ ;;
+ sparc*-*linux*)
+ LD="${LD-ld} -m elf64_sparc"
+ ;;
+ esac
+ ;;
esac
fi
rm -rf conftest*
# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
-# [ACTION-SUCCESS], [ACTION-FAILURE])
+# [ACTION-SUCCESS], [ACTION-FAILURE])
# ----------------------------------------------------
# Check whether the given linker option works
AC_DEFUN([_LT_LINKER_OPTION],
sysv5* | sco5v6* | sysv4.2uw2*)
kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
if test -n "$kargmax"; then
- lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'`
+ lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'`
else
lt_cv_sys_max_cmd_len=32768
fi
teststring=$teststring$teststring
done
SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
- # If test is not a shell built-in, we'll probably end up computing a
- # maximum length that is only half of the actual maximum length, but
- # we can't tell.
+ # If test is not a shell built-in, we'll probably end up computing a
+ # maximum length that is only half of the actual maximum length, but
+ # we can't tell.
while { test "X"`$SHELL [$]0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \
= "XX$teststring$teststring"; } >/dev/null 2>&1 &&
- test $i != 17 # 1/2 MB should be enough
- do
- i=`expr $i + 1`
- teststring=$teststring$teststring
- done
+ test $i != 17 # 1/2 MB should be enough
+ do
+ i=`expr $i + 1`
+ teststring=$teststring$teststring
+ done
# Only check the string length outside the loop.
lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
- teststring=
+ teststring=
# Add a significant safety factor because C++ compilers can tack on
# massive amounts of additional arguments before passing them to the
# linker. It appears as though 1/2 is a usable value.
- lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
fi
;;
esac
# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
-# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
+# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
# ----------------------------------------------------------------
m4_defun([_LT_TRY_DLOPEN_SELF],
[m4_require([_LT_HEADER_DLFCN])dnl
mingw* | pw32* | cegcc*)
lt_cv_dlopen="LoadLibrary"
lt_cv_dlopen_libs=
- ;;
+ ;;
cygwin*)
lt_cv_dlopen="dlopen"
lt_cv_dlopen_libs=
- ;;
+ ;;
darwin*)
# if libdl is installed we need to link against it
lt_cv_dlopen_libs=
lt_cv_dlopen_self=yes
])
- ;;
+ ;;
*)
AC_CHECK_FUNC([shl_load],
if test "x$lt_cv_dlopen_self" = xyes; then
wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
- lt_cv_dlopen_self_static, [dnl
+ lt_cv_dlopen_self_static, [dnl
_LT_TRY_DLOPEN_SELF(
lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross)
else
# FIXME - insert some real tests, host_os isn't really good enough
case $host_os in
- darwin*)
- if test -n "$STRIP" ; then
- striplib="$STRIP -x"
+ darwin*)
+ if test -n "$STRIP" ; then
+ striplib="$STRIP -x"
old_striplib="$STRIP -S"
- AC_MSG_RESULT([yes])
- else
- AC_MSG_RESULT([no])
- fi
- ;;
- *)
- AC_MSG_RESULT([no])
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+fi
+ ;;
+ *)
+ AC_MSG_RESULT([no])
;;
esac
fi
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
;;
m68k)
- library_names_spec='$libname.ixlibrary $libname.a'
- # Create ${libname}_ixlibrary.a entries in /sys/libs.
+ library_names_spec='$libname.ixlibrary $libname.a'
+ # Create ${libname}_ixlibrary.a entries in /sys/libs.
finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
- ;;
+ ;;
esac
;;
library_names_spec='$libname.dll.a'
# DLL is installed to $(libdir)/../bin by postinstall_cmds
postinstall_cmds='base_file=`basename \${file}`~
- dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
dldir=$destdir/`dirname \$dlpath`~
test -d \$dldir || mkdir -p \$dldir~
$install_prog $dir/$dlname \$dldir/$dlname~
fi
sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
;;
- hppa*64*)
- shrext_cmds='.sl'
- hardcode_into_libs=yes
- dynamic_linker="$host_os dld.sl"
- shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
- shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
- soname_spec='${libname}${release}${shared_ext}$major'
- sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
- sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
- ;;
- *)
+ hppa*64*)
+ shrext_cmds='.sl'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ *)
shrext_cmds='.sl'
dynamic_linker="$host_os dld.sl"
shlibpath_var=SHLIB_PATH
need_lib_prefix=no
# Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
case $host_os in
- openbsd3.3 | openbsd3.3.*) need_version=yes ;;
- *) need_version=no ;;
+ openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+ *) need_version=no ;;
esac
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
-fi
+ fi
if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
-fi
+ fi
_LT_DECL([], [variables_saved_for_relink], [1],
[Variables whose values should be saved in libtool wrapper scripts and
lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
lt_cv_file_magic_cmd='func_win32_libid'
else
- lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
- lt_cv_file_magic_cmd='$OBJDUMP -f'
+ lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
fi
;;
lt_cv_path_NM="$NM"
else
lt_nm_to_check="${ac_tool_prefix}nm"
- if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+ if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
lt_nm_to_check="$lt_nm_to_check nm"
fi
for lt_tmp_nm in $lt_nm_to_check; do
: ${lt_cv_path_NM=no}
fi])
if test "$lt_cv_path_NM" != "no"; then
- NM="$lt_cv_path_NM"
+NM="$lt_cv_path_NM"
else
# Didn't find any BSD compatible name lister, look for dumpbin.
AC_CHECK_TOOLS(DUMPBIN, ["dumpbin -symbols" "link -dump -symbols"], :)
" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
" ' prfx=^$ac_symprfx]"
else
- lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+ lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
fi
# Check to see that the pipe works correctly.
cat <<_LT_EOF >> conftest.$ac_ext
-/* The mapping between symbol names and symbols. */
+/* The mapping between symbol names and symbols. */
const struct {
const char *name;
void *address;
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
;;
m68k)
- # FIXME: we need at least 68020 code to build shared libraries, but
- # adding the `-m68020' flag to GCC prevents building anything better,
- # like `-m68040'.
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
- ;;
+ ;;
esac
;;
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
- ;;
- esac
;;
esac
;;
+ esac
+ ;;
lynxos*)
;;
m88k*)
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
;;
m68k)
- # FIXME: we need at least 68020 code to build shared libraries, but
- # adding the `-m68020' flag to GCC prevents building anything better,
- # like `-m68040'.
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
- ;;
+ ;;
esac
;;
fi
;;
- *)
+ *)
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
- ;;
- esac
+ ;;
+ esac
else
# PORTME Check for flag to pass linker flags through the system compiler.
case $host_os in
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
_LT_TAGVAR(lt_prog_compiler_wl, $1)=''
;;
- esac
- ;;
+ esac
+ ;;
esac
;;
;;
esac
_LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
-], [
+],[
runpath_var=
_LT_TAGVAR(allow_undefined_flag, $1)=
_LT_TAGVAR(always_export_symbols, $1)=no
# ancient GNU ld didn't support --whole-archive et. al.
if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
_LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
- else
+ else
_LT_TAGVAR(whole_archive_flag_spec, $1)=
fi
supports_anon_versioning=no
# see comment about AmigaOS4 .so support
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)=''
- ;;
+ ;;
m68k)
_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
tmp_addflag=
tmp_sharedflag='-shared'
case $cc_basename,$host_cpu in
- pgcc*) # Portland Group C compiler
+ pgcc*) # Portland Group C compiler
_LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
tmp_addflag=' $pic_flag'
;;
pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers
_LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
tmp_addflag=' $pic_flag -Mnomain' ;;
- ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
+ ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
tmp_addflag=' -i_dynamic' ;;
efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64
tmp_addflag=' -i_dynamic -nofor_main' ;;
if test "x$supports_anon_versioning" = xyes; then
_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
- cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
echo "local: *; };" >> $output_objdir/$libname.ver~
$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
- fi
+ fi
case $cc_basename in
xlf*)
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
case `$LD -v 2>&1` in
- *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*)
+ *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*)
_LT_TAGVAR(ld_shlibs, $1)=no
cat <<_LT_EOF 1>&2
# need to do runtime linking.
case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
for ld_flag in $LDFLAGS; do
- if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
- aix_use_runtimelinking=yes
- break
- fi
+ if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+ aix_use_runtimelinking=yes
+ break
+ fi
done
;;
esac
if test -f "$collect2name" &&
strings "$collect2name" | $GREP resolve_lib_name >/dev/null
then
- # We have reworked collect2
+ # We have reworked collect2
:
else
- # We have old collect2
+ # We have old collect2
_LT_TAGVAR(hardcode_direct, $1)=unsupported
- # It fails to find uninstalled libraries when the uninstalled
- # path is not listed in the libpath. Setting hardcode_minus_L
- # to unsupported forces relinking
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
_LT_TAGVAR(hardcode_minus_L, $1)=yes
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=
else
# not using gcc
if test "$host_cpu" = ia64; then
- # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
- # chokes on -Wl,-G. The following line is correct:
+ # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+ # chokes on -Wl,-G. The following line is correct:
shared_flag='-G'
else
if test "$aix_use_runtimelinking" = yes; then
_LT_SYS_MODULE_PATH_AIX
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
- else
+ else
if test "$host_cpu" = ia64; then
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
_LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
# see comment about AmigaOS4 .so support
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)=''
- ;;
+ ;;
m68k)
_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
darwin* | rhapsody*)
_LT_DARWIN_LINKER_FEATURES($1)
- ;;
+ ;;
dgux*)
_LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
- else
- case $host_os in
- openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
+ else
+ case $host_os in
+ openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
- ;;
- *)
+ ;;
+ *)
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
- ;;
- esac
- fi
+ ;;
+ esac
+ fi
else
_LT_TAGVAR(ld_shlibs, $1)=no
fi
else
case `$CC -V 2>&1` in
*"Compilers 5.0"*)
- wlarc=''
+ wlarc=''
_LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
# The compiler driver will combine and reorder linker options,
# but understands `-z linker_flag'. GCC discards it without `$wl',
# but is careful enough not to reorder.
- # Supported since Solaris 2.6 (maybe 2.5.1?)
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
if test "$GCC" = yes; then
_LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
else
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym'
;;
esac
- fi
+ fi
fi
])
AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
- #
+#
# There doesn't appear to be a way to prevent this compiler from
# explicitly linking system object files so we need to strip them
# from the output so that they don't get included in the library
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
- #
+#
# There doesn't appear to be a way to prevent this compiler from
# explicitly linking system object files so we need to strip them
# from the output so that they don't get included in the library
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
- #
+#
# There doesn't appear to be a way to prevent this compiler from
# explicitly linking system object files so we need to strip them
# from the output so that they don't get included in the library
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
- #
+#
# There doesn't appear to be a way to prevent this compiler from
# explicitly linking system object files so we need to strip them
# from the output so that they don't get included in the library
[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ],
[m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ],
[AC_CHECK_TOOL(GCJ, gcj,)
- test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
+ test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
AC_SUBST(GCJFLAGS)])])[]dnl
])
# ---------------------------------------------
m4_define([_PKG_CONFIG],
[if test -n "$$1"; then
- pkg_cv_[]$1="$$1"
+ pkg_cv_[]$1="$$1"
elif test -n "$PKG_CONFIG"; then
- PKG_CHECK_EXISTS([$3],
- [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
- [pkg_failed=yes])
- else
- pkg_failed=untried
+ PKG_CHECK_EXISTS([$3],
+ [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
+ [pkg_failed=yes])
+else
+ pkg_failed=untried
fi[]dnl
])# _PKG_CONFIG
you want to change it or regenerate `configure' using a newer version
of `autoconf'.
- The simplest way to compile this package is:
+The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system.
Compiling For Multiple Architectures
====================================
- You can compile the package for more than one kind of computer at the
+You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you can use GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
Installation Names
==================
- By default, `make install' installs the package's commands under
+By default, `make install' installs the package's commands under
`/usr/local/bin', include files under `/usr/local/include', etc. You
can specify an installation prefix other than `/usr/local' by giving
`configure' the option `--prefix=PREFIX', where PREFIX must be an
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
- Some packages pay attention to `--enable-FEATURE' options to
+Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
Defining Variables
==================
- Variables not defined in a site shell script can be set in the
+Variables not defined in a site shell script can be set in the
environment passed to `configure'. However, some packages may run
configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \
+ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \
$(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \
&& exit 0; \
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
$(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --gnu Makefile
+ $(AUTOMAKE) --gnu Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
- esac; \
+ esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
+ fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
# commands through without removal of \ escapes.
if test -n "${ZSH_VERSION+set}" ; then
setopt NO_GLOB_SUBST
- fi
+fi
cfgfile="${ofile}T"
trap "$RM \"$cfgfile\"; exit 1" 1 2 15
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
if test -z "$lt_ECHO"; then
- if test "X${echo_test_string+set}" != Xset; then
- # find a string as large as possible, as long as the shell can cope with it
- for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
- # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+if test "X${echo_test_string+set}" != Xset; then
+# find a string as large as possible, as long as the shell can cope with it
+ for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
+ # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
if { echo_test_string=`eval $cmd`; } 2>/dev/null &&
{ test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null
- then
- break
- fi
- done
- fi
+ then
+ break
+ fi
+ done
+fi
if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
- test "X$echo_testing_string" = "X$echo_test_string"; then
- :
- else
- # The Solaris, AIX, and Digital Unix default echo programs unquote
- # backslashes. This makes it impossible to quote backslashes using
- # echo "$something" | sed 's/\\/\\\\/g'
- #
- # So, first we look for a working echo in the user's PATH.
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ :
+else
+ # The Solaris, AIX, and Digital Unix default echo programs unquote
+ # backslashes. This makes it impossible to quote backslashes using
+ # echo "$something" | sed 's/\\/\\\\/g'
+ #
+ # So, first we look for a working echo in the user's PATH.
- lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
- for dir in $PATH /usr/ucb; do
- IFS="$lt_save_ifs"
- if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
- test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
- echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
- test "X$echo_testing_string" = "X$echo_test_string"; then
- ECHO="$dir/echo"
- break
- fi
- done
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for dir in $PATH /usr/ucb; do
IFS="$lt_save_ifs"
+ if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+ test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ ECHO="$dir/echo"
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
if test "X$ECHO" = Xecho; then
- # We didn't find a better echo, so look for alternatives.
+ # We didn't find a better echo, so look for alternatives.
if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' &&
echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` &&
- test "X$echo_testing_string" = "X$echo_test_string"; then
- # This shell has a builtin print -r that does the trick.
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ # This shell has a builtin print -r that does the trick.
ECHO='print -r'
elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } &&
- test "X$CONFIG_SHELL" != X/bin/ksh; then
- # If we have ksh, try running configure again with it.
- ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
- export ORIGINAL_CONFIG_SHELL
- CONFIG_SHELL=/bin/ksh
- export CONFIG_SHELL
- exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
- else
- # Try using printf.
+ test "X$CONFIG_SHELL" != X/bin/ksh; then
+ # If we have ksh, try running configure again with it.
+ ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+ export ORIGINAL_CONFIG_SHELL
+ CONFIG_SHELL=/bin/ksh
+ export CONFIG_SHELL
+ exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
+ else
+ # Try using printf.
ECHO='printf %s\n'
if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ # Cool, printf works
+ :
+ elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+ test "X$echo_testing_string" = 'X\t' &&
+ echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
test "X$echo_testing_string" = "X$echo_test_string"; then
- # Cool, printf works
- :
- elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
- test "X$echo_testing_string" = 'X\t' &&
- echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
- test "X$echo_testing_string" = "X$echo_test_string"; then
- CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
- export CONFIG_SHELL
- SHELL="$CONFIG_SHELL"
- export SHELL
+ CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+ export CONFIG_SHELL
+ SHELL="$CONFIG_SHELL"
+ export SHELL
ECHO="$CONFIG_SHELL [$]0 --fallback-echo"
- elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
- test "X$echo_testing_string" = 'X\t' &&
- echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
- test "X$echo_testing_string" = "X$echo_test_string"; then
+ elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+ test "X$echo_testing_string" = 'X\t' &&
+ echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
ECHO="$CONFIG_SHELL [$]0 --fallback-echo"
- else
- # maybe with a smaller string...
- prev=:
+ else
+ # maybe with a smaller string...
+ prev=:
- for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
+ for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null
- then
- break
- fi
- prev="$cmd"
- done
+ then
+ break
+ fi
+ prev="$cmd"
+ done
- if test "$prev" != 'sed 50q "[$]0"'; then
- echo_test_string=`eval $prev`
- export echo_test_string
- exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
- else
- # Oops. We lost completely, so just stick with echo.
+ if test "$prev" != 'sed 50q "[$]0"'; then
+ echo_test_string=`eval $prev`
+ export echo_test_string
+ exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
+ else
+ # Oops. We lost completely, so just stick with echo.
ECHO=echo
- fi
- fi
+ fi
fi
fi
fi
fi
+fi
# Copy echo and quote the copy suitably for passing to libtool from
# the Makefile, instead of quoting the original, which is used later.
m4_defun([_LT_ENABLE_LOCK],
[AC_ARG_ENABLE([libtool-lock],
[AS_HELP_STRING([--disable-libtool-lock],
- [avoid locking (might break parallel builds)])])
+ [avoid locking (might break parallel builds)])])
test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
# Some flags need to be propagated to the compiler or linker for good
echo 'int i;' > conftest.$ac_ext
if AC_TRY_EVAL(ac_compile); then
case `/usr/bin/file conftest.$ac_objext` in
- *ELF-32*)
- HPUX_IA64_MODE="32"
- ;;
- *ELF-64*)
- HPUX_IA64_MODE="64"
- ;;
+ *ELF-32*)
+ HPUX_IA64_MODE="32"
+ ;;
+ *ELF-64*)
+ HPUX_IA64_MODE="64"
+ ;;
esac
fi
rm -rf conftest*
# Find out which ABI we are using.
echo '[#]line __oline__ "configure"' > conftest.$ac_ext
if AC_TRY_EVAL(ac_compile); then
- if test "$lt_cv_prog_gnu_ld" = yes; then
- case `/usr/bin/file conftest.$ac_objext` in
- *32-bit*)
- LD="${LD-ld} -melf32bsmip"
- ;;
- *N32*)
- LD="${LD-ld} -melf32bmipn32"
- ;;
- *64-bit*)
- LD="${LD-ld} -melf64bmip"
- ;;
- esac
- else
- case `/usr/bin/file conftest.$ac_objext` in
- *32-bit*)
- LD="${LD-ld} -32"
- ;;
- *N32*)
- LD="${LD-ld} -n32"
- ;;
- *64-bit*)
- LD="${LD-ld} -64"
- ;;
- esac
- fi
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -melf32bsmip"
+ ;;
+ *N32*)
+ LD="${LD-ld} -melf32bmipn32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -melf64bmip"
+ ;;
+ esac
+ else
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
fi
rm -rf conftest*
;;
echo 'int i;' > conftest.$ac_ext
if AC_TRY_EVAL(ac_compile); then
case `/usr/bin/file conftest.o` in
- *32-bit*)
- case $host in
+ *32-bit*)
+ case $host in
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_i386_fbsd"
;;
- x86_64-*linux*)
- LD="${LD-ld} -m elf_i386"
- ;;
- ppc64-*linux*|powerpc64-*linux*)
- LD="${LD-ld} -m elf32ppclinux"
- ;;
- s390x-*linux*)
- LD="${LD-ld} -m elf_s390"
- ;;
- sparc64-*linux*)
- LD="${LD-ld} -m elf32_sparc"
- ;;
- esac
- ;;
- *64-bit*)
- case $host in
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_i386"
+ ;;
+ ppc64-*linux*|powerpc64-*linux*)
+ LD="${LD-ld} -m elf32ppclinux"
+ ;;
+ s390x-*linux*)
+ LD="${LD-ld} -m elf_s390"
+ ;;
+ sparc64-*linux*)
+ LD="${LD-ld} -m elf32_sparc"
+ ;;
+ esac
+ ;;
+ *64-bit*)
+ case $host in
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_x86_64_fbsd"
;;
- x86_64-*linux*)
- LD="${LD-ld} -m elf_x86_64"
- ;;
- ppc*-*linux*|powerpc*-*linux*)
- LD="${LD-ld} -m elf64ppc"
- ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ ppc*-*linux*|powerpc*-*linux*)
+ LD="${LD-ld} -m elf64ppc"
+ ;;
s390*-*linux*|s390*-*tpf*)
- LD="${LD-ld} -m elf64_s390"
- ;;
- sparc*-*linux*)
- LD="${LD-ld} -m elf64_sparc"
- ;;
- esac
- ;;
+ LD="${LD-ld} -m elf64_s390"
+ ;;
+ sparc*-*linux*)
+ LD="${LD-ld} -m elf64_sparc"
+ ;;
+ esac
+ ;;
esac
fi
rm -rf conftest*
# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
-# [ACTION-SUCCESS], [ACTION-FAILURE])
+# [ACTION-SUCCESS], [ACTION-FAILURE])
# ----------------------------------------------------
# Check whether the given linker option works
AC_DEFUN([_LT_LINKER_OPTION],
sysv5* | sco5v6* | sysv4.2uw2*)
kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
if test -n "$kargmax"; then
- lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'`
+ lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'`
else
lt_cv_sys_max_cmd_len=32768
fi
teststring=$teststring$teststring
done
SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
- # If test is not a shell built-in, we'll probably end up computing a
- # maximum length that is only half of the actual maximum length, but
- # we can't tell.
+ # If test is not a shell built-in, we'll probably end up computing a
+ # maximum length that is only half of the actual maximum length, but
+ # we can't tell.
while { test "X"`$SHELL [$]0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \
= "XX$teststring$teststring"; } >/dev/null 2>&1 &&
- test $i != 17 # 1/2 MB should be enough
- do
- i=`expr $i + 1`
- teststring=$teststring$teststring
- done
+ test $i != 17 # 1/2 MB should be enough
+ do
+ i=`expr $i + 1`
+ teststring=$teststring$teststring
+ done
# Only check the string length outside the loop.
lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
- teststring=
+ teststring=
# Add a significant safety factor because C++ compilers can tack on
# massive amounts of additional arguments before passing them to the
# linker. It appears as though 1/2 is a usable value.
- lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
fi
;;
esac
# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
-# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
+# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
# ----------------------------------------------------------------
m4_defun([_LT_TRY_DLOPEN_SELF],
[m4_require([_LT_HEADER_DLFCN])dnl
mingw* | pw32* | cegcc*)
lt_cv_dlopen="LoadLibrary"
lt_cv_dlopen_libs=
- ;;
+ ;;
cygwin*)
lt_cv_dlopen="dlopen"
lt_cv_dlopen_libs=
- ;;
+ ;;
darwin*)
# if libdl is installed we need to link against it
lt_cv_dlopen_libs=
lt_cv_dlopen_self=yes
])
- ;;
+ ;;
*)
AC_CHECK_FUNC([shl_load],
if test "x$lt_cv_dlopen_self" = xyes; then
wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
- lt_cv_dlopen_self_static, [dnl
+ lt_cv_dlopen_self_static, [dnl
_LT_TRY_DLOPEN_SELF(
lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross)
else
# FIXME - insert some real tests, host_os isn't really good enough
case $host_os in
- darwin*)
- if test -n "$STRIP" ; then
- striplib="$STRIP -x"
+ darwin*)
+ if test -n "$STRIP" ; then
+ striplib="$STRIP -x"
old_striplib="$STRIP -S"
- AC_MSG_RESULT([yes])
- else
- AC_MSG_RESULT([no])
- fi
- ;;
- *)
- AC_MSG_RESULT([no])
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+fi
+ ;;
+ *)
+ AC_MSG_RESULT([no])
;;
esac
fi
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
;;
m68k)
- library_names_spec='$libname.ixlibrary $libname.a'
- # Create ${libname}_ixlibrary.a entries in /sys/libs.
+ library_names_spec='$libname.ixlibrary $libname.a'
+ # Create ${libname}_ixlibrary.a entries in /sys/libs.
finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
- ;;
+ ;;
esac
;;
library_names_spec='$libname.dll.a'
# DLL is installed to $(libdir)/../bin by postinstall_cmds
postinstall_cmds='base_file=`basename \${file}`~
- dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
dldir=$destdir/`dirname \$dlpath`~
test -d \$dldir || mkdir -p \$dldir~
$install_prog $dir/$dlname \$dldir/$dlname~
fi
sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
;;
- hppa*64*)
- shrext_cmds='.sl'
- hardcode_into_libs=yes
- dynamic_linker="$host_os dld.sl"
- shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
- shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
- soname_spec='${libname}${release}${shared_ext}$major'
- sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
- sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
- ;;
- *)
+ hppa*64*)
+ shrext_cmds='.sl'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ *)
shrext_cmds='.sl'
dynamic_linker="$host_os dld.sl"
shlibpath_var=SHLIB_PATH
need_lib_prefix=no
# Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
case $host_os in
- openbsd3.3 | openbsd3.3.*) need_version=yes ;;
- *) need_version=no ;;
+ openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+ *) need_version=no ;;
esac
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
-fi
+ fi
if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
-fi
+ fi
_LT_DECL([], [variables_saved_for_relink], [1],
[Variables whose values should be saved in libtool wrapper scripts and
lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
lt_cv_file_magic_cmd='func_win32_libid'
else
- lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
- lt_cv_file_magic_cmd='$OBJDUMP -f'
+ lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
fi
;;
lt_cv_path_NM="$NM"
else
lt_nm_to_check="${ac_tool_prefix}nm"
- if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+ if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
lt_nm_to_check="$lt_nm_to_check nm"
fi
for lt_tmp_nm in $lt_nm_to_check; do
: ${lt_cv_path_NM=no}
fi])
if test "$lt_cv_path_NM" != "no"; then
- NM="$lt_cv_path_NM"
+NM="$lt_cv_path_NM"
else
# Didn't find any BSD compatible name lister, look for dumpbin.
AC_CHECK_TOOLS(DUMPBIN, ["dumpbin -symbols" "link -dump -symbols"], :)
" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
" ' prfx=^$ac_symprfx]"
else
- lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+ lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
fi
# Check to see that the pipe works correctly.
cat <<_LT_EOF >> conftest.$ac_ext
-/* The mapping between symbol names and symbols. */
+/* The mapping between symbol names and symbols. */
const struct {
const char *name;
void *address;
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
;;
m68k)
- # FIXME: we need at least 68020 code to build shared libraries, but
- # adding the `-m68020' flag to GCC prevents building anything better,
- # like `-m68040'.
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
- ;;
+ ;;
esac
;;
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
- ;;
- esac
;;
esac
;;
+ esac
+ ;;
lynxos*)
;;
m88k*)
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
;;
m68k)
- # FIXME: we need at least 68020 code to build shared libraries, but
- # adding the `-m68020' flag to GCC prevents building anything better,
- # like `-m68040'.
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
- ;;
+ ;;
esac
;;
fi
;;
- *)
+ *)
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
- ;;
- esac
+ ;;
+ esac
else
# PORTME Check for flag to pass linker flags through the system compiler.
case $host_os in
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
_LT_TAGVAR(lt_prog_compiler_wl, $1)=''
;;
- esac
- ;;
+ esac
+ ;;
esac
;;
;;
esac
_LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
-], [
+],[
runpath_var=
_LT_TAGVAR(allow_undefined_flag, $1)=
_LT_TAGVAR(always_export_symbols, $1)=no
# ancient GNU ld didn't support --whole-archive et. al.
if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
_LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
- else
+ else
_LT_TAGVAR(whole_archive_flag_spec, $1)=
fi
supports_anon_versioning=no
# see comment about AmigaOS4 .so support
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)=''
- ;;
+ ;;
m68k)
_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
tmp_addflag=
tmp_sharedflag='-shared'
case $cc_basename,$host_cpu in
- pgcc*) # Portland Group C compiler
+ pgcc*) # Portland Group C compiler
_LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
tmp_addflag=' $pic_flag'
;;
pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers
_LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
tmp_addflag=' $pic_flag -Mnomain' ;;
- ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
+ ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
tmp_addflag=' -i_dynamic' ;;
efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64
tmp_addflag=' -i_dynamic -nofor_main' ;;
if test "x$supports_anon_versioning" = xyes; then
_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
- cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
echo "local: *; };" >> $output_objdir/$libname.ver~
$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
- fi
+ fi
case $cc_basename in
xlf*)
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
case `$LD -v 2>&1` in
- *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*)
+ *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*)
_LT_TAGVAR(ld_shlibs, $1)=no
cat <<_LT_EOF 1>&2
# need to do runtime linking.
case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
for ld_flag in $LDFLAGS; do
- if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
- aix_use_runtimelinking=yes
- break
- fi
+ if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+ aix_use_runtimelinking=yes
+ break
+ fi
done
;;
esac
if test -f "$collect2name" &&
strings "$collect2name" | $GREP resolve_lib_name >/dev/null
then
- # We have reworked collect2
+ # We have reworked collect2
:
else
- # We have old collect2
+ # We have old collect2
_LT_TAGVAR(hardcode_direct, $1)=unsupported
- # It fails to find uninstalled libraries when the uninstalled
- # path is not listed in the libpath. Setting hardcode_minus_L
- # to unsupported forces relinking
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
_LT_TAGVAR(hardcode_minus_L, $1)=yes
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=
else
# not using gcc
if test "$host_cpu" = ia64; then
- # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
- # chokes on -Wl,-G. The following line is correct:
+ # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+ # chokes on -Wl,-G. The following line is correct:
shared_flag='-G'
else
if test "$aix_use_runtimelinking" = yes; then
_LT_SYS_MODULE_PATH_AIX
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
- else
+ else
if test "$host_cpu" = ia64; then
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
_LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
# see comment about AmigaOS4 .so support
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)=''
- ;;
+ ;;
m68k)
_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
darwin* | rhapsody*)
_LT_DARWIN_LINKER_FEATURES($1)
- ;;
+ ;;
dgux*)
_LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
- else
- case $host_os in
- openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
+ else
+ case $host_os in
+ openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
- ;;
- *)
+ ;;
+ *)
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
- ;;
- esac
- fi
+ ;;
+ esac
+ fi
else
_LT_TAGVAR(ld_shlibs, $1)=no
fi
else
case `$CC -V 2>&1` in
*"Compilers 5.0"*)
- wlarc=''
+ wlarc=''
_LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
# The compiler driver will combine and reorder linker options,
# but understands `-z linker_flag'. GCC discards it without `$wl',
# but is careful enough not to reorder.
- # Supported since Solaris 2.6 (maybe 2.5.1?)
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
if test "$GCC" = yes; then
_LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
else
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym'
;;
esac
- fi
+ fi
fi
])
AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
- #
+#
# There doesn't appear to be a way to prevent this compiler from
# explicitly linking system object files so we need to strip them
# from the output so that they don't get included in the library
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
- #
+#
# There doesn't appear to be a way to prevent this compiler from
# explicitly linking system object files so we need to strip them
# from the output so that they don't get included in the library
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
- #
+#
# There doesn't appear to be a way to prevent this compiler from
# explicitly linking system object files so we need to strip them
# from the output so that they don't get included in the library
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
- #
+#
# There doesn't appear to be a way to prevent this compiler from
# explicitly linking system object files so we need to strip them
# from the output so that they don't get included in the library
[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ],
[m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ],
[AC_CHECK_TOOL(GCJ, gcj,)
- test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
+ test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
AC_SUBST(GCJFLAGS)])])[]dnl
])
shift
for mf
do
- # Strip MF so we end up with the name of the file.
- mf=`echo "$mf" | sed -e 's/:.*$//'`
- # Check whether this is an Automake generated Makefile or not.
- # We used to match only the files named `Makefile.in', but
- # some people rename them; so instead we look at the file content.
- # Grep'ing the first line is not enough: some people post-process
- # each Makefile.in and add a new line on top of each file to say so.
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named `Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
# Grep'ing the whole file is not good either: AIX grep has a line
# limit of 2048, but all sed's we know have understand at least 4000.
if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
- dirpart=`AS_DIRNAME("$mf")`
- else
- continue
- fi
- # Extract the definition of DEPDIR, am__include, and am__quote
- # from the Makefile without running `make'.
- DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
- test -z "$DEPDIR" && continue
- am__include=`sed -n 's/^am__include = //p' < "$mf"`
- test -z "am__include" && continue
- am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
- # When using ansi2knr, U may be empty or an underscore; expand it
- U=`sed -n 's/^U = //p' < "$mf"`
- # Find all dependency output files, they are included files with
- # $(DEPDIR) in their names. We invoke sed twice because it is the
- # simplest approach to changing $(DEPDIR) to its actual value in the
- # expansion.
- for file in `sed -n "
- s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
- sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
- # Make sure the directory exists.
- test -f "$dirpart/$file" && continue
- fdir=`AS_DIRNAME(["$file"])`
- AS_MKDIR_P([$dirpart/$fdir])
- # echo "creating $dirpart/$file"
- echo '# dummy' > "$dirpart/$file"
- done
+ dirpart=`AS_DIRNAME("$mf")`
+ else
+ continue
+ fi
+ # Extract the definition of DEPDIR, am__include, and am__quote
+ # from the Makefile without running `make'.
+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ am__include=`sed -n 's/^am__include = //p' < "$mf"`
+ test -z "am__include" && continue
+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+ # When using ansi2knr, U may be empty or an underscore; expand it
+ U=`sed -n 's/^U = //p' < "$mf"`
+ # Find all dependency output files, they are included files with
+ # $(DEPDIR) in their names. We invoke sed twice because it is the
+ # simplest approach to changing $(DEPDIR) to its actual value in the
+ # expansion.
+ for file in `sed -n "
+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`AS_DIRNAME(["$file"])`
+ AS_MKDIR_P([$dirpart/$fdir])
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
done
+done
}
])# _AM_OUTPUT_DEPENDENCY_COMMANDS
# Use -I$(srcdir) only when $(srcdir) != ., so that make's output
# is not polluted with repeated "-I."
AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
- # test to see if srcdir already configured
+# test to see if srcdir already configured
if test -f $srcdir/config.status; then
- AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
- fi
+ AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+fi
fi
# test whether we have cygpath
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
- [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
- [_AM_PROG_TAR([v7])])])
+ [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+ [_AM_PROG_TAR([v7])])])
_AM_IF_OPTION([no-dependencies],,
[AC_PROVIDE_IFELSE([AC_PROG_CC],
- [_AM_DEPENDENCIES(CC)],
- [define([AC_PROG_CC],
- defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+ [_AM_DEPENDENCIES(CC)],
+ [define([AC_PROG_CC],
+ defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
AC_PROVIDE_IFELSE([AC_PROG_CXX],
- [_AM_DEPENDENCIES(CXX)],
- [define([AC_PROG_CXX],
- defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+ [_AM_DEPENDENCIES(CXX)],
+ [define([AC_PROG_CXX],
+ defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
AC_PROVIDE_IFELSE([AC_PROG_OBJC],
[_AM_DEPENDENCIES(OBJC)],
[define([AC_PROG_OBJC],
# Ignore all kinds of additional output from `make'.
case `$am_make -s -f confmf 2> /dev/null` in #(
*the\ am__doit\ target*)
- am__include=include
- am__quote=
- _am_result=GNU
+ am__include=include
+ am__quote=
+ _am_result=GNU
;;
esac
# Now try BSD make style include.
echo '.include "confinc"' > confmf
case `$am_make -s -f confmf 2> /dev/null` in #(
*the\ am__doit\ target*)
- am__include=.include
- am__quote="\""
- _am_result=BSD
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
;;
esac
-fi
+ fi
AC_SUBST([am__include])
AC_SUBST([am__quote])
AC_MSG_RESULT([$_am_result])
Pa_GetStreamWriteAvailable @32
Pa_GetSampleSize @33
Pa_Sleep @34
+Pa_UpdateAvailableDeviceList @35
+Pa_SetDevicesChangedCallback @36
PaAsio_GetAvailableLatencyValues @50
PaAsio_ShowControlPanel @51
PaUtil_InitializeX86PlainConverters @52
if [[ "$have_libossaudio" = "yes" ]] ; then
DLL_LIBS="$DLL_LIBS -lossaudio"
LIBS="$LIBS -lossaudio"
- fi
+ fi
AC_DEFINE(PA_USE_OSS)
fi
#ifndef PORTAUDIO_H
#define PORTAUDIO_H
/*
- * $Id$
+ * $Id: portaudio.h 1670 2011-05-04 16:37:52Z rob_bielik $
* PortAudio Portable Real-Time Audio Library
* PortAudio API Header File
* Latest version available at: http://www.portaudio.com/
Pairs of calls to Pa_Initialize()/Pa_Terminate() may overlap, and are not
required to be fully nested.
- Note that if Pa_Initialize() returns an error code, Pa_Terminate() should
+ If Pa_Initialize() returns an error code, Pa_Terminate() should
NOT be called.
+ @note The device list returned by Pa_GetDeviceCount() et al. is frozen
+ at the time Pa_Initialize() is called, and not updated dynamically, even if
+ hardware devices (e.g. USB or firewire devices) are connected or disconnected
+ during the course of the program's lifetime. If it is required to re-scan the
+ list of devices, one must call Pa_UpdateAvailableDeviceList() or, completely
+ uninitialize PortAudio using Pa_Terminate(), and then reinitialize it by calling
+ Pa_Initialize().
+
@return paNoError if successful, otherwise an error code indicating the cause
of failure.
*/
PaDeviceIndex Pa_GetDefaultOutputDevice( void );
+/** Update the list of available devices to match currently available hardware devices.
+
+ PortAudio's list of available devices is usually frozen at the time Pa_Initialize() is
+ called. Pa_UpdateAvailableDeviceList() may be called to refresh PortAudio's list
+ of available devices at any time while PortAudio is initialized.
+
+ @note Open streams will not be affected by calls to this function, but
+ any previously returned PaDeviceInfo pointers are invalidated once this
+ function is called.
+
+ @return an error code indicating whether the device refresh was successful.
+ */
+PaError Pa_UpdateAvailableDeviceList( void );
+
/** The type used to represent monotonic time in seconds. PaTime is
used for the fields of the PaStreamCallbackTimeInfo argument to the
PaStreamCallback and as the result of Pa_GetStreamTime().
-
+
PaTime values have unspecified origin.
@see PaStreamCallback, PaStreamCallbackTimeInfo, Pa_GetStreamTime
#define paInt16 ((PaSampleFormat) 0x00000008) /**< @see PaSampleFormat */
#define paInt8 ((PaSampleFormat) 0x00000010) /**< @see PaSampleFormat */
#define paUInt8 ((PaSampleFormat) 0x00000020) /**< @see PaSampleFormat */
-#define paCustomFormat ((PaSampleFormat) 0x00010000) /**< @see PaSampleFormat */
+#define paCustomFormat ((PaSampleFormat) 0x00010000)/**< @see PaSampleFormat */
#define paNonInterleaved ((PaSampleFormat) 0x80000000) /**< @see PaSampleFormat */
/** Returns the current time in seconds for a stream according to the same clock used
to generate callback PaStreamCallbackTimeInfo timestamps. The time values are
monotonically increasing and have unspecified origin.
-
+
Pa_GetStreamTime returns valid time values for the entire life of the stream,
from when the stream is opened until it is closed. Starting and stopping the stream
does not affect the passage of time returned by Pa_GetStreamTime.
+typedef void PaDevicesChangedCallback( void *userData );
+
+PaError Pa_SetDevicesChangedCallback( void *userData, PaStreamFinishedCallback* devicesChangedCallback );
+
+
+
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
if test "X$func_dirname_result" = "X${1}"; then
func_dirname_result="${3}"
- else
+else
func_dirname_result="$func_dirname_result${2}"
- fi
+fi
func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
}
progdir=$func_dirname_result
progdir=`cd "$progdir" && pwd`
progpath="$progdir/$progname"
- ;;
+ ;;
*)
save_IFS="$IFS"
IFS=:
IFS="$save_IFS"
test -n "$progdir" || progdir=`pwd`
progpath="$progdir/$progname"
- ;;
+ ;;
esac
# Sed substitution that helps us do robust quoting. It backslashifies
func_fatal_error ()
{
func_error ${1+"$@"}
- exit $EXIT_FAILURE
+ exit $EXIT_FAILURE
}
# func_fatal_help arg...
}
help="Try \`$progname --help' for more information." ## default
-
+
# func_grep expression filename
# Check whether EXPRESSION matches any line of FILENAME, without output.
func_grep ()
# ...otherwise throw away the child directory and loop
my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
- done
+ done
my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
save_mkdir_p_IFS="$IFS"; IFS=':'
# Bail out if we (or some other process) failed to create a directory.
test -d "$my_directory_path" || \
func_fatal_error "Failed to create \`$1'"
- fi
+fi
}
my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
if test ! -d "$my_tmpdir"; then
- # Failing that, at least try and use $RANDOM to avoid a race
- my_tmpdir="${my_template}-${RANDOM-0}$$"
+ # Failing that, at least try and use $RANDOM to avoid a race
+ my_tmpdir="${my_template}-${RANDOM-0}$$"
- save_mktempdir_umask=`umask`
- umask 0077
+ save_mktempdir_umask=`umask`
+ umask 0077
$MKDIR "$my_tmpdir"
- umask $save_mktempdir_umask
+ umask $save_mktempdir_umask
fi
# If we're not in dry-run mode, bomb out on failure
func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
*)
func_quote_for_eval_unquoted_result="$1" ;;
- esac
+ esac
case $func_quote_for_eval_unquoted_result in
# Double-quote args containing shell metacharacters to delay
# in scan sets, so we specify it separately.
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
- ;;
+ ;;
*)
func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
esac
-e "$double_quote_subst" -e "$sed_double_backslash"` ;;
*)
my_arg="$1" ;;
- esac
+ esac
case $my_arg in
# Double-quote args containing shell metacharacters to delay
# word splitting and command substitution for a subsequent eval.
# Many Bourne shells cannot handle close brackets correctly
# in scan sets, so we specify it separately.
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
my_arg="\"$my_arg\""
- ;;
- esac
+ ;;
+ esac
func_quote_for_expand_result="$my_arg"
}
my_status=$?
if test "$my_status" -eq 0; then :; else
eval "(exit $my_status); $my_fail_exp"
- fi
+ fi
fi
}
if ${opt_dry_run-false}; then :; else
eval "$lt_user_locale
$my_cmd"
- my_status=$?
+ my_status=$?
eval "$lt_safe_locale"
if test "$my_status" -eq 0; then :; else
eval "(exit $my_status); $my_fail_exp"
- fi
+ fi
fi
}
elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
# Yippee, $ECHO works!
:
-else
+ else
# Restart under the correct shell, and then maybe $ECHO will work.
exec $SHELL "$progpath" --no-reexec ${1+"$@"}
-fi
+ fi
if test "X$1" = X--fallback-echo; then
# used as fallback echo
$*
EOF
exit $EXIT_SUCCESS
-fi
+ fi
magic="%%%MAGIC variable%%%"
magic_exe="%%%MAGIC EXE variable%%%"
else
func_error "ignoring unknown tag $tagname"
fi
- ;;
+ ;;
esac
}
func_echo "enabling shell trace mode"
opt_debug='set -x'
$opt_debug
- ;;
+ ;;
-dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
execute_dlfiles="$execute_dlfiles $1"
shift
- ;;
+ ;;
--dry-run | -n) opt_dry_run=: ;;
--features) func_features ;;
# Catch anything else as an error
*) func_error "invalid argument for $opt"
exit_cmd=exit
- break
- ;;
- esac
+ break
+ ;;
+ esac
mode="$1"
shift
--quiet|--silent) preserve_args="$preserve_args $opt"
opt_silent=:
- ;;
+ ;;
--verbose| -v) preserve_args="$preserve_args $opt"
opt_silent=false
- ;;
+ ;;
--tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
preserve_args="$preserve_args $opt $1"
func_enable_tag "$1" # tagname is set here
shift
- ;;
+ ;;
# Separate optargs to long options:
-dlopen=*|--mode=*|--tag=*)
-*) func_fatal_help "unrecognized option \`$opt'" ;;
*) nonopt="$opt"
- break
- ;;
- esac
- done
+ break
+ ;;
+ esac
+ done
case $host in
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
$progname: and run autoconf again.
_LT_EOF
- else
+ else
cat >&2 <<_LT_EOF
$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
$progname: and run autoconf again.
_LT_EOF
- fi
+ fi
else
cat >&2 <<_LT_EOF
$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
$progname: You should recreate aclocal.m4 with macros from revision $package_revision
$progname: of $PACKAGE $VERSION and run autoconf again.
_LT_EOF
- fi
+ fi
exit $EXIT_MISMATCH
fi
args=$func_stripname_result
lastarg=
save_ifs="$IFS"; IFS=','
- for arg in $args; do
+ for arg in $args; do
IFS="$save_ifs"
func_quote_for_eval "$arg"
lastarg="$lastarg $func_quote_for_eval_result"
continue
;;
- *)
+ * )
# Accept the current argument as the source file.
# The previous "srcfile" becomes the current argument.
#
if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
func_show_eval '$MV "$output_obj" "$lobj"' \
'error=$?; $opt_dry_run || $RM $removelist; exit $error'
- fi
+ fi
# Allow error messages only from the first compilation.
if test "$suppress_opt" = yes; then
- suppress_output=' >/dev/null 2>&1'
+ suppress_output=' >/dev/null 2>&1'
fi
fi
else
if test ! -f "$dir/$dlname"; then
func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
- fi
fi
+ fi
;;
*.lo)
# Now add the directory to shlibpath_var.
if eval "test -z \"\$$shlibpath_var\""; then
eval "$shlibpath_var=\"\$dir\""
- else
+ else
eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
fi
done
func_source "$func_ltwrapper_scriptname_result"
# Transform arg to wrapped name.
file="$progdir/$program"
- fi
+ fi
;;
esac
# Quote arguments (to preserve shell metacharacters).
if test -n "$shlibpath_var"; then
eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
$ECHO "export $shlibpath_var"
- fi
+ fi
$ECHO "$cmd$args"
exit $EXIT_SUCCESS
fi
*[\\\ /]cp\ *) ;;
*) prev=$arg ;;
esac
- ;;
+ ;;
-g | -m | -o)
prev=$arg
;;
esac
# Do a test to see if this is really a libtool program.
- case $host in
+ case $host in
*cygwin* | *mingw*)
if func_ltwrapper_executable_p "$file"; then
func_ltwrapper_scriptname "$file"
-static-libtool-libs)
if test -z "$pic_flag" && test -n "$link_static_flag"; then
dlopen_self=$dlopen_self_static
- fi
+ fi
prefer_static_libs=yes
;;
esac
case "$deplibs " in
*" $qarg.ltframework "*) ;;
*) deplibs="$deplibs $qarg.ltframework" # this is fixed later
- ;;
+ ;;
esac
;;
esac
non_pic_object=$xdir$func_lo2o_result
func_append libobjs " $pic_object"
func_append non_pic_objects " $non_pic_object"
- else
+ else
func_fatal_error "\`$arg' is not a valid libtool object"
+ fi
fi
- fi
done
else
func_fatal_error "link input file \`$arg' does not exist"
*" $arg "*) ;;
* ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
esac
- continue
- ;;
+ continue
+ ;;
-multi_module)
single_module="${wl}-multi_module"
-* | +*)
func_quote_for_eval "$arg"
arg="$func_quote_for_eval_result"
- ;;
+ ;;
*.$objext)
# A standard object.
non_pic_object=$xdir$func_lo2o_result
func_append libobjs " $pic_object"
func_append non_pic_objects " $non_pic_object"
- else
+ else
func_fatal_error "\`$arg' is not a valid libtool object"
+ fi
fi
- fi
;;
*.$libext)
# to be aesthetically quoted because they are evaled later.
func_quote_for_eval "$arg"
arg="$func_quote_for_eval_result"
- ;;
+ ;;
esac # arg
# Now actually substitute the argument into the commands.
*" $deplib "*) ;;
* ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
esac
- fi
+ fi
fi
continue
;;
continue
fi
fi
- ;;
+ ;;
*) ;;
esac
fi
case " $dlpreconveniencelibs " in
*" $deplib "*) ;;
*)
- valid_a_lib=no
- case $deplibs_check_method in
- match_pattern*)
+ valid_a_lib=no
+ case $deplibs_check_method in
+ match_pattern*)
set dummy $deplibs_check_method; shift
match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \
| $EGREP "$match_pattern_regex" > /dev/null; then
- valid_a_lib=yes
- fi
- ;;
- pass_all)
valid_a_lib=yes
+ fi
;;
- esac
- if test "$valid_a_lib" != yes; then
+ pass_all)
+ valid_a_lib=yes
+ ;;
+ esac
+ if test "$valid_a_lib" != yes; then
$ECHO
$ECHO "*** Warning: Trying to link with static lib archive $deplib."
$ECHO "*** I have the capability to make that library automatically link in when"
$ECHO "*** shared version of the library, which you do not appear to have"
$ECHO "*** because the file extensions .$libext of this argument makes me believe"
$ECHO "*** that it is just a static archive that I should not use here."
- else
+ else
$ECHO
$ECHO "*** Warning: Linking the shared library $output against the"
$ECHO "*** static library $deplib is not portable!"
- deplibs="$deplib $deplibs"
- fi
+ deplibs="$deplib $deplibs"
+ fi
;;
esac
continue
case " $new_inherited_linker_flags " in
*" $tmp_inherited_linker_flag "*) ;;
*) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
- esac
+ esac
done
fi
dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
for deplib in $dependency_libs; do
deplibs="$deplib $deplibs"
if $opt_duplicate_deps ; then
- case "$tmp_libs " in
- *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
- esac
- fi
+ case "$tmp_libs " in
+ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+ esac
+ fi
tmp_libs="$tmp_libs $deplib"
done
elif test "$linkmode" != prog && test "$linkmode" != lib; then
link_static=no # Whether the deplib will be linked statically
use_static_libs=$prefer_static_libs
- if test "$use_static_libs" = built && test "$installed" = yes; then
+ if test "$use_static_libs" = built && test "$installed" = yes ; then
use_static_libs=no
fi
if test -n "$library_names" &&
need_relink=no
;;
*)
- if test "$installed" = no; then
- notinst_deplibs="$notinst_deplibs $lib"
- need_relink=yes
- fi
+ if test "$installed" = no; then
+ notinst_deplibs="$notinst_deplibs $lib"
+ need_relink=yes
+ fi
;;
esac
# This is a shared library
$GREP ": [^:]* bundle" >/dev/null ; then
if test "X$dlopenmodule" != "X$lib"; then
$ECHO "*** Warning: lib $linklib is a module, not a shared library"
- if test -z "$old_library" ; then
+ if test -z "$old_library" ; then
$ECHO
$ECHO "*** And there doesn't seem to be a static archive available"
$ECHO "*** The link will probably fail, sorry"
- else
- add="$dir/$old_library"
- fi
+ else
+ add="$dir/$old_library"
+ fi
elif test -n "$old_library"; then
add="$dir/$old_library"
- fi
+ fi
fi
esac
elif test "$hardcode_minus_L" = no; then
elif test "$hardcode_automatic" = yes; then
if test -n "$inst_prefix_dir" &&
test -f "$inst_prefix_dir$libdir/$linklib" ; then
- add="$inst_prefix_dir$libdir/$linklib"
+ add="$inst_prefix_dir$libdir/$linklib"
else
- add="$libdir/$linklib"
+ add="$libdir/$linklib"
fi
else
# We cannot seem to hardcode it, guess we'll fake it.
darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
if test -z "$darwin_install_name"; then
darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
- fi
+ fi
compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
path=
- fi
+ fi
fi
;;
*)
func_warning "\`$deplib' seems to be moved"
path="-L$absdir"
- fi
- ;;
- esac
+ fi
+ ;;
+ esac
case " $deplibs " in
*" $path "*) ;;
*) deplibs="$path $deplibs" ;;
$output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
if test "X$precious_files_regex" != "X"; then
if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
- then
+ then
continue
fi
fi
done
test -n "$removelist" && \
func_show_eval "${RM}r \$removelist"
- fi
+ fi
# Now set the variables for building old libraries.
if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
*-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
# Compiler inserts libc in the correct place for threads to work
;;
- *)
+ *)
# Add libc to deplibs on all other systems if necessary.
if test "$build_libtool_need_lc" = "yes"; then
deplibs="$deplibs -lc"
i=""
;;
esac
- fi
+ fi
if test -n "$i" ; then
libname=`eval "\\$ECHO \"$libname_spec\""`
deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
$SED -e 10q |
$EGREP "$file_magic_regex" > /dev/null; then
- newdeplibs="$newdeplibs $a_deplib"
- a_deplib=""
- break 2
+ newdeplibs="$newdeplibs $a_deplib"
+ a_deplib=""
+ break 2
fi
done
done
len=$func_len_result
if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
func_show_eval "$cmd" 'exit $?'
- skipped_export=false
+ skipped_export=false
else
- # The command line is too long to execute in one step.
+ # The command line is too long to execute in one step.
func_verbose "using reloadable object file for export list..."
- skipped_export=:
+ skipped_export=:
# Break out early, otherwise skipped_export may be
# set to false by a later but shorter cmd.
break
tmp_deplibs=
for test_deplib in $deplibs; do
- case " $convenience " in
- *" $test_deplib "*) ;;
- *)
- tmp_deplibs="$tmp_deplibs $test_deplib"
- ;;
- esac
+ case " $convenience " in
+ *" $test_deplib "*) ;;
+ *)
+ tmp_deplibs="$tmp_deplibs $test_deplib"
+ ;;
+ esac
done
deplibs="$tmp_deplibs"
test "X$libobjs" = "X " && libobjs=
fi
fi
-
+
if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
eval flag=\"$thread_safe_flag_spec\"
linker_flags="$linker_flags $flag"
cmds=$module_cmds
fi
else
- if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
- eval test_cmds=\"$archive_expsym_cmds\"
- cmds=$archive_expsym_cmds
- else
- eval test_cmds=\"$archive_cmds\"
- cmds=$archive_cmds
+ if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+ eval test_cmds=\"$archive_expsym_cmds\"
+ cmds=$archive_expsym_cmds
+ else
+ eval test_cmds=\"$archive_cmds\"
+ cmds=$archive_cmds
fi
fi
else
if test -n "$save_libobjs"; then
func_verbose "creating reloadable object files..."
- output=$output_objdir/$output_la-${k}.$objext
+ output=$output_objdir/$output_la-${k}.$objext
eval test_cmds=\"$reload_cmds\"
func_len " $test_cmds"
len0=$func_len_result
len=$len0
- # Loop over the list of objects to be linked.
- for obj in $save_libobjs
- do
+ # Loop over the list of objects to be linked.
+ for obj in $save_libobjs
+ do
func_len " $obj"
func_arith $len + $func_len_result
len=$func_arith_result
- if test "X$objlist" = X ||
+ if test "X$objlist" = X ||
test "$len" -lt "$max_cmd_len"; then
func_append objlist " $obj"
- else
- # The command $test_cmds is almost too long, add a
- # command to the queue.
- if test "$k" -eq 1 ; then
- # The first file doesn't have a previous command to add.
- eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
- else
- # All subsequent reloadable object files will link in
- # the last one created.
+ else
+ # The command $test_cmds is almost too long, add a
+ # command to the queue.
+ if test "$k" -eq 1 ; then
+ # The first file doesn't have a previous command to add.
+ eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
+ else
+ # All subsequent reloadable object files will link in
+ # the last one created.
eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\"
- fi
- last_robj=$output_objdir/$output_la-${k}.$objext
+ fi
+ last_robj=$output_objdir/$output_la-${k}.$objext
func_arith $k + 1
k=$func_arith_result
- output=$output_objdir/$output_la-${k}.$objext
- objlist=$obj
+ output=$output_objdir/$output_la-${k}.$objext
+ objlist=$obj
func_len " $last_robj"
func_arith $len0 + $func_len_result
len=$func_arith_result
- fi
- done
- # Handle the remaining objects by creating one last
- # reloadable object file. All subsequent reloadable object
- # files will link in the last one created.
- test -z "$concat_cmds" || concat_cmds=$concat_cmds~
- eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
+ fi
+ done
+ # Handle the remaining objects by creating one last
+ # reloadable object file. All subsequent reloadable object
+ # files will link in the last one created.
+ test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+ eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
if test -n "$last_robj"; then
eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
fi
output=
fi
- if ${skipped_export-false}; then
+ if ${skipped_export-false}; then
func_verbose "generating symbol list for \`$libname.la'"
- export_symbols="$output_objdir/$libname.exp"
+ export_symbols="$output_objdir/$libname.exp"
$opt_dry_run || $RM $export_symbols
- libobjs=$output
- # Append the command to create the export file.
+ libobjs=$output
+ # Append the command to create the export file.
test -z "$concat_cmds" || concat_cmds=$concat_cmds~
eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
if test -n "$last_robj"; then
eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
- fi
+ fi
fi
test -n "$save_libobjs" &&
func_verbose "creating a temporary reloadable object file: $output"
- # Loop through the commands generated above and execute them.
- save_ifs="$IFS"; IFS='~'
- for cmd in $concat_cmds; do
- IFS="$save_ifs"
+ # Loop through the commands generated above and execute them.
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $concat_cmds; do
+ IFS="$save_ifs"
$opt_silent || {
func_quote_for_expand "$cmd"
eval "func_echo $func_quote_for_expand_result"
exit $lt_exit
}
- done
- IFS="$save_ifs"
+ done
+ IFS="$save_ifs"
if test -n "$export_symbols_regex" && ${skipped_export-false}; then
func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
cmds=$module_cmds
fi
else
- if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
- cmds=$archive_expsym_cmds
- else
- cmds=$archive_cmds
+ if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+ cmds=$archive_expsym_cmds
+ else
+ cmds=$archive_cmds
fi
fi
fi
case $host in
*-*-darwin*)
- # Don't allow lazy linking, it breaks C++ global constructors
+ # Don't allow lazy linking, it breaks C++ global constructors
# But is supposedly fixed on 10.4 or later (yay!).
- if test "$tagname" = CXX ; then
+ if test "$tagname" = CXX ; then
case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
10.[0123])
- compile_command="$compile_command ${wl}-bind_at_load"
- finalize_command="$finalize_command ${wl}-bind_at_load"
+ compile_command="$compile_command ${wl}-bind_at_load"
+ finalize_command="$finalize_command ${wl}-bind_at_load"
;;
esac
- fi
+ fi
# Time to change all our "foo.ltframework" stuff back to "-framework foo"
compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
- ;;
+ ;;
esac
# template prelinking step
if test -n "$prelink_cmds"; then
func_execute_cmds "$prelink_cmds" 'exit $?'
- fi
+ fi
wrappers_required=yes
- case $host in
- *cygwin* | *mingw* )
+ case $host in
+ *cygwin* | *mingw* )
if test "$build_libtool_libs" != yes; then
wrappers_required=no
fi
- ;;
+ ;;
*cegcc)
# Disable wrappers for cegcc, we are cross compiling anyway.
wrappers_required=no
- ;;
- *)
+ ;;
+ * )
if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
wrappers_required=no
- fi
- ;;
- esac
+ fi
+ ;;
+ esac
if test "$wrappers_required" = no; then
# Replace the output file specification.
compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
func_dirname_and_basename "$output" "" "."
output_name=$func_basename_result
output_path=$func_dirname_result
- cwrappersource="$output_path/$objdir/lt-$output_name.c"
- cwrapper="$output_path/$output_name.exe"
+ cwrappersource="$output_path/$objdir/lt-$output_name.c"
+ cwrapper="$output_path/$output_name.exe"
$RM $cwrappersource $cwrapper
trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
$opt_dry_run || {
$LTCC $LTCFLAGS -o $cwrapper $cwrappersource
$STRIP $cwrapper
- }
+ }
# Now, create the wrapper script for func_source use:
func_ltwrapper_scriptname $cwrapper
# note: this script will not be executed, so do not chmod.
if test "x$build" = "x$host" ; then
$cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
- else
+ else
func_emit_wrapper no > $func_ltwrapper_scriptname_result
fi
- }
- ;;
+}
+ ;;
* )
$RM $output
trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
oldobjs="$old_deplibs $non_pic_objects"
if test "$preload" = yes && test -f "$symfileobj"; then
oldobjs="$oldobjs $symfileobj"
- fi
+ fi
fi
addlibs="$old_convenience"
fi
# Do each command in the archive commands.
if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
- cmds=$old_archive_from_new_cmds
+ cmds=$old_archive_from_new_cmds
else
# Add any objects from preloaded convenience libraries
:
else
$ECHO "copying selected object files to avoid basename conflicts..."
- gentop="$output_objdir/${outputname}x"
- generated="$generated $gentop"
+ gentop="$output_objdir/${outputname}x"
+ generated="$generated $gentop"
func_mkdir_p "$gentop"
save_oldobjs=$oldobjs
oldobjs=
# the above command should be used before it gets too long
oldobjs=$objlist
if test "$obj" = "$last_oldobj" ; then
- RANLIB=$save_RANLIB
+ RANLIB=$save_RANLIB
fi
test -z "$concat_cmds" || concat_cmds=$concat_cmds~
eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
fi
fi
func_execute_cmds "$cmds" 'exit $?'
- done
+ done
test -n "$generated" && \
func_show_eval "${RM}r$generated"
*.la)
func_basename "$lib"
name="$func_basename_result"
- eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
test -z "$libdir" && \
func_fatal_error "\`$lib' is not a valid libtool archive"
- newdlfiles="$newdlfiles $libdir/$name"
+ newdlfiles="$newdlfiles $libdir/$name"
;;
*) newdlfiles="$newdlfiles $lib" ;;
esac
# the library:
func_basename "$lib"
name="$func_basename_result"
- eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
test -z "$libdir" && \
func_fatal_error "\`$lib' is not a valid libtool archive"
- newdlprefiles="$newdlprefiles $libdir/$name"
+ newdlprefiles="$newdlprefiles $libdir/$name"
;;
esac
done
;;
esac
exit $EXIT_SUCCESS
-}
+ }
{ test "$mode" = link || test "$mode" = relink; } &&
func_mode_link ${1+"$@"}
*" $dlname "*) ;;
*) rmfiles="$rmfiles $objdir/$dlname" ;;
esac
- test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
+ test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
;;
uninstall)
if test -n "$library_names"; then
# Do each command in the postuninstall commands.
func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
- fi
+ fi
if test -n "$old_library"; then
# Do each command in the old_postuninstall commands.
func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
- fi
+ fi
# FIXME: should reinstall the best remaining shared library.
;;
esac
if func_ltwrapper_p "$file"; then
if func_ltwrapper_executable_p "$file"; then
func_ltwrapper_scriptname "$file"
- relink_command=
+ relink_command=
func_source $func_ltwrapper_scriptname_result
rmfiles="$rmfiles $func_ltwrapper_scriptname_result"
else
/*
- * $Id$
+ * $Id: pa_converters.c 1661 2011-04-28 18:54:46Z rob_bielik $
* Portable Audio I/O Library sample conversion mechanism
*
* Based on the Open Source API proposed by Ross Bencina
@todo Consider whether functions which dither but don't clip should exist,
V18 automatically enabled clipping whenever dithering was selected. Perhaps
- we should do the same.
+ we should do the same.
see: "require clipping for dithering sample conversion functions?"
http://www.portaudio.com/trac/ticket/112
void *sourceBuffer, signed int sourceStride,
unsigned int count, struct PaUtilTriangularDitherGenerator *ditherGenerator )
{
- unsigned char *src = (unsigned char*)sourceBuffer;
- PaInt16 *dest = (PaInt16*)destinationBuffer;
+ unsigned char *src = (unsigned char *)sourceBuffer;
+ PaInt16 *dest = (PaInt16 *)destinationBuffer;
PaInt32 temp, dither;
dither = PaUtil_Generate16BitTriangularDither( ditherGenerator );
*dest = (PaInt16) (((temp >> 1) + dither) >> 15);
- src += sourceStride * 3;
+ src += sourceStride * 3;
dest += destinationStride;
}
}
src += sourceStride * 3;
dest += destinationStride;
- }
+}
}
/* -------------------------------------------------------------------------- */
/*
- * $Id$
+ * $Id: pa_front.c 1673 2011-05-06 04:40:22Z rob_bielik $
* Portable Audio I/O Library Multi-Host API front end
* Validate function parameters and manage multiple host APIs.
*
#define PA_VERSION_ 1899
#define PA_VERSION_TEXT_ "PortAudio V19-devel (built " __DATE__ " " __TIME__ ")"
-
+extern void PaUtil_InitializeHotPlug();
+extern void PaUtil_TerminateHotPlug();
int Pa_GetVersion( void )
}
+typedef struct _PaInternalInfo
+{
+ PaUtilHostApiRepresentation **hostApis_;
+ int hostApisCount_;
+ int initializationCount_;
+ int deviceCount_;
+
+ PaUtilStreamRepresentation *firstOpenStream_;
+
+ PaDevicesChangedCallback* devicesChangedCallback_;
+ void* devicesChangedCallbackUserData_;
+
+} PaInternalInfo;
-static PaUtilHostApiRepresentation **hostApis_ = 0;
-static int hostApisCount_ = 0;
-static int initializationCount_ = 0;
-static int deviceCount_ = 0;
+static PaInternalInfo paInternalInfo_ = {0};
-PaUtilStreamRepresentation *firstOpenStream_ = NULL;
-#define PA_IS_INITIALISED_ (initializationCount_ != 0)
+
+#define PA_IS_INITIALISED_ (paInternalInfo_.initializationCount_ != 0)
static int CountHostApiInitializers( void )
/* terminate in reverse order from initialization */
PA_DEBUG(("TerminateHostApis in \n"));
- while( hostApisCount_ > 0 )
+ while( paInternalInfo_.hostApisCount_ > 0 )
{
- --hostApisCount_;
- hostApis_[hostApisCount_]->Terminate( hostApis_[hostApisCount_] );
+ --paInternalInfo_.hostApisCount_;
+ paInternalInfo_.hostApis_[paInternalInfo_.hostApisCount_]->Terminate( paInternalInfo_.hostApis_[paInternalInfo_.hostApisCount_] );
}
- hostApisCount_ = 0;
- deviceCount_ = 0;
+ paInternalInfo_.hostApisCount_ = 0;
+ paInternalInfo_.deviceCount_ = 0;
- if( hostApis_ != 0 )
- PaUtil_FreeMemory( hostApis_ );
- hostApis_ = 0;
+ if( paInternalInfo_.hostApis_ != 0 )
+ PaUtil_FreeMemory( paInternalInfo_.hostApis_ );
+ paInternalInfo_.hostApis_ = 0;
PA_DEBUG(("TerminateHostApis out\n"));
}
initializerCount = CountHostApiInitializers();
- hostApis_ = (PaUtilHostApiRepresentation**)PaUtil_AllocateMemory(
+ paInternalInfo_.hostApis_ = (PaUtilHostApiRepresentation**)PaUtil_AllocateMemory(
sizeof(PaUtilHostApiRepresentation*) * initializerCount );
- if( !hostApis_ )
+ if( !paInternalInfo_.hostApis_ )
{
result = paInsufficientMemory;
goto error;
}
- hostApisCount_ = 0;
- deviceCount_ = 0;
+ paInternalInfo_.hostApisCount_ = 0;
+ paInternalInfo_.deviceCount_ = 0;
baseDeviceIndex = 0;
for( i=0; i< initializerCount; ++i )
{
- hostApis_[hostApisCount_] = NULL;
+ paInternalInfo_.hostApis_[paInternalInfo_.hostApisCount_] = NULL;
PA_DEBUG(( "before paHostApiInitializers[%d].\n",i));
- result = paHostApiInitializers[i]( &hostApis_[hostApisCount_], hostApisCount_ );
+ result = paHostApiInitializers[i]( &paInternalInfo_.hostApis_[paInternalInfo_.hostApisCount_], paInternalInfo_.hostApisCount_ );
if( result != paNoError )
goto error;
PA_DEBUG(( "after paHostApiInitializers[%d].\n",i));
- if( hostApis_[hostApisCount_] )
+ if( paInternalInfo_.hostApis_[paInternalInfo_.hostApisCount_] )
{
- PaUtilHostApiRepresentation* hostApi = hostApis_[hostApisCount_];
+ PaUtilHostApiRepresentation* hostApi = paInternalInfo_.hostApis_[paInternalInfo_.hostApisCount_];
assert( hostApi->info.defaultInputDevice < hostApi->info.deviceCount );
assert( hostApi->info.defaultOutputDevice < hostApi->info.deviceCount );
hostApi->info.defaultOutputDevice += baseDeviceIndex;
baseDeviceIndex += hostApi->info.deviceCount;
- deviceCount_ += hostApi->info.deviceCount;
+ paInternalInfo_.deviceCount_ += hostApi->info.deviceCount;
- ++hostApisCount_;
+ ++paInternalInfo_.hostApisCount_;
}
}
if( device < 0 )
return -1;
- while( i < hostApisCount_
- && device >= hostApis_[i]->info.deviceCount )
+ while( i < paInternalInfo_.hostApisCount_
+ && device >= paInternalInfo_.hostApis_[i]->info.deviceCount )
{
- device -= hostApis_[i]->info.deviceCount;
+ device -= paInternalInfo_.hostApis_[i]->info.deviceCount;
++i;
}
- if( i >= hostApisCount_ )
+ if( i >= paInternalInfo_.hostApisCount_ )
return -1;
if( hostSpecificDeviceIndex )
static void AddOpenStream( PaStream* stream )
{
- ((PaUtilStreamRepresentation*)stream)->nextOpenStream = firstOpenStream_;
- firstOpenStream_ = (PaUtilStreamRepresentation*)stream;
+ ((PaUtilStreamRepresentation*)stream)->nextOpenStream = paInternalInfo_.firstOpenStream_;
+ paInternalInfo_.firstOpenStream_ = (PaUtilStreamRepresentation*)stream;
}
static void RemoveOpenStream( PaStream* stream )
{
PaUtilStreamRepresentation *previous = NULL;
- PaUtilStreamRepresentation *current = firstOpenStream_;
+ PaUtilStreamRepresentation *current = paInternalInfo_.firstOpenStream_;
while( current != NULL )
{
{
if( previous == NULL )
{
- firstOpenStream_ = current->nextOpenStream;
+ paInternalInfo_.firstOpenStream_ = current->nextOpenStream;
}
else
{
/* we call Pa_CloseStream() here to ensure that the same destruction
logic is used for automatically closed streams */
- while( firstOpenStream_ != NULL )
- Pa_CloseStream( firstOpenStream_ );
+ while( paInternalInfo_.firstOpenStream_ != NULL )
+ Pa_CloseStream( paInternalInfo_.firstOpenStream_ );
}
if( PA_IS_INITIALISED_ )
{
- ++initializationCount_;
+ ++paInternalInfo_.initializationCount_;
result = paNoError;
}
else
PaUtil_InitializeClock();
PaUtil_ResetTraceMessages();
+ /* Initialize hot plug here, so all its internal info is setup */
+ PaUtil_InitializeHotPlug();
+
result = InitializeHostApis();
if( result == paNoError )
- ++initializationCount_;
+ ++paInternalInfo_.initializationCount_;
}
PA_LOGAPI_EXIT_PAERROR( "Pa_Initialize", result );
if( PA_IS_INITIALISED_ )
{
- if( --initializationCount_ == 0 )
+ if( --paInternalInfo_.initializationCount_ == 0 )
{
CloseOpenStreams();
TerminateHostApis();
+ PaUtil_TerminateHotPlug();
+
PaUtil_DumpTraceMessages();
}
result = paNoError;
{
result = paHostApiNotFound;
- for( i=0; i < hostApisCount_; ++i )
+ for( i=0; i < paInternalInfo_.hostApisCount_; ++i )
{
- if( hostApis_[i]->info.type == type )
+ if( paInternalInfo_.hostApis_[i]->info.type == type )
{
result = i;
break;
{
result = paHostApiNotFound;
- for( i=0; i < hostApisCount_; ++i )
+ for( i=0; i < paInternalInfo_.hostApisCount_; ++i )
{
- if( hostApis_[i]->info.type == type )
+ if( paInternalInfo_.hostApis_[i]->info.type == type )
{
- *hostApi = hostApis_[i];
+ *hostApi = paInternalInfo_.hostApis_[i];
result = paNoError;
break;
}
}
else
{
- result = hostApisCount_;
+ result = paInternalInfo_.hostApisCount_;
}
PA_LOGAPI_EXIT_PAERROR_OR_T_RESULT( "Pa_GetHostApiCount", "PaHostApiIndex: %d", result );
/* internal consistency check: make sure that the default host api
index is within range */
- if( result < 0 || result >= hostApisCount_ )
+ if( result < 0 || result >= paInternalInfo_.hostApisCount_ )
{
result = paInternalError;
}
PA_LOGAPI(("\tPaHostApiInfo*: NULL [ PortAudio not initialized ]\n" ));
}
- else if( hostApi < 0 || hostApi >= hostApisCount_ )
+ else if( hostApi < 0 || hostApi >= paInternalInfo_.hostApisCount_ )
{
info = NULL;
}
else
{
- info = &hostApis_[hostApi]->info;
+ info = &paInternalInfo_.hostApis_[hostApi]->info;
PA_LOGAPI(("Pa_GetHostApiInfo returned:\n" ));
PA_LOGAPI(("\tPaHostApiInfo*: 0x%p\n", info ));
}
else
{
- if( hostApi < 0 || hostApi >= hostApisCount_ )
+ if( hostApi < 0 || hostApi >= paInternalInfo_.hostApisCount_ )
{
result = paInvalidHostApi;
}
else
{
if( hostApiDeviceIndex < 0 ||
- hostApiDeviceIndex >= hostApis_[hostApi]->info.deviceCount )
+ hostApiDeviceIndex >= paInternalInfo_.hostApis_[hostApi]->info.deviceCount )
{
result = paInvalidDevice;
}
else
{
- result = hostApis_[hostApi]->privatePaFrontInfo.baseDeviceIndex + hostApiDeviceIndex;
+ result = paInternalInfo_.hostApis_[hostApi]->privatePaFrontInfo.baseDeviceIndex + hostApiDeviceIndex;
}
}
}
}
else
{
- result = deviceCount_;
+ result = paInternalInfo_.deviceCount_;
}
PA_LOGAPI_EXIT_PAERROR_OR_T_RESULT( "Pa_GetDeviceCount", "PaDeviceIndex: %d", result );
}
else
{
- result = hostApis_[hostApi]->info.defaultInputDevice;
+ result = paInternalInfo_.hostApis_[hostApi]->info.defaultInputDevice;
}
PA_LOGAPI_EXIT_T( "Pa_GetDefaultInputDevice", "PaDeviceIndex: %d", result );
}
else
{
- result = hostApis_[hostApi]->info.defaultOutputDevice;
+ result = paInternalInfo_.hostApis_[hostApi]->info.defaultOutputDevice;
}
PA_LOGAPI_EXIT_T( "Pa_GetDefaultOutputDevice", "PaDeviceIndex: %d", result );
}
+PaError Pa_UpdateAvailableDeviceList( void )
+{
+ PaError result = paNoError;
+ void **scanResults = NULL;
+ int *deviceCounts = NULL;
+ int i = 0;
+
+ PA_LOGAPI_ENTER( "Pa_UpdateAvailableDeviceList" );
+ if( !PA_IS_INITIALISED_ )
+ {
+ result = paNotInitialized;
+ goto done;
+ }
+
+ /* Allocate data structures used in 2-stage commit */
+ scanResults = (void **) PaUtil_AllocateMemory( sizeof(void*) * paInternalInfo_.hostApisCount_ );
+ if( !scanResults )
+ {
+ result = paInsufficientMemory;
+ goto done;
+ }
+
+ deviceCounts = ( int * ) PaUtil_AllocateMemory( sizeof( int ) * paInternalInfo_.hostApisCount_ );
+ if( !deviceCounts )
+ {
+ result = paInsufficientMemory;
+ goto done;
+ }
+
+ /* Phase 1: Perform a scan of new devices */
+ for( i = 0 ; i < paInternalInfo_.hostApisCount_ ; ++i )
+ {
+ PaUtilHostApiRepresentation *hostApi = paInternalInfo_.hostApis_[i];
+ if( hostApi->ScanDeviceInfos == NULL )
+ continue;
+
+ PA_DEBUG(( "Scanning new device list for host api %d.\n",i));
+ if( hostApi->ScanDeviceInfos( hostApi, i, &scanResults[ i ], &deviceCounts[ i ] ) != paNoError )
+ break;
+
+ }
+
+ /* Check the result of the scan operation */
+ if( i < paInternalInfo_.hostApisCount_ )
+ {
+ /* If failure, rollback the scan changes back to original state */
+ int j = 0;
+ for( j = 0 ; j < i ; ++j )
+ {
+ PaUtilHostApiRepresentation *hostApi = paInternalInfo_.hostApis_[j];
+ if( hostApi->DisposeDeviceInfos == NULL )
+ continue;
+
+ PA_DEBUG(( "Performing rollback for device list scan for host api %d.\n",i));
+ hostApi->DisposeDeviceInfos( hostApi, scanResults[ j ], deviceCounts[ j ] );
+ }
+ }
+ else
+ {
+ int baseDeviceIndex = 0;
+ paInternalInfo_.deviceCount_ = 0;
+
+ /* Otherwise, commit the scan changes to each back-end */
+ for( i = 0 ; i < paInternalInfo_.hostApisCount_ ; ++i )
+ {
+ PaUtilHostApiRepresentation *hostApi = paInternalInfo_.hostApis_[i];
+ if( hostApi->CommitDeviceInfos == NULL )
+ {
+ /* Not yet implemented for this backend. Just
+ assume that the baseDeviceIndex and the paInternalInfo_.deviceCount_ are
+ incremented according to the values in the info */
+ baseDeviceIndex += hostApi->info.deviceCount;
+ paInternalInfo_.deviceCount_ += hostApi->info.deviceCount;
+ continue;
+ }
+
+ PA_DEBUG(( "Committing device list scan for host api %d.\n",i));
+ if( hostApi->CommitDeviceInfos( hostApi, i, scanResults[ i ], deviceCounts[ i ] ) != paNoError )
+ {
+ PA_DEBUG(( "Committing failed (shouldn't happen) %d.\n",i));
+ result = paInternalError;
+ goto done;
+ }
+
+ assert( hostApi->info.defaultInputDevice < hostApi->info.deviceCount );
+ assert( hostApi->info.defaultOutputDevice < hostApi->info.deviceCount );
+
+ hostApi->privatePaFrontInfo.baseDeviceIndex = baseDeviceIndex;
+
+ if( hostApi->info.defaultInputDevice != paNoDevice )
+ hostApi->info.defaultInputDevice += baseDeviceIndex;
+
+ if( hostApi->info.defaultOutputDevice != paNoDevice )
+ hostApi->info.defaultOutputDevice += baseDeviceIndex;
+
+ baseDeviceIndex += hostApi->info.deviceCount;
+ paInternalInfo_.deviceCount_ += hostApi->info.deviceCount;
+ }
+ }
+
+done:
+
+ if( scanResults )
+ PaUtil_FreeMemory( scanResults );
+
+ if( deviceCounts )
+ PaUtil_FreeMemory( deviceCounts );
+
+ return result;
+}
+
const PaDeviceInfo* Pa_GetDeviceInfo( PaDeviceIndex device )
{
int hostSpecificDeviceIndex;
}
else
{
- result = hostApis_[hostApiIndex]->deviceInfos[ hostSpecificDeviceIndex ];
+ result = paInternalInfo_.hostApis_[hostApiIndex]->deviceInfos[ hostSpecificDeviceIndex ];
PA_LOGAPI(("Pa_GetDeviceInfo returned:\n" ));
PA_LOGAPI(("\tPaDeviceInfo*: 0x%p:\n", result ));
if( inputHostApiIndex != -1 )
{
*hostApiInputDevice = paUseHostApiSpecificDeviceSpecification;
- *hostApi = hostApis_[inputHostApiIndex];
+ *hostApi = paInternalInfo_.hostApis_[inputHostApiIndex];
}
else
{
}
else
{
- if( inputParameters->device < 0 || inputParameters->device >= deviceCount_ )
+ if( inputParameters->device < 0 || inputParameters->device >= paInternalInfo_.deviceCount_ )
return paInvalidDevice;
inputHostApiIndex = FindHostApi( inputParameters->device, hostApiInputDevice );
if( inputHostApiIndex < 0 )
return paInternalError;
- *hostApi = hostApis_[inputHostApiIndex];
+ *hostApi = paInternalInfo_.hostApis_[inputHostApiIndex];
if( inputParameters->channelCount <= 0 )
return paInvalidChannelCount;
if( outputHostApiIndex != -1 )
{
*hostApiOutputDevice = paUseHostApiSpecificDeviceSpecification;
- *hostApi = hostApis_[outputHostApiIndex];
+ *hostApi = paInternalInfo_.hostApis_[outputHostApiIndex];
}
else
{
}
else
{
- if( outputParameters->device < 0 || outputParameters->device >= deviceCount_ )
+ if( outputParameters->device < 0 || outputParameters->device >= paInternalInfo_.deviceCount_ )
return paInvalidDevice;
outputHostApiIndex = FindHostApi( outputParameters->device, hostApiOutputDevice );
if( outputHostApiIndex < 0 )
return paInternalError;
- *hostApi = hostApis_[outputHostApiIndex];
+ *hostApi = paInternalInfo_.hostApis_[outputHostApiIndex];
if( outputParameters->channelCount <= 0 )
return paInvalidChannelCount;
return (PaError) result;
}
+extern void PaUtil_LockHotPlug();
+extern void PaUtil_UnlockHotPlug();
+
+
+PaError Pa_SetDevicesChangedCallback( void *userData, PaStreamFinishedCallback* devicesChangedCallback )
+{
+ PaUtil_LockHotPlug();
+ paInternalInfo_.devicesChangedCallback_ = devicesChangedCallback;
+ paInternalInfo_.devicesChangedCallbackUserData_ = userData;
+ PaUtil_UnlockHotPlug();
+ return paNoError;
+}
+
+/* Called whenever a OS audio device change has been detected */
+void PaUtil_DevicesChanged(unsigned state, void* pData)
+{
+ (void)state;
+ (void)pData;
+ PaUtil_LockHotPlug();
+ if (paInternalInfo_.devicesChangedCallback_)
+ {
+ (paInternalInfo_.devicesChangedCallback_)(paInternalInfo_.devicesChangedCallbackUserData_);
+ }
+ PaUtil_UnlockHotPlug();
+}
+
#ifndef PA_HOSTAPI_H
#define PA_HOSTAPI_H
/*
- * $Id$
+ * $Id: pa_hostapi.h 1664 2011-05-01 16:10:58Z rossb $
* Portable Audio I/O Library
* host api representation
*
const PaStreamParameters *inputParameters,
const PaStreamParameters *outputParameters,
double sampleRate );
+
+ /**
+ Collect current native device information and compute a new device count.
+ This method should not result in the host API making any changes to its
+ internal data structures, instead it is the first step in a two-stage commit
+ process which will be completed only if all host API scans return with no errors.
+
+ Some time later the caller will either (1) pass scanResults and newDeviceCount
+ to CommitDeviceInfos() to complete the transaction, or (2) pass scanResults
+ and newDeviceCount to DisposeDeviceInfos() to abort the transaction.
+ */
+ PaError (*ScanDeviceInfos)( struct PaUtilHostApiRepresentation *hostApi, PaHostApiIndex index, void **scanResults, int *newDeviceCount );
+
+ /**
+ Replace the previous device information with the device information
+ passed in as an argument via scanResults. This is the second/final stage of
+ the two-stage transaction required for updating the available device information.
+ This function should free any resources associated with the previous device
+ information.
+ @FIXME: this function should probably not return an error code as it should not be
+ permitted to fail.
+ */
+ PaError (*CommitDeviceInfos)( struct PaUtilHostApiRepresentation *hostApi, PaHostApiIndex index, void *scanResults, int deviceCount );
+
+ /**
+ Free device information previously returned by ScanDeviceInfos(). This function
+ will be called in cases where the update available device info transaction
+ failed for some reason.
+ */
+ PaError (*DisposeDeviceInfos)( struct PaUtilHostApiRepresentation *hostApi, void *scanResults, int deviceCount );
+
} PaUtilHostApiRepresentation;
/*
- * $Id$
+ * $Id: pa_process.c 1661 2011-04-28 18:54:46Z rob_bielik $
* Portable Audio I/O Library
* streamCallback <-> host buffer processing adapter
*
bp->inputZeroer = PaUtil_SelectZeroer( hostInputSampleFormat );
bp->userInputIsInterleaved = (userInputSampleFormat & paNonInterleaved)?0:1;
-
+
bp->hostInputIsInterleaved = (hostInputSampleFormat & paNonInterleaved)?0:1;
bp->userInputSampleFormatIsEqualToHost = ((userInputSampleFormat & ~paNonInterleaved) == (hostInputSampleFormat & ~paNonInterleaved));
}
else /* there are input channels */
{
-
+
destBytePtr = (unsigned char *)bp->tempInputBuffer;
if( bp->userInputIsInterleaved )
/* process host buffer directly, or use temp buffer if formats differ or host buffer non-interleaved */
if( bp->userInputSampleFormatIsEqualToHost && bp->hostInputIsInterleaved && bp->hostInputChannels[0][0].data)
{
- userInput = hostInputChannels[0].data;
- destBytePtr = (unsigned char *)hostInputChannels[0].data;
+ userInput = hostInputChannels[0].data;
+ destBytePtr = (unsigned char *)hostInputChannels[0].data;
skipInputConvert = 1;
- }
+ }
else
{
userInput = bp->tempInputBuffer;
/* setup non-interleaved ptrs */
if( bp->userInputSampleFormatIsEqualToHost && !bp->hostInputIsInterleaved && bp->hostInputChannels[0][0].data )
{
- for( i=0; i<bp->inputChannelCount; ++i )
- {
+ for( i=0; i<bp->inputChannelCount; ++i )
+ {
bp->tempInputBufferPtrs[i] = hostInputChannels[i].data;
}
skipInputConvert = 1;
{
for( i=0; i<bp->inputChannelCount; ++i )
{
- bp->tempInputBufferPtrs[i] = ((unsigned char*)bp->tempInputBuffer) +
- i * bp->bytesPerUserInputSample * frameCount;
- }
+ bp->tempInputBufferPtrs[i] = ((unsigned char*)bp->tempInputBuffer) +
+ i * bp->bytesPerUserInputSample * frameCount;
+ }
}
userInput = bp->tempInputBufferPtrs;
}
}
else
- {
+ {
if( skipInputConvert )
{
- for( i=0; i<bp->inputChannelCount; ++i )
- {
+ for( i=0; i<bp->inputChannelCount; ++i )
+ {
/* advance src ptr for next iteration */
hostInputChannels[i].data = ((unsigned char*)hostInputChannels[i].data) +
frameCount * hostInputChannels[i].stride * bp->bytesPerHostInputSample;
{
for( i=0; i<bp->inputChannelCount; ++i )
{
- bp->inputConverter( destBytePtr, destSampleStrideSamples,
- hostInputChannels[i].data,
- hostInputChannels[i].stride,
- frameCount, &bp->ditherGenerator );
+ bp->inputConverter( destBytePtr, destSampleStrideSamples,
+ hostInputChannels[i].data,
+ hostInputChannels[i].stride,
+ frameCount, &bp->ditherGenerator );
- destBytePtr += destChannelStrideBytes; /* skip to next destination channel */
+ destBytePtr += destChannelStrideBytes; /* skip to next destination channel */
- /* advance src ptr for next iteration */
- hostInputChannels[i].data = ((unsigned char*)hostInputChannels[i].data) +
- frameCount * hostInputChannels[i].stride * bp->bytesPerHostInputSample;
- }
+ /* advance src ptr for next iteration */
+ hostInputChannels[i].data = ((unsigned char*)hostInputChannels[i].data) +
+ frameCount * hostInputChannels[i].stride * bp->bytesPerHostInputSample;
}
}
}
+ }
/* configure user output buffer */
if( bp->outputChannelCount == 0 )
/* process host buffer directly, or use temp buffer if formats differ or host buffer non-interleaved */
if( bp->userOutputSampleFormatIsEqualToHost && bp->hostOutputIsInterleaved )
{
- userOutput = hostOutputChannels[0].data;
+ userOutput = hostOutputChannels[0].data;
skipOutputConvert = 1;
- }
+ }
else
{
userOutput = bp->tempOutputBuffer;
{
if( bp->userOutputSampleFormatIsEqualToHost && !bp->hostOutputIsInterleaved )
{
- for( i=0; i<bp->outputChannelCount; ++i )
- {
+ for( i = 0; i < bp->outputChannelCount; ++i )
+ {
bp->tempOutputBufferPtrs[i] = hostOutputChannels[i].data;
}
skipOutputConvert = 1;
{
for( i=0; i<bp->outputChannelCount; ++i )
{
- bp->tempOutputBufferPtrs[i] = ((unsigned char*)bp->tempOutputBuffer) +
- i * bp->bytesPerUserOutputSample * frameCount;
- }
+ bp->tempOutputBufferPtrs[i] = ((unsigned char*)bp->tempOutputBuffer) +
+ i * bp->bytesPerUserOutputSample * frameCount;
+ }
}
userOutput = bp->tempOutputBufferPtrs;
}
else
{
+
+ srcBytePtr = (unsigned char *)bp->tempOutputBuffer;
- srcBytePtr = (unsigned char *)bp->tempOutputBuffer;
-
- if( bp->userOutputIsInterleaved )
- {
- srcSampleStrideSamples = bp->outputChannelCount;
- srcChannelStrideBytes = bp->bytesPerUserOutputSample;
- }
- else /* user output is not interleaved */
- {
- srcSampleStrideSamples = 1;
- srcChannelStrideBytes = frameCount * bp->bytesPerUserOutputSample;
- }
+ if( bp->userOutputIsInterleaved )
+ {
+ srcSampleStrideSamples = bp->outputChannelCount;
+ srcChannelStrideBytes = bp->bytesPerUserOutputSample;
+ }
+ else /* user output is not interleaved */
+ {
+ srcSampleStrideSamples = 1;
+ srcChannelStrideBytes = frameCount * bp->bytesPerUserOutputSample;
+ }
- for( i=0; i<bp->outputChannelCount; ++i )
- {
- bp->outputConverter( hostOutputChannels[i].data,
- hostOutputChannels[i].stride,
- srcBytePtr, srcSampleStrideSamples,
- frameCount, &bp->ditherGenerator );
+ for( i=0; i<bp->outputChannelCount; ++i )
+ {
+ bp->outputConverter( hostOutputChannels[i].data,
+ hostOutputChannels[i].stride,
+ srcBytePtr, srcSampleStrideSamples,
+ frameCount, &bp->ditherGenerator );
- srcBytePtr += srcChannelStrideBytes; /* skip to next source channel */
+ srcBytePtr += srcChannelStrideBytes; /* skip to next source channel */
- /* advance dest ptr for next iteration */
- hostOutputChannels[i].data = ((unsigned char*)hostOutputChannels[i].data) +
- frameCount * hostOutputChannels[i].stride * bp->bytesPerHostOutputSample;
- }
- }
+ /* advance dest ptr for next iteration */
+ hostOutputChannels[i].data = ((unsigned char*)hostOutputChannels[i].data) +
+ frameCount * hostOutputChannels[i].stride * bp->bytesPerHostOutputSample;
+ }
+ }
}
framesProcessed += frameCount;
/*
- * $Id$
+ * $Id: pa_linux_alsa.c 1661 2011-04-28 18:54:46Z rob_bielik $
* PortAudio Portable Real-Time Audio Library
* Latest Version at: http://www.portaudio.com
* ALSA implementation by Joshua Haberman and Arve Knudsen
#ifdef PA_ALSA_USE_OBSOLETE_HOST_BUFFER_CALC
if( framesPerUserBuffer != paFramesPerBufferUnspecified )
- {
+ {
/* Preferably the host buffer size should be a multiple of the user buffer size */
if( bufferSize > framesPerUserBuffer )
else
if( alsa_snd_pcm_hw_params_test_period_size( self->pcm, hwParams, framesPerHostBuffer / 2, 0 ) == 0 )
framesPerHostBuffer /= 2;
- }
+ }
}
else
{
#ifdef PA_ALSA_USE_OBSOLETE_HOST_BUFFER_CALC
if( framesPerUserBuffer != paFramesPerBufferUnspecified )
- {
+ {
/* Try to get a power-of-two of the user buffer size. */
framesPerHostBuffer = framesPerUserBuffer;
if( framesPerHostBuffer < bufferSize )
framesPerHostBuffer = ((minmax_diff == 2) ? max - 1 : max);
}
- PA_DEBUG(( "%s: device period minimum = %lu\n", __FUNCTION__, min ));
- PA_DEBUG(( "%s: device period maximum = %lu\n", __FUNCTION__, max ));
- PA_DEBUG(( "%s: host buffer period = %lu\n", __FUNCTION__, framesPerHostBuffer ));
+ PA_DEBUG(( "%s: device period minimum = %lu\n", __FUNCTION__, min ));
+ PA_DEBUG(( "%s: device period maximum = %lu\n", __FUNCTION__, max ));
+ PA_DEBUG(( "%s: host buffer period = %lu\n", __FUNCTION__, framesPerHostBuffer ));
PA_DEBUG(( "%s: host buffer period latency = %f\n", __FUNCTION__, (double)(framesPerHostBuffer / sampleRate) ));
/* Try setting period size */
ENSURE_( alsa_snd_pcm_hw_params_get_rate_min( hwParams, &_min, &_dir ), paUnanticipatedHostError );
ENSURE_( alsa_snd_pcm_hw_params_get_rate_max( hwParams, &_max, &_dir ), paUnanticipatedHostError );
PA_DEBUG(( "%s: SR min = %d, max = %d, req = %lu\n", __FUNCTION__, _min, _max, approx ));
- }
+}
goto end;
}
int xrun = 0;
#ifdef PTHREAD_CANCELED
- pthread_testcancel();
+ pthread_testcancel();
#endif
/* @concern StreamStop if the main thread has requested a stop and the stream has not been effectively
xrun = 0;
#ifdef PTHREAD_CANCELED
- pthread_testcancel();
+ pthread_testcancel();
#endif
/** @concern Xruns Under/overflows are to be reported to the callback */
(float) sampleRate,
framesPerBuffer ));
VDBUG( ("Opening Stream.\n") );
-
+
/*These first few bits of code are from paSkeleton with few modifications.*/
if( inputParameters )
{
pthread_mutex_init( &stream->timingInformationMutex, NULL );
stream->timingInformationMutexIsInitialized = 1;
-
+
if( stream->outputUnit ) {
UpdateReciprocalOfActualOutputSampleRateFromDeviceProperty( stream );
stream->recipricalOfActualOutputSampleRate_ioProcCopy = stream->recipricalOfActualOutputSampleRate;
-
+
AudioDeviceAddPropertyListener( stream->outputDevice, 0, /* isInput = */ FALSE, kAudioDevicePropertyActualSampleRate,
AudioDevicePropertyActualSampleRateListenerProc, stream );
-
+
UpdateOutputLatencySamplesFromDeviceProperty( stream );
stream->deviceOutputLatencySamples_ioProcCopy = stream->deviceOutputLatencySamples;
-
+
AudioDeviceAddPropertyListener( stream->outputDevice, 0, /* isInput = */ FALSE, kAudioDevicePropertyLatency,
AudioDevicePropertyOutputLatencySamplesListenerProc, stream );
-
+
}else{
stream->recipricalOfActualOutputSampleRate = 1.;
stream->recipricalOfActualOutputSampleRate_ioProcCopy = 0.;
stream->deviceOutputLatencySamples_ioProcCopy = 0;
}
-
+
if( stream->inputUnit ) {
UpdateInputLatencySamplesFromDeviceProperty( stream );
stream->deviceInputLatencySamples_ioProcCopy = stream->deviceInputLatencySamples;
-
+
AudioDeviceAddPropertyListener( stream->inputDevice, 0, /* isInput = */ TRUE, kAudioDevicePropertyLatency,
AudioDevicePropertyInputLatencySamplesListenerProc, stream );
- }else{
+ } else {
stream->deviceInputLatencySamples = 0;
stream->deviceInputLatencySamples_ioProcCopy = 0;
- }
-
+ }
+
stream->state = STOPPED;
stream->xrunFlags = 0;
----------------------------------------------------------------- */
/* compute PaStreamCallbackTimeInfo */
-
+
if( pthread_mutex_trylock( &stream->timingInformationMutex ) == 0 ){
/* snapshot the ioproc copy of timing information */
stream->deviceOutputLatencySamples_ioProcCopy = stream->deviceOutputLatencySamples;
stream->recipricalOfActualOutputSampleRate_ioProcCopy = stream->recipricalOfActualOutputSampleRate;
stream->deviceInputLatencySamples_ioProcCopy = stream->deviceInputLatencySamples;
pthread_mutex_unlock( &stream->timingInformationMutex );
- }
+ }
/* For timeInfo.currentTime we could calculate current time backwards from the HAL audio
output time to give a more accurate impression of the current timeslice but it doesn't
- stream->deviceInputLatencySamples_ioProcCopy * stream->recipricalOfActualOutputSampleRate_ioProcCopy; // FIXME should be using input sample rate here?
timeInfo.outputBufferDacTime = HOST_TIME_TO_PA_TIME(inTimeStamp->mHostTime)
+ stream->deviceOutputLatencySamples_ioProcCopy * stream->recipricalOfActualOutputSampleRate_ioProcCopy;
- }
+ }
else /* full duplex with ring-buffer from a separate input AUHAL ioproc */
{
/* FIXME: review. this computation of inputBufferAdcTime is definitely wrong since it doesn't take the ring buffer latency into account */
- stream->deviceInputLatencySamples_ioProcCopy * stream->recipricalOfActualOutputSampleRate_ioProcCopy; // FIXME should be using input sample rate here?
timeInfo.outputBufferDacTime = 0;
}
-
+
//printf( "---%g, %g, %g\n", timeInfo.inputBufferAdcTime, timeInfo.currentTime, timeInfo.outputBufferDacTime );
if( isRender && stream->inputUnit == stream->outputUnit
if( stream ) {
- if( stream->outputUnit ) {
+ if( stream->outputUnit ) {
AudioDeviceRemovePropertyListener( stream->outputDevice, 0, /* isInput = */ FALSE, kAudioDevicePropertyActualSampleRate,
AudioDevicePropertyActualSampleRateListenerProc );
AudioDeviceRemovePropertyListener( stream->outputDevice, 0, /* isInput = */ FALSE, kAudioDevicePropertyLatency,
if( stream->outputUnit && stream->outputUnit != stream->inputUnit ) {
ERR_WRAP( AudioOutputUnitStart(stream->outputUnit) );
}
-
+
return paNoError;
#undef ERR_WRAP
}
/*
- * $Id$
+ * $Id: pa_win_ds.c 1672 2011-05-04 20:11:30Z rossb $
* Portable Audio I/O Library DirectSound implementation
*
* Authors: Phil Burk, Robert Marsanyi & Ross Bencina
#include "pa_win_waveformat.h"
#include "pa_win_wdmks_utils.h"
-#ifndef PA_USE_WMME
-#error "Portaudio internal error: PA_USE_WMME=0/1 not defined. pa_hostapi.h should ensure that it is."
-#endif
-
#if (defined(WIN32) && (defined(_MSC_VER) && (_MSC_VER >= 1200))) /* MSC version 6 and above */
#pragma comment( lib, "dsound.lib" )
#pragma comment( lib, "winmm.lib" )
const PaStreamParameters *inputParameters,
const PaStreamParameters *outputParameters,
double sampleRate );
+static PaError ScanDeviceInfos( struct PaUtilHostApiRepresentation *hostApi, PaHostApiIndex index, void **newDeviceInfos, int *newDeviceCount );
+static PaError CommitDeviceInfos( struct PaUtilHostApiRepresentation *hostApi, PaHostApiIndex index, void *deviceInfos, int deviceCount );
+static PaError DisposeDeviceInfos( struct PaUtilHostApiRepresentation *hostApi, void *deviceInfos, int deviceCount );
static PaError CloseStream( PaStream* stream );
static PaError StartStream( PaStream *stream );
static PaError StopStream( PaStream *stream );
volatile int abortProcessing; /* stop thread immediately */
} PaWinDsStream;
+typedef struct PaWinDsScanDeviceInfosResults{ /* used for tranferring device infos during scanning / rescanning */
+ PaDeviceInfo **deviceInfos;
+ PaDeviceIndex defaultInputDevice;
+ PaDeviceIndex defaultOutputDevice;
+} PaWinDsScanDeviceInfosResults;
+
/************************************************************************************
** Duplicate the input string using the allocations allocator.
int count;
int free;
- DSDeviceNameAndGUID *items; // Allocated using LocalAlloc()
+ DSDeviceNameAndGUID *items; /* Allocated using LocalAlloc() */
} DSDeviceNameAndGUIDVector;
typedef struct DSDeviceNamesAndGUIDs{
** The device will not be added to the device list if any errors are encountered.
*/
static PaError AddOutputDeviceInfoFromDirectSound(
- PaWinDsHostApiRepresentation *winDsHostApi, char *name, LPGUID lpGUID, char *pnpInterface )
+ PaWinDsDeviceInfo *winDsDeviceInfo, char *name, LPGUID lpGUID, char *pnpInterface )
{
- PaUtilHostApiRepresentation *hostApi = &winDsHostApi->inheritedHostApiRep;
- PaWinDsDeviceInfo *winDsDeviceInfo = (PaWinDsDeviceInfo*) hostApi->deviceInfos[hostApi->info.deviceCount];
PaDeviceInfo *deviceInfo = &winDsDeviceInfo->inheritedDeviceInfo;
HRESULT hr;
- LPDIRECTSOUND lpDirectSound;
+ LPDIRECTSOUND lpDirectSound = NULL;
DSCAPS caps;
- int deviceOK = TRUE;
PaError result = paNoError;
int i;
- /* Copy GUID to the device info structure. Set pointer. */
- if( lpGUID == NULL )
- {
- winDsDeviceInfo->lpGUID = NULL;
- }
- else
- {
- memcpy( &winDsDeviceInfo->guid, lpGUID, sizeof(GUID) );
- winDsDeviceInfo->lpGUID = &winDsDeviceInfo->guid;
- }
-
+
if( lpGUID )
{
if (IsEqualGUID (&IID_IRolandVSCEmulated1,lpGUID) ||
IsEqualGUID (&IID_IRolandVSCEmulated2,lpGUID) )
{
PA_DEBUG(("BLACKLISTED: %s \n",name));
- return paNoError;
+ return paInvalidDevice;
}
}
Note that using CoCreateInstance doesn't work on windows CE.
*/
hr = paWinDsDSoundEntryPoints.DirectSoundCreate( lpGUID, &lpDirectSound, NULL );
-
- /** try using CoCreateInstance because DirectSoundCreate was hanging under
- some circumstances - note this was probably related to the
- #define BOOL short bug which has now been fixed
- @todo delete this comment and the following code once we've ensured
- there is no bug.
- */
- /*
- hr = CoCreateInstance( &CLSID_DirectSound, NULL, CLSCTX_INPROC_SERVER,
- &IID_IDirectSound, (void**)&lpDirectSound );
-
- if( hr == S_OK )
- {
- hr = IDirectSound_Initialize( lpDirectSound, lpGUID );
- }
- */
-
if( hr != DS_OK )
{
if (hr == DSERR_ALLOCATED)
lpGUID->Data4[6],
lpGUID->Data4[7]));
- deviceOK = FALSE;
+ result = paUnanticipatedHostError;
+ goto error;
}
else
{
if( hr != DS_OK )
{
DBUG(("Cannot GetCaps() for DirectSound device %s. Result = 0x%x\n", name, hr ));
- deviceOK = FALSE;
+
+ result = paUnanticipatedHostError;
+ goto error;
}
else
{
if( caps.dwFlags & DSCAPS_EMULDRIVER )
{
/* If WMME supported, then reject Emulated drivers because they are lousy. */
- deviceOK = FALSE;
+ result = paInvalidDevice;
+ goto error;
}
#endif
- if( deviceOK )
+ deviceInfo->maxInputChannels = 0;
+ winDsDeviceInfo->deviceInputChannelCountIsKnown = 1;
+
+ /* DS output capabilities only indicate supported number of channels
+ using two flags which indicate mono and/or stereo.
+ We assume that stereo devices may support more than 2 channels
+ (as is the case with 5.1 devices for example) and so
+ set deviceOutputChannelCountIsKnown to 0 (unknown).
+ In this case OpenStream will try to open the device
+ when the user requests more than 2 channels, rather than
+ returning an error.
+ */
+ if( caps.dwFlags & DSCAPS_PRIMARYSTEREO )
{
- deviceInfo->maxInputChannels = 0;
- winDsDeviceInfo->deviceInputChannelCountIsKnown = 1;
-
- /* DS output capabilities only indicate supported number of channels
- using two flags which indicate mono and/or stereo.
- We assume that stereo devices may support more than 2 channels
- (as is the case with 5.1 devices for example) and so
- set deviceOutputChannelCountIsKnown to 0 (unknown).
- In this case OpenStream will try to open the device
- when the user requests more than 2 channels, rather than
- returning an error.
- */
- if( caps.dwFlags & DSCAPS_PRIMARYSTEREO )
- {
- deviceInfo->maxOutputChannels = 2;
- winDsDeviceInfo->deviceOutputChannelCountIsKnown = 0;
- }
- else
- {
- deviceInfo->maxOutputChannels = 1;
- winDsDeviceInfo->deviceOutputChannelCountIsKnown = 1;
- }
+ deviceInfo->maxOutputChannels = 2;
+ winDsDeviceInfo->deviceOutputChannelCountIsKnown = 0;
+ }
+ else
+ {
+ deviceInfo->maxOutputChannels = 1;
+ winDsDeviceInfo->deviceOutputChannelCountIsKnown = 1;
+ }
- /* Guess channels count from speaker configuration. We do it only when
- pnpInterface is NULL or when PAWIN_USE_WDMKS_DEVICE_INFO is undefined.
- */
+ /* Guess channels count from speaker configuration. We do it only when
+ pnpInterface is NULL or when PAWIN_USE_WDMKS_DEVICE_INFO is undefined.
+ */
#ifdef PAWIN_USE_WDMKS_DEVICE_INFO
- if( !pnpInterface )
+ if( !pnpInterface )
#endif
+ {
+ DWORD spkrcfg;
+ if( SUCCEEDED(IDirectSound_GetSpeakerConfig( lpDirectSound, &spkrcfg )) )
{
- DWORD spkrcfg;
- if( SUCCEEDED(IDirectSound_GetSpeakerConfig( lpDirectSound, &spkrcfg )) )
+ int count = 0;
+ switch (DSSPEAKER_CONFIG(spkrcfg))
{
- int count = 0;
- switch (DSSPEAKER_CONFIG(spkrcfg))
- {
- case DSSPEAKER_HEADPHONE: count = 2; break;
- case DSSPEAKER_MONO: count = 1; break;
- case DSSPEAKER_QUAD: count = 4; break;
- case DSSPEAKER_STEREO: count = 2; break;
- case DSSPEAKER_SURROUND: count = 4; break;
- case DSSPEAKER_5POINT1: count = 6; break;
- case DSSPEAKER_7POINT1: count = 8; break;
+ case DSSPEAKER_HEADPHONE: count = 2; break;
+ case DSSPEAKER_MONO: count = 1; break;
+ case DSSPEAKER_QUAD: count = 4; break;
+ case DSSPEAKER_STEREO: count = 2; break;
+ case DSSPEAKER_SURROUND: count = 4; break;
+ case DSSPEAKER_5POINT1: count = 6; break;
+ case DSSPEAKER_7POINT1: count = 8; break;
#ifndef DSSPEAKER_7POINT1_SURROUND
#define DSSPEAKER_7POINT1_SURROUND 0x00000008
#endif
- case DSSPEAKER_7POINT1_SURROUND: count = 8; break;
+ case DSSPEAKER_7POINT1_SURROUND: count = 8; break;
#ifndef DSSPEAKER_5POINT1_SURROUND
#define DSSPEAKER_5POINT1_SURROUND 0x00000009
#endif
- case DSSPEAKER_5POINT1_SURROUND: count = 6; break;
- }
- if( count )
- {
- deviceInfo->maxOutputChannels = count;
- winDsDeviceInfo->deviceOutputChannelCountIsKnown = 1;
- }
+ case DSSPEAKER_5POINT1_SURROUND: count = 6; break;
}
- }
-
-#ifdef PAWIN_USE_WDMKS_DEVICE_INFO
- if( pnpInterface )
- {
- int count = PaWin_WDMKS_QueryFilterMaximumChannelCount( pnpInterface, /* isInput= */ 0 );
- if( count > 0 )
+ if( count )
{
deviceInfo->maxOutputChannels = count;
winDsDeviceInfo->deviceOutputChannelCountIsKnown = 1;
}
}
-#endif /* PAWIN_USE_WDMKS_DEVICE_INFO */
+ }
- deviceInfo->defaultLowInputLatency = 0.; /** @todo IMPLEMENT ME */
- deviceInfo->defaultLowOutputLatency = 0.; /** @todo IMPLEMENT ME */
- deviceInfo->defaultHighInputLatency = 0.; /** @todo IMPLEMENT ME */
- deviceInfo->defaultHighOutputLatency = 0.; /** @todo IMPLEMENT ME */
-
- /* initialize defaultSampleRate */
-
- if( caps.dwFlags & DSCAPS_CONTINUOUSRATE )
+#ifdef PAWIN_USE_WDMKS_DEVICE_INFO
+ if( pnpInterface )
+ {
+ int count = PaWin_WDMKS_QueryFilterMaximumChannelCount( pnpInterface, /* isInput= */ 0 );
+ if( count > 0 )
{
- /* initialize to caps.dwMaxSecondarySampleRate incase none of the standard rates match */
- deviceInfo->defaultSampleRate = caps.dwMaxSecondarySampleRate;
-
- for( i = 0; i < PA_DEFAULTSAMPLERATESEARCHORDER_COUNT_; ++i )
- {
- if( defaultSampleRateSearchOrder_[i] >= caps.dwMinSecondarySampleRate
- && defaultSampleRateSearchOrder_[i] <= caps.dwMaxSecondarySampleRate )
- {
- deviceInfo->defaultSampleRate = defaultSampleRateSearchOrder_[i];
- break;
- }
- }
+ deviceInfo->maxOutputChannels = count;
+ winDsDeviceInfo->deviceOutputChannelCountIsKnown = 1;
}
- else if( caps.dwMinSecondarySampleRate == caps.dwMaxSecondarySampleRate )
+ }
+#endif /* PAWIN_USE_WDMKS_DEVICE_INFO */
+
+ deviceInfo->defaultLowInputLatency = 0.; /** @todo IMPLEMENT ME */
+ deviceInfo->defaultLowOutputLatency = 0.; /** @todo IMPLEMENT ME */
+ deviceInfo->defaultHighInputLatency = 0.; /** @todo IMPLEMENT ME */
+ deviceInfo->defaultHighOutputLatency = 0.; /** @todo IMPLEMENT ME */
+
+ /* initialize defaultSampleRate */
+
+ if( caps.dwFlags & DSCAPS_CONTINUOUSRATE )
+ {
+ /* initialize to caps.dwMaxSecondarySampleRate incase none of the standard rates match */
+ deviceInfo->defaultSampleRate = caps.dwMaxSecondarySampleRate;
+
+ for( i = 0; i < PA_DEFAULTSAMPLERATESEARCHORDER_COUNT_; ++i )
{
- if( caps.dwMinSecondarySampleRate == 0 )
+ if( defaultSampleRateSearchOrder_[i] >= caps.dwMinSecondarySampleRate
+ && defaultSampleRateSearchOrder_[i] <= caps.dwMaxSecondarySampleRate )
{
- /*
- ** On my Thinkpad 380Z, DirectSoundV6 returns min-max=0 !!
- ** But it supports continuous sampling.
- ** So fake range of rates, and hope it really supports it.
- */
- deviceInfo->defaultSampleRate = 44100.0f;
-
- DBUG(("PA - Reported rates both zero. Setting to fake values for device #%s\n", name ));
- }
- else
- {
- deviceInfo->defaultSampleRate = caps.dwMaxSecondarySampleRate;
+ deviceInfo->defaultSampleRate = defaultSampleRateSearchOrder_[i];
+ break;
}
}
- else if( (caps.dwMinSecondarySampleRate < 1000.0) && (caps.dwMaxSecondarySampleRate > 50000.0) )
+ }
+ else if( caps.dwMinSecondarySampleRate == caps.dwMaxSecondarySampleRate )
+ {
+ if( caps.dwMinSecondarySampleRate == 0 )
{
- /* The EWS88MT drivers lie, lie, lie. The say they only support two rates, 100 & 100000.
- ** But we know that they really support a range of rates!
- ** So when we see a ridiculous set of rates, assume it is a range.
+ /*
+ ** On my Thinkpad 380Z, DirectSoundV6 returns min-max=0 !!
+ ** But it supports continuous sampling.
+ ** So fake range of rates, and hope it really supports it.
*/
- deviceInfo->defaultSampleRate = 44100.0f;
- DBUG(("PA - Sample rate range used instead of two odd values for device #%s\n", name ));
+ deviceInfo->defaultSampleRate = 44100.0f;
+
+ DBUG(("PA - Reported rates both zero. Setting to fake values for device #%s\n", name ));
+ }
+ else
+ {
+ deviceInfo->defaultSampleRate = caps.dwMaxSecondarySampleRate;
}
- else deviceInfo->defaultSampleRate = caps.dwMaxSecondarySampleRate;
+ }
+ else if( (caps.dwMinSecondarySampleRate < 1000.0) && (caps.dwMaxSecondarySampleRate > 50000.0) )
+ {
+ /* The EWS88MT drivers lie, lie, lie. The say they only support two rates, 100 & 100000.
+ ** But we know that they really support a range of rates!
+ ** So when we see a ridiculous set of rates, assume it is a range.
+ */
+ deviceInfo->defaultSampleRate = 44100.0f;
+ DBUG(("PA - Sample rate range used instead of two odd values for device #%s\n", name ));
+ }
+ else deviceInfo->defaultSampleRate = caps.dwMaxSecondarySampleRate;
- //printf( "min %d max %d\n", caps.dwMinSecondarySampleRate, caps.dwMaxSecondarySampleRate );
- // dwFlags | DSCAPS_CONTINUOUSRATE
- }
+ //printf( "min %d max %d\n", caps.dwMinSecondarySampleRate, caps.dwMaxSecondarySampleRate );
+ // dwFlags | DSCAPS_CONTINUOUSRATE
}
IDirectSound_Release( lpDirectSound );
}
- if( deviceOK )
+ /* Copy GUID to the device info structure. Set pointer. */
+ if( lpGUID == NULL )
{
- deviceInfo->name = name;
-
- if( lpGUID == NULL )
- hostApi->info.defaultOutputDevice = hostApi->info.deviceCount;
-
- hostApi->info.deviceCount++;
+ winDsDeviceInfo->lpGUID = NULL;
}
+ else
+ {
+ memcpy( &winDsDeviceInfo->guid, lpGUID, sizeof(GUID) );
+ winDsDeviceInfo->lpGUID = &winDsDeviceInfo->guid;
+ }
+
+ deviceInfo->name = name;
+
+ return result;
+
+error:
+ if( lpDirectSound )
+ IDirectSound_Release( lpDirectSound );
return result;
}
** The device will not be added to the device list if any errors are encountered.
*/
static PaError AddInputDeviceInfoFromDirectSoundCapture(
- PaWinDsHostApiRepresentation *winDsHostApi, char *name, LPGUID lpGUID, char *pnpInterface )
+ PaWinDsDeviceInfo *winDsDeviceInfo, char *name, LPGUID lpGUID, char *pnpInterface )
{
- PaUtilHostApiRepresentation *hostApi = &winDsHostApi->inheritedHostApiRep;
- PaWinDsDeviceInfo *winDsDeviceInfo = (PaWinDsDeviceInfo*) hostApi->deviceInfos[hostApi->info.deviceCount];
PaDeviceInfo *deviceInfo = &winDsDeviceInfo->inheritedDeviceInfo;
HRESULT hr;
- LPDIRECTSOUNDCAPTURE lpDirectSoundCapture;
+ LPDIRECTSOUNDCAPTURE lpDirectSoundCapture = NULL;
DSCCAPS caps;
- int deviceOK = TRUE;
PaError result = paNoError;
- /* Copy GUID to the device info structure. Set pointer. */
- if( lpGUID == NULL )
- {
- winDsDeviceInfo->lpGUID = NULL;
- }
- else
- {
- winDsDeviceInfo->lpGUID = &winDsDeviceInfo->guid;
- memcpy( &winDsDeviceInfo->guid, lpGUID, sizeof(GUID) );
- }
-
hr = paWinDsDSoundEntryPoints.DirectSoundCaptureCreate( lpGUID, &lpDirectSoundCapture, NULL );
-
- /** try using CoCreateInstance because DirectSoundCreate was hanging under
- some circumstances - note this was probably related to the
- #define BOOL short bug which has now been fixed
- @todo delete this comment and the following code once we've ensured
- there is no bug.
- */
- /*
- hr = CoCreateInstance( &CLSID_DirectSoundCapture, NULL, CLSCTX_INPROC_SERVER,
- &IID_IDirectSoundCapture, (void**)&lpDirectSoundCapture );
- */
if( hr != DS_OK )
{
DBUG(("Cannot create Capture for %s. Result = 0x%x\n", name, hr ));
- deviceOK = FALSE;
+ result = paUnanticipatedHostError;
+ goto error;
}
else
{
if( hr != DS_OK )
{
DBUG(("Cannot GetCaps() for Capture device %s. Result = 0x%x\n", name, hr ));
- deviceOK = FALSE;
+ result = paUnanticipatedHostError;
+ goto error;
}
else
{
if( caps.dwFlags & DSCAPS_EMULDRIVER )
{
/* If WMME supported, then reject Emulated drivers because they are lousy. */
- deviceOK = FALSE;
+ result = paInvalidDevice;
+ goto error;
}
#endif
- if( deviceOK )
- {
- deviceInfo->maxInputChannels = caps.dwChannels;
- winDsDeviceInfo->deviceInputChannelCountIsKnown = 1;
+ deviceInfo->maxInputChannels = caps.dwChannels;
+ winDsDeviceInfo->deviceInputChannelCountIsKnown = 1;
- deviceInfo->maxOutputChannels = 0;
- winDsDeviceInfo->deviceOutputChannelCountIsKnown = 1;
+ deviceInfo->maxOutputChannels = 0;
+ winDsDeviceInfo->deviceOutputChannelCountIsKnown = 1;
#ifdef PAWIN_USE_WDMKS_DEVICE_INFO
- if( pnpInterface )
+ if( pnpInterface )
+ {
+ int count = PaWin_WDMKS_QueryFilterMaximumChannelCount( pnpInterface, /* isInput= */ 1 );
+ if( count > 0 )
{
- int count = PaWin_WDMKS_QueryFilterMaximumChannelCount( pnpInterface, /* isInput= */ 1 );
- if( count > 0 )
- {
- deviceInfo->maxInputChannels = count;
- winDsDeviceInfo->deviceInputChannelCountIsKnown = 1;
- }
+ deviceInfo->maxInputChannels = count;
+ winDsDeviceInfo->deviceInputChannelCountIsKnown = 1;
}
+ }
#endif /* PAWIN_USE_WDMKS_DEVICE_INFO */
- deviceInfo->defaultLowInputLatency = 0.; /** @todo IMPLEMENT ME */
- deviceInfo->defaultLowOutputLatency = 0.; /** @todo IMPLEMENT ME */
- deviceInfo->defaultHighInputLatency = 0.; /** @todo IMPLEMENT ME */
- deviceInfo->defaultHighOutputLatency = 0.; /** @todo IMPLEMENT ME */
+ deviceInfo->defaultLowInputLatency = 0.; /** @todo IMPLEMENT ME */
+ deviceInfo->defaultLowOutputLatency = 0.; /** @todo IMPLEMENT ME */
+ deviceInfo->defaultHighInputLatency = 0.; /** @todo IMPLEMENT ME */
+ deviceInfo->defaultHighOutputLatency = 0.; /** @todo IMPLEMENT ME */
/* constants from a WINE patch by Francois Gouget, see:
- http://www.winehq.com/hypermail/wine-patches/2003/01/0290.html
+http://www.winehq.com/hypermail/wine-patches/2003/01/0290.html
- ---
- Date: Fri, 14 May 2004 10:38:12 +0200 (CEST)
- From: Francois Gouget <fgouget@ ... .fr>
- To: Ross Bencina <rbencina@ ... .au>
- Subject: Re: Permission to use wine 48/96 wave patch in BSD licensed library
+---
+Date: Fri, 14 May 2004 10:38:12 +0200 (CEST)
+From: Francois Gouget <fgouget@ ... .fr>
+To: Ross Bencina <rbencina@ ... .au>
+Subject: Re: Permission to use wine 48/96 wave patch in BSD licensed library
- [snip]
+[snip]
- I give you permission to use the patch below under the BSD license.
- http://www.winehq.com/hypermail/wine-patches/2003/01/0290.html
+I give you permission to use the patch below under the BSD license.
+http://www.winehq.com/hypermail/wine-patches/2003/01/0290.html
- [snip]
+[snip]
*/
#ifndef WAVE_FORMAT_48M08
#define WAVE_FORMAT_48M08 0x00001000 /* 48 kHz, Mono, 8-bit */
#define WAVE_FORMAT_96S16 0x00080000 /* 96 kHz, Stereo, 16-bit */
#endif
- /* defaultSampleRate */
- if( caps.dwChannels == 2 )
- {
- if( caps.dwFormats & WAVE_FORMAT_4S16 )
- deviceInfo->defaultSampleRate = 44100.0;
- else if( caps.dwFormats & WAVE_FORMAT_48S16 )
- deviceInfo->defaultSampleRate = 48000.0;
- else if( caps.dwFormats & WAVE_FORMAT_2S16 )
- deviceInfo->defaultSampleRate = 22050.0;
- else if( caps.dwFormats & WAVE_FORMAT_1S16 )
- deviceInfo->defaultSampleRate = 11025.0;
- else if( caps.dwFormats & WAVE_FORMAT_96S16 )
- deviceInfo->defaultSampleRate = 96000.0;
- else
- deviceInfo->defaultSampleRate = 0.;
- }
- else if( caps.dwChannels == 1 )
- {
- if( caps.dwFormats & WAVE_FORMAT_4M16 )
- deviceInfo->defaultSampleRate = 44100.0;
- else if( caps.dwFormats & WAVE_FORMAT_48M16 )
- deviceInfo->defaultSampleRate = 48000.0;
- else if( caps.dwFormats & WAVE_FORMAT_2M16 )
- deviceInfo->defaultSampleRate = 22050.0;
- else if( caps.dwFormats & WAVE_FORMAT_1M16 )
- deviceInfo->defaultSampleRate = 11025.0;
- else if( caps.dwFormats & WAVE_FORMAT_96M16 )
- deviceInfo->defaultSampleRate = 96000.0;
- else
- deviceInfo->defaultSampleRate = 0.;
- }
- else deviceInfo->defaultSampleRate = 0.;
+ /* defaultSampleRate */
+ if( caps.dwChannels == 2 )
+ {
+ if( caps.dwFormats & WAVE_FORMAT_4S16 )
+ deviceInfo->defaultSampleRate = 44100.0;
+ else if( caps.dwFormats & WAVE_FORMAT_48S16 )
+ deviceInfo->defaultSampleRate = 48000.0;
+ else if( caps.dwFormats & WAVE_FORMAT_2S16 )
+ deviceInfo->defaultSampleRate = 22050.0;
+ else if( caps.dwFormats & WAVE_FORMAT_1S16 )
+ deviceInfo->defaultSampleRate = 11025.0;
+ else if( caps.dwFormats & WAVE_FORMAT_96S16 )
+ deviceInfo->defaultSampleRate = 96000.0;
+ else
+ deviceInfo->defaultSampleRate = 0.;
}
+ else if( caps.dwChannels == 1 )
+ {
+ if( caps.dwFormats & WAVE_FORMAT_4M16 )
+ deviceInfo->defaultSampleRate = 44100.0;
+ else if( caps.dwFormats & WAVE_FORMAT_48M16 )
+ deviceInfo->defaultSampleRate = 48000.0;
+ else if( caps.dwFormats & WAVE_FORMAT_2M16 )
+ deviceInfo->defaultSampleRate = 22050.0;
+ else if( caps.dwFormats & WAVE_FORMAT_1M16 )
+ deviceInfo->defaultSampleRate = 11025.0;
+ else if( caps.dwFormats & WAVE_FORMAT_96M16 )
+ deviceInfo->defaultSampleRate = 96000.0;
+ else
+ deviceInfo->defaultSampleRate = 0.;
+ }
+ else deviceInfo->defaultSampleRate = 0.;
}
IDirectSoundCapture_Release( lpDirectSoundCapture );
}
- if( deviceOK )
+
+ /* Copy GUID to the device info structure. Set pointer. */
+ if( lpGUID == NULL )
{
- deviceInfo->name = name;
+ winDsDeviceInfo->lpGUID = NULL;
+ }
+ else
+ {
+ winDsDeviceInfo->lpGUID = &winDsDeviceInfo->guid;
+ memcpy( &winDsDeviceInfo->guid, lpGUID, sizeof(GUID) );
+ }
- if( lpGUID == NULL )
- hostApi->info.defaultInputDevice = hostApi->info.deviceCount;
+ deviceInfo->name = name;
- hostApi->info.deviceCount++;
- }
+ return result;
+
+error:
+ if( lpDirectSoundCapture )
+ IDirectSoundCapture_Release( lpDirectSoundCapture );
return result;
}
PaError PaWinDs_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex hostApiIndex )
{
PaError result = paNoError;
- int i, deviceCount;
+ int deviceCount;
PaWinDsHostApiRepresentation *winDsHostApi;
- DSDeviceNamesAndGUIDs deviceNamesAndGUIDs;
-
- PaWinDsDeviceInfo *deviceInfoArray;
char comWasInitialized = 0;
+ void *scanResults = 0;
/*
If COM is already initialized CoInitialize will either return
if( hr != RPC_E_CHANGED_MODE )
comWasInitialized = 1;
- /* initialise guid vectors so they can be safely deleted on error */
- deviceNamesAndGUIDs.winDsHostApi = NULL;
- deviceNamesAndGUIDs.inputNamesAndGUIDs.items = NULL;
- deviceNamesAndGUIDs.outputNamesAndGUIDs.items = NULL;
-
PaWinDs_InitializeDSoundEntryPoints();
winDsHostApi = (PaWinDsHostApiRepresentation*)PaUtil_AllocateMemory( sizeof(PaWinDsHostApiRepresentation) );
(*hostApi)->info.type = paDirectSound;
(*hostApi)->info.name = "Windows DirectSound";
+ /* these are all updated by CommitDeviceInfos() */
(*hostApi)->info.deviceCount = 0;
(*hostApi)->info.defaultInputDevice = paNoDevice;
(*hostApi)->info.defaultOutputDevice = paNoDevice;
+ (*hostApi)->deviceInfos = 0;
-
-/* DSound - enumerate devices to count them and to gather their GUIDs */
-
- result = InitializeDSDeviceNameAndGUIDVector( &deviceNamesAndGUIDs.inputNamesAndGUIDs, winDsHostApi->allocations );
- if( result != paNoError )
- goto error;
-
- result = InitializeDSDeviceNameAndGUIDVector( &deviceNamesAndGUIDs.outputNamesAndGUIDs, winDsHostApi->allocations );
+ result = ScanDeviceInfos( &winDsHostApi->inheritedHostApiRep, hostApiIndex, &scanResults, &deviceCount );
if( result != paNoError )
goto error;
- paWinDsDSoundEntryPoints.DirectSoundCaptureEnumerateA( (LPDSENUMCALLBACK)CollectGUIDsProc, (void *)&deviceNamesAndGUIDs.inputNamesAndGUIDs );
-
- paWinDsDSoundEntryPoints.DirectSoundEnumerateA( (LPDSENUMCALLBACK)CollectGUIDsProc, (void *)&deviceNamesAndGUIDs.outputNamesAndGUIDs );
-
- if( deviceNamesAndGUIDs.inputNamesAndGUIDs.enumerationError != paNoError )
- {
- result = deviceNamesAndGUIDs.inputNamesAndGUIDs.enumerationError;
- goto error;
- }
-
- if( deviceNamesAndGUIDs.outputNamesAndGUIDs.enumerationError != paNoError )
- {
- result = deviceNamesAndGUIDs.outputNamesAndGUIDs.enumerationError;
- goto error;
- }
-
- deviceCount = deviceNamesAndGUIDs.inputNamesAndGUIDs.count + deviceNamesAndGUIDs.outputNamesAndGUIDs.count;
+ /* FIXME for now we ignore the result of CommitDeviceInfos(), it should probably be an atomic non-failing operation */
+ CommitDeviceInfos( &winDsHostApi->inheritedHostApiRep, hostApiIndex, scanResults, deviceCount );
-#ifdef PAWIN_USE_WDMKS_DEVICE_INFO
- if( deviceCount > 0 )
- {
- deviceNamesAndGUIDs.winDsHostApi = winDsHostApi;
- FindDevicePnpInterfaces( &deviceNamesAndGUIDs );
- }
-#endif /* PAWIN_USE_WDMKS_DEVICE_INFO */
-
- if( deviceCount > 0 )
- {
- /* allocate array for pointers to PaDeviceInfo structs */
- (*hostApi)->deviceInfos = (PaDeviceInfo**)PaUtil_GroupAllocateMemory(
- winDsHostApi->allocations, sizeof(PaDeviceInfo*) * deviceCount );
- if( !(*hostApi)->deviceInfos )
- {
- result = paInsufficientMemory;
- goto error;
- }
-
- /* allocate all PaDeviceInfo structs in a contiguous block */
- deviceInfoArray = (PaWinDsDeviceInfo*)PaUtil_GroupAllocateMemory(
- winDsHostApi->allocations, sizeof(PaWinDsDeviceInfo) * deviceCount );
- if( !deviceInfoArray )
- {
- result = paInsufficientMemory;
- goto error;
- }
-
- for( i=0; i < deviceCount; ++i )
- {
- PaDeviceInfo *deviceInfo = &deviceInfoArray[i].inheritedDeviceInfo;
- deviceInfo->structVersion = 2;
- deviceInfo->hostApi = hostApiIndex;
- deviceInfo->name = 0;
- (*hostApi)->deviceInfos[i] = deviceInfo;
- }
-
- for( i=0; i < deviceNamesAndGUIDs.inputNamesAndGUIDs.count; ++i )
- {
- result = AddInputDeviceInfoFromDirectSoundCapture( winDsHostApi,
- deviceNamesAndGUIDs.inputNamesAndGUIDs.items[i].name,
- deviceNamesAndGUIDs.inputNamesAndGUIDs.items[i].lpGUID,
- deviceNamesAndGUIDs.inputNamesAndGUIDs.items[i].pnpInterface );
- if( result != paNoError )
- goto error;
- }
-
- for( i=0; i < deviceNamesAndGUIDs.outputNamesAndGUIDs.count; ++i )
- {
- result = AddOutputDeviceInfoFromDirectSound( winDsHostApi,
- deviceNamesAndGUIDs.outputNamesAndGUIDs.items[i].name,
- deviceNamesAndGUIDs.outputNamesAndGUIDs.items[i].lpGUID,
- deviceNamesAndGUIDs.outputNamesAndGUIDs.items[i].pnpInterface );
- if( result != paNoError )
- goto error;
- }
- }
-
- result = TerminateDSDeviceNameAndGUIDVector( &deviceNamesAndGUIDs.inputNamesAndGUIDs );
- if( result != paNoError )
- goto error;
-
- result = TerminateDSDeviceNameAndGUIDVector( &deviceNamesAndGUIDs.outputNamesAndGUIDs );
- if( result != paNoError )
- goto error;
-
-
(*hostApi)->Terminate = Terminate;
(*hostApi)->OpenStream = OpenStream;
(*hostApi)->IsFormatSupported = IsFormatSupported;
+ (*hostApi)->ScanDeviceInfos = ScanDeviceInfos;
+ (*hostApi)->CommitDeviceInfos = CommitDeviceInfos;
+ (*hostApi)->DisposeDeviceInfos = DisposeDeviceInfos;
PaUtil_InitializeStreamInterface( &winDsHostApi->callbackStreamInterface, CloseStream, StartStream,
StopStream, AbortStream, IsStreamStopped, IsStreamActive,
PaUtil_FreeMemory( winDsHostApi );
}
- TerminateDSDeviceNameAndGUIDVector( &deviceNamesAndGUIDs.inputNamesAndGUIDs );
- TerminateDSDeviceNameAndGUIDVector( &deviceNamesAndGUIDs.outputNamesAndGUIDs );
-
if( comWasInitialized )
CoUninitialize();
return paFormatIsSupported;
}
+/***********************************************************************************/
+static PaError ScanDeviceInfos( struct PaUtilHostApiRepresentation *hostApi, PaHostApiIndex hostApiIndex, void **scanResults, int *newDeviceCount )
+{
+ PaWinDsHostApiRepresentation *winDsHostApi = (PaWinDsHostApiRepresentation*)hostApi;
+ PaWinDsDeviceInfo *deviceInfoArray;
+ char comWasInitialized = winDsHostApi->comWasInitialized;
+ PaError result = paNoError;
+ PaWinDsScanDeviceInfosResults *outArgument = 0;
+ DSDeviceNamesAndGUIDs deviceNamesAndGUIDs;
+ int i = 0;
+ int maximumNewDeviceCount = 0;
+
+ /* Check preconditions */
+ if( !comWasInitialized || scanResults == NULL || newDeviceCount == NULL )
+ return paInternalError;
+
+ /* initialize the out params */
+ *scanResults = NULL;
+ *newDeviceCount = 0;
+
+ /* initialise guid vectors so they can be safely deleted on error */
+ deviceNamesAndGUIDs.winDsHostApi = NULL;
+ deviceNamesAndGUIDs.inputNamesAndGUIDs.items = NULL;
+ deviceNamesAndGUIDs.outputNamesAndGUIDs.items = NULL;
+
+ result = InitializeDSDeviceNameAndGUIDVector( &deviceNamesAndGUIDs.inputNamesAndGUIDs, winDsHostApi->allocations );
+ if( result != paNoError )
+ goto error;
+
+ result = InitializeDSDeviceNameAndGUIDVector( &deviceNamesAndGUIDs.outputNamesAndGUIDs, winDsHostApi->allocations );
+ if( result != paNoError )
+ goto error;
+
+ deviceNamesAndGUIDs.winDsHostApi = winDsHostApi;
+
+ /* DSound - enumerate devices to count them and to gather their GUIDs and device names */
+
+ paWinDsDSoundEntryPoints.DirectSoundCaptureEnumerateA( (LPDSENUMCALLBACK)CollectGUIDsProc, (void *)&deviceNamesAndGUIDs.inputNamesAndGUIDs );
+
+ if( deviceNamesAndGUIDs.inputNamesAndGUIDs.enumerationError != paNoError )
+ {
+ result = deviceNamesAndGUIDs.inputNamesAndGUIDs.enumerationError;
+ goto error;
+ }
+
+ paWinDsDSoundEntryPoints.DirectSoundEnumerateA( (LPDSENUMCALLBACK)CollectGUIDsProc, (void *)&deviceNamesAndGUIDs.outputNamesAndGUIDs );
+
+ if( deviceNamesAndGUIDs.outputNamesAndGUIDs.enumerationError != paNoError )
+ {
+ result = deviceNamesAndGUIDs.outputNamesAndGUIDs.enumerationError;
+ goto error;
+ }
+
+ maximumNewDeviceCount = deviceNamesAndGUIDs.inputNamesAndGUIDs.count +
+ deviceNamesAndGUIDs.outputNamesAndGUIDs.count;
+
+#ifdef PAWIN_USE_WDMKS_DEVICE_INFO
+ if( maximumNewDeviceCount > 0 )
+ {
+ FindDevicePnpInterfaces( &deviceNamesAndGUIDs );
+ }
+#endif /* PAWIN_USE_WDMKS_DEVICE_INFO */
+
+ if( maximumNewDeviceCount > 0 )
+ {
+ /* Allocate the out param for all the info we need */
+ outArgument = (PaWinDsScanDeviceInfosResults *) PaUtil_GroupAllocateMemory(
+ winDsHostApi->allocations, sizeof(PaWinDsScanDeviceInfosResults) );
+ if( !outArgument )
+ {
+ result = paInsufficientMemory;
+ goto error;
+ }
+
+ /* allocate array for pointers to PaDeviceInfo structs */
+ outArgument->deviceInfos = (PaDeviceInfo**)PaUtil_GroupAllocateMemory(
+ winDsHostApi->allocations, sizeof(PaDeviceInfo*) * maximumNewDeviceCount );
+ if( !outArgument->deviceInfos )
+ {
+ result = paInsufficientMemory;
+ goto error;
+ }
+
+ /* allocate all PaDeviceInfo structs in a contiguous block */
+ deviceInfoArray = (PaWinDsDeviceInfo*)PaUtil_GroupAllocateMemory(
+ winDsHostApi->allocations, sizeof(PaWinDsDeviceInfo) * maximumNewDeviceCount );
+ if( !deviceInfoArray )
+ {
+ result = paInsufficientMemory;
+ goto error;
+ }
+
+ for( i = 0 ; i < maximumNewDeviceCount; ++i )
+ {
+ PaDeviceInfo *deviceInfo = &deviceInfoArray[i].inheritedDeviceInfo;
+ deviceInfo->structVersion = 2;
+ deviceInfo->hostApi = hostApiIndex;
+ deviceInfo->name = 0;
+
+ outArgument->deviceInfos[ i ] = deviceInfo;
+ }
+
+ for( i = 0 ; i < deviceNamesAndGUIDs.inputNamesAndGUIDs.count ; ++i )
+ {
+ PaWinDsDeviceInfo *winDsDeviceInfo = (PaWinDsDeviceInfo*)outArgument->deviceInfos[*newDeviceCount];
+
+ result = AddInputDeviceInfoFromDirectSoundCapture( winDsDeviceInfo,
+ deviceNamesAndGUIDs.inputNamesAndGUIDs.items[i].name,
+ deviceNamesAndGUIDs.inputNamesAndGUIDs.items[i].lpGUID,
+ deviceNamesAndGUIDs.inputNamesAndGUIDs.items[i].pnpInterface );
+ if( result == paNoError )
+ {
+ if( deviceNamesAndGUIDs.inputNamesAndGUIDs.items[i].lpGUID == NULL )
+ outArgument->defaultInputDevice = *newDeviceCount;
+ (*newDeviceCount)++;
+ }
+ /* ignore error results here and just skip the device */
+ }
+
+ for( i = 0 ; i < deviceNamesAndGUIDs.outputNamesAndGUIDs.count ; ++i )
+ {
+ PaWinDsDeviceInfo *winDsDeviceInfo = (PaWinDsDeviceInfo*)outArgument->deviceInfos[*newDeviceCount];
+
+ result = AddOutputDeviceInfoFromDirectSound( winDsDeviceInfo,
+ deviceNamesAndGUIDs.outputNamesAndGUIDs.items[i].name,
+ deviceNamesAndGUIDs.outputNamesAndGUIDs.items[i].lpGUID,
+ deviceNamesAndGUIDs.outputNamesAndGUIDs.items[i].pnpInterface );
+ if( result == paNoError )
+ {
+ if( deviceNamesAndGUIDs.outputNamesAndGUIDs.items[i].lpGUID == NULL )
+ outArgument->defaultOutputDevice = *newDeviceCount;
+ (*newDeviceCount)++;
+ }
+ /* ignore error results here and just skip the device */
+ }
+ }
+
+ result = TerminateDSDeviceNameAndGUIDVector( &deviceNamesAndGUIDs.inputNamesAndGUIDs );
+ if( result != paNoError )
+ goto error;
+
+ result = TerminateDSDeviceNameAndGUIDVector( &deviceNamesAndGUIDs.outputNamesAndGUIDs );
+ if( result != paNoError )
+ goto error;
+
+ *scanResults = outArgument;
+ return result;
+
+error:
+ TerminateDSDeviceNameAndGUIDVector( &deviceNamesAndGUIDs.inputNamesAndGUIDs );
+ TerminateDSDeviceNameAndGUIDVector( &deviceNamesAndGUIDs.outputNamesAndGUIDs );
+
+ if( outArgument )
+ {
+ if( outArgument->deviceInfos )
+ {
+ if( outArgument->deviceInfos[0] )
+ {
+ PaUtil_GroupFreeMemory( winDsHostApi->allocations, outArgument->deviceInfos[0] );
+ }
+
+ PaUtil_GroupFreeMemory( winDsHostApi->allocations, outArgument->deviceInfos );
+ }
+ }
+ return result;
+}
+
+static PaError CommitDeviceInfos( struct PaUtilHostApiRepresentation *hostApi, PaHostApiIndex index, void *scanResults, int deviceCount )
+{
+ PaWinDsHostApiRepresentation *winDsHostApi = (PaWinDsHostApiRepresentation*)hostApi;
+ PaError result = paNoError;
+ int i = 0;
+
+ hostApi->info.deviceCount = 0;
+ hostApi->info.defaultInputDevice = paNoDevice;
+ hostApi->info.defaultOutputDevice = paNoDevice;
+
+ /* Free any old memory which might be in the device info */
+ if( hostApi->deviceInfos )
+ {
+ PaUtil_GroupFreeMemory( winDsHostApi->allocations, hostApi->deviceInfos[0] );
+ PaUtil_GroupFreeMemory( winDsHostApi->allocations, hostApi->deviceInfos );
+ hostApi->deviceInfos = NULL;
+ }
+
+ if( scanResults != NULL )
+ {
+ PaWinDsScanDeviceInfosResults *scanDeviceInfosResults = ( PaWinDsScanDeviceInfosResults * ) scanResults;
+
+ if( deviceCount > 0 )
+ {
+ /* use the array allocated in ScanDeviceInfos() as our deviceInfos */
+ hostApi->deviceInfos = scanDeviceInfosResults->deviceInfos;
+
+ hostApi->info.defaultInputDevice = scanDeviceInfosResults->defaultInputDevice;
+ hostApi->info.defaultOutputDevice = scanDeviceInfosResults->defaultOutputDevice;
+
+ hostApi->info.deviceCount = deviceCount;
+ }
+
+ PaUtil_GroupFreeMemory( winDsHostApi->allocations, scanDeviceInfosResults );
+ }
+
+ return result;
+}
+
+static PaError DisposeDeviceInfos( struct PaUtilHostApiRepresentation *hostApi, void *scanResults, int deviceCount )
+{
+ PaWinDsHostApiRepresentation *winDsHostApi = (PaWinDsHostApiRepresentation*)hostApi;
+
+ if( scanResults != NULL )
+ {
+ PaWinDsScanDeviceInfosResults *scanDeviceInfosResults = ( PaWinDsScanDeviceInfosResults * ) scanResults;
+
+ if( scanDeviceInfosResults->deviceInfos )
+ {
+ PaUtil_GroupFreeMemory( winDsHostApi->allocations, scanDeviceInfosResults->deviceInfos[0] ); /* all device info structs are allocated in a block so we can destroy them here */
+ PaUtil_GroupFreeMemory( winDsHostApi->allocations, scanDeviceInfosResults->deviceInfos );
+ }
+
+ PaUtil_GroupFreeMemory( winDsHostApi->allocations, scanDeviceInfosResults );
+ }
+
+ return paNoError;
+}
/*************************************************************************
** Determine minimum number of buffers required for this host based
#include "pa_ringbuffer.h"\r
\r
#ifndef NTDDI_VERSION\r
- \r
+\r
#undef WINVER\r
#undef _WIN32_WINNT\r
#define WINVER 0x0600 // VISTA\r
#define _WIN32_WINNT WINVER\r
\r
#ifndef _AVRT_ //<< fix MinGW dummy compile by defining missing type: AVRT_PRIORITY\r
- typedef enum _AVRT_PRIORITY\r
- {\r
- AVRT_PRIORITY_LOW = -1,\r
- AVRT_PRIORITY_NORMAL,\r
- AVRT_PRIORITY_HIGH,\r
- AVRT_PRIORITY_CRITICAL\r
- } AVRT_PRIORITY, *PAVRT_PRIORITY;\r
+ typedef enum _AVRT_PRIORITY\r
+ {\r
+ AVRT_PRIORITY_LOW = -1,\r
+ AVRT_PRIORITY_NORMAL,\r
+ AVRT_PRIORITY_HIGH,\r
+ AVRT_PRIORITY_CRITICAL\r
+ } AVRT_PRIORITY, *PAVRT_PRIORITY;\r
#endif\r
\r
#include <basetyps.h> // << for IID/CLSID\r
typedef LONGLONG REFERENCE_TIME;\r
#define NONAMELESSUNION\r
#endif\r
- \r
+\r
#ifndef WAVE_FORMAT_IEEE_FLOAT\r
#define WAVE_FORMAT_IEEE_FLOAT 0x0003 // 32-bit floating-point\r
#endif \r
typedef struct\r
{\r
PaUtilHostApiRepresentation inheritedHostApiRep;\r
- PaUtilStreamInterface callbackStreamInterface;\r
- PaUtilStreamInterface blockingStreamInterface;\r
+ PaUtilStreamInterface callbackStreamInterface;\r
+ PaUtilStreamInterface blockingStreamInterface;\r
\r
- PaUtilAllocationGroup *allocations;\r
+ PaUtilAllocationGroup *allocations;\r
\r
/* implementation specific data goes here */\r
\r
{\r
/* IMPLEMENT ME: rename this */\r
PaUtilStreamRepresentation streamRepresentation;\r
- PaUtilCpuLoadMeasurer cpuLoadMeasurer;\r
- PaUtilBufferProcessor bufferProcessor;\r
+ PaUtilCpuLoadMeasurer cpuLoadMeasurer;\r
+ PaUtilBufferProcessor bufferProcessor;\r
\r
// input\r
- PaWasapiSubStream in;\r
+ PaWasapiSubStream in;\r
IAudioCaptureClient *captureClientParent;\r
IStream *captureClientStream;\r
IAudioCaptureClient *captureClient;\r
- IAudioEndpointVolume *inVol;\r
+ IAudioEndpointVolume *inVol;\r
\r
// output\r
- PaWasapiSubStream out;\r
+ PaWasapiSubStream out;\r
IAudioRenderClient *renderClientParent;\r
IStream *renderClientStream;\r
IAudioRenderClient *renderClient;\r
- IAudioEndpointVolume *outVol;\r
+ IAudioEndpointVolume *outVol;\r
\r
// event handles for event-driven processing mode\r
HANDLE event[S_COUNT];\r
// Aligns WASAPI buffer to 128 byte packet boundary. HD Audio will fail to play if buffer\r
// is misaligned. This problem was solved in Windows 7 were AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED\r
// is thrown although we must align for Vista anyway.\r
-static UINT32 AlignFramesPerBuffer(UINT32 nFrames, UINT32 nSamplesPerSec, UINT32 nBlockAlign,\r
+static UINT32 AlignFramesPerBuffer(UINT32 nFrames, UINT32 nSamplesPerSec, UINT32 nBlockAlign, \r
ALIGN_FUNC pAlignFunc)\r
{\r
#define HDA_PACKET_SIZE (128)\r
\r
frame_bytes = packets * HDA_PACKET_SIZE;\r
nFrames = frame_bytes / nBlockAlign;\r
-\r
+ \r
return nFrames;\r
\r
#undef HDA_PACKET_SIZE\r
case paInt24: return _MixMonoToStereo_2TO1_24_L;\r
case paInt32: return _MixMonoToStereo_2TO1_32_L;\r
case paFloat32: return _MixMonoToStereo_2TO1_32f_L;\r
- }\r
+ }\r
break;\r
}\r
\r
If COM is already initialized CoInitialize will either return\r
FALSE, or RPC_E_CHANGED_MODE if it was initialised in a different\r
threading mode. In either case we shouldn't consider it an error\r
- but we need to be careful to not call CoUninitialize() if\r
+ but we need to be careful to not call CoUninitialize() if \r
RPC_E_CHANGED_MODE was returned.\r
*/\r
hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);\r
paWasapi->enumerator = NULL;\r
hr = CoCreateInstance(&pa_CLSID_IMMDeviceEnumerator, NULL, CLSCTX_INPROC_SERVER,\r
&pa_IID_IMMDeviceEnumerator, (void **)&paWasapi->enumerator);\r
- \r
+\r
// We need to set the result to a value otherwise we will return paNoError\r
// [IF_FAILED_JUMP(hResult, error);]\r
IF_FAILED_INTERNAL_ERROR_JUMP(hr, result, error);\r
// We need to set the result to a value otherwise we will return paNoError\r
// [IF_FAILED_JUMP(hResult, error);]\r
IF_FAILED_INTERNAL_ERROR_JUMP(hr, result, error);\r
- }\r
+ }\r
}\r
else\r
{\r
// We need to set the result to a value otherwise we will return paNoError\r
// [IF_FAILED_JUMP(hResult, error);]\r
IF_FAILED_INTERNAL_ERROR_JUMP(hr, result, error);\r
- }\r
+ }\r
}\r
else\r
{\r
DWORD calling_thread_id = GetCurrentThreadId();\r
if (g_WasapiInitThread != calling_thread_id)\r
{\r
- PRINT(("WASAPI: failed CoUninitializes calling thread[%d] does not match initializing thread[%d]\n",\r
+ PRINT(("WASAPI: failed CoUninitializes calling thread[%d] does not match initializing thread[%d]\n", \r
calling_thread_id, g_WasapiInitThread));\r
}\r
else\r
{\r
case WAVE_FORMAT_EXTENSIBLE: {\r
\r
- PRINT(("wFormatTag =WAVE_FORMAT_EXTENSIBLE\n"));\r
+ PRINT(("wFormatTag=WAVE_FORMAT_EXTENSIBLE\n"));\r
\r
if (IsEqualGUID(&in->SubFormat, &pa_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT))\r
{\r
- PRINT(("SubFormat =KSDATAFORMAT_SUBTYPE_IEEE_FLOAT\n"));\r
+ PRINT(("SubFormat=KSDATAFORMAT_SUBTYPE_IEEE_FLOAT\n"));\r
}\r
else\r
if (IsEqualGUID(&in->SubFormat, &pa_KSDATAFORMAT_SUBTYPE_PCM))\r
{\r
- PRINT(("SubFormat =KSDATAFORMAT_SUBTYPE_PCM\n"));\r
+ PRINT(("SubFormat=KSDATAFORMAT_SUBTYPE_PCM\n"));\r
}\r
else\r
{\r
- PRINT(("SubFormat =CUSTOM GUID{%d:%d:%d:%d%d%d%d%d%d%d%d}\n",\r
+ PRINT(("SubFormat=CUSTOM GUID{%d:%d:%d:%d%d%d%d%d%d%d%d}\n",\r
in->SubFormat.Data1,\r
in->SubFormat.Data2,\r
in->SubFormat.Data3,\r
(int)in->SubFormat.Data4[6],\r
(int)in->SubFormat.Data4[7]));\r
}\r
- PRINT(("Samples.wValidBitsPerSample =%d\n", in->Samples.wValidBitsPerSample));\r
+ PRINT(("Samples.wValidBitsPerSample=%d\n", in->Samples.wValidBitsPerSample));\r
PRINT(("dwChannelMask =0x%X\n",in->dwChannelMask));\r
\r
break; }\r
\r
- case WAVE_FORMAT_PCM: PRINT(("wFormatTag =WAVE_FORMAT_PCM\n")); break;\r
- case WAVE_FORMAT_IEEE_FLOAT: PRINT(("wFormatTag =WAVE_FORMAT_IEEE_FLOAT\n")); break;\r
+ case WAVE_FORMAT_PCM: PRINT(("wFormatTag=WAVE_FORMAT_PCM\n")); break;\r
+ case WAVE_FORMAT_IEEE_FLOAT: PRINT(("wFormatTag=WAVE_FORMAT_IEEE_FLOAT\n")); break;\r
default: \r
PRINT(("wFormatTag =UNKNOWN(%d)\n",old->wFormatTag)); break;\r
}\r
}\r
}\r
break; }\r
-\r
- case WAVE_FORMAT_IEEE_FLOAT:\r
+ \r
+ case WAVE_FORMAT_IEEE_FLOAT: \r
return paFloat32;\r
\r
case WAVE_FORMAT_PCM: {\r
old->nBlockAlign = (old->nChannels * (old->wBitsPerSample/8));\r
old->nAvgBytesPerSec = (old->nSamplesPerSec * old->nBlockAlign);\r
\r
- // WAVEFORMATEX\r
+ //WAVEFORMATEX\r
if ((params->channelCount <= 2) && ((bitsPerSample == 16) || (bitsPerSample == 8)))\r
{\r
old->cbSize = 0;\r
old->wFormatTag = WAVE_FORMAT_PCM;\r
}\r
- // WAVEFORMATEXTENSIBLE\r
+ //WAVEFORMATEXTENSIBLE\r
else\r
{\r
old->wFormatTag = WAVE_FORMAT_EXTENSIBLE;\r
\r
// Try selecting suitable sample type\r
for (i = 0; i < STATIC_ARRAY_SIZE(BestToWorst); ++i)\r
- {\r
+ {\r
WAVEFORMATEXTENSIBLE sample = { 0 };\r
\r
PaStreamParameters sample_params = stereo_params;\r
\r
hr = IAudioClient_IsFormatSupported(myClient, shareMode, &sample.Format, (shareMode == AUDCLNT_SHAREMODE_SHARED ? &sharedClosestMatch : NULL));\r
if (hr == S_OK)\r
- {\r
+ {\r
memcpy(outWavex, &sample, sizeof(WAVEFORMATEXTENSIBLE));\r
CoTaskMemFree(sharedClosestMatch);\r
return (answer = paFormatIsSupported);\r
MakeWaveFormatFromParams(&spfmt, &spfmt_params, sampleRate);\r
\r
hr = IAudioClient_IsFormatSupported(myClient, shareMode, &spfmt.Format, (shareMode == AUDCLNT_SHAREMODE_SHARED ? &sharedClosestMatch : NULL));\r
- if (hr == S_OK)\r
- {\r
+ if (hr == S_OK)\r
+ {\r
memcpy(outWavex, &spfmt, sizeof(WAVEFORMATEXTENSIBLE));\r
CoTaskMemFree(sharedClosestMatch);\r
- answer = paFormatIsSupported;\r
+ answer = paFormatIsSupported;\r
break;\r
+ }\r
}\r
- }\r
\r
// Nothing helped\r
LogHostError(hr);\r
// - For Shared mode we use double buffering.\r
if ((sub->shareMode == AUDCLNT_SHAREMODE_EXCLUSIVE) || fullDuplex)\r
{\r
- // Exclusive mode does not allow >1 buffers be used for Event interface, e.g. GetBuffer\r
+ // Exclusive mode does not allow >1 buffers be used for Event interface, e.g. GetBuffer \r
// call must acquire max buffer size and it all must be processed.\r
if (sub->streamFlags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK)\r
sub->userBufferAndHostMatch = 1;\r
-\r
+ \r
// Use paUtilBoundedHostBufferSize because exclusive mode will starve and produce\r
// bad quality of audio\r
sub->buffers = 1;\r
}\r
\r
// ------------------------------------------------------------------------------------------\r
-static void _CalculateAlignedPeriod(PaWasapiSubStream *pSub, UINT32 *nFramesPerLatency,\r
+static void _CalculateAlignedPeriod(PaWasapiSubStream *pSub, UINT32 *nFramesPerLatency, \r
ALIGN_FUNC pAlignFunc)\r
{\r
// Align frames to HD Audio packet size of 128 bytes for Exclusive mode only.\r
framesPerLatency += MakeFramesFromHns(SecondsTonano100(params->suggestedLatency), pSub->wavex.Format.nSamplesPerSec);\r
#else\r
// Calculate host buffer size\r
- if ((pSub->shareMode != AUDCLNT_SHAREMODE_EXCLUSIVE) &&\r
+ if ((pSub->shareMode != AUDCLNT_SHAREMODE_EXCLUSIVE) && \r
(!pSub->streamFlags || ((pSub->streamFlags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK) == 0)))\r
{\r
- framesPerLatency = PaUtil_GetFramesPerHostBuffer(userFramesPerBuffer,\r
+ framesPerLatency = PaUtil_GetFramesPerHostBuffer(userFramesPerBuffer, \r
params->suggestedLatency, pSub->wavex.Format.nSamplesPerSec, 0/*,\r
(pSub->streamFlags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK ? 0 : 1)*/);\r
}\r
\r
// Work 1:1 with user buffer (only polling allows to use >1)\r
framesPerLatency += MakeFramesFromHns(SecondsTonano100(params->suggestedLatency), pSub->wavex.Format.nSamplesPerSec);\r
-\r
+ \r
// Use Polling if overall latency is > 5ms as it allows to use 100% CPU in a callback,\r
// or user specified latency parameter\r
overall = MakeHnsPeriod(framesPerLatency, pSub->wavex.Format.nSamplesPerSec);\r
if ((overall >= (106667*2)/*21.33ms*/) || ((INT32)(params->suggestedLatency*100000.0) != 0/*0.01 msec granularity*/))\r
{\r
- framesPerLatency = PaUtil_GetFramesPerHostBuffer(userFramesPerBuffer,\r
+ framesPerLatency = PaUtil_GetFramesPerHostBuffer(userFramesPerBuffer, \r
params->suggestedLatency, pSub->wavex.Format.nSamplesPerSec, 0/*,\r
(streamFlags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK ? 0 : 1)*/);\r
\r
// Recalculate aligned period\r
framesPerLatency = MakeFramesFromHns(pSub->period, pSub->wavex.Format.nSamplesPerSec);\r
_CalculateAlignedPeriod(pSub, &framesPerLatency, ALIGN_BWD);\r
- }\r
+ }\r
}\r
else\r
{\r
// Recalculate aligned period\r
framesPerLatency = MakeFramesFromHns(pSub->period, pSub->wavex.Format.nSamplesPerSec);\r
_CalculateAlignedPeriod(pSub, &framesPerLatency, ALIGN_FWD);\r
- }\r
+ }\r
}\r
\r
/*! Windows 7 does not allow to set latency lower than minimal device period and will\r
*/\r
{\r
/*! AUDCLNT_E_BUFFER_SIZE_ERROR: Applies to Windows 7 and later.\r
- Indicates that the buffer duration value requested by an exclusive-mode client is\r
- out of range. The requested duration value for pull mode must not be greater than\r
+ Indicates that the buffer duration value requested by an exclusive-mode client is \r
+ out of range. The requested duration value for pull mode must not be greater than \r
500 milliseconds; for push mode the duration value must not be greater than 2 seconds.\r
*/\r
if (pSub->shareMode == AUDCLNT_SHAREMODE_EXCLUSIVE)\r
NULL);\r
\r
/*! WASAPI is tricky on large device buffer, sometimes 2000ms can be allocated sometimes\r
- less. There is no known guaranteed level thus we make subsequent tries by decreasing\r
+ less. There is no known guaranteed level thus we make subsequent tries by decreasing \r
buffer by 100ms per try.\r
*/\r
while ((hr == E_OUTOFMEMORY) && (pSub->period > (100 * 10000)))\r
IAudioClient_AddRef(pSub->clientParent);\r
\r
// Recalculate buffers count\r
- _RecalculateBuffersCount(pSub,\r
- userFramesPerBuffer,\r
- MakeFramesFromHns(pSub->period, pSub->wavex.Format.nSamplesPerSec),\r
+ _RecalculateBuffersCount(pSub, \r
+ userFramesPerBuffer, \r
+ MakeFramesFromHns(pSub->period, pSub->wavex.Format.nSamplesPerSec), \r
fullDuplex);\r
\r
done:\r
\r
// Only get IAudioCaptureClient input once here instead of getting it at multiple places based on the use\r
hr = IAudioClient_GetService(stream->in.clientParent, &pa_IID_IAudioCaptureClient, (void **)&stream->captureClientParent);\r
- if (hr != S_OK)\r
+ if (hr != S_OK)\r
{\r
LogHostError(hr);\r
LogPaError(result = paUnanticipatedHostError);\r
\r
// buffer\r
if ((stream->in.tailBuffer = PaUtil_AllocateMemory(sizeof(PaUtilRingBuffer))) == NULL)\r
- {\r
+ {\r
LogPaError(result = paInsufficientMemory);\r
- goto error;\r
- }\r
+ goto error;\r
+ }\r
memset(stream->in.tailBuffer, 0, sizeof(PaUtilRingBuffer));\r
\r
// buffer memory region\r
{\r
LogPaError(result = paInternalError);\r
goto error;\r
- }\r
+ }\r
}\r
}\r
else\r
goto error;\r
}\r
\r
- // Get closest format\r
+ // Get closest format\r
hostOutputSampleFormat = PaUtil_SelectClosestAvailableFormat( WaveToPaFormat(&stream->out.wavex), outputSampleFormat );\r
\r
- // Set user-side custom host processor\r
+ // Set user-side custom host processor\r
if ((outputStreamInfo != NULL) &&\r
(outputStreamInfo->flags & paWinWasapiRedirectHostProcessor))\r
{\r
\r
// Only get IAudioCaptureClient output once here instead of getting it at multiple places based on the use\r
hr = IAudioClient_GetService(stream->out.clientParent, &pa_IID_IAudioRenderClient, (void **)&stream->renderClientParent);\r
- if (hr != S_OK)\r
+ if (hr != S_OK)\r
{\r
LogHostError(hr);\r
LogPaError(result = paUnanticipatedHostError);\r
goto error;\r
}\r
- }\r
+ }\r
else\r
{\r
outputChannelCount = 0;\r
else\r
if (outputParameters)\r
{\r
- if ((stream->out.buffers == 1) &&\r
+ if ((stream->out.buffers == 1) && \r
(!stream->out.streamFlags || ((stream->out.streamFlags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK) == 0)))\r
bufferMode = paUtilBoundedHostBufferSize;\r
}\r
if ((stream->in.clientParent && (stream->in.streamFlags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK)) ||\r
(stream->out.clientParent && (stream->out.streamFlags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK)))\r
{\r
- if ((stream->hThread = CREATE_THREAD(ProcThreadEvent)) == NULL) \r
+ if ((stream->hThread = CREATE_THREAD(ProcThreadEvent)) == NULL)\r
{\r
PRINT(("Failed creating thread: ProcThreadEvent."));\r
result = paUnanticipatedHostError;\r
goto nonblocking_start_error;\r
- }\r
+ }\r
}\r
else\r
{\r
- if ((stream->hThread = CREATE_THREAD(ProcThreadPoll)) == NULL) \r
+ if ((stream->hThread = CREATE_THREAD(ProcThreadPoll)) == NULL)\r
{\r
PRINT(("Failed creating thread: ProcThreadPoll."));\r
result = paUnanticipatedHostError;\r
goto nonblocking_start_error;\r
- }\r
+ }\r
}\r
\r
// Wait for thread to start\r
- if (WaitForSingleObject(stream->hThreadStart, 60*1000) == WAIT_TIMEOUT) \r
+ if (WaitForSingleObject(stream->hThreadStart, 60*1000) == WAIT_TIMEOUT)\r
{\r
PRINT(("Failed starting thread: timeout."));\r
result = paUnanticipatedHostError;\r
goto nonblocking_start_error;\r
- }\r
+ }\r
}\r
else\r
{\r
}\r
}\r
if (stream->in.clientParent != NULL) \r
- {\r
+ {\r
if ((stream->hBlockingOpStreamRD = CreateEvent(NULL, TRUE, TRUE, NULL)) == NULL) \r
{\r
result = paInsufficientMemory;\r
}\r
\r
if (buf2 != NULL)\r
- {\r
+ {\r
// Register available frames to processor\r
PaUtil_SetInputFrameCount(&stream->bufferProcessor, buf2_size);\r
\r
// Read hardware\r
while (frames != 0)\r
{\r
- // Check if blocking call must be interrupted\r
+ // Check if blocking call must be interrupted\r
if (WaitForSingleObject(stream->hCloseRequest, sleep) != WAIT_TIMEOUT)\r
- break;\r
+ break;\r
\r
// Get available frames (must be finding out available frames before call to IAudioCaptureClient_GetBuffer\r
// othervise audio glitches will occur inExclusive mode as it seems that WASAPI has some scheduling/\r
{\r
LogHostError(hr);\r
return paUnanticipatedHostError;\r
- }\r
+ }\r
\r
// Wait for more frames to become available\r
if (available == 0)\r
// Avoid busy waiting, schedule next 1 millesecond wait\r
if (sleep == 0)\r
sleep = ThreadIdleScheduler_NextSleep(&sched);\r
- }\r
+ }\r
else\r
{\r
if ((sleep = ThreadIdleScheduler_NextSleep(&sched)) != 0)\r
\r
// Register available frames to processor\r
PaUtil_SetInputFrameCount(&stream->bufferProcessor, available);\r
-\r
+ \r
// Register host buffer pointer to processor\r
- PaUtil_SetInterleavedInputChannels(&stream->bufferProcessor, 0, wasapi_buffer, stream->bufferProcessor.inputChannelCount);\r
-\r
+ PaUtil_SetInterleavedInputChannels(&stream->bufferProcessor, 0, wasapi_buffer, stream->bufferProcessor.inputChannelCount);\r
+ \r
// Copy user data to host buffer (with conversion if applicable)\r
processed = PaUtil_CopyInput(&stream->bufferProcessor, (void **)&user_buffer, frames);\r
frames -= processed;\r
}\r
\r
// Blocking (potentially, untill 'frames' are consumed) loop\r
- while (frames != 0)\r
- {\r
- // Check if blocking call must be interrupted\r
+ while (frames != 0)\r
+ {\r
+ // Check if blocking call must be interrupted\r
if (WaitForSingleObject(stream->hCloseRequest, sleep) != WAIT_TIMEOUT)\r
- break;\r
+ break;\r
\r
// Get frames available\r
if ((hr = _PollGetOutputFramesAvailable(stream, &available)) != S_OK)\r
- {\r
- LogHostError(hr);\r
+ {\r
+ LogHostError(hr);\r
goto end;\r
- }\r
+ }\r
\r
// Wait for more frames to become available\r
if (available == 0)\r
\r
// Keep in 'frmaes' range\r
if (available > frames)\r
- available = frames;\r
+ available = frames;\r
\r
- // Get pointer to host buffer\r
+ // Get pointer to host buffer\r
if ((hr = IAudioRenderClient_GetBuffer(stream->renderClient, available, &wasapi_buffer)) != S_OK)\r
- {\r
- // Buffer size is too big, waiting\r
- if (hr == AUDCLNT_E_BUFFER_TOO_LARGE)\r
- continue;\r
+ {\r
+ // Buffer size is too big, waiting\r
+ if (hr == AUDCLNT_E_BUFFER_TOO_LARGE)\r
+ continue;\r
\r
- LogHostError(hr);\r
+ LogHostError(hr);\r
goto end;\r
- }\r
+ }\r
\r
// Keep waiting again (on Vista it was noticed that WASAPI could SOMETIMES return NULL pointer \r
// to buffer without returning AUDCLNT_E_BUFFER_TOO_LARGE instead)\r
if (wasapi_buffer == NULL)\r
continue;\r
\r
- // Register available frames to processor\r
- PaUtil_SetOutputFrameCount(&stream->bufferProcessor, available);\r
-\r
- // Register host buffer pointer to processor\r
- PaUtil_SetInterleavedOutputChannels(&stream->bufferProcessor, 0, wasapi_buffer, stream->bufferProcessor.outputChannelCount);\r
-\r
+ // Register available frames to processor\r
+ PaUtil_SetOutputFrameCount(&stream->bufferProcessor, available);\r
+ \r
+ // Register host buffer pointer to processor\r
+ PaUtil_SetInterleavedOutputChannels(&stream->bufferProcessor, 0, wasapi_buffer, stream->bufferProcessor.outputChannelCount);\r
+ \r
// Copy user data to host buffer (with conversion if applicable), this call will advance\r
// pointer 'user_buffer' to consumed portion of data\r
processed = PaUtil_CopyOutput(&stream->bufferProcessor, (const void **)&user_buffer, frames);\r
frames -= processed;\r
\r
- // Release host buffer\r
+ // Release host buffer\r
if ((hr = IAudioRenderClient_ReleaseBuffer(stream->renderClient, available, 0)) != S_OK)\r
- {\r
- LogHostError(hr);\r
+ {\r
+ LogHostError(hr);\r
goto end;\r
+ }\r
}\r
- }\r
\r
end:\r
\r
DWORD sleep_ms = 0;\r
DWORD sleep_ms_in;\r
DWORD sleep_ms_out;\r
-\r
+ \r
BOOL bThreadComInitialized = FALSE;\r
\r
/*\r
sleep_ms_out = GetFramesSleepTime(stream->bufferProcessor.framesPerUserBuffer, stream->out.wavex.Format.nSamplesPerSec);\r
}\r
\r
- // Choose smallest\r
+ // Choose smallest \r
if ((sleep_ms_in != 0) && (sleep_ms_out != 0))\r
sleep_ms = min(sleep_ms_in, sleep_ms_out);\r
else\r
{\r
if ((hr = IAudioClient_Start(stream->in.clientProc)) != S_OK)\r
{\r
- LogHostError(hr);\r
- goto thread_error;\r
+ LogHostError(hr);\r
+ goto thread_error;\r
+ }\r
}\r
- }\r
\r
// Initialize event & start OUTPUT stream\r
if (stream->out.clientProc)\r
- {\r
+ {\r
// Preload buffer (obligatory, othervise ->Start() will fail), avoid processing\r
// when in full-duplex mode as it requires input processing as well\r
if (!PA_WASAPI__IS_FULLDUPLEX(stream))\r
if ((hr = ProcessOutputBuffer(stream, processor, frames)) != S_OK)\r
{\r
LogHostError(hr); // not fatal, just log\r
- }\r
- }\r
+ }\r
+ }\r
}\r
else\r
- {\r
+ {\r
if (frames != 0)\r
- {\r
+ {\r
if ((hr = ProcessOutputBuffer(stream, processor, frames)) != S_OK)\r
- {\r
+ {\r
LogHostError(hr); // not fatal, just log\r
- }\r
- }\r
+ }\r
+ }\r
}\r
}\r
else\r
- {\r
+ {\r
LogHostError(hr); // not fatal, just log\r
}\r
}\r
LogHostError(hr);\r
goto thread_error;\r
}\r
-\r
+ \r
// output\r
if (stream->bufferMode == paUtilFixedHostBufferSize)\r
{\r
{\r
LogHostError(hr);\r
goto thread_error;\r
- }\r
+ }\r
}\r
}\r
else\r
{\r
LogHostError(hr);\r
goto thread_error;\r
- }\r
+ }\r
}\r
}\r
\r
\r
LogPaError(paInsufficientMemory);\r
break;\r
- }\r
+ }\r
}\r
\r
// replace buffer pointer\r
if (sleep_ms == 0)\r
{\r
next_sleep = ThreadIdleScheduler_NextSleep(&scheduler);\r
- }\r
+ }\r
\r
// get available frames\r
if ((hr = _PollGetOutputFramesAvailable(stream, &o_frames)) != S_OK)\r
/*
- * $Id$
+ * $Id: pa_win_wmme.c 1663 2011-05-01 13:21:43Z rossb $
* pa_win_wmme.c
* Implementation of PortAudio for Windows MultiMedia Extensions (WMME)
*
(*hostApi)->Terminate = Terminate;
(*hostApi)->OpenStream = OpenStream;
(*hostApi)->IsFormatSupported = IsFormatSupported;
+ (*hostApi)->ScanDeviceInfos = 0;
+ (*hostApi)->CommitDeviceInfos = 0;
+ (*hostApi)->DisposeDeviceInfos = 0;
PaUtil_InitializeStreamInterface( &winMmeHostApi->callbackStreamInterface, CloseStream, StartStream,
StopStream, AbortStream, IsStreamStopped, IsStreamActive,
{
switch(j){
case 0:
- /* first, attempt to open the device using WAVEFORMATEXTENSIBLE,
- if this fails we fall back to WAVEFORMATEX */
+ /* first, attempt to open the device using WAVEFORMATEXTENSIBLE,
+ if this fails we fall back to WAVEFORMATEX */
- PaWin_InitializeWaveFormatExtensible( &waveFormat, devices[i].channelCount,
- sampleFormat, waveFormatTag, sampleRate, channelMask );
+ PaWin_InitializeWaveFormatExtensible( &waveFormat, devices[i].channelCount,
+ sampleFormat, waveFormatTag, sampleRate, channelMask );
break;
-
+
case 1:
- /* retry with WAVEFORMATEX */
+ /* retry with WAVEFORMATEX */
- PaWin_InitializeWaveFormatEx( &waveFormat, devices[i].channelCount,
- sampleFormat, waveFormatTag, sampleRate );
+ PaWin_InitializeWaveFormatEx( &waveFormat, devices[i].channelCount,
+ sampleFormat, waveFormatTag, sampleRate );
break;
}
--- /dev/null
+
+#include "pa_util.h"
+#include "pa_debugprint.h"
+#include "pa_allocation.h"
+
+#include "pa_win_wdmks_utils.h"
+
+#include <windows.h>
+#include <dbt.h>
+#include <process.h>
+#include <assert.h>
+#include <ks.h>
+#include <ksmedia.h>
+
+#include <setupapi.h>
+
+#include <stdio.h>
+
+#if (defined(WIN32) && (defined(_MSC_VER) && (_MSC_VER >= 1200))) /* MSC version 6 and above */
+#pragma comment( lib, "setupapi.lib" )
+#endif
+
+
+/* Implemented in pa_front.c
+ @param first 0 = unknown, 1 = insertion, 2 = removal
+ @param second Host specific device change info (in windows it is the (unicode) device path)
+*/
+extern void PaUtil_DevicesChanged(unsigned, void*);
+
+/* use CreateThread for CYGWIN/Windows Mobile, _beginthreadex for all others */
+#if !defined(__CYGWIN__) && !defined(_WIN32_WCE)
+#define CREATE_THREAD_FUNCTION (HANDLE)_beginthreadex
+#define PA_THREAD_FUNC static unsigned WINAPI
+#else
+#define CREATE_THREAD_FUNCTION CreateThread
+#define PA_THREAD_FUNC static DWORD WINAPI
+#endif
+
+typedef struct PaHotPlugDeviceInfo
+{
+ wchar_t name[MAX_PATH];
+ struct PaHotPlugDeviceInfo* next;
+} PaHotPlugDeviceInfo;
+
+typedef struct PaHotPlugDeviceEventHandlerInfo
+{
+ HANDLE hWnd;
+ HANDLE hMsgThread;
+ HANDLE hNotify;
+ CRITICAL_SECTION lock;
+ PaUtilAllocationGroup* cacheAllocGroup;
+ PaHotPlugDeviceInfo* cache;
+
+} PaHotPlugDeviceEventHandlerInfo;
+
+
+static BOOL RemoveDeviceFromCache(PaHotPlugDeviceEventHandlerInfo* pInfo, const wchar_t* name)
+{
+ if (pInfo->cache != NULL)
+ {
+ PaHotPlugDeviceInfo* lastEntry = 0;
+ PaHotPlugDeviceInfo* entry = pInfo->cache;
+ while (entry != NULL)
+ {
+ if (_wcsicmp(entry->name, name) == 0)
+ {
+ if (lastEntry)
+ {
+ lastEntry->next = entry->next;
+ }
+ else
+ {
+ pInfo->cache = NULL;
+ }
+ PaUtil_GroupFreeMemory(pInfo->cacheAllocGroup, entry);
+ return TRUE;
+ }
+
+ lastEntry = entry;
+ entry = entry->next;
+ }
+ }
+ return FALSE;
+}
+
+static void InsertDeviceIntoCache(PaHotPlugDeviceEventHandlerInfo* pInfo, const wchar_t* name)
+{
+ PaHotPlugDeviceInfo** ppEntry = NULL;
+
+ /* Remove it first (if possible) so we don't accidentally get duplicates */
+ RemoveDeviceFromCache(pInfo, name);
+
+ if (pInfo->cache == NULL)
+ {
+ ppEntry = &pInfo->cache;
+ }
+ else
+ {
+ PaHotPlugDeviceInfo* entry = pInfo->cache;
+ while (entry->next != NULL)
+ {
+ entry = entry->next;
+ }
+ ppEntry = &entry->next;
+ }
+
+ *ppEntry = (PaHotPlugDeviceInfo*)PaUtil_GroupAllocateMemory(pInfo->cacheAllocGroup, sizeof(PaHotPlugDeviceInfo));
+ wcsncpy((*ppEntry)->name, name, MAX_PATH-1);
+ (*ppEntry)->next = NULL;
+}
+
+static BOOL IsDeviceAudio(const wchar_t* deviceName)
+{
+ int channelCnt = 0;
+ channelCnt += PaWin_WDMKS_QueryFilterMaximumChannelCount((void*)deviceName, 1);
+ channelCnt += PaWin_WDMKS_QueryFilterMaximumChannelCount((void*)deviceName, 0);
+ return (channelCnt > 0);
+}
+
+static void PopulateCacheWithAvailableAudioDevices(PaHotPlugDeviceEventHandlerInfo* pInfo)
+{
+ HDEVINFO handle = NULL;
+ const int sizeInterface = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_W) + (MAX_PATH * sizeof(WCHAR));
+ SP_DEVICE_INTERFACE_DETAIL_DATA_W* devInterfaceDetails = (SP_DEVICE_INTERFACE_DETAIL_DATA_W*)PaUtil_AllocateMemory(sizeInterface);
+
+ if (devInterfaceDetails)
+ {
+ devInterfaceDetails->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_W);
+
+ /* Open a handle to search for devices (filters) */
+ handle = SetupDiGetClassDevsW(&KSCATEGORY_AUDIO,NULL,NULL,DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);
+ if( handle != NULL )
+ {
+ int device;
+
+ /* Iterate through the devices */
+ for( device = 0;;device++ )
+ {
+ SP_DEVICE_INTERFACE_DATA interfaceData;
+ SP_DEVINFO_DATA devInfoData;
+ int noError;
+
+ interfaceData.cbSize = sizeof(SP_DEVICE_INTERFACE_DATA);
+ interfaceData.Reserved = 0;
+ devInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
+ devInfoData.Reserved = 0;
+
+ noError = SetupDiEnumDeviceInterfaces(handle,NULL,&KSCATEGORY_AUDIO,device,&interfaceData);
+ if( !noError )
+ break; /* No more devices */
+
+ noError = SetupDiGetDeviceInterfaceDetailW(handle,&interfaceData,devInterfaceDetails,sizeInterface,NULL,&devInfoData);
+ if( noError )
+ {
+ if (IsDeviceAudio(devInterfaceDetails->DevicePath))
+ {
+ PA_DEBUG(("Hotplug cache populated with: '%S'\n", devInterfaceDetails->DevicePath));
+ InsertDeviceIntoCache(pInfo, devInterfaceDetails->DevicePath);
+ }
+ }
+ }
+ SetupDiDestroyDeviceInfoList(handle);
+ }
+ PaUtil_FreeMemory(devInterfaceDetails);
+ }
+}
+
+static LRESULT CALLBACK PaMsgWinProcW(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ PaHotPlugDeviceEventHandlerInfo* pInfo = (PaHotPlugDeviceEventHandlerInfo*)( GetWindowLongPtr(hWnd, GWLP_USERDATA) );
+ switch(msg)
+ {
+ case WM_DEVICECHANGE:
+ switch(wParam)
+ {
+ case DBT_DEVICEARRIVAL:
+ {
+ PDEV_BROADCAST_DEVICEINTERFACE_W ptr = (PDEV_BROADCAST_DEVICEINTERFACE_W)lParam;
+ if (ptr->dbcc_devicetype != DBT_DEVTYP_DEVICEINTERFACE)
+ break;
+
+ if (!IsEqualGUID(&ptr->dbcc_classguid, &KSCATEGORY_AUDIO))
+ break;
+
+ if (IsDeviceAudio(ptr->dbcc_name))
+ {
+ PA_DEBUG(("Device inserted : %S\n", ptr->dbcc_name));
+ InsertDeviceIntoCache(pInfo, ptr->dbcc_name);
+ PaUtil_DevicesChanged(1, ptr->dbcc_name);
+ }
+ }
+ break;
+ case DBT_DEVICEREMOVECOMPLETE:
+ {
+ PDEV_BROADCAST_DEVICEINTERFACE_W ptr = (PDEV_BROADCAST_DEVICEINTERFACE_W)lParam;
+ if (ptr->dbcc_devicetype != DBT_DEVTYP_DEVICEINTERFACE)
+ break;
+
+ if (!IsEqualGUID(&ptr->dbcc_classguid, &KSCATEGORY_AUDIO))
+ break;
+
+ if (RemoveDeviceFromCache(pInfo, ptr->dbcc_name))
+ {
+ PA_DEBUG(("Device removed : %S\n", ptr->dbcc_name));
+ PaUtil_DevicesChanged(2, ptr->dbcc_name);
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ break;
+ }
+ return DefWindowProcW(hWnd, msg, wParam, lParam);
+}
+
+PA_THREAD_FUNC PaRunMessageLoop(void* ptr)
+{
+ PaHotPlugDeviceEventHandlerInfo* pInfo = (PaHotPlugDeviceEventHandlerInfo*)ptr;
+ WNDCLASSW wnd = { 0 };
+ HMODULE hInstance = GetModuleHandleW(NULL);
+
+ wnd.lpfnWndProc = PaMsgWinProcW;
+ wnd.hInstance = hInstance;
+ wnd.lpszClassName = L"{1E0D4F5A-B31F-4dcc-AE3C-4F30A47BD521}"; /* Using a GUID as class name */
+ pInfo->hWnd = CreateWindowW((LPCWSTR)MAKEINTATOM(RegisterClassW(&wnd)), NULL, 0, 0, 0, 0, 0, HWND_MESSAGE, NULL, hInstance, NULL);
+ if (pInfo->hWnd)
+ {
+ DEV_BROADCAST_DEVICEINTERFACE_W NotificationFilter = { sizeof(DEV_BROADCAST_DEVICEINTERFACE_W) };
+ NotificationFilter.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
+
+#ifndef DEVICE_NOTIFY_ALL_INTERFACE_CLASSES
+#define DEVICE_NOTIFY_ALL_INTERFACE_CLASSES 0x00000004
+#endif
+
+ pInfo->hNotify = RegisterDeviceNotificationW(
+ pInfo->hWnd,
+ &NotificationFilter,
+ DEVICE_NOTIFY_WINDOW_HANDLE|DEVICE_NOTIFY_ALL_INTERFACE_CLASSES
+ );
+
+ assert(pInfo->hNotify);
+
+ SetWindowLongPtr(pInfo->hWnd, GWLP_USERDATA, (LONG_PTR)pInfo);
+
+ if (pInfo->hNotify)
+ {
+ MSG msg;
+ BOOL result;
+ while((result = GetMessageW(&msg, pInfo->hWnd, 0, 0)) != 0)
+ {
+ if (result == -1)
+ {
+ break;
+ }
+ TranslateMessage(&msg);
+ DispatchMessageW(&msg);
+ }
+ UnregisterDeviceNotification(pInfo->hNotify);
+ pInfo->hNotify = 0;
+ }
+ DestroyWindow(pInfo->hWnd);
+ pInfo->hWnd = 0;
+ }
+ return 0;
+}
+
+static PaHotPlugDeviceEventHandlerInfo* s_handler = 0;
+
+void PaUtil_InitializeHotPlug()
+{
+ if (s_handler == 0)
+ {
+ s_handler = (PaHotPlugDeviceEventHandlerInfo*)PaUtil_AllocateMemory(sizeof(PaHotPlugDeviceEventHandlerInfo));
+ if (s_handler)
+ {
+ s_handler->cacheAllocGroup = PaUtil_CreateAllocationGroup();
+ InitializeCriticalSection(&s_handler->lock);
+ PopulateCacheWithAvailableAudioDevices(s_handler);
+ /* Start message thread */
+ s_handler->hMsgThread = CREATE_THREAD_FUNCTION(NULL, 0, PaRunMessageLoop, s_handler, 0, NULL);
+ assert(s_handler->hMsgThread != 0);
+ }
+ }
+}
+
+void PaUtil_TerminateHotPlug()
+{
+ if (s_handler != 0)
+ {
+ if (s_handler->hWnd)
+ {
+ PostMessage(s_handler->hWnd, WM_QUIT, 0, 0);
+ if (WaitForSingleObject(s_handler->hMsgThread, 1000) == WAIT_TIMEOUT)
+ {
+ TerminateThread(s_handler->hMsgThread, -1);
+ }
+ }
+ DeleteCriticalSection(&s_handler->lock);
+ PaUtil_FreeAllAllocations( s_handler->cacheAllocGroup );
+ PaUtil_DestroyAllocationGroup( s_handler->cacheAllocGroup );
+ PaUtil_FreeMemory( s_handler );
+ s_handler = 0;
+ }
+}
+
+void PaUtil_LockHotPlug()
+{
+ EnterCriticalSection(&s_handler->lock);
+}
+
+void PaUtil_UnlockHotPlug()
+{
+ LeaveCriticalSection(&s_handler->lock);
+}
#include <winioctl.h> // MinGW32 does not define this automatically\r
#include <ks.h>\r
#include <ksmedia.h>\r
-#include <stdio.h> // just for some development printfs\r
+#include <stdio.h> // just for some development printfs\r
\r
#include "portaudio.h"\r
#include "pa_util.h"\r
#include "pa_win_wdmks_utils.h"\r
\r
#if !defined(PA_WDMKS_NO_KSGUID_LIB) && !defined(PAWIN_WDMKS_NO_KSGUID_LIB)\r
- #if (defined(WIN32) && (defined(_MSC_VER) && (_MSC_VER >= 1200))) /* MSC version 6 and above */\r
- #pragma comment( lib, "ksguid.lib" )\r
- #endif\r
- #define pa_KSDATAFORMAT_TYPE_AUDIO KSDATAFORMAT_TYPE_AUDIO\r
- #define pa_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT KSDATAFORMAT_SUBTYPE_IEEE_FLOAT\r
- #define pa_KSDATAFORMAT_SUBTYPE_PCM KSDATAFORMAT_SUBTYPE_PCM\r
- #define pa_KSDATAFORMAT_SUBTYPE_WAVEFORMATEX KSDATAFORMAT_SUBTYPE_WAVEFORMATEX\r
- #define pa_KSMEDIUMSETID_Standard KSMEDIUMSETID_Standard\r
- #define pa_KSINTERFACESETID_Standard KSINTERFACESETID_Standard\r
- #define pa_KSPROPSETID_Pin KSPROPSETID_Pin\r
+#if (defined(WIN32) && (defined(_MSC_VER) && (_MSC_VER >= 1200))) /* MSC version 6 and above */\r
+#pragma comment( lib, "ksguid.lib" )\r
+#endif\r
+#define pa_KSDATAFORMAT_TYPE_AUDIO KSDATAFORMAT_TYPE_AUDIO\r
+#define pa_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT KSDATAFORMAT_SUBTYPE_IEEE_FLOAT\r
+#define pa_KSDATAFORMAT_SUBTYPE_PCM KSDATAFORMAT_SUBTYPE_PCM\r
+#define pa_KSDATAFORMAT_SUBTYPE_WAVEFORMATEX KSDATAFORMAT_SUBTYPE_WAVEFORMATEX\r
+#define pa_KSMEDIUMSETID_Standard KSMEDIUMSETID_Standard\r
+#define pa_KSINTERFACESETID_Standard KSINTERFACESETID_Standard\r
+#define pa_KSPROPSETID_Pin KSPROPSETID_Pin\r
#else\r
- static const GUID pa_KSDATAFORMAT_TYPE_AUDIO = { STATIC_KSDATAFORMAT_TYPE_AUDIO };\r
- static const GUID pa_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT = { STATIC_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT };\r
- static const GUID pa_KSDATAFORMAT_SUBTYPE_PCM = { STATIC_KSDATAFORMAT_SUBTYPE_PCM };\r
- static const GUID pa_KSDATAFORMAT_SUBTYPE_WAVEFORMATEX = { STATIC_KSDATAFORMAT_SUBTYPE_WAVEFORMATEX };\r
- static const GUID pa_KSMEDIUMSETID_Standard = { STATIC_KSMEDIUMSETID_Standard };\r
- static const GUID pa_KSINTERFACESETID_Standard = { STATIC_KSINTERFACESETID_Standard };\r
- static const GUID pa_KSPROPSETID_Pin = { STATIC_KSPROPSETID_Pin };\r
+static const GUID pa_KSDATAFORMAT_TYPE_AUDIO = { STATIC_KSDATAFORMAT_TYPE_AUDIO };\r
+static const GUID pa_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT = { STATIC_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT };\r
+static const GUID pa_KSDATAFORMAT_SUBTYPE_PCM = { STATIC_KSDATAFORMAT_SUBTYPE_PCM };\r
+static const GUID pa_KSDATAFORMAT_SUBTYPE_WAVEFORMATEX = { STATIC_KSDATAFORMAT_SUBTYPE_WAVEFORMATEX };\r
+static const GUID pa_KSMEDIUMSETID_Standard = { STATIC_KSMEDIUMSETID_Standard };\r
+static const GUID pa_KSINTERFACESETID_Standard = { STATIC_KSINTERFACESETID_Standard };\r
+static const GUID pa_KSPROPSETID_Pin = { STATIC_KSPROPSETID_Pin };\r
#endif\r
\r
\r
@author Phil Burk <philburk@softsynth.com>
*/
/*
- * $Id$
+ * $Id: patest_leftright.c 1661 2011-04-28 18:54:46Z rob_bielik $
*
* This program uses the PortAudio Portable Audio Library.
* For more information see: http://www.portaudio.com
{
// Smoothly pan between left and right.
if( data->currentBalance < data->targetBalance )
- {
+ {
data->currentBalance += BALANCE_DELTA;
- }
+ }
else if( data->currentBalance > data->targetBalance )
- {
+ {
data->currentBalance -= BALANCE_DELTA;
- }
+ }
// Apply left/right balance.
*out++ = data->sine[data->left_phase] * (1.0f - data->currentBalance); /* left */
*out++ = data->sine[data->right_phase] * data->currentBalance; /* right */
-
+
data->left_phase += 1;
if( data->left_phase >= TABLE_SIZE ) data->left_phase -= TABLE_SIZE;
data->right_phase += 3; /* higher pitch so we can distinguish left and right. */
PaStreamParameters outputParameters;
PaError err;
paTestData data;
- int i;
+ int i;
printf("Play different tone sine waves that alternate between left and right channel.\n");
printf("The low tone should be on the left channel.\n");
printf("Play for several seconds.\n");
for( i=0; i<4; i++ )
- {
+ {
printf("Hear low sound on left side.\n");
data.targetBalance = 0.01;
Pa_Sleep( 1000 );
printf("Hear high sound on right side.\n");
data.targetBalance = 0.99;
Pa_Sleep( 1000 );
- }
+ }
err = Pa_StopStream( stream );
if( err != paNoError ) goto error;
@author Phil Burk <philburk@softsynth.com>
*/
/*
- * $Id$
+ * $Id: patest_out_underflow.c 1661 2011-04-28 18:54:46Z rob_bielik $
*
* This program uses the PortAudio Portable Audio Library.
* For more information see: http://www.portaudio.com
/* Determine number of sines required to get to 50% */
do
- {
- Pa_Sleep( 100 );
+ {
+ Pa_Sleep( 100 );
load = Pa_GetStreamCpuLoad( stream );
printf("sineCount = %d, CPU load = %f\n", data.sineCount, load );
if( load < 0.3 )
{
data.sineCount += 10;
- }
+ }
else if( load < 0.4 )
{
data.sineCount += 2;
timeInfo->currentTime,\r
timeInfo->outputBufferDacTime );\r
\r
- printf( "getStreamTime() returns: %g\n", Pa_GetStreamTime(data->stream) - data->start );\r
+ printf( "getStreamTime() returns: %g\n", Pa_GetStreamTime(data->stream)-data->start );\r
\r
for( i=0; i<framesPerBuffer; i++ )\r
{\r
@author Phil Burk <philburk@softsynth.com>
*/
/*
- * $Id$
+ * $Id: patest_two_rates.c 1661 2011-04-28 18:54:46Z rob_bielik $
*
* Author: Phil Burk http://www.softsynth.com
*
} paTestData;
/* This routine will be called by the PortAudio engine when audio is needed.
- ** It may called at interrupt level on some machines so don't do anything
- ** that could mess up the system like calling malloc() or free().
- */
+** It may called at interrupt level on some machines so don't do anything
+** that could mess up the system like calling malloc() or free().
+*/
static int patestCallback( const void *inputBuffer, void *outputBuffer,
- unsigned long framesPerBuffer,
+ unsigned long framesPerBuffer,
const PaStreamCallbackTimeInfo* timeInfo,
PaStreamCallbackFlags statusFlags,
void *userData )
outputParameters.suggestedLatency = Pa_GetDeviceInfo( outputParameters.device )->defaultLowOutputLatency;
outputParameters.hostApiSpecificStreamInfo = NULL;
- /* Start first stream. **********************/
+ /* Start first stream. **********************/
err = Pa_OpenStream(
- &stream1,
+ &stream1,
NULL, /* no input */
&outputParameters,
- SAMPLE_RATE_1,
+ SAMPLE_RATE_1,
FRAMES_PER_BUFFER,
- paClipOff, /* we won't output out of range samples so don't bother clipping them */
- patestCallback,
- &data1 );
- if( err != paNoError ) goto error;
+ paClipOff, /* we won't output out of range samples so don't bother clipping them */
+ patestCallback,
+ &data1 );
+ if( err != paNoError ) goto error;
err = Pa_StartStream( stream1 );
if( err != paNoError ) goto error;
/* Start second stream. **********************/
err = Pa_OpenStream(
- &stream2,
+ &stream2,
NULL, /* no input */
&outputParameters,
- SAMPLE_RATE_2,
+ SAMPLE_RATE_2,
FRAMES_PER_BUFFER,
- paClipOff, /* we won't output out of range samples so don't bother clipping them */
- patestCallback,
- &data2 );
+ paClipOff, /* we won't output out of range samples so don't bother clipping them */
+ patestCallback,
+ &data2 );
if( err != paNoError ) goto error;
err = Pa_StartStream( stream2 );
--- /dev/null
+#include <stdio.h>
+#include <assert.h>
+
+#include "portaudio.h"
+
+void printDevices()
+{
+ int deviceCount = Pa_GetDeviceCount();
+ int i;
+
+ for( i=0; i < deviceCount; ++i ){
+ const PaDeviceInfo *deviceInfo = Pa_GetDeviceInfo(i);
+ const PaHostApiInfo *hostApiInfo = Pa_GetHostApiInfo( deviceInfo->hostApi );
+
+ assert( deviceInfo != 0 );
+
+ printf( "%d %s (%s)\n", i, deviceInfo->name, hostApiInfo->name );
+ }
+}
+
+static void devicesChangedCallback(void* p)
+{
+ (void)p;
+
+ printf( "Portaudio device list have changed!\n" );
+}
+
+int main(int argc, char* argv[])
+{
+ Pa_Initialize();
+
+ Pa_SetDevicesChangedCallback(NULL, devicesChangedCallback);
+
+ for(;;){
+ printDevices();
+
+ printf( "press [enter] to update the device list. or q + [enter] to quit.\n" );
+ if( getchar() == 'q' )
+ break;
+
+ Pa_UpdateAvailableDeviceList();
+ }
+
+ Pa_Terminate();
+
+ return 0;
+}
+