diff --git a/configure b/configure index 4981cb7..b9561b5 100755 --- a/configure +++ b/configure @@ -1,11 +1,10 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.57 for RtAudio 3.0. +# Generated by GNU Autoconf 2.59 for RtAudio 4.0. # -# Report bugs to . +# Report bugs to . # -# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 -# Free Software Foundation, Inc. +# Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## @@ -22,9 +21,10 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi +DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. -if (FOO=FOO; unset FOO) >/dev/null 2>&1; then +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false @@ -43,7 +43,7 @@ for as_var in \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do - if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var @@ -220,16 +220,17 @@ rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else + test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. -as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. -as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS @@ -268,9 +269,9 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='RtAudio' PACKAGE_TARNAME='rtaudio' -PACKAGE_VERSION='3.0' -PACKAGE_STRING='RtAudio 3.0' -PACKAGE_BUGREPORT='gary@ccrma.stanford.edu' +PACKAGE_VERSION='4.0' +PACKAGE_STRING='RtAudio 4.0' +PACKAGE_BUGREPORT='gary@music.mcgill.ca' ac_unique_file="RtAudio.cpp" # Factoring default headers for most tests. @@ -310,7 +311,7 @@ ac_includes_default="\ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS GXX CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX CPP EGREP debug cflags object_path warn build build_cpu build_vendor build_os host host_cpu host_vendor host_os sound_api audio_apis frameworks LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS GXX CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX RANLIB ac_ct_RANLIB AR CPP EGREP debug cflags object_path warn build build_cpu build_vendor build_os host host_cpu host_vendor host_os sound_api audio_apis frameworks LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -669,7 +670,7 @@ done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ - localstatedir libdir includedir oldincludedir infodir mandir + localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in @@ -709,10 +710,10 @@ if test -z "$srcdir"; then # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$0" : 'X\(//\)[^/]' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } @@ -787,7 +788,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures RtAudio 3.0 to adapt to many kinds of systems. +\`configure' configures RtAudio 4.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -812,9 +813,9 @@ _ACEOF cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] + [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] + [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify @@ -848,7 +849,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of RtAudio 3.0:";; + short | recursive ) echo "Configuration of RtAudio 4.0:";; esac cat <<\_ACEOF @@ -860,9 +861,11 @@ Optional Features: Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-jack = choose JACK server support (linux only) + --with-jack = choose JACK server support (mac and linux only) --with-alsa = choose native ALSA API support (linux only) --with-oss = choose OSS API support (linux only) + --with-jack = choose JACK server support (unix only) + --with-core = choose CoreAudio API support (mac only) Some influential environment variables: CC C compiler command @@ -878,7 +881,7 @@ Some influential environment variables: Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. -Report bugs to . +Report bugs to . _ACEOF fi @@ -912,12 +915,45 @@ case $srcdir in ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac -# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be -# absolute. -ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` -ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` -ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. @@ -928,7 +964,7 @@ ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || - test -f $ac_srcdir/configure.in; then + test -f $ac_srcdir/configure.in; then echo $ac_configure --help else @@ -941,11 +977,10 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -RtAudio configure 3.0 -generated by GNU Autoconf 2.57 +RtAudio configure 4.0 +generated by GNU Autoconf 2.59 -Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 -Free Software Foundation, Inc. +Copyright (C) 2003 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -956,8 +991,8 @@ cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by RtAudio $as_me 3.0, which was -generated by GNU Autoconf 2.57. Invocation command line was +It was created by RtAudio $as_me 4.0, which was +generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -1034,19 +1069,19 @@ do 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. + ac_must_keep_next=false # Got value, back to normal. else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac fi ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. @@ -1080,12 +1115,12 @@ _ASBOX case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ - "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } @@ -1114,7 +1149,7 @@ _ASBOX for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" + echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi @@ -1133,7 +1168,7 @@ _ASBOX echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 - rm -f core core.* *.core && + rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 @@ -1213,7 +1248,7 @@ fi # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | - sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" @@ -1230,13 +1265,13 @@ echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: + ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. @@ -1293,7 +1328,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu - ac_config_files="$ac_config_files tests/Makefile" + ac_config_files="$ac_config_files rtaudio-config Makefile tests/Makefile" # Fill GXX with something before test. @@ -1637,7 +1672,6 @@ ac_compiler=`set X $ac_compile; echo $2` (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -1657,8 +1691,8 @@ ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -echo "$as_me:$LINENO: checking for C compiler default output" >&5 -echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 +echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 @@ -1678,23 +1712,23 @@ do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) - ;; + ;; conftest.$ac_ext ) - # This is the source file. - ;; + # This is the source file. + ;; [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; + # We found the default executable, but exeext='' is most + # certainly right. + break;; *.* ) - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - # FIXME: I believe we export ac_cv_exeext for Libtool, - # but it would be cool to find out if it's true. Does anybody - # maintain Libtool? --akim. - export ac_cv_exeext - break;; + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool, + # but it would be cool to find out if it's true. Does anybody + # maintain Libtool? --akim. + export ac_cv_exeext + break;; * ) - break;; + break;; esac done else @@ -1768,8 +1802,8 @@ for ac_file in conftest.exe conftest conftest.*; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - export ac_cv_exeext - break;; + export ac_cv_exeext + break;; * ) break;; esac done @@ -1794,7 +1828,6 @@ if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -1845,7 +1878,6 @@ if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -1865,11 +1897,21 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -1882,7 +1924,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi @@ -1898,7 +1940,6 @@ if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -1915,11 +1956,21 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -1932,7 +1983,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 @@ -1959,7 +2010,6 @@ else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -1987,6 +2037,16 @@ static char *f (char * (*g) (char **, int), char **p, ...) va_end (v); return s; } + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std1 is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std1. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; @@ -2013,11 +2073,21 @@ do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2030,7 +2100,7 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext +rm -f conftest.err conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC @@ -2058,19 +2128,28 @@ cat >conftest.$ac_ext <<_ACEOF _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ - ''\ - '#include ' \ + '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ @@ -2078,14 +2157,13 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include $ac_declaration +#include int main () { @@ -2096,11 +2174,21 @@ exit (42); _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2113,9 +2201,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 continue fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2132,11 +2219,21 @@ exit (42); _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2148,7 +2245,7 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then @@ -2162,7 +2259,7 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -2288,7 +2385,6 @@ if test "${ac_cv_cxx_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2308,11 +2404,21 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2325,7 +2431,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi @@ -2341,7 +2447,6 @@ if test "${ac_cv_prog_cxx_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2358,11 +2463,21 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2375,7 +2490,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cxx_g=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 @@ -2395,8 +2510,7 @@ else fi fi for ac_declaration in \ - ''\ - '#include ' \ + '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ @@ -2404,14 +2518,13 @@ for ac_declaration in \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include $ac_declaration +#include int main () { @@ -2422,11 +2535,21 @@ exit (42); _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2439,9 +2562,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 continue fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2458,11 +2580,21 @@ exit (42); _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2474,7 +2606,7 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then @@ -2489,6 +2621,131 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + echo "$as_me:$LINENO: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + RANLIB=$ac_ct_RANLIB +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +# Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $AR in + [\\/]* | ?:[\\/]*) + ac_cv_path_AR="$AR" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_AR="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_path_AR" && ac_cv_path_AR="no" + ;; +esac +fi +AR=$ac_cv_path_AR + +if test -n "$AR"; then + echo "$as_me:$LINENO: result: $AR" >&5 +echo "${ECHO_T}$AR" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +if [ $AR = "no" ] ; then + { { echo "$as_me:$LINENO: error: \"Could not find ar - needed to create a library\"" >&5 +echo "$as_me: error: \"Could not find ar - needed to create a library\"" >&2;} + { (exit 1); exit 1; }; }; +fi # Checks for libraries. @@ -2501,7 +2758,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lpthread $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2525,11 +2781,21 @@ pthread_create (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2542,7 +2808,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_pthread_pthread_create=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_create" >&5 @@ -2561,6 +2828,8 @@ echo "$as_me: error: RtAudio requires the pthread library!" >&2;} fi + + # Checks for header files. ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -2590,7 +2859,6 @@ do # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2601,7 +2869,7 @@ cat >>conftest.$ac_ext <<_ACEOF #else # include #endif - Syntax error + Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 @@ -2613,6 +2881,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -2633,7 +2902,6 @@ rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2651,6 +2919,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -2697,7 +2966,6 @@ do # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2708,7 +2976,7 @@ cat >>conftest.$ac_ext <<_ACEOF #else # include #endif - Syntax error + Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 @@ -2720,6 +2988,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -2740,7 +3009,6 @@ rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2758,6 +3026,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -2818,7 +3087,6 @@ if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2839,11 +3107,21 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2856,12 +3134,11 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2883,7 +3160,6 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2908,7 +3184,6 @@ if test $ac_cv_header_stdc = yes; then : else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2920,9 +3195,9 @@ cat >>conftest.$ac_ext <<_ACEOF # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif @@ -2933,7 +3208,7 @@ main () int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) + || toupper (i) != TOUPPER (i)) exit(2); exit (0); } @@ -2958,7 +3233,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi @@ -2983,7 +3258,7 @@ fi for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h + inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_header" >&5 @@ -2992,7 +3267,6 @@ if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3004,11 +3278,21 @@ $ac_includes_default _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3021,7 +3305,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 @@ -3053,7 +3337,6 @@ else echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3064,11 +3347,21 @@ $ac_includes_default _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3081,7 +3374,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 @@ -3089,7 +3382,6 @@ echo "${ECHO_T}$ac_header_compiler" >&6 echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3107,6 +3399,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -3126,33 +3419,32 @@ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? -case $ac_header_compiler:$ac_header_preproc in - yes:no ) +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes ;; - no:yes ) + no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## +## ----------------------------------- ## +## Report this to gary@music.mcgill.ca ## +## ----------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 @@ -3163,7 +3455,7 @@ echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - eval "$as_ac_Header=$ac_header_preproc" + eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 @@ -3186,7 +3478,6 @@ if test "${ac_cv_c_const+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3249,11 +3540,21 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3266,7 +3567,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_const=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 echo "${ECHO_T}$ac_cv_c_const" >&6 @@ -3298,30 +3599,126 @@ else echo "${ECHO_T}no" >&6 fi; -# Check compiler and use -Wall if gnu. -if test $GXX = "yes" ; then - warn=-Wall +# Checks for functions +echo "$as_me:$LINENO: checking for gettimeofday" >&5 +echo $ECHO_N "checking for gettimeofday... $ECHO_C" >&6 +if test "${ac_cv_func_gettimeofday+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define gettimeofday to an innocuous variant, in case declares gettimeofday. + For example, HP-UX 11i declares gettimeofday. */ +#define gettimeofday innocuous_gettimeofday -fi +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char gettimeofday (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ -# Checks for package options and external software -ac_aux_dir= -for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do - if test -f $ac_dir/install-sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f $ac_dir/install.sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f $ac_dir/shtool; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef gettimeofday + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gettimeofday (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_gettimeofday) || defined (__stub___gettimeofday) +choke me +#else +char (*f) () = gettimeofday; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != gettimeofday; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_gettimeofday=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_gettimeofday=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_gettimeofday" >&5 +echo "${ECHO_T}$ac_cv_func_gettimeofday" >&6 +if test $ac_cv_func_gettimeofday = yes; then + cflags=$cflags" -DHAVE_GETTIMEOFDAY" +fi + + +# Check compiler and use -Wall if gnu. +if test $GXX = "yes" ; then + warn=-Wall + +fi + +# Checks for package options and external software +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} { (exit 1); exit 1; }; } @@ -3387,6 +3784,16 @@ host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$as_me:$LINENO: checking for audio API" >&5 echo $ECHO_N "checking for audio API... $ECHO_C" >&6 case $host in + *-*-netbsd*) + sound_api=-D__LINUX_OSS__ + + echo "$as_me:$LINENO: result: using OSS" >&5 +echo "${ECHO_T}using OSS" >&6 + audio_apis=-D__LINUX_OSS__ + + cflags=$cflags" -lossaudio" + ;; + *-*-linux*) sound_api=_NO_API_ @@ -3394,11 +3801,11 @@ case $host in # Check whether --with-jack or --without-jack was given. if test "${with_jack+set}" = set; then withval="$with_jack" - sound_api=-D__LINUX_JACK__ + sound_api=-D__UNIX_JACK__ echo "$as_me:$LINENO: result: using JACK" >&5 echo "${ECHO_T}using JACK" >&6 fi; - if test $sound_api = -D__LINUX_JACK__; then + if test $sound_api = -D__UNIX_JACK__; then TEMP_LIBS=$LIBS echo "$as_me:$LINENO: checking for jack_client_new in -ljack" >&5 @@ -3409,7 +3816,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ljack $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3433,11 +3839,21 @@ jack_client_new (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3450,7 +3866,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_jack_jack_client_new=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_jack_jack_client_new" >&5 @@ -3477,7 +3894,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lasound $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3501,11 +3917,21 @@ snd_pcm_open (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3518,7 +3944,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_asound_snd_pcm_open=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_asound_snd_pcm_open" >&5 @@ -3537,7 +3964,7 @@ echo "$as_me: error: Jack support also requires the asound library!" >&2;} fi LIBS="`pkg-config --cflags --libs jack` $TEMP_LIBS -lasound" - audio_apis="-D__LINUX_JACK__" + audio_apis="-D__UNIX_JACK__" fi # Look for Alsa flag @@ -3559,7 +3986,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lasound $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3583,11 +4009,21 @@ snd_pcm_open (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3600,7 +4036,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_asound_snd_pcm_open=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_asound_snd_pcm_open" >&5 @@ -3659,7 +4096,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-laudio $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3683,11 +4119,21 @@ alOpenPort (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3700,7 +4146,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_audio_alOpenPort=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_audio_alOpenPort" >&5 @@ -3721,8 +4168,109 @@ fi ;; *-apple*) - # Check for CoreAudio framework - if test "${ac_cv_header_CoreAudio_CoreAudio_h+set}" = set; then + sound_api=_NO_API_ + + +# Check whether --with-jack or --without-jack was given. +if test "${with_jack+set}" = set; then + withval="$with_jack" + sound_api=-D__UNIX_JACK__ + echo "$as_me:$LINENO: result: using JACK" >&5 +echo "${ECHO_T}using JACK" >&6 +fi; + if test $sound_api = -D__UNIX_JACK__; then + +echo "$as_me:$LINENO: checking for jack_client_new in -ljack" >&5 +echo $ECHO_N "checking for jack_client_new in -ljack... $ECHO_C" >&6 +if test "${ac_cv_lib_jack_jack_client_new+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ljack $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char jack_client_new (); +int +main () +{ +jack_client_new (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_jack_jack_client_new=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_jack_jack_client_new=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_jack_jack_client_new" >&5 +echo "${ECHO_T}$ac_cv_lib_jack_jack_client_new" >&6 +if test $ac_cv_lib_jack_jack_client_new = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBJACK 1 +_ACEOF + + LIBS="-ljack $LIBS" + +else + { { echo "$as_me:$LINENO: error: JACK support requires the jack library!" >&5 +echo "$as_me: error: JACK support requires the jack library!" >&2;} + { (exit 1); exit 1; }; } +fi + + audio_apis="-D__UNIX_JACK__" + fi + + # Look for Core flag + +# Check whether --with-core or --without-core was given. +if test "${with_core+set}" = set; then + withval="$with_core" + sound_api=-D__MACOSX_CORE__ + echo "$as_me:$LINENO: result: using CoreAudio" >&5 +echo "${ECHO_T}using CoreAudio" >&6 +fi; + if test $sound_api = -D__MACOSX_CORE__; then + if test "${ac_cv_header_CoreAudio_CoreAudio_h+set}" = set; then echo "$as_me:$LINENO: checking for CoreAudio/CoreAudio.h" >&5 echo $ECHO_N "checking for CoreAudio/CoreAudio.h... $ECHO_C" >&6 if test "${ac_cv_header_CoreAudio_CoreAudio_h+set}" = set; then @@ -3735,7 +4283,6 @@ else echo "$as_me:$LINENO: checking CoreAudio/CoreAudio.h usability" >&5 echo $ECHO_N "checking CoreAudio/CoreAudio.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3746,11 +4293,21 @@ $ac_includes_default _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3763,7 +4320,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 @@ -3771,7 +4328,6 @@ echo "${ECHO_T}$ac_header_compiler" >&6 echo "$as_me:$LINENO: checking CoreAudio/CoreAudio.h presence" >&5 echo $ECHO_N "checking CoreAudio/CoreAudio.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3789,6 +4345,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -3808,33 +4365,189 @@ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? -case $ac_header_compiler:$ac_header_preproc in - yes:no ) +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) { echo "$as_me:$LINENO: WARNING: CoreAudio/CoreAudio.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: CoreAudio/CoreAudio.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: CoreAudio/CoreAudio.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: CoreAudio/CoreAudio.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: CoreAudio/CoreAudio.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: CoreAudio/CoreAudio.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: CoreAudio/CoreAudio.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: CoreAudio/CoreAudio.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: CoreAudio/CoreAudio.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: CoreAudio/CoreAudio.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: CoreAudio/CoreAudio.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: CoreAudio/CoreAudio.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: CoreAudio/CoreAudio.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: CoreAudio/CoreAudio.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: CoreAudio/CoreAudio.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: CoreAudio/CoreAudio.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## +## ----------------------------------- ## +## Report this to gary@music.mcgill.ca ## +## ----------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; - no:yes ) +esac +echo "$as_me:$LINENO: checking for CoreAudio/CoreAudio.h" >&5 +echo $ECHO_N "checking for CoreAudio/CoreAudio.h... $ECHO_C" >&6 +if test "${ac_cv_header_CoreAudio_CoreAudio_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_CoreAudio_CoreAudio_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_CoreAudio_CoreAudio_h" >&5 +echo "${ECHO_T}$ac_cv_header_CoreAudio_CoreAudio_h" >&6 + +fi +if test $ac_cv_header_CoreAudio_CoreAudio_h = yes; then + : +else + { { echo "$as_me:$LINENO: error: CoreAudio header files not found!" >&5 +echo "$as_me: error: CoreAudio header files not found!" >&2;} + { (exit 1); exit 1; }; } +fi + + + frameworks="-framework CoreAudio -framework CoreFoundation" + + audio_apis="-D__MACOSX_CORE__ $audio_apis" + fi + + # If no audio api flags specified, use CoreAudio + if test $sound_api = _NO_API_; then + sound_api=-D__MACOSX_CORE__ + + echo "$as_me:$LINENO: result: using CoreAudio" >&5 +echo "${ECHO_T}using CoreAudio" >&6 + if test "${ac_cv_header_CoreAudio_CoreAudio_h+set}" = set; then + echo "$as_me:$LINENO: checking for CoreAudio/CoreAudio.h" >&5 +echo $ECHO_N "checking for CoreAudio/CoreAudio.h... $ECHO_C" >&6 +if test "${ac_cv_header_CoreAudio_CoreAudio_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_CoreAudio_CoreAudio_h" >&5 +echo "${ECHO_T}$ac_cv_header_CoreAudio_CoreAudio_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking CoreAudio/CoreAudio.h usability" >&5 +echo $ECHO_N "checking CoreAudio/CoreAudio.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking CoreAudio/CoreAudio.h presence" >&5 +echo $ECHO_N "checking CoreAudio/CoreAudio.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: CoreAudio/CoreAudio.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: CoreAudio/CoreAudio.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: CoreAudio/CoreAudio.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: CoreAudio/CoreAudio.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) { echo "$as_me:$LINENO: WARNING: CoreAudio/CoreAudio.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: CoreAudio/CoreAudio.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: CoreAudio/CoreAudio.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: CoreAudio/CoreAudio.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: CoreAudio/CoreAudio.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: CoreAudio/CoreAudio.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: CoreAudio/CoreAudio.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: CoreAudio/CoreAudio.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: CoreAudio/CoreAudio.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: CoreAudio/CoreAudio.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: CoreAudio/CoreAudio.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: CoreAudio/CoreAudio.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: CoreAudio/CoreAudio.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: CoreAudio/CoreAudio.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## +## ----------------------------------- ## +## Report this to gary@music.mcgill.ca ## +## ----------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 @@ -3861,8 +4574,9 @@ echo "$as_me: error: CoreAudio header files not found!" >&2;} fi - frameworks="-framework CoreAudio" + frameworks="-framework CoreAudio -framework CoreFoundation" + fi ;; *) @@ -3882,7 +4596,6 @@ if test "${ac_cv_prog_gcc_traditional+set}" = set; then else ac_pattern="Autoconf.*'x'" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3902,7 +4615,6 @@ rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3955,13 +4667,13 @@ _ACEOF # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | @@ -3991,13 +4703,13 @@ test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ + ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; -s/^\([^=]*=[ ]*\):*/\1/; +s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; -s/^[^=]*=[ ]*$//; +s/^[^=]*=[ ]*$//; }' fi @@ -4011,13 +4723,13 @@ fi cat >confdef2opt.sed <<\_ACEOF t clear : clear -s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g t quote -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g t quote d : quote -s,[ `~#$^&*(){}\\|;'"<>?],\\&,g +s,[ `~#$^&*(){}\\|;'"<>?],\\&,g s,\[,\\&,g s,\],\\&,g s,\$,$$,g @@ -4039,7 +4751,7 @@ ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | - sed 's/\$U\././;s/\.o$//;s/\.obj$//'` + sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' @@ -4083,9 +4795,10 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi +DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. -if (FOO=FOO; unset FOO) >/dev/null 2>&1; then +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false @@ -4104,7 +4817,7 @@ for as_var in \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do - if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var @@ -4283,16 +4996,17 @@ rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else + test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. -as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. -as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS @@ -4318,8 +5032,8 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by RtAudio $as_me 3.0, which was -generated by GNU Autoconf 2.57. Invocation command line was +This file was extended by RtAudio $as_me 4.0, which was +generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -4363,7 +5077,7 @@ Usage: $0 [OPTIONS] [FILE]... -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] - instantiate the configuration file FILE + instantiate the configuration file FILE Configuration files: $config_files @@ -4373,12 +5087,11 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -RtAudio config.status 3.0 -configured by $0, generated by GNU Autoconf 2.57, +RtAudio config.status 4.0 +configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" -Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 -Free Software Foundation, Inc. +Copyright (C) 2003 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir @@ -4476,6 +5189,8 @@ for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. + "rtaudio-config" ) CONFIG_FILES="$CONFIG_FILES rtaudio-config" ;; + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "tests/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} @@ -4571,6 +5286,9 @@ s,@OBJEXT@,$OBJEXT,;t t s,@CXX@,$CXX,;t t s,@CXXFLAGS@,$CXXFLAGS,;t t s,@ac_ct_CXX@,$ac_ct_CXX,;t t +s,@RANLIB@,$RANLIB,;t t +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t +s,@AR@,$AR,;t t s,@CPP@,$CPP,;t t s,@EGREP@,$EGREP,;t t s,@debug@,$debug,;t t @@ -4619,9 +5337,9 @@ _ACEOF (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else - ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end @@ -4639,21 +5357,21 @@ for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } @@ -4669,10 +5387,10 @@ echo X"$ac_file" | as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } @@ -4710,12 +5428,45 @@ case $srcdir in ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac -# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be -# absolute. -ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` -ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` -ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac @@ -4733,7 +5484,7 @@ echo "$as_me: creating $ac_file" >&6;} configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | - sed 's,.*/,,'` by configure." + sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. @@ -4742,24 +5493,24 @@ echo "$as_me: creating $ac_file" >&6;} case $f in -) echo $tmp/stdin ;; [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } - echo $f;; + echo "$f";; *) # Relative - if test -f "$f"; then - # Build tree - echo $f - elif test -f "$srcdir/$f"; then - # Source tree - echo $srcdir/$f - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } - fi;; + fi;; esac done` || { (exit 1); exit 1; } _ACEOF @@ -4820,3 +5571,5 @@ if test "$no_create" != yes; then $ac_cs_success || { (exit 1); exit 1; } fi + +chmod oug+x rtaudio-config diff --git a/doc/html/RtAudio_8h-source.html b/doc/html/RtAudio_8h-source.html index 4d853be..5c34773 100644 --- a/doc/html/RtAudio_8h-source.html +++ b/doc/html/RtAudio_8h-source.html @@ -1,621 +1,634 @@ -The RtAudio Tutorial +The RtAudio Home Page +
-Tutorial   Class/Enum List   File List   Compound Members  
+Home   Class/Enum List   File List   Compound Members  
-

RtAudio.h

00001 /************************************************************************/
-00038 /************************************************************************/
-00039 
-00040 // RtAudio: Version 3.0.3 (18 November 2005)
-00041 
-00042 #ifndef __RTAUDIO_H
-00043 #define __RTAUDIO_H
-00044 
-00045 #include "RtError.h"
-00046 #include <string>
-00047 #include <vector>
-00048 
-00049 // Operating system dependent thread functionality.
-00050 #if defined(__WINDOWS_DS__) || defined(__WINDOWS_ASIO__)
-00051   #include <windows.h>
-00052   #include <process.h>
+

RtAudio.h

Go to the documentation of this file.
00001 /************************************************************************/
+00039 /************************************************************************/
+00040 
+00045 // RtAudio: Version 4.0
+00046 
+00047 #ifndef __RTAUDIO_H
+00048 #define __RTAUDIO_H
+00049 
+00050 #include <string>
+00051 #include <vector>
+00052 #include "RtError.h"
 00053 
-00054   typedef unsigned long ThreadHandle;
-00055   typedef CRITICAL_SECTION StreamMutex;
-00056 
-00057 #else // Various unix flavors with pthread support.
-00058   #include <pthread.h>
-00059 
-00060   typedef pthread_t ThreadHandle;
-00061   typedef pthread_mutex_t StreamMutex;
-00062 
-00063 #endif
-00064 
-00065 // This global structure type is used to pass callback information
-00066 // between the private RtAudio stream structure and global callback
-00067 // handling functions.
-00068 struct CallbackInfo {
-00069   void *object;    // Used as a "this" pointer.
-00070   ThreadHandle thread;
-00071   bool usingCallback;
-00072   void *callback;
-00073   void *userData;
-00074   void *apiInfo;   // void pointer for API specific callback information
-00075 
-00076   // Default constructor.
-00077   CallbackInfo()
-00078     :object(0), usingCallback(false), callback(0),
-00079      userData(0), apiInfo(0) {}
-00080 };
-00081 
-00082 // Support for signed integers and floats.  Audio data fed to/from
-00083 // the tickStream() routine is assumed to ALWAYS be in host
-00084 // byte order.  The internal routines will automatically take care of
-00085 // any necessary byte-swapping between the host format and the
-00086 // soundcard.  Thus, endian-ness is not a concern in the following
-00087 // format definitions.
-00088 typedef unsigned long RtAudioFormat;
-00089 static const RtAudioFormat RTAUDIO_SINT8 = 0x1;    
-00090 static const RtAudioFormat RTAUDIO_SINT16 = 0x2;   
-00091 static const RtAudioFormat RTAUDIO_SINT24 = 0x4;   
-00092 static const RtAudioFormat RTAUDIO_SINT32 = 0x8;   
-00093 static const RtAudioFormat RTAUDIO_FLOAT32 = 0x10; 
-00094 static const RtAudioFormat RTAUDIO_FLOAT64 = 0x20; 
-00096 typedef int (*RtAudioCallback)(char *buffer, int bufferSize, void *userData);
-00097 
-00099 struct RtAudioDeviceInfo {
-00100   std::string name;      
-00101   bool probed;          
-00102   int outputChannels;   
-00103   int inputChannels;    
-00104   int duplexChannels;   
-00105   bool isDefault;       
-00106   std::vector<int> sampleRates; 
-00107   RtAudioFormat nativeFormats;  
-00109   // Default constructor.
-00110   RtAudioDeviceInfo()
-00111     :probed(false), outputChannels(0), inputChannels(0),
-00112        duplexChannels(0), isDefault(false), nativeFormats(0) {}
-00113 };
-00114 
-00115 // **************************************************************** //
-00116 //
-00117 // RtApi class declaration.
-00118 //
-00119 // Note that RtApi is an abstract base class and cannot be
-00120 // explicitly instantiated.  The class RtAudio will create an
-00121 // instance of an RtApi subclass (RtApiOss, RtApiAlsa,
-00122 // RtApiJack, RtApiCore, RtApiAl, RtApiDs, or RtApiAsio).
-00123 //
-00124 // **************************************************************** //
-00125 
-00126 class RtApi
-00127 {
-00128 public:
-00129 
-00130   enum StreamState {
-00131     STREAM_STOPPED,
-00132     STREAM_RUNNING
-00133   };
-00134 
-00135   RtApi();
-00136   virtual ~RtApi();
-00137   void openStream( int outputDevice, int outputChannels,
-00138                    int inputDevice, int inputChannels,
-00139                    RtAudioFormat format, int sampleRate,
-00140                    int *bufferSize, int numberOfBuffers );
-00141   void openStream( int outputDevice, int outputChannels,
-00142                    int inputDevice, int inputChannels,
-00143                    RtAudioFormat format, int sampleRate,
-00144                    int *bufferSize, int *numberOfBuffers );
-00145   virtual void setStreamCallback( RtAudioCallback callback, void *userData ) = 0;
-00146   virtual void cancelStreamCallback() = 0;
-00147   int getDeviceCount(void);
-00148   RtAudioDeviceInfo getDeviceInfo( int device );
-00149   char * const getStreamBuffer();
-00150   RtApi::StreamState getStreamState() const;
-00151   virtual void tickStream() = 0;
-00152   virtual void closeStream();
-00153   virtual void startStream() = 0;
-00154   virtual void stopStream() = 0;
-00155   virtual void abortStream() = 0;
-00156 
-00157 protected:
-00158 
-00159   static const unsigned int MAX_SAMPLE_RATES;
-00160   static const unsigned int SAMPLE_RATES[];
-00161 
-00162   enum { FAILURE, SUCCESS };
-00163 
-00164   enum StreamMode {
-00165     OUTPUT,
-00166     INPUT,
-00167     DUPLEX,
-00168     UNINITIALIZED = -75
-00169   };
-00170 
-00171   // A protected structure used for buffer conversion.
-00172   struct ConvertInfo {
-00173     int channels;
-00174     int inJump, outJump;
-00175     RtAudioFormat inFormat, outFormat;
-00176     std::vector<int> inOffset;
-00177     std::vector<int> outOffset;
-00178   };
-00179 
-00180   // A protected structure for audio streams.
-00181   struct RtApiStream {
-00182     int device[2];          // Playback and record, respectively.
-00183     void *apiHandle;        // void pointer for API specific stream handle information
-00184     StreamMode mode;         // OUTPUT, INPUT, or DUPLEX.
-00185     StreamState state;       // STOPPED or RUNNING
-00186     char *userBuffer;
-00187     char *deviceBuffer;
-00188     bool doConvertBuffer[2]; // Playback and record, respectively.
-00189     bool deInterleave[2];    // Playback and record, respectively.
-00190     bool doByteSwap[2];      // Playback and record, respectively.
-00191     int sampleRate;
-00192     int bufferSize;
-00193     int nBuffers;
-00194     int nUserChannels[2];    // Playback and record, respectively.
-00195     int nDeviceChannels[2];  // Playback and record channels, respectively.
-00196     RtAudioFormat userFormat;
-00197     RtAudioFormat deviceFormat[2]; // Playback and record, respectively.
-00198     StreamMutex mutex;
-00199     CallbackInfo callbackInfo;
-00200     ConvertInfo convertInfo[2];
-00201 
-00202     RtApiStream()
-00203       :apiHandle(0), userBuffer(0), deviceBuffer(0) {}
-00204   };
-00205 
-00206   // A protected device structure for audio devices.
-00207   struct RtApiDevice {
-00208     std::string name;      
-00209     bool probed;           
-00210     void *apiDeviceId;     // void pointer for API specific device information
-00211     int maxOutputChannels; 
-00212     int maxInputChannels;  
-00213     int maxDuplexChannels; 
-00214     int minOutputChannels; 
-00215     int minInputChannels;  
-00216     int minDuplexChannels; 
-00217     bool hasDuplexSupport; 
-00218     bool isDefault;        
-00219     std::vector<int> sampleRates; 
-00220     RtAudioFormat nativeFormats;  
-00222     // Default constructor.
-00223     RtApiDevice()
-00224       :probed(false), apiDeviceId(0), maxOutputChannels(0), maxInputChannels(0),
-00225        maxDuplexChannels(0), minOutputChannels(0), minInputChannels(0),
-00226        minDuplexChannels(0), isDefault(false), nativeFormats(0) {}
-00227   };
-00228 
-00229   typedef signed short Int16;
-00230   typedef signed int Int32;
-00231   typedef float Float32;
-00232   typedef double Float64;
-00233 
-00234   char message_[1024];
-00235   int nDevices_;
-00236   std::vector<RtApiDevice> devices_;
-00237   RtApiStream stream_;
-00238 
-00243   virtual void initialize(void) = 0;
-00244 
-00253   virtual void probeDeviceInfo( RtApiDevice *info );
-00254 
-00263   virtual bool probeDeviceOpen( int device, StreamMode mode, int channels, 
-00264                                 int sampleRate, RtAudioFormat format,
-00265                                 int *bufferSize, int numberOfBuffers );
-00266 
-00271   virtual int getDefaultInputDevice(void);
-00272 
-00277   virtual int getDefaultOutputDevice(void);
-00278 
-00280   void clearDeviceInfo( RtApiDevice *info );
-00281 
-00283   void clearStreamInfo();
-00284 
-00286   void error( RtError::Type type );
-00287 
-00292   void verifyStream();
+00070 typedef unsigned long RtAudioFormat;
+00071 static const RtAudioFormat RTAUDIO_SINT8 = 0x1;    // 8-bit signed integer.
+00072 static const RtAudioFormat RTAUDIO_SINT16 = 0x2;   // 16-bit signed integer.
+00073 static const RtAudioFormat RTAUDIO_SINT24 = 0x4;   // Lower 3 bytes of 32-bit signed integer.
+00074 static const RtAudioFormat RTAUDIO_SINT32 = 0x8;   // 32-bit signed integer.
+00075 static const RtAudioFormat RTAUDIO_FLOAT32 = 0x10; // Normalized between plus/minus 1.0.
+00076 static const RtAudioFormat RTAUDIO_FLOAT64 = 0x20; // Normalized between plus/minus 1.0.
+00077 
+00112 typedef unsigned int RtAudioStreamFlags;
+00113 static const RtAudioStreamFlags RTAUDIO_NONINTERLEAVED = 0x1;    // Use non-interleaved buffers (default = interleaved).
+00114 static const RtAudioStreamFlags RTAUDIO_MINIMIZE_LATENCY = 0x2;  // Attempt to set stream parameters for lowest possible latency.
+00115 static const RtAudioStreamFlags RTAUDIO_HOG_DEVICE = 0x4;        // Attempt grab device and prevent use by others.
+00116 
+00128 typedef unsigned int RtAudioStreamStatus;
+00129 static const RtAudioStreamStatus RTAUDIO_INPUT_OVERFLOW = 0x1;    // Input data was discarded because of an overflow condition at the driver.
+00130 static const RtAudioStreamStatus RTAUDIO_OUTPUT_UNDERFLOW = 0x2;  // The output buffer ran low, likely causing a gap in the output sound.
+00131 
+00133 
+00171 typedef int (*RtAudioCallback)( void *outputBuffer, void *inputBuffer,
+00172                                 unsigned int nFrames,
+00173                                 double streamTime,
+00174                                 RtAudioStreamStatus status,
+00175                                 void *userData );
+00176 
+00177 
+00178 // **************************************************************** //
+00179 //
+00180 // RtAudio class declaration.
+00181 //
+00182 // RtAudio is a "controller" used to select an available audio i/o
+00183 // interface.  It presents a common API for the user to call but all
+00184 // functionality is implemented by the class RtApi and its
+00185 // subclasses.  RtAudio creates an instance of an RtApi subclass
+00186 // based on the user's API choice.  If no choice is made, RtAudio
+00187 // attempts to make a "logical" API selection.
+00188 //
+00189 // **************************************************************** //
+00190 
+00191 class RtApi;
+00192 
+00193 class RtAudio
+00194 {
+00195  public:
+00196 
+00198   enum Api {
+00199     UNSPECIFIED,    
+00200     LINUX_ALSA,     
+00201     LINUX_OSS,      
+00202     UNIX_JACK,      
+00203     MACOSX_CORE,    
+00204     WINDOWS_ASIO,   
+00205     WINDOWS_DS,     
+00206     RTAUDIO_DUMMY   
+00207   };
+00208 
+00210   struct DeviceInfo {
+00211     bool probed;                  
+00212     std::string name;             
+00213     unsigned int outputChannels;  
+00214     unsigned int inputChannels;   
+00215     unsigned int duplexChannels;  
+00216     bool isDefaultOutput;         
+00217     bool isDefaultInput;          
+00218     std::vector<unsigned int> sampleRates; 
+00219     RtAudioFormat nativeFormats;  
+00221     // Default constructor.
+00222     DeviceInfo()
+00223       :probed(false), outputChannels(0), inputChannels(0), duplexChannels(0),
+00224        isDefaultOutput(false), isDefaultInput(false), nativeFormats(0) {}
+00225   };
+00226 
+00228   struct StreamParameters {
+00229     unsigned int deviceId;     
+00230     unsigned int nChannels;    
+00231     unsigned int firstChannel; 
+00233     // Default constructor.
+00234     StreamParameters()
+00235       : deviceId(0), nChannels(0), firstChannel(0) {}
+00236   };
+00237 
+00239 
+00284   struct StreamOptions {
+00285     RtAudioStreamFlags flags;      
+00286     unsigned int numberOfBuffers;  
+00287     std::string streamName;        
+00289     // Default constructor.
+00290     StreamOptions()
+00291       : flags(0), numberOfBuffers(0) {}
+00292   };
 00293 
-00298   void convertBuffer( char *outBuffer, char *inBuffer, ConvertInfo &info );
-00299 
-00301   void byteSwapBuffer( char *buffer, int samples, RtAudioFormat format );
-00302 
-00304   int formatBytes( RtAudioFormat format );
-00305 };
-00306 
-00307 
-00308 // **************************************************************** //
-00309 //
-00310 // RtAudio class declaration.
-00311 //
-00312 // RtAudio is a "controller" used to select an available audio i/o
-00313 // interface.  It presents a common API for the user to call but all
-00314 // functionality is implemented by the class RtAudioApi and its
-00315 // subclasses.  RtAudio creates an instance of an RtAudioApi subclass
-00316 // based on the user's API choice.  If no choice is made, RtAudio
-00317 // attempts to make a "logical" API selection.
-00318 //
-00319 // **************************************************************** //
-00320 
-00321 class RtAudio
-00322 {
-00323 public:
+00295 
+00300   static void getCompiledApi( std::vector<RtAudio::Api> &apis ) throw();
+00301 
+00303 
+00311   RtAudio( RtAudio::Api api=UNSPECIFIED ) throw();
+00312 
+00314 
+00318   ~RtAudio() throw();
+00319 
+00321   RtAudio::Api getCurrentApi( void ) throw();
+00322 
 00324 
-00326   enum RtAudioApi {
-00327     UNSPECIFIED,    
-00328     LINUX_ALSA,     
-00329     LINUX_OSS,      
-00330     LINUX_JACK,     
-00331     MACOSX_CORE,    
-00332     IRIX_AL,        
-00333     WINDOWS_ASIO,   
-00334     WINDOWS_DS      
-00335   };
-00336 
-00338 
-00348   RtAudio( RtAudioApi api=UNSPECIFIED );
-00349 
-00351 
-00362   RtAudio( int outputDevice, int outputChannels,
-00363            int inputDevice, int inputChannels,
-00364            RtAudioFormat format, int sampleRate,
-00365            int *bufferSize, int numberOfBuffers, RtAudioApi api=UNSPECIFIED );
-00366 
-00368 
-00376   RtAudio( int outputDevice, int outputChannels,
-00377            int inputDevice, int inputChannels,
-00378            RtAudioFormat format, int sampleRate,
-00379            int *bufferSize, int *numberOfBuffers, RtAudioApi api=UNSPECIFIED );
-00380 
-00382 
-00386   ~RtAudio();
-00387 
-00389 
-00415   void openStream( int outputDevice, int outputChannels,
-00416                    int inputDevice, int inputChannels,
-00417                    RtAudioFormat format, int sampleRate,
-00418                    int *bufferSize, int numberOfBuffers );
-00419 
-00421 
-00429   void openStream( int outputDevice, int outputChannels,
-00430                    int inputDevice, int inputChannels,
-00431                    RtAudioFormat format, int sampleRate,
-00432                    int *bufferSize, int *numberOfBuffers );
-00433 
-00435 
-00454   void setStreamCallback(RtAudioCallback callback, void *userData) { rtapi_->setStreamCallback( callback, userData ); };
+00329   unsigned int getDeviceCount( void ) throw();
+00330 
+00332 
+00342   RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
+00343 
+00345 
+00352   unsigned int getDefaultOutputDevice( void ) throw();
+00353 
+00355 
+00362   unsigned int getDefaultInputDevice( void ) throw();
+00363 
+00365 
+00402   void openStream( RtAudio::StreamParameters *outputParameters,
+00403                    RtAudio::StreamParameters *inputParameters,
+00404                    RtAudioFormat format, unsigned int sampleRate,
+00405                    unsigned int *bufferFrames, RtAudioCallback callback,
+00406                    void *userData = NULL, RtAudio::StreamOptions *options = NULL );
+00407 
+00409 
+00413   void closeStream( void ) throw();
+00414 
+00416 
+00422   void startStream( void );
+00423 
+00425 
+00431   void stopStream( void );
+00432 
+00434 
+00440   void abortStream( void );
+00441 
+00443   bool isStreamOpen( void ) throw();
+00444 
+00446   bool isStreamRunning( void ) throw();
+00447 
+00449 
+00452   double getStreamTime( void );
+00453 
 00455 
-00457 
-00464   void cancelStreamCallback() { rtapi_->cancelStreamCallback(); };
-00465 
-00467   int getDeviceCount(void) { return rtapi_->getDeviceCount(); };
-00468 
-00470 
-00478   RtAudioDeviceInfo getDeviceInfo(int device) { return rtapi_->getDeviceInfo( device ); };
-00479 
+00463   long getStreamLatency( void );
+00464 
+00466   void showWarnings( bool value = true ) throw();
+00467 
+00468  protected:
+00469 
+00470   void openRtApi( RtAudio::Api api );
+00471   RtApi *rtapi_;
+00472 };
+00473 
+00474 // Operating system dependent thread functionality.
+00475 #if defined(__WINDOWS_DS__) || defined(__WINDOWS_ASIO__)
+00476   #include <windows.h>
+00477   #include <process.h>
+00478 
+00479   typedef unsigned long ThreadHandle;
+00480   typedef CRITICAL_SECTION StreamMutex;
 00481 
-00486   char * const getStreamBuffer() { return rtapi_->getStreamBuffer(); };
-00487 
-00489 
-00494   void tickStream() { rtapi_->tickStream(); };
-00495 
-00497 
-00501   void closeStream()  { rtapi_->closeStream(); };
-00502 
-00504 
-00508   void startStream() { rtapi_->startStream(); };
-00509 
-00511 
-00515   void stopStream() { rtapi_->stopStream(); };
-00516 
-00518 
-00522   void abortStream() { rtapi_->abortStream(); };
-00523 
-00524 
-00525  protected:
+00482 #elif defined(__LINUX_ALSA__) || defined(__UNIX_JACK__) || defined(__LINUX_OSS__) || defined(__MACOSX_CORE__)
+00483   // Using pthread library for various flavors of unix.
+00484   #include <pthread.h>
+00485 
+00486   typedef pthread_t ThreadHandle;
+00487   typedef pthread_mutex_t StreamMutex;
+00488 
+00489 #else // Setup for "dummy" behavior
+00490 
+00491   #define __RTAUDIO_DUMMY__
+00492   typedef int ThreadHandle;
+00493   typedef int StreamMutex;
+00494 
+00495 #endif
+00496 
+00497 // This global structure type is used to pass callback information
+00498 // between the private RtAudio stream structure and global callback
+00499 // handling functions.
+00500 struct CallbackInfo {
+00501   void *object;    // Used as a "this" pointer.
+00502   ThreadHandle thread;
+00503   void *callback;
+00504   void *userData;
+00505   void *apiInfo;   // void pointer for API specific callback information
+00506   bool isRunning;
+00507 
+00508   // Default constructor.
+00509   CallbackInfo()
+00510     :object(0), callback(0), userData(0), apiInfo(0), isRunning(false) {}
+00511 };
+00512 
+00513 // **************************************************************** //
+00514 //
+00515 // RtApi class declaration.
+00516 //
+00517 // Subclasses of RtApi contain all API- and OS-specific code necessary
+00518 // to fully implement the RtAudio API.
+00519 //
+00520 // Note that RtApi is an abstract base class and cannot be
+00521 // explicitly instantiated.  The class RtAudio will create an
+00522 // instance of an RtApi subclass (RtApiOss, RtApiAlsa,
+00523 // RtApiJack, RtApiCore, RtApiAl, RtApiDs, or RtApiAsio).
+00524 //
+00525 // **************************************************************** //
 00526 
-00527   void initialize( RtAudioApi api );
-00528 
-00529   RtApi *rtapi_;
-00530 };
-00531 
+00527 #if defined( HAVE_GETTIMEOFDAY )
+00528   #include <sys/time.h>
+00529 #endif
+00530 
+00531 #include <sstream>
 00532 
-00533 // RtApi Subclass prototypes.
-00534 
-00535 #if defined(__LINUX_ALSA__)
-00536 
-00537 class RtApiAlsa: public RtApi
-00538 {
-00539 public:
-00540 
-00541   RtApiAlsa();
-00542   ~RtApiAlsa();
-00543   void tickStream();
-00544   void closeStream();
-00545   void startStream();
-00546   void stopStream();
-00547   void abortStream();
-00548   int streamWillBlock();
-00549   void setStreamCallback( RtAudioCallback callback, void *userData );
-00550   void cancelStreamCallback();
-00551 
-00552   private:
-00553 
-00554   void initialize(void);
-00555   bool primeOutputBuffer();
-00556   void probeDeviceInfo( RtApiDevice *info );
-00557   bool probeDeviceOpen( int device, StreamMode mode, int channels, 
-00558                         int sampleRate, RtAudioFormat format,
-00559                         int *bufferSize, int numberOfBuffers );
-00560 };
+00533 class RtApi
+00534 {
+00535 public:
+00536 
+00537   RtApi();
+00538   virtual ~RtApi();
+00539   virtual RtAudio::Api getCurrentApi( void ) = 0;
+00540   virtual unsigned int getDeviceCount( void ) = 0;
+00541   virtual RtAudio::DeviceInfo getDeviceInfo( unsigned int device ) = 0;
+00542   virtual unsigned int getDefaultInputDevice( void );
+00543   virtual unsigned int getDefaultOutputDevice( void );
+00544   void openStream( RtAudio::StreamParameters *outputParameters,
+00545                    RtAudio::StreamParameters *inputParameters,
+00546                    RtAudioFormat format, unsigned int sampleRate,
+00547                    unsigned int *bufferFrames, RtAudioCallback callback,
+00548                    void *userData, RtAudio::StreamOptions *options );
+00549   virtual void closeStream( void );
+00550   virtual void startStream( void ) = 0;
+00551   virtual void stopStream( void ) = 0;
+00552   virtual void abortStream( void ) = 0;
+00553   long getStreamLatency( void );
+00554   virtual double getStreamTime( void );
+00555   bool isStreamOpen( void ) { return stream_.state != STREAM_CLOSED; };
+00556   bool isStreamRunning( void ) { return stream_.state == STREAM_RUNNING; };
+00557   void showWarnings( bool value ) { showWarnings_ = value; };
+00558 
+00559 
+00560 protected:
 00561 
-00562 #endif
-00563 
-00564 #if defined(__LINUX_JACK__)
-00565 
-00566 class RtApiJack: public RtApi
-00567 {
-00568 public:
-00569 
-00570   RtApiJack();
-00571   ~RtApiJack();
-00572   void tickStream();
-00573   void closeStream();
-00574   void startStream();
-00575   void stopStream();
-00576   void abortStream();
-00577   void setStreamCallback( RtAudioCallback callback, void *userData );
-00578   void cancelStreamCallback();
-00579   // This function is intended for internal use only.  It must be
-00580   // public because it is called by the internal callback handler,
-00581   // which is not a member of RtAudio.  External use of this function
-00582   // will most likely produce highly undesireable results!
-00583   void callbackEvent( unsigned long nframes );
-00584 
-00585   private:
-00586 
-00587   void initialize(void);
-00588   void probeDeviceInfo( RtApiDevice *info );
-00589   bool probeDeviceOpen( int device, StreamMode mode, int channels, 
-00590                         int sampleRate, RtAudioFormat format,
-00591                         int *bufferSize, int numberOfBuffers );
-00592 };
-00593 
-00594 #endif
-00595 
-00596 #if defined(__LINUX_OSS__)
-00597 
-00598 class RtApiOss: public RtApi
-00599 {
-00600 public:
-00601 
-00602   RtApiOss();
-00603   ~RtApiOss();
-00604   void tickStream();
-00605   void closeStream();
-00606   void startStream();
-00607   void stopStream();
-00608   void abortStream();
-00609   int streamWillBlock();
-00610   void setStreamCallback( RtAudioCallback callback, void *userData );
-00611   void cancelStreamCallback();
-00612 
-00613   private:
-00614 
-00615   void initialize(void);
-00616   void probeDeviceInfo( RtApiDevice *info );
-00617   bool probeDeviceOpen( int device, StreamMode mode, int channels, 
-00618                         int sampleRate, RtAudioFormat format,
-00619                         int *bufferSize, int numberOfBuffers );
-00620 };
-00621 
-00622 #endif
-00623 
-00624 #if defined(__MACOSX_CORE__)
-00625 
-00626 #include <CoreAudio/AudioHardware.h>
-00627 
-00628 class RtApiCore: public RtApi
-00629 {
-00630 public:
-00631 
-00632   RtApiCore();
-00633   ~RtApiCore();
-00634   int getDefaultOutputDevice(void);
-00635   int getDefaultInputDevice(void);
-00636   void tickStream();
-00637   void closeStream();
-00638   void startStream();
-00639   void stopStream();
-00640   void abortStream();
-00641   void setStreamCallback( RtAudioCallback callback, void *userData );
-00642   void cancelStreamCallback();
-00643 
-00644   // This function is intended for internal use only.  It must be
-00645   // public because it is called by the internal callback handler,
-00646   // which is not a member of RtAudio.  External use of this function
-00647   // will most likely produce highly undesireable results!
-00648   void callbackEvent( AudioDeviceID deviceId, void *inData, void *outData );
-00649 
-00650   private:
-00651 
-00652   void initialize(void);
-00653   void probeDeviceInfo( RtApiDevice *info );
-00654   bool probeDeviceOpen( int device, StreamMode mode, int channels, 
-00655                         int sampleRate, RtAudioFormat format,
-00656                         int *bufferSize, int numberOfBuffers );
-00657 };
-00658 
-00659 #endif
-00660 
-00661 #if defined(__WINDOWS_DS__)
-00662 
-00663 class RtApiDs: public RtApi
-00664 {
-00665 public:
-00666 
-00667   RtApiDs();
-00668   ~RtApiDs();
-00669   int getDefaultOutputDevice(void);
-00670   int getDefaultInputDevice(void);
-00671   void tickStream();
-00672   void closeStream();
-00673   void startStream();
-00674   void stopStream();
-00675   void abortStream();
-00676   int streamWillBlock();
-00677   void setStreamCallback( RtAudioCallback callback, void *userData );
-00678   void cancelStreamCallback();
-00679 
-00680   public:
-00681   // \brief Internal structure that provide debug information on the state of a running DSound device.
-00682   struct RtDsStatistics {
-00683     // \brief Sample Rate.
-00684     long sampleRate;
-00685     // \brief The size of one sample * number of channels on the input device.
-00686     int inputFrameSize; 
-00687     // \brief The size of one sample * number of channels on the output device.
-00688     int outputFrameSize; 
-00689     /* \brief The number of times the read pointer had to be adjusted to avoid reading from an unsafe buffer position.
-00690      *
-00691      * This field is only used when running in DUPLEX mode. INPUT mode devices just wait until the data is 
-00692      * available.
-00693      */
-00694     int numberOfReadOverruns;
-00695     // \brief The number of times the write pointer had to be adjusted to avoid writing in an unsafe buffer position.
-00696     int numberOfWriteUnderruns;
-00697     // \brief Number of bytes by attribute to buffer configuration by which writing must lead the current write pointer.
-00698     int writeDeviceBufferLeadBytes;
-00699     // \brief Number of bytes by attributable to the device driver by which writing must lead the current write pointer on this output device.
-00700     unsigned long writeDeviceSafeLeadBytes;
-00701     // \brief Number of bytes by which reading must trail the current read pointer on this input device.
-00702     unsigned long readDeviceSafeLeadBytes; 
-00703     /* \brief Estimated latency in seconds. 
-00704     *
-00705     * For INPUT mode devices, based the latency of the device's safe read pointer, plus one buffer's
-00706     * worth of additional latency.
-00707     *
-00708     * For OUTPUT mode devices, the latency of the device's safe write pointer, plus N buffers of 
-00709     * additional buffer latency.
-00710     *
-00711     * For DUPLEX devices, the sum of latencies for both input and output devices. DUPLEX devices
-00712     * also back off the read pointers an additional amount in order to maintain synchronization 
-00713     * between out-of-phase read and write pointers. This time is also included.
-00714     *
-00715     * Note that most software packages report latency between the safe write pointer 
-00716     * and the software lead pointer, excluding the hardware device's safe write pointer 
-00717     * latency. Figures of 1 or 2ms of latency on Windows audio devices are invariably of this type.
-00718     * The reality is that hardware devices often have latencies of 30ms or more (often much 
-00719     * higher for duplex operation).
-00720     */
-00721 
-00722     double latency;
-00723   };
-00724   // \brief Report on the current state of a running DSound device.
-00725   static RtDsStatistics getDsStatistics();
-00726 
-00727   private:
-00728 
-00729   void initialize(void);
-00730   void probeDeviceInfo( RtApiDevice *info );
-00731   bool probeDeviceOpen( int device, StreamMode mode, int channels, 
-00732                         int sampleRate, RtAudioFormat format,
-00733                         int *bufferSize, int numberOfBuffers );
-00734 
-00735   bool coInitialized;
-00736   bool buffersRolling;
-00737   long duplexPrerollBytes;
-00738   static RtDsStatistics statistics;
-00739 
-00740 };
-00741 
-00742 #endif
-00743 
-00744 #if defined(__WINDOWS_ASIO__)
-00745 
-00746 class RtApiAsio: public RtApi
-00747 {
-00748 public:
-00749 
-00750   RtApiAsio();
-00751   ~RtApiAsio();
-00752   void tickStream();
-00753   void closeStream();
-00754   void startStream();
-00755   void stopStream();
-00756   void abortStream();
-00757   void setStreamCallback( RtAudioCallback callback, void *userData );
-00758   void cancelStreamCallback();
-00759 
-00760   // This function is intended for internal use only.  It must be
-00761   // public because it is called by the internal callback handler,
-00762   // which is not a member of RtAudio.  External use of this function
-00763   // will most likely produce highly undesireable results!
-00764   void callbackEvent( long bufferIndex );
-00765 
-00766   private:
+00562   static const unsigned int MAX_SAMPLE_RATES;
+00563   static const unsigned int SAMPLE_RATES[];
+00564 
+00565   enum { FAILURE, SUCCESS };
+00566 
+00567   enum ErrorType {
+00568     WARNING,
+00569     INVALID_CALL,
+00570     SYSTEM
+00571   };
+00572 
+00573   enum StreamState {
+00574     STREAM_STOPPED,
+00575     STREAM_RUNNING,
+00576     STREAM_CLOSED = -50
+00577   };
+00578 
+00579   enum StreamMode {
+00580     OUTPUT,
+00581     INPUT,
+00582     DUPLEX,
+00583     UNINITIALIZED = -75
+00584   };
+00585 
+00586   // A protected structure used for buffer conversion.
+00587   struct ConvertInfo {
+00588     int channels;
+00589     int inJump, outJump;
+00590     RtAudioFormat inFormat, outFormat;
+00591     std::vector<int> inOffset;
+00592     std::vector<int> outOffset;
+00593   };
+00594 
+00595   // A protected structure for audio streams.
+00596   struct RtApiStream {
+00597     unsigned int device[2];    // Playback and record, respectively.
+00598     void *apiHandle;           // void pointer for API specific stream handle information
+00599     StreamMode mode;           // OUTPUT, INPUT, or DUPLEX.
+00600     StreamState state;         // STOPPED, RUNNING, or CLOSED
+00601     char *userBuffer[2];       // Playback and record, respectively.
+00602     char *deviceBuffer;
+00603     bool doConvertBuffer[2];   // Playback and record, respectively.
+00604     bool userInterleaved;
+00605     bool deviceInterleaved[2]; // Playback and record, respectively.
+00606     bool doByteSwap[2];        // Playback and record, respectively.
+00607     unsigned int sampleRate;
+00608     unsigned int bufferSize;
+00609     unsigned int nBuffers;
+00610     unsigned int nUserChannels[2];    // Playback and record, respectively.
+00611     unsigned int nDeviceChannels[2];  // Playback and record channels, respectively.
+00612     unsigned int channelOffset[2];    // Playback and record, respectively.
+00613     unsigned long latency[2];         // Playback and record, respectively.
+00614     RtAudioFormat userFormat;
+00615     RtAudioFormat deviceFormat[2];    // Playback and record, respectively.
+00616     StreamMutex mutex;
+00617     CallbackInfo callbackInfo;
+00618     ConvertInfo convertInfo[2];
+00619     double streamTime;         // Number of elapsed seconds since the stream started.
+00620 
+00621 #if defined(HAVE_GETTIMEOFDAY)
+00622     struct timeval lastTickTimestamp;
+00623 #endif
+00624 
+00625     RtApiStream()
+00626       :apiHandle(0), deviceBuffer(0) {}
+00627   };
+00628 
+00629   typedef signed short Int16;
+00630   typedef signed int Int32;
+00631   typedef float Float32;
+00632   typedef double Float64;
+00633 
+00634   std::ostringstream errorStream_;
+00635   std::string errorText_;
+00636   bool showWarnings_;
+00637   RtApiStream stream_;
+00638 
+00646   virtual bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, 
+00647                                 unsigned int firstChannel, unsigned int sampleRate,
+00648                                 RtAudioFormat format, unsigned int *bufferSize,
+00649                                 RtAudio::StreamOptions *options );
+00650 
+00652   void tickStreamTime( void );
+00653 
+00655   void clearStreamInfo();
+00656 
+00661   void verifyStream( void );
+00662 
+00664   void error( ErrorType type );
+00665 
+00670   void convertBuffer( char *outBuffer, char *inBuffer, ConvertInfo &info );
+00671 
+00673   void byteSwapBuffer( char *buffer, unsigned int samples, RtAudioFormat format );
+00674 
+00676   unsigned int formatBytes( RtAudioFormat format );
+00677 
+00679   void setConvertInfo( StreamMode mode, unsigned int firstChannel );
+00680 };
+00681 
+00682 // **************************************************************** //
+00683 //
+00684 // Inline RtAudio definitions.
+00685 //
+00686 // **************************************************************** //
+00687 
+00688 inline RtAudio::Api RtAudio :: getCurrentApi( void ) throw() { return rtapi_->getCurrentApi(); };
+00689 inline unsigned int RtAudio :: getDeviceCount( void ) throw() { return rtapi_->getDeviceCount(); };
+00690 inline RtAudio::DeviceInfo RtAudio :: getDeviceInfo( unsigned int device ) { return rtapi_->getDeviceInfo( device ); };
+00691 inline unsigned int RtAudio :: getDefaultInputDevice( void ) throw() { return rtapi_->getDefaultInputDevice(); };
+00692 inline unsigned int RtAudio :: getDefaultOutputDevice( void ) throw() { return rtapi_->getDefaultOutputDevice(); };
+00693 inline void RtAudio :: closeStream( void ) throw() { return rtapi_->closeStream(); };
+00694 inline void RtAudio :: startStream( void ) { return rtapi_->startStream(); };
+00695 inline void RtAudio :: stopStream( void )  { return rtapi_->stopStream(); };
+00696 inline void RtAudio :: abortStream( void ) { return rtapi_->abortStream(); };
+00697 inline bool RtAudio :: isStreamOpen( void ) throw() { return rtapi_->isStreamOpen(); };
+00698 inline bool RtAudio :: isStreamRunning( void ) throw() { return rtapi_->isStreamRunning(); };
+00699 inline long RtAudio :: getStreamLatency( void ) { return rtapi_->getStreamLatency(); };
+00700 inline double RtAudio :: getStreamTime( void ) { return rtapi_->getStreamTime(); };
+00701 inline void RtAudio :: showWarnings( bool value ) throw() { rtapi_->showWarnings( value ); };
+00702 
+00703 // RtApi Subclass prototypes.
+00704 
+00705 #if defined(__MACOSX_CORE__)
+00706 
+00707 #include <CoreAudio/AudioHardware.h>
+00708 
+00709 class RtApiCore: public RtApi
+00710 {
+00711 public:
+00712 
+00713   RtApiCore();
+00714   ~RtApiCore();
+00715   RtAudio::Api getCurrentApi( void ) { return RtAudio::MACOSX_CORE; };
+00716   unsigned int getDeviceCount( void );
+00717   RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
+00718   unsigned int getDefaultOutputDevice( void );
+00719   unsigned int getDefaultInputDevice( void );
+00720   void closeStream( void );
+00721   void startStream( void );
+00722   void stopStream( void );
+00723   void abortStream( void );
+00724   long getStreamLatency( void );
+00725 
+00726   // This function is intended for internal use only.  It must be
+00727   // public because it is called by the internal callback handler,
+00728   // which is not a member of RtAudio.  External use of this function
+00729   // will most likely produce highly undesireable results!
+00730   bool callbackEvent( AudioDeviceID deviceId,
+00731                       const AudioBufferList *inBufferList,
+00732                       const AudioBufferList *outBufferList );
+00733 
+00734   private:
+00735 
+00736   bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, 
+00737                         unsigned int firstChannel, unsigned int sampleRate,
+00738                         RtAudioFormat format, unsigned int *bufferSize,
+00739                         RtAudio::StreamOptions *options );
+00740   static const char* getErrorCode( OSStatus code );
+00741 };
+00742 
+00743 #endif
+00744 
+00745 #if defined(__UNIX_JACK__)
+00746 
+00747 class RtApiJack: public RtApi
+00748 {
+00749 public:
+00750 
+00751   RtApiJack();
+00752   ~RtApiJack();
+00753   RtAudio::Api getCurrentApi( void ) { return RtAudio::UNIX_JACK; };
+00754   unsigned int getDeviceCount( void );
+00755   RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
+00756   void closeStream( void );
+00757   void startStream( void );
+00758   void stopStream( void );
+00759   void abortStream( void );
+00760   long getStreamLatency( void );
+00761 
+00762   // This function is intended for internal use only.  It must be
+00763   // public because it is called by the internal callback handler,
+00764   // which is not a member of RtAudio.  External use of this function
+00765   // will most likely produce highly undesireable results!
+00766   bool callbackEvent( unsigned long nframes );
 00767 
-00768   void initialize(void);
-00769   void probeDeviceInfo( RtApiDevice *info );
-00770   bool probeDeviceOpen( int device, StreamMode mode, int channels, 
-00771                         int sampleRate, RtAudioFormat format,
-00772                         int *bufferSize, int numberOfBuffers );
-00773 
-00774   bool coInitialized;
+00768   private:
+00769 
+00770   bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, 
+00771                         unsigned int firstChannel, unsigned int sampleRate,
+00772                         RtAudioFormat format, unsigned int *bufferSize,
+00773                         RtAudio::StreamOptions *options );
+00774 };
 00775 
-00776 };
-00777 
-00778 #endif
+00776 #endif
+00777 
+00778 #if defined(__WINDOWS_ASIO__)
 00779 
-00780 #if defined(__IRIX_AL__)
-00781 
-00782 class RtApiAl: public RtApi
-00783 {
-00784 public:
-00785 
-00786   RtApiAl();
-00787   ~RtApiAl();
-00788   int getDefaultOutputDevice(void);
-00789   int getDefaultInputDevice(void);
-00790   void tickStream();
-00791   void closeStream();
-00792   void startStream();
-00793   void stopStream();
-00794   void abortStream();
-00795   int streamWillBlock();
-00796   void setStreamCallback( RtAudioCallback callback, void *userData );
-00797   void cancelStreamCallback();
-00798 
-00799   private:
+00780 class RtApiAsio: public RtApi
+00781 {
+00782 public:
+00783 
+00784   RtApiAsio();
+00785   ~RtApiAsio();
+00786   RtAudio::Api getCurrentApi( void ) { return RtAudio::WINDOWS_ASIO; };
+00787   unsigned int getDeviceCount( void );
+00788   RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
+00789   void closeStream( void );
+00790   void startStream( void );
+00791   void stopStream( void );
+00792   void abortStream( void );
+00793   long getStreamLatency( void );
+00794 
+00795   // This function is intended for internal use only.  It must be
+00796   // public because it is called by the internal callback handler,
+00797   // which is not a member of RtAudio.  External use of this function
+00798   // will most likely produce highly undesireable results!
+00799   bool callbackEvent( long bufferIndex );
 00800 
-00801   void initialize(void);
-00802   void probeDeviceInfo( RtApiDevice *info );
-00803   bool probeDeviceOpen( int device, StreamMode mode, int channels, 
-00804                         int sampleRate, RtAudioFormat format,
-00805                         int *bufferSize, int numberOfBuffers );
-00806 };
-00807 
-00808 #endif
-00809 
-00810 // Define the following flag to have extra information spewed to stderr.
-00811 //#define __RTAUDIO_DEBUG__
-00812 
-00813 #endif
+00801   private:
+00802 
+00803   bool coInitialized_;
+00804   bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, 
+00805                         unsigned int firstChannel, unsigned int sampleRate,
+00806                         RtAudioFormat format, unsigned int *bufferSize,
+00807                         RtAudio::StreamOptions *options );
+00808 };
+00809 
+00810 #endif
+00811 
+00812 #if defined(__WINDOWS_DS__)
+00813 
+00814 class RtApiDs: public RtApi
+00815 {
+00816 public:
+00817 
+00818   RtApiDs();
+00819   ~RtApiDs();
+00820   RtAudio::Api getCurrentApi( void ) { return RtAudio::WINDOWS_DS; };
+00821   unsigned int getDeviceCount( void );
+00822   unsigned int getDefaultOutputDevice( void );
+00823   unsigned int getDefaultInputDevice( void );
+00824   RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
+00825   void closeStream( void );
+00826   void startStream( void );
+00827   void stopStream( void );
+00828   void abortStream( void );
+00829   long getStreamLatency( void );
+00830 
+00831   // This function is intended for internal use only.  It must be
+00832   // public because it is called by the internal callback handler,
+00833   // which is not a member of RtAudio.  External use of this function
+00834   // will most likely produce highly undesireable results!
+00835   void callbackEvent( void );
+00836 
+00837   private:
+00838 
+00839   bool coInitialized_;
+00840   bool buffersRolling;
+00841   long duplexPrerollBytes;
+00842   bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, 
+00843                         unsigned int firstChannel, unsigned int sampleRate,
+00844                         RtAudioFormat format, unsigned int *bufferSize,
+00845                         RtAudio::StreamOptions *options );
+00846 };
+00847 
+00848 #endif
+00849 
+00850 #if defined(__LINUX_ALSA__)
+00851 
+00852 class RtApiAlsa: public RtApi
+00853 {
+00854 public:
+00855 
+00856   RtApiAlsa();
+00857   ~RtApiAlsa();
+00858   RtAudio::Api getCurrentApi() { return RtAudio::LINUX_ALSA; };
+00859   unsigned int getDeviceCount( void );
+00860   RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
+00861   void closeStream( void );
+00862   void startStream( void );
+00863   void stopStream( void );
+00864   void abortStream( void );
+00865 
+00866   // This function is intended for internal use only.  It must be
+00867   // public because it is called by the internal callback handler,
+00868   // which is not a member of RtAudio.  External use of this function
+00869   // will most likely produce highly undesireable results!
+00870   void callbackEvent( void );
+00871 
+00872   private:
+00873 
+00874   bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, 
+00875                         unsigned int firstChannel, unsigned int sampleRate,
+00876                         RtAudioFormat format, unsigned int *bufferSize,
+00877                         RtAudio::StreamOptions *options );
+00878 };
+00879 
+00880 #endif
+00881 
+00882 #if defined(__LINUX_OSS__)
+00883 
+00884 class RtApiOss: public RtApi
+00885 {
+00886 public:
+00887 
+00888   RtApiOss();
+00889   ~RtApiOss();
+00890   RtAudio::Api getCurrentApi() { return RtAudio::LINUX_OSS; };
+00891   unsigned int getDeviceCount( void );
+00892   RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
+00893   void closeStream( void );
+00894   void startStream( void );
+00895   void stopStream( void );
+00896   void abortStream( void );
+00897 
+00898   // This function is intended for internal use only.  It must be
+00899   // public because it is called by the internal callback handler,
+00900   // which is not a member of RtAudio.  External use of this function
+00901   // will most likely produce highly undesireable results!
+00902   void callbackEvent( void );
+00903 
+00904   private:
+00905 
+00906   bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, 
+00907                         unsigned int firstChannel, unsigned int sampleRate,
+00908                         RtAudioFormat format, unsigned int *bufferSize,
+00909                         RtAudio::StreamOptions *options );
+00910 };
+00911 
+00912 #endif
+00913 
+00914 #if defined(__RTAUDIO_DUMMY__)
+00915 
+00916 class RtApiDummy: public RtApi
+00917 {
+00918 public:
+00919 
+00920   RtApiDummy() { errorText_ = "RtApiDummy: This class provides no functionality."; error( WARNING ); };
+00921   RtAudio::Api getCurrentApi( void ) { return RtAudio::RTAUDIO_DUMMY; };
+00922   unsigned int getDeviceCount( void ) { return 0; };
+00923   RtAudio::DeviceInfo getDeviceInfo( unsigned int device ) { RtAudio::DeviceInfo info; return info; };
+00924   void closeStream( void ) {};
+00925   void startStream( void ) {};
+00926   void stopStream( void ) {};
+00927   void abortStream( void ) {};
+00928 
+00929   private:
+00930 
+00931   bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, 
+00932                         unsigned int firstChannel, unsigned int sampleRate,
+00933                         RtAudioFormat format, unsigned int *bufferSize,
+00934                         RtAudio::StreamOptions *options ) { return false; };
+00935 };
+00936 
+00937 #endif
+00938 
+00939 #endif
+00940 
+00941 // Indentation settings for Vim and Emacs
+00942 //
+00943 // Local Variables:
+00944 // c-basic-offset: 2
+00945 // indent-tabs-mode: nil
+00946 // End:
+00947 //
+00948 // vim: et sts=2 sw=2
 

- +
©2001-2005 Gary P. Scavone, McGill University. All Rights Reserved.
- Maintained by Gary P. Scavone, gary@music.mcgill.ca
©2001-2007 Gary P. Scavone, McGill University. All Rights Reserved.
Maintained by Gary P. Scavone.
diff --git a/doc/html/RtAudio_8h.html b/doc/html/RtAudio_8h.html new file mode 100644 index 0000000..8e35aee --- /dev/null +++ b/doc/html/RtAudio_8h.html @@ -0,0 +1,179 @@ + + +The RtAudio Home Page + + + + +
+Home   Class/Enum List   File List   Compound Members  
+
+ +

RtAudio.h File Reference

#include <string>
+#include <vector>
+#include "RtError.h"
+#include <sstream>
+ +

+Go to the source code of this file. + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Classes

class  RtAudio
 Realtime audio i/o C++ classes. More...
struct  RtAudio::DeviceInfo
 The public device information structure for returning queried values. More...
struct  RtAudio::StreamParameters
 The structure for specifying input or ouput stream parameters. More...
struct  RtAudio::StreamOptions
 The structure for specifying stream options. More...

Typedefs

typedef unsigned long RtAudioFormat
 RtAudio data format type.
typedef unsigned int RtAudioStreamFlags
 RtAudio stream option flags.
typedef unsigned int RtAudioStreamStatus
 RtAudio stream status (over- or underflow) flags.
typedef int(* RtAudioCallback )(void *outputBuffer, void *inputBuffer, unsigned int nFrames, double streamTime, RtAudioStreamStatus status, void *userData)
 RtAudio callback function prototype.
+


Detailed Description

+

Typedef Documentation

+

+ + + + +
+ + + + +
typedef unsigned long RtAudioFormat
+
+ + + + + +
+   + + +

+RtAudio data format type. +

+Support for signed integers and floats. Audio data fed to/from an RtAudio stream is assumed to ALWAYS be in host byte order. The internal routines will automatically take care of any necessary byte-swapping between the host format and the soundcard. Thus, endian-ness is not a concern in the following format definitions.

+

    +
  • RTAUDIO_SINT8: 8-bit signed integer.
  • RTAUDIO_SINT16: 16-bit signed integer.
  • RTAUDIO_SINT24: Upper 3 bytes of 32-bit signed integer.
  • RTAUDIO_SINT32: 32-bit signed integer.
  • RTAUDIO_FLOAT32: Normalized between plus/minus 1.0.
  • RTAUDIO_FLOAT64: Normalized between plus/minus 1.0.
+
+

+ + + + +
+ + + + +
typedef unsigned long RtAudioStreamFlags
+
+ + + + + +
+   + + +

+RtAudio stream option flags. +

+The following flags can be OR'ed together to allow a client to make changes to the default stream behavior:

+

    +
  • RTAUDIO_NONINTERLEAVED: Use non-interleaved buffers (default = interleaved).
  • RTAUDIO_MINIMIZE_LATENCY: Attempt to set stream parameters for lowest possible latency.
  • RTAUDIO_HOG_DEVICE: Attempt grab device for exclusive use.
+

+By default, RtAudio streams pass and receive audio data from the client in an interleaved format. By passing the RTAUDIO_NONINTERLEAVED flag to the openStream() function, audio data will instead be presented in non-interleaved buffers. In this case, each buffer argument in the RtAudioCallback function will point to a single array of data, with nFrames samples for each channel concatenated back-to-back. For example, the first sample of data for the second channel would be located at index nFrames (assuming the buffer pointer was recast to the correct data type for the stream).

+Certain audio APIs offer a number of parameters that influence the I/O latency of a stream. By default, RtAudio will attempt to set these parameters internally for robust (glitch-free) performance (though some APIs, like Windows Direct Sound, make this difficult). By passing the RTAUDIO_MINIMIZE_LATENCY flag to the openStream() function, internal stream settings will be influenced in an attempt to minimize stream latency, though possibly at the expense of stream performance.

+If the RTAUDIO_HOG_DEVICE flag is set, RtAudio will attempt to open the input and/or output stream device(s) for exclusive use. Note that this is not possible with all supported audio APIs.

+

+ + + + +
+ + + + +
typedef unsigned long RtAudioStreamStatus
+
+ + + + + +
+   + + +

+RtAudio stream status (over- or underflow) flags. +

+Notification of a stream over- or underflow is indicated by a non-zero stream status argument in the RtAudioCallback function. The stream status can be one of the following two options, depending on whether the stream is open for output and/or input:

+

    +
  • RTAUDIO_INPUT_OVERFLOW: Input data was discarded because of an overflow condition at the driver.
  • RTAUDIO_OUTPUT_UNDERFLOW: The output buffer ran low, likely producing a break in the output sound.
+
+

+ + + + +
+ + + + +
typedef int(* RtAudioCallback)(void *outputBuffer, void *inputBuffer, unsigned int nFrames, double streamTime, RtAudioStreamStatus status, void *userData)
+
+ + + + + +
+   + + +

+RtAudio callback function prototype. +

+All RtAudio clients must create a function of type RtAudioCallback to read and/or write data from/to the audio stream. When the underlying audio system is ready for new input or output data, this function will be invoked.

+

Parameters:
+ + + + + + + +
outputBuffer For output (or duplex) streams, the client should write nFrames of audio sample frames into this buffer. This argument should be recast to the datatype specified when the stream was opened. For input-only streams, this argument will be NULL.
inputBuffer For input (or duplex) streams, this buffer will hold nFrames of input audio sample frames. This argument should be recast to the datatype specified when the stream was opened. For output-only streams, this argument will be NULL.
nFrames The number of sample frames of input or output data in the buffers. The actual buffer size in bytes is dependent on the data type and number of channels in use.
streamTime The number of seconds that have elapsed since the stream was started.
status If non-zero, this argument indicates a data overflow or underflow condition for the stream. The particular condition can be determined by comparison with the RtAudioStreamStatus flags.
userData A pointer to optional data provided by the client when opening the stream (default = NULL).
+
+To continue normal stream operation, the RtAudioCallback function should return a value of zero. To stop the stream and drain the output buffer, the function should return a value of one. To abort the stream immediately, the client should return a value of two.
+


+ + + +
©2001-2007 Gary P. Scavone, McGill University. All Rights Reserved.
Maintained by Gary P. Scavone.
+ + + diff --git a/doc/html/RtError_8h-source.html b/doc/html/RtError_8h-source.html index 3211c9a..7d28615 100644 --- a/doc/html/RtError_8h-source.html +++ b/doc/html/RtError_8h-source.html @@ -1,11 +1,12 @@ -The RtAudio Tutorial +The RtAudio Home Page +
-Tutorial   Class/Enum List   File List   Compound Members  
+Home   Class/Enum List   File List   Compound Members  

RtError.h

00001 /************************************************************************/
@@ -14,50 +15,47 @@
 00012 #ifndef RTERROR_H
 00013 #define RTERROR_H
 00014 
-00015 #include <iostream>
-00016 #include <string>
-00017 
-00018 class RtError
-00019 {
-00020 public:
-00022   enum Type {
-00023     WARNING,           
-00024     DEBUG_WARNING,     
-00025     UNSPECIFIED,       
-00026     NO_DEVICES_FOUND,  
-00027     INVALID_DEVICE,    
-00028     INVALID_STREAM,    
-00029     MEMORY_ERROR,      
-00030     INVALID_PARAMETER, 
-00031     DRIVER_ERROR,      
-00032     SYSTEM_ERROR,      
-00033     THREAD_ERROR       
-00034   };
-00035 
-00036 protected:
-00037   std::string message_;
-00038   Type type_;
-00039 
-00040 public:
-00042   RtError(const std::string& message, Type type = RtError::UNSPECIFIED) : message_(message), type_(type) {}
+00015 #include <exception>
+00016 #include <iostream>
+00017 #include <string>
+00018 
+00019 class RtError : public std::exception
+00020 {
+00021  public:
+00023   enum Type {
+00024     UNSPECIFIED,       
+00025     NO_DEVICES_FOUND,  
+00026     INVALID_DEVICE,    
+00027     MEMORY_ERROR,      
+00028     INVALID_PARAMETER, 
+00029     INVALID_USE,       
+00030     DRIVER_ERROR,      
+00031     SYSTEM_ERROR,      
+00032     THREAD_ERROR       
+00033   };
+00034 
+00036   RtError( const std::string& message, Type type = RtError::UNSPECIFIED ) throw() : message_(message), type_(type) {}
+00037  
+00039   virtual ~RtError( void ) throw() {}
+00040 
+00042   virtual void printMessage( void ) throw() { std::cerr << '\n' << message_ << "\n\n"; }
 00043 
-00045   virtual ~RtError(void) {};
+00045   virtual const Type& getType(void) throw() { return type_; }
 00046 
-00048   virtual void printMessage(void) { std::cerr << '\n' << message_ << "\n\n"; }
+00048   virtual const std::string& getMessage(void) throw() { return message_; }
 00049 
-00051   virtual const Type& getType(void) { return type_; }
+00051   virtual const char* what( void ) const throw() { return message_.c_str(); }
 00052 
-00054   virtual const std::string& getMessage(void) { return message_; }
-00055 
-00057   virtual const char *getMessageString(void) { return message_.c_str(); }
-00058 };
-00059 
-00060 #endif
+00053  protected:
+00054   std::string message_;
+00055   Type type_;
+00056 };
+00057 
+00058 #endif
 

- +
©2001-2005 Gary P. Scavone, McGill University. All Rights Reserved.
- Maintained by Gary P. Scavone, gary@music.mcgill.ca
©2001-2007 Gary P. Scavone, McGill University. All Rights Reserved.
Maintained by Gary P. Scavone.
diff --git a/doc/html/acknowledge.html b/doc/html/acknowledge.html new file mode 100644 index 0000000..82ed11e --- /dev/null +++ b/doc/html/acknowledge.html @@ -0,0 +1,31 @@ + + +The RtAudio Home Page + + + + +
+Home   Class/Enum List   File List   Compound Members  
+
+ +

Acknowledgements

Many thanks to the following people for providing bug fixes and improvements:
    +
  • +Robin Davies (Windows DS and ASIO)
  • +
  • +Ryan Williams (Windows non-MS compiler ASIO support)
  • +
  • +Ed Wildgoose (Linux ALSA and Jack)
  • +
  • +Dominic Mazzoni
  • +
+

+The RtAudio API incorporates many of the concepts developed in the PortAudio project by Phil Burk and Ross Bencina. Early development also incorporated ideas from Bill Schottstaedt's sndlib. The CCRMA SoundWire group provided valuable feedback during the API proposal stages.

+The early 2.0 version of RtAudio was slowly developed over the course of many months while in residence at the Institut Universitari de L'Audiovisual (IUA) in Barcelona, Spain and the Laboratory of Acoustics and Audio Signal Processing at the Helsinki University of Technology, Finland. Much subsequent development happened while working at the Center for Computer Research in Music and Acoustics (CCRMA) at Stanford University. All recent versions of RtAudio have been completed while working as an assistant professor of Music Technology at McGill University. This work was supported in part by the United States Air Force Office of Scientific Research (grant #F49620-99-1-0293).


+ + + +
©2001-2007 Gary P. Scavone, McGill University. All Rights Reserved.
Maintained by Gary P. Scavone.
+ + + diff --git a/doc/html/annotated.html b/doc/html/annotated.html index eaa21a7..5dc72ff 100644 --- a/doc/html/annotated.html +++ b/doc/html/annotated.html @@ -1,23 +1,25 @@ -The RtAudio Tutorial +The RtAudio Home Page +
-Tutorial   Class/Enum List   File List   Compound Members  
+Home   Class/Enum List   File List   Compound Members  

RtAudio Class List

Here are the classes, structs, unions and interfaces with brief descriptions: - + + +
RtAudioRealtime audio i/o C++ classes
RtAudioDeviceInfoThe public device information structure for returning queried values
RtAudio::DeviceInfoThe public device information structure for returning queried values
RtAudio::StreamOptionsThe structure for specifying stream options
RtAudio::StreamParametersThe structure for specifying input or ouput stream parameters
RtErrorException handling class for RtAudio & RtMidi

- +
©2001-2005 Gary P. Scavone, McGill University. All Rights Reserved.
- Maintained by Gary P. Scavone, gary@music.mcgill.ca
©2001-2007 Gary P. Scavone, McGill University. All Rights Reserved.
Maintained by Gary P. Scavone.
diff --git a/doc/html/apinotes.html b/doc/html/apinotes.html new file mode 100644 index 0000000..983f063 --- /dev/null +++ b/doc/html/apinotes.html @@ -0,0 +1,35 @@ + + +The RtAudio Home Page + + + + +
+Home   Class/Enum List   File List   Compound Members  
+
+ +

API Notes

RtAudio is designed to provide a common API across the various supported operating systems and audio libraries. Despite that, some issues should be mentioned with regard to each.

+Linux:

+RtAudio for Linux was developed under Redhat distributions 7.0 - Fedora. Three different audio APIs are supported on Linux platforms: OSS (versions >= 4.0), ALSA, and Jack. Note that RtAudio now only supports the newer version 4.0 OSS API. The ALSA API is now part of the Linux kernel and offers significantly better functionality than the OSS API. RtAudio provides support for the 1.0 and higher versions of ALSA. Jack is a low-latency audio server written primarily for the GNU/Linux operating system. It can connect a number of different applications to an audio device, as well as allow them to share audio between themselves. Input/output latency on the order of 15 milliseconds can typically be achieved using any of the Linux APIs by fine-tuning the RtAudio buffer parameters (without kernel modifications). Latencies on the order of 5 milliseconds or less can be achieved using a low-latency kernel patch and increasing FIFO scheduling priority. The pthread library, which is used for callback functionality, is a standard component of all Linux distributions.

+The ALSA library includes OSS emulation support. That means that you can run programs compiled for the OSS API even when using the ALSA drivers and library. It should be noted however that OSS emulation under ALSA is not perfect. Specifically, channel number queries seem to consistently produce invalid results. While OSS emulation is successful for the majority of RtAudio tests, it is recommended that the native ALSA implementation of RtAudio be used on systems which have ALSA drivers installed.

+The ALSA implementation of RtAudio makes no use of the ALSA "plug" interface. All necessary data format conversions, channel compensation, de-interleaving, and byte-swapping is handled by internal RtAudio routines.

+At the moment, only one RtAudio instance can be connected to the Jack server.

+Macintosh OS-X (CoreAudio and Jack):

+The Apple CoreAudio API is designed to use a separate callback procedure for each of its audio devices. A single RtAudio duplex stream using two different devices is supported, though it cannot be guaranteed to always behave correctly because we cannot synchronize these two callbacks. The numberOfBuffers parameter to the RtAudio::openStream() function has no affect in this implementation.

+It is not possible to have multiple instances of RtAudio accessing the same CoreAudio device.

+The RtAudio Jack support can be compiled on Macintosh OS-X systems, as well as in Linux.

+Windows (DirectSound):

+In order to compile RtAudio under Windows for the DirectSound API, you must have the header and source files for DirectSound version 5.0 or higher. As far as I know, there is no DirectSoundCapture support for Windows NT. Audio output latency with DirectSound can be reasonably good, especially since RtAudio version 3.0.2. Input audio latency still tends to be bad but better since version 3.0.2. RtAudio was originally developed with Visual C++ version 6.0 but has been tested with .NET.

+The DirectSound version of RtAudio can be compiled with or without the UNICODE preprocessor definition.

+Windows (ASIO):

+The Steinberg ASIO audio API allows only a single device driver to be loaded and accessed at a time. ASIO device drivers must be supplied by audio hardware manufacturers, though ASIO emulation is possible on top of systems with DirectSound drivers. The numberOfBuffers parameter to the RtAudio::openStream() function has no affect in this implementation.

+A number of ASIO source and header files are required for use with RtAudio. Specifically, an RtAudio project must include the following files: asio.h,cpp; asiodrivers.h,cpp; asiolist.h,cpp; asiodrvr.h; asiosys.h; ginclude.h; iasiodrv.h; iasiothiscallresolver.h,cpp. The Visual C++ projects found in /tests/Windows/ compile both ASIO and DirectSound support.

+The Steinberg provided asiolist class does not compile when the preprocessor definition UNICODE is defined. Note that this could be an issue when using RtAudio with Qt, though Qt programs appear to compile without the UNICODE definition (try DEFINES -= UNICODE in your .pro file). RtAudio with ASIO support has been tested using the MinGW compiler under Windows XP, as well as in the Visual Studio environment.


+ + + +
©2001-2007 Gary P. Scavone, McGill University. All Rights Reserved.
Maintained by Gary P. Scavone.
+ + + diff --git a/doc/html/bugs.html b/doc/html/bugs.html new file mode 100644 index 0000000..27fecd8 --- /dev/null +++ b/doc/html/bugs.html @@ -0,0 +1,39 @@ + + +RtAudio Bugs + + + +

RtAudio Bug Tracker

+ +"Bugs" are considered to be problems that cause program crashes or unpredictable results. Incomplete or unavailable features are tracked as updates. + +

Reported (Unconfirmed) Bugs:

+ + + + + + +
#VersionAPIDescriptionStatus
13.03CoreAudioDo we need a run-time test for endianness given the new Intel Macs?Not yet tested (GS)
+ +

Confirmed Bugs (Unfixed):

+ + + + +
#VersionAPIDescription
+ +

Fixed Bugs:

+ + + + + + + +
#VersionAPIDescription
14.0Windows DSMemory allocation bug in device querying
24.0All unicesDefault pthread scheduling priority changed to SCHED_RR when defined
34.0ALSAChanged sample rate setting to use snd_pcm_hw_params_set_rate_near() function
44.0CoreAudioRtAudio checks a device's internal data format and sets it to the highest allowable bit rate. For some stupid devices, like the Griffin iMic, the default format is 8-bit mono when the requested format and number of channels does not exist. So, we need to query the device's capabilities using the kAudioStreamPropertyPhysicalFormats selector - i.e. ask a device for all of the channels/format/rate combination that it supports - and then enumerate through them to pick the best one.
+ + + + diff --git a/doc/html/classRtAudio-members.html b/doc/html/classRtAudio-members.html index 3e95506..338a781 100644 --- a/doc/html/classRtAudio-members.html +++ b/doc/html/classRtAudio-members.html @@ -1,44 +1,46 @@ -The RtAudio Tutorial +The RtAudio Home Page +
-Tutorial   Class/Enum List   File List   Compound Members  
+Home   Class/Enum List   File List   Compound Members  

RtAudio Member List

This is the complete list of members for RtAudio, including all inherited members.

- - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + - - - + + +
abortStream()RtAudio [inline]
cancelStreamCallback()RtAudio [inline]
closeStream()RtAudio [inline]
getDeviceCount(void)RtAudio [inline]
getDeviceInfo(int device)RtAudio [inline]
getStreamBuffer()RtAudio [inline]
IRIX_AL enum valueRtAudio
abortStream(void)RtAudio [inline]
Api enum nameRtAudio
closeStream(void)RtAudio [inline]
getCompiledApi(std::vector< RtAudio::Api > &apis)RtAudio [static]
getCurrentApi(void)RtAudio [inline]
getDefaultInputDevice(void)RtAudio [inline]
getDefaultOutputDevice(void)RtAudio [inline]
getDeviceCount(void)RtAudio [inline]
getDeviceInfo(unsigned int device)RtAudio [inline]
getStreamLatency(void)RtAudio [inline]
getStreamTime(void)RtAudio [inline]
isStreamOpen(void)RtAudio [inline]
isStreamRunning(void)RtAudio [inline]
LINUX_ALSA enum valueRtAudio
LINUX_JACK enum valueRtAudio
LINUX_OSS enum valueRtAudio
MACOSX_CORE enum valueRtAudio
openStream(int outputDevice, int outputChannels, int inputDevice, int inputChannels, RtAudioFormat format, int sampleRate, int *bufferSize, int numberOfBuffers)RtAudio
openStream(int outputDevice, int outputChannels, int inputDevice, int inputChannels, RtAudioFormat format, int sampleRate, int *bufferSize, int *numberOfBuffers)RtAudio
RtAudio(RtAudioApi api=UNSPECIFIED)RtAudio
RtAudio(int outputDevice, int outputChannels, int inputDevice, int inputChannels, RtAudioFormat format, int sampleRate, int *bufferSize, int numberOfBuffers, RtAudioApi api=UNSPECIFIED)RtAudio
RtAudio(int outputDevice, int outputChannels, int inputDevice, int inputChannels, RtAudioFormat format, int sampleRate, int *bufferSize, int *numberOfBuffers, RtAudioApi api=UNSPECIFIED)RtAudio
RtAudioApi enum nameRtAudio
setStreamCallback(RtAudioCallback callback, void *userData)RtAudio [inline]
startStream()RtAudio [inline]
stopStream()RtAudio [inline]
tickStream()RtAudio [inline]
openStream(RtAudio::StreamParameters *outputParameters, RtAudio::StreamParameters *inputParameters, RtAudioFormat format, unsigned int sampleRate, unsigned int *bufferFrames, RtAudioCallback callback, void *userData=NULL, RtAudio::StreamOptions *options=NULL)RtAudio
RtAudio(RtAudio::Api api=UNSPECIFIED)RtAudio
RTAUDIO_DUMMY enum valueRtAudio
showWarnings(bool value=true)RtAudio [inline]
startStream(void)RtAudio [inline]
stopStream(void)RtAudio [inline]
UNIX_JACK enum valueRtAudio
UNSPECIFIED enum valueRtAudio
WINDOWS_ASIO enum valueRtAudio
WINDOWS_DS enum valueRtAudio
~RtAudio()RtAudio
WINDOWS_ASIO enum valueRtAudio
WINDOWS_DS enum valueRtAudio
~RtAudio()RtAudio


- +
©2001-2005 Gary P. Scavone, McGill University. All Rights Reserved.
- Maintained by Gary P. Scavone, gary@music.mcgill.ca
©2001-2007 Gary P. Scavone, McGill University. All Rights Reserved.
Maintained by Gary P. Scavone.
diff --git a/doc/html/classRtAudio.html b/doc/html/classRtAudio.html index 237c17e..4b2b2cd 100644 --- a/doc/html/classRtAudio.html +++ b/doc/html/classRtAudio.html @@ -1,11 +1,12 @@ -The RtAudio Tutorial +The RtAudio Home Page +
-Tutorial   Class/Enum List   File List   Compound Members  
+Home   Class/Enum List   File List   Compound Members  

RtAudio Class Reference

Realtime audio i/o C++ classes. @@ -16,90 +17,110 @@ List of all members. - - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + +

Public Types

enum  RtAudioApi {
+
enum  Api {
  UNSPECIFIED, LINUX_ALSA, LINUX_OSS, -LINUX_JACK, +UNIX_JACK,
  MACOSX_CORE, -IRIX_AL, -WINDOWS_ASIO, -WINDOWS_DS +WINDOWS_ASIO, +WINDOWS_DS, +RTAUDIO_DUMMY
}
 Audio API specifier arguments. More...

Public Member Functions

 RtAudio (RtAudioApi api=UNSPECIFIED)
 RtAudio (RtAudio::Api api=UNSPECIFIED) throw ()
 The default class constructor.
 RtAudio (int outputDevice, int outputChannels, int inputDevice, int inputChannels, RtAudioFormat format, int sampleRate, int *bufferSize, int numberOfBuffers, RtAudioApi api=UNSPECIFIED)
 The class constructor.
 ~RtAudio () throw ()
 A constructor which can be used to open a stream during instantiation.
 RtAudio (int outputDevice, int outputChannels, int inputDevice, int inputChannels, RtAudioFormat format, int sampleRate, int *bufferSize, int *numberOfBuffers, RtAudioApi api=UNSPECIFIED)
 The destructor.
+RtAudio::Api getCurrentApi (void) throw ()
 An overloaded constructor which opens a stream and also returns numberOfBuffers parameter via pointer argument.
 ~RtAudio ()
 Returns the audio API specifier for the current instance of RtAudio.
unsigned int getDeviceCount (void) throw ()
 The destructor.
void openStream (int outputDevice, int outputChannels, int inputDevice, int inputChannels, RtAudioFormat format, int sampleRate, int *bufferSize, int numberOfBuffers)
 A public function that queries for the number of audio devices available.
RtAudio::DeviceInfo getDeviceInfo (unsigned int device)
 A public method for opening a stream with the specified parameters.
void openStream (int outputDevice, int outputChannels, int inputDevice, int inputChannels, RtAudioFormat format, int sampleRate, int *bufferSize, int *numberOfBuffers)
 Return an RtAudio::DeviceInfo structure for a specified device number.
unsigned int getDefaultOutputDevice (void) throw ()
 A public method for opening a stream and also returning numberOfBuffers parameter via pointer argument.
void setStreamCallback (RtAudioCallback callback, void *userData)
 A function that returns the index of the default output device.
unsigned int getDefaultInputDevice (void) throw ()
 A public method which sets a user-defined callback function for a given stream.
void cancelStreamCallback ()
 A function that returns the index of the default input device.
void openStream (RtAudio::StreamParameters *outputParameters, RtAudio::StreamParameters *inputParameters, RtAudioFormat format, unsigned int sampleRate, unsigned int *bufferFrames, RtAudioCallback callback, void *userData=NULL, RtAudio::StreamOptions *options=NULL)
 A public method which cancels a callback process and function for the stream.
-int getDeviceCount (void)
 A public function for opening a stream with the specified parameters.
void closeStream (void) throw ()
 A public method which returns the number of audio devices found.
RtAudioDeviceInfo getDeviceInfo (int device)
 A function that closes a stream and frees any associated stream memory.
void startStream (void)
 Return an RtAudioDeviceInfo structure for a specified device number.
char *const getStreamBuffer ()
 A function that starts a stream.
void stopStream (void)
 A public method which returns a pointer to the buffer for an open stream.
void tickStream ()
 Stop a stream, allowing any samples remaining in the output queue to be played.
void abortStream (void)
 Public method used to trigger processing of input/output data for a stream.
void closeStream ()
 Stop a stream, discarding any samples remaining in the input/output queue.
+bool isStreamOpen (void) throw ()
 Public method which closes a stream and frees any associated buffers.
void startStream ()
 Returns true if a stream is open and false if not.
+bool isStreamRunning (void) throw ()
 Public method which starts a stream.
void stopStream ()
 Returns true if the stream is running and false if it is stopped or not open.
double getStreamTime (void)
 Stop a stream, allowing any samples remaining in the queue to be played out and/or read in.
void abortStream ()
 Returns the number of elapsed seconds since the stream was started.
long getStreamLatency (void)
 Stop a stream, discarding any samples remaining in the input/output queue.
 Returns the internal stream latency in sample frames.
+void showWarnings (bool value=true) throw ()
 Specify whether warning messages should be printed to stderr.

Static Public Member Functions

static void getCompiledApi (std::vector< RtAudio::Api > &apis) throw ()
 A static function to determine the available compiled audio APIs.

Classes

struct  DeviceInfo
 The public device information structure for returning queried values. More...
struct  StreamOptions
 The structure for specifying stream options. More...
struct  StreamParameters
 The structure for specifying input or ouput stream parameters. More...

Detailed Description

Realtime audio i/o C++ classes.

-RtAudio provides a common API (Application Programming Interface) for realtime audio input/output across Linux (native ALSA, Jack, and OSS), SGI, Macintosh OS X (CoreAudio), and Windows (DirectSound and ASIO) operating systems.

-RtAudio WWW site: http://music.mcgill.ca/~gary/rtaudio/

-RtAudio: realtime audio i/o C++ classes Copyright (c) 2001-2005 Gary P. Scavone

+RtAudio provides a common API (Application Programming Interface) for realtime audio input/output across Linux (native ALSA, Jack, and OSS), SGI, Macintosh OS X (CoreAudio and Jack), and Windows (DirectSound and ASIO) operating systems.

+RtAudio WWW site: http://www.music.mcgill.ca/~gary/rtaudio/

+RtAudio: realtime audio i/o C++ classes Copyright (c) 2001-2007 Gary P. Scavone

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

-Any person wishing to distribute modifications to the Software is requested to send the modifications to the original developer so that they can be incorporated into the canonical version.

+Any person wishing to distribute modifications to the Software is asked to send the modifications to the original developer so that they can be incorporated into the canonical version. This is, however, not a binding provision of this license.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


Member Enumeration Documentation

-

+

@@ -123,23 +144,23 @@ Search for a working compiled API. The Advanced Linux Sound Architecture API. - + - - - +
- +
enum RtAudio::RtAudioApi enum RtAudio::Api
LINUX_OSS  The Linux Open Sound System API.
LINUX_JACK  -The Linux Jack Low-Latency Audio Server API.
UNIX_JACK  +The Jack Low-Latency Audio Server API.
MACOSX_CORE  Macintosh OS-X Core Audio API.
IRIX_AL  -The Irix Audio Library API.
WINDOWS_ASIO  +
WINDOWS_ASIO  The Steinberg Audio Stream I/O API.
WINDOWS_DS  +
WINDOWS_DS  The Microsoft Direct Sound API.
RTAUDIO_DUMMY  +A compilable but non-functional API.


Constructor & Destructor Documentation

-

+

- + - +
@@ -147,10 +168,10 @@ The Microsoft Direct Sound API.
RtAudio::RtAudio RtAudioApi RtAudio::Api  api = UNSPECIFIED  )  throw ()
@@ -164,75 +185,23 @@ The Microsoft Direct Sound API.

-The default class constructor. +The class constructor.

-Probes the system to make sure at least one audio input/output device is available and determines the api-specific identifier for each device found. An RtError error can be thrown if no devices are found or if a memory allocation error occurs.

+The constructor performs minor initialization tasks. No exceptions can be thrown.

If no API argument is specified and multiple API support has been compiled, the default order of use is JACK, ALSA, OSS (Linux systems) and ASIO, DS (Windows systems). -

+

@@ -246,75 +215,24 @@ If no API argument is specified and multiple API support has been compiled, the +If a stream is running or open, it will be stopped and closed automatically.
- + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + +
RtAudio::RtAudio RtAudio::~RtAudio int  outputDevice,
int  outputChannels,
int  inputDevice,
int  inputChannels,
RtAudioFormat  format,
int  sampleRate,
int *  bufferSize,
int  numberOfBuffers,
RtAudioApi  api = UNSPECIFIED
 )  throw ()

-A constructor which can be used to open a stream during instantiation. +The destructor.

-The specified output and/or input device identifiers correspond to those enumerated via the getDeviceInfo() method. If device = 0, the default or first available devices meeting the given parameters is selected. If an output or input channel value is zero, the corresponding device value is ignored. When a stream is successfully opened, its identifier is returned via the "streamId" pointer. An RtError can be thrown if no devices are found for the given parameters, if a memory allocation error occurs, or if a driver error occurs.

See also:
openStream()
-
-

+


Member Function Documentation

+

@@ -328,22 +246,23 @@ The specified output and/or input device identifiers correspond to those enumera +The values returned in the std::vector can be compared against the enumerated list values. Note that there can be more than one API compiled for certain operating systems.
- + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + +
RtAudio::RtAudio static void RtAudio::getCompiledApi int  outputDevice,
int  outputChannels,
int  inputDevice,
int  inputChannels,
RtAudioFormat  format,
int  sampleRate,
int *  bufferSize,
int *  numberOfBuffers,
RtAudioApi  api = UNSPECIFIED
std::vector< RtAudio::Api > &  apis  )  throw () [static]

-An overloaded constructor which opens a stream and also returns numberOfBuffers parameter via pointer argument. +A static function to determine the available compiled audio APIs.

-See the previous constructor call for details. This overloaded version differs only in that it takes a pointer argument for the numberOfBuffers parameter and returns the value used by the audio device (which may be different from that requested). Note that the numberofBuffers parameter is not used with the Linux Jack, Macintosh CoreAudio, and Windows ASIO APIs.

-

+

@@ -357,157 +276,23 @@ See the previous constructor call for details. This overloaded version differs o +This function performs a system query of available devices each time it is called, thus supporting devices connected after instantiation. If a system error occurs during processing, a warning will be issued.
- + + - +
RtAudio::~RtAudio unsigned int RtAudio::getDeviceCount void   )  throw () [inline]

-The destructor. +A public function that queries for the number of audio devices available.

-Stops and closes an open stream and devices and deallocates buffer and structure memory.

-


Member Function Documentation

-

+

- -
- + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void RtAudio::openStream RtAudio::DeviceInfo RtAudio::getDeviceInfo int  outputDevice,
int  outputChannels,
int  inputDevice,
int  inputChannels,
RtAudioFormat  format,
int  sampleRate,
int *  bufferSize,
int  numberOfBuffers
-
- - - - - -
-   - - -

-A public method for opening a stream with the specified parameters. -

-An RtError is thrown if a stream cannot be opened.

-

Parameters:
- - - - - - - - - -
outputDevice,: If equal to 0, the default or first device found meeting the given parameters is opened. Otherwise, the device number should correspond to one of those enumerated via the getDeviceInfo() method.
outputChannels,: The desired number of output channels. If equal to zero, the outputDevice identifier is ignored.
inputDevice,: If equal to 0, the default or first device found meeting the given parameters is opened. Otherwise, the device number should correspond to one of those enumerated via the getDeviceInfo() method.
inputChannels,: The desired number of input channels. If equal to zero, the inputDevice identifier is ignored.
format,: An RtAudioFormat specifying the desired sample data format.
sampleRate,: The desired sample rate (sample frames per second).
*bufferSize,: A pointer value indicating the desired internal buffer size in sample frames. The actual value used by the device is returned via the same pointer. A value of zero can be specified, in which case the lowest allowable value is determined.
numberOfBuffers,: A value which can be used to help control device latency. More buffers typically result in more robust performance, though at a cost of greater latency. A value of zero can be specified, in which case the lowest allowable value is used.
-
-
-

- - - @@ -521,32 +306,23 @@ An RtError is thrown if a stream cann +Any device integer between 0 and getDeviceCount() - 1 is valid. If an invalid argument is provided, an RtError (type = INVALID_USE) will be thrown. If a device is busy or otherwise unavailable, the structure member "probed" will have a value of "false" and all other members are undefined. If the specified device is the current default input or output device, the corresponding "isDefault" member will have a value of "true".
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + +
void RtAudio::openStream int  outputDevice,
int  outputChannels,
int  inputDevice,
int  inputChannels,
RtAudioFormat  format,
int  sampleRate,
int *  bufferSize,
int *  numberOfBuffers
unsigned int  device  )  [inline]

-A public method for opening a stream and also returning numberOfBuffers parameter via pointer argument. +Return an RtAudio::DeviceInfo structure for a specified device number.

-See the previous function call for details. This overloaded version differs only in that it takes a pointer argument for the numberOfBuffers parameter and returns the value used by the audio device (which may be different from that requested). Note that the numberofBuffers parameter is not used with the Linux Jack, Macintosh CoreAudio, and Windows ASIO APIs.

-

+

@@ -560,22 +336,23 @@ See the previous function call for details. This overloaded version differs only +If the underlying audio API does not provide a "default device", or if no devices are available, the return value will be 0. Note that this is a valid device identifier and it is the client's responsibility to verify that a device is available before attempting to open a stream.
- + - - - - - - - - - - - - - + + + +
void RtAudio::setStreamCallback unsigned int RtAudio::getDefaultOutputDevice RtAudioCallback  callback,
void *  userData
[inline]void   )  throw () [inline]

-A public method which sets a user-defined callback function for a given stream. +A function that returns the index of the default output device.

-This method assigns a callback function to a previously opened stream for non-blocking stream functionality. A separate process is initiated, though the user function is called only when the stream is "running" (between calls to the startStream() and stopStream() methods, respectively). The callback process remains active for the duration of the stream and is automatically shutdown when the stream is closed (via the closeStream() method or by object destruction). The callback process can also be shutdown and the user function de-referenced through an explicit call to the cancelStreamCallback() method. Note that the stream can use only blocking or callback functionality at a particular time, though it is possible to alternate modes on the same stream through the use of the setStreamCallback() and cancelStreamCallback() methods (the blocking tickStream() method can be used before a callback is set and/or after a callback is cancelled). An RtError will be thrown if called when no stream is open or a thread errors occurs.

-

+

@@ -589,23 +366,68 @@ This method assigns a callback function to a previously opened stream for non-bl +If the underlying audio API does not provide a "default device", or if no devices are available, the return value will be 0. Note that this is a valid device identifier and it is the client's responsibility to verify that a device is available before attempting to open a stream.
- + + - +
void RtAudio::cancelStreamCallback unsigned int RtAudio::getDefaultInputDevice void   )  [inline] throw () [inline]

-A public method which cancels a callback process and function for the stream. +A function that returns the index of the default input device.

-This method shuts down a callback process and de-references the user function for the stream. Callback functionality can subsequently be restarted on the stream via the setStreamCallback() method. An RtError will be thrown if called when no stream is open.

-

+

@@ -619,22 +441,36 @@ This method shuts down a callback process and de-references the user function fo +An RtError (type = SYSTEM_ERROR) is thrown if a stream cannot be opened with the specified parameters or an error occurs during processing. An RtError (type = INVALID_USE) is thrown if any invalid device ID or channel number parameters are specified.

+

Parameters:
+
- + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
RtAudioDeviceInfo RtAudio::getDeviceInfo void RtAudio::openStream int  device  )  [inline]RtAudio::StreamParameters outputParameters,
RtAudio::StreamParameters inputParameters,
RtAudioFormat  format,
unsigned int  sampleRate,
unsigned int *  bufferFrames,
RtAudioCallback  callback,
void *  userData = NULL,
RtAudio::StreamOptions options = NULL

-Return an RtAudioDeviceInfo structure for a specified device number. +A public function for opening a stream with the specified parameters.

-Any device integer between 1 and getDeviceCount() is valid. If a device is busy or otherwise unavailable, the structure member "probed" will have a value of "false" and all other members are undefined. If the specified device is the current default input or output device, the "isDefault" member will have a value of "true". An RtError will be thrown for an invalid device argument.

+ + + + + + + + +
outputParameters Specifies output stream parameters to use when opening a stream, including a device ID, number of channels, and starting channel number. For input-only streams, this argument should be NULL. The device ID is an index value between 0 and getDeviceCount() - 1.
inputParameters Specifies input stream parameters to use when opening a stream, including a device ID, number of channels, and starting channel number. For output-only streams, this argument should be NULL. The device ID is an index value between 0 and getDeviceCount() - 1.
format An RtAudioFormat specifying the desired sample data format.
sampleRate The desired sample rate (sample frames per second).
*bufferFrames A pointer to a value indicating the desired internal buffer size in sample frames. The actual value used by the device is returned via the same pointer. A value of zero can be specified, in which case the lowest allowable value is determined.
callback A client-defined function that will be invoked when input data is available and/or output data is needed.
userData An optional pointer to data that can be accessed from within the callback function.
options An optional pointer to a structure containing various global stream options, including a list of OR'ed RtAudioStreamFlags and a suggested number of stream buffers that can be used to control stream latency. More buffers typically result in more robust performance, though at a cost of greater latency. If a value of zero is specified, a system-specific median value is chosen. If the RTAUDIO_MINIMIZE_LATENCY flag bit is set, the lowest allowable value is used. The actual value used is returned via the structure argument. The parameter is API dependent.
+ + -

+

@@ -648,19 +484,20 @@ Any device integer between 1 and getDe +If a stream is not open, this function issues a warning and returns (no exception is thrown).
- + + - +
char* const RtAudio::getStreamBuffer void RtAudio::closeStream void   )  [inline] throw () [inline]

-A public method which returns a pointer to the buffer for an open stream. +A function that closes a stream and frees any associated stream memory.

-The user should fill and/or read the buffer data in interleaved format and then call the tickStream() method. An RtError will be thrown if called when no stream is open.

-

+

- + + @@ -677,19 +514,20 @@ The user should fill and/or read the buffer data in interleaved format and then +An RtError (type = SYSTEM_ERROR) is thrown if an error occurs during processing. An RtError (type = INVALID_USE) is thrown if a stream is not open. A warning is issued if the stream is already running.
void RtAudio::tickStream void RtAudio::startStream void   )  [inline]

-Public method used to trigger processing of input/output data for a stream. +A function that starts a stream.

-This method blocks until all buffer data is read/written. An RtError will be thrown if a driver error occurs or if called when no stream is open.

-

+

- + + @@ -706,19 +544,20 @@ This method blocks until all buffer data is read/written. An

-Public method which closes a stream and frees any associated buffers. +Stop a stream, allowing any samples remaining in the output queue to be played.

-If a stream is not open, this method issues a warning and returns (an RtError is not thrown). +An RtError (type = SYSTEM_ERROR) is thrown if an error occurs during processing. An RtError (type = INVALID_USE) is thrown if a stream is not open. A warning is issued if the stream is already stopped.

void RtAudio::closeStream void RtAudio::stopStream void   )  [inline]
-

+

Maximum simultaneous input/output channels supported by device.
- + + @@ -735,19 +574,20 @@ If a stream is not open, this method issues a warning and returns (an RtError will be thrown if a driver error occurs or if called when no stream is open. +An RtError (type = SYSTEM_ERROR) is thrown if an error occurs during processing. An RtError (type = INVALID_USE) is thrown if a stream is not open. A warning is issued if the stream is already stopped.
void RtAudio::startStream void RtAudio::abortStream void   )  [inline]
-

+

- + - + - + + +
- + + @@ -764,19 +604,20 @@ An RtError will be thrown if a driver +If a stream is not open, an RtError (type = INVALID_USE) will be thrown.
void RtAudio::stopStream double RtAudio::getStreamTime void   )  [inline]

-Stop a stream, allowing any samples remaining in the queue to be played out and/or read in. +Returns the number of elapsed seconds since the stream was started.

-An RtError will be thrown if a driver error occurs or if called when no stream is open.

-

+


- + + @@ -793,9 +634,9 @@ An RtError will be thrown if a driver +The stream latency refers to delay in audio input and/or output caused by internal buffering by the audio system and/or hardware. For duplex streams, the returned value will represent the sum of the input and output latencies. If a stream is not open, an RtError (type = INVALID_USE) will be thrown. If the API does not report latency, the return value will be zero.
void RtAudio::abortStream long RtAudio::getStreamLatency void   )  [inline]

-Stop a stream, discarding any samples remaining in the input/output queue. +Returns the internal stream latency in sample frames.

-An RtError will be thrown if a driver error occurs or if called when no stream is open.


The documentation for this class was generated from the following file:
- +
©2001-2005 Gary P. Scavone, McGill University. All Rights Reserved.
- Maintained by Gary P. Scavone, gary@music.mcgill.ca
©2001-2007 Gary P. Scavone, McGill University. All Rights Reserved.
Maintained by Gary P. Scavone.
diff --git a/doc/html/compiling.html b/doc/html/compiling.html new file mode 100644 index 0000000..9346457 --- /dev/null +++ b/doc/html/compiling.html @@ -0,0 +1,42 @@ + + +The RtAudio Home Page + + + + +

+Home   Class/Enum List   File List   Compound Members  
+
+ +

Debugging & Compiling

+Debugging

+If you are having problems getting RtAudio to run on your system, make sure to pass a value of true to the RtAudio::showWarnings() function (this is the default setting). A variety of warning messages will be displayed which may help in determining the problem. Also, try using the programs included in the tests directory. The program probe displays the queried capabilities of all hardware devices found for all APIs compiled. When using the ALSA API, further information can be displayed by defining the preprocessor definition __RTAUDIO_DEBUG__.

+Compiling

+In order to compile RtAudio for a specific OS and audio API, it is necessary to supply the appropriate preprocessor definition and library within the compiler statement:

+ + + + + + + + + + + + + + + +
OS: Audio API: C++ Class: Preprocessor Definition: Library or Framework: Example Compiler Statement:
Linux ALSA RtApiAlsa __LINUX_ALSA__ asound, pthread g++ -Wall -D__LINUX_ALSA__ -o probe probe.cpp RtAudio.cpp -lasound -lpthread
Linux OSS RtApiOss __LINUX_OSS__ pthread g++ -Wall -D__LINUX_OSS__ -o probe probe.cpp RtAudio.cpp -lpthread
Linux or Macintosh OS-X Jack Audio Server RtApiJack __UNIX_JACK__ jack, pthread g++ -Wall -D__UNIX_JACK__ -o probe probe.cpp RtAudio.cpp `pkg-config --cflags --libs jack` -lpthread

+

Macintosh OS-X CoreAudio RtApiCore __MACOSX_CORE__ pthread, CoreAudio g++ -Wall -D__MACOSX_CORE__ -o probe probe.cpp RtAudio.cpp -framework CoreAudio -lpthread
Windows Direct Sound RtApiDs __WINDOWS_DS__ dsound.lib (ver. 5.0 or higher), multithreaded compiler specific
Windows ASIO RtApiAsio __WINDOWS_ASIO__ various ASIO header and source files compiler specific
+

+The example compiler statements above could be used to compile the probe.cpp example file, assuming that probe.cpp, RtAudio.h, RtError.h, and RtAudio.cpp all exist in the same directory.


+ + + +
©2001-2007 Gary P. Scavone, McGill University. All Rights Reserved.
Maintained by Gary P. Scavone.
+ + + diff --git a/doc/html/duplex.html b/doc/html/duplex.html new file mode 100644 index 0000000..5ea8165 --- /dev/null +++ b/doc/html/duplex.html @@ -0,0 +1,84 @@ + + +The RtAudio Home Page + + + + +
+Home   Class/Enum List   File List   Compound Members  
+
+ +

Duplex Mode

Finally, it is easy to use RtAudio for simultaneous audio input/output, or duplex operation. In this example, we simply pass the input data back to the output.

+

#include "RtAudio.h"
+#include <iostream>
+
+// Pass-through function.
+int inout( void *outputBuffer, void *inputBuffer, unsigned int nBufferFrames,
+           double streamTime, RtAudioStreamStatus status, void *data )
+{
+  // Since the number of input and output channels is equal, we can do
+  // a simple buffer copy operation here.
+  if ( status ) std::cout << "Stream over/underflow detected." << std::endl;
+
+  unsigned long *bytes = (unsigned long *) data;
+  memcpy( outputBuffer, inputBuffer, *bytes );
+  return 0;
+}
+
+int main()
+{
+ RtAudio adac;
+  if ( adac.getDeviceCount() < 1 ) {
+    std::cout << "\nNo audio devices found!\n";
+    exit( 0 );
+  }
+
+  // Set the same number of channels for both input and output.
+  unsigned int bufferBytes, bufferFrames = 512;
+  RtAudio::StreamParameters iParams, oParams;
+  iParams.deviceId = 0; // first available device
+  iParams.nChannels = 2;
+  oParams.deviceId = 0; // first available device
+  oParams.nChannels = 2;
+
+  try {
+    adac.openStream( &oParams, &iParams, RTAUDIO_SINT32, 44100, &bufferFrames, &inout, (void *)&bufferBytes );
+  }
+  catch ( RtError& e ) {
+    e.printMessage();
+    exit( 0 );
+  }
+
+  bufferBytes = bufferFrames * 2 * 4;
+
+  try {
+    adac.startStream();
+
+    char input;
+    std::cout << "\nRunning ... press <enter> to quit.\n";
+    std::cin.get(input);
+
+    // Stop the stream.
+    adac.stopStream();
+  }
+  catch ( RtError& e ) {
+    e.printMessage();
+    goto cleanup;
+  }
+
+ cleanup:
+  if ( adac.isStreamOpen() ) adac.closeStream();
+
+  return 0;
+}
+

+In this example, audio recorded by the stream input will be played out during the next round of audio processing.

+Note that a duplex stream can make use of two different devices (except when using the Linux Jack and Windows ASIO APIs). However, this may cause timing problems due to possible device clock variations, unless a common external "sync" is provided.


+ + + +
©2001-2007 Gary P. Scavone, McGill University. All Rights Reserved.
Maintained by Gary P. Scavone.
+ + + diff --git a/doc/html/errors.html b/doc/html/errors.html new file mode 100644 index 0000000..d0f776a --- /dev/null +++ b/doc/html/errors.html @@ -0,0 +1,19 @@ + + +The RtAudio Home Page + + + + +
+Home   Class/Enum List   File List   Compound Members  
+
+ +

Error Handling

RtAudio makes restrained use of C++ exceptions. That is, exceptions are thrown only when system errors occur that prevent further class operation or when the user makes invalid function calls. In other cases, a warning message may be displayed and an appropriate value is returned. For example, if a system error occurs when processing the RtAudio::getDeviceCount() function, the return value is zero. In such a case, the user cannot expect to make use of most other RtAudio functions because no devices are available (and thus a stream cannot be opened). A client can call the function RtAudio::showWarnings() with a boolean argument to enable or disable the printing of warning messages to stderr. By default, warning messages are displayed. There is a protected RtAudio method, error(), that can be modified to globally control how these messages are handled and reported.
+ + + +
©2001-2007 Gary P. Scavone, McGill University. All Rights Reserved.
Maintained by Gary P. Scavone.
+ + + diff --git a/doc/html/files.html b/doc/html/files.html index eb980a1..c00be9f 100644 --- a/doc/html/files.html +++ b/doc/html/files.html @@ -1,22 +1,22 @@ -The RtAudio Tutorial +The RtAudio Home Page +
-Tutorial   Class/Enum List   File List   Compound Members  
+Home   Class/Enum List   File List   Compound Members  

RtAudio File List

Here is a list of all documented files with brief descriptions: - +
RtAudio.h [code]
RtAudio.h [code]
RtError.h [code]

- +
©2001-2005 Gary P. Scavone, McGill University. All Rights Reserved.
- Maintained by Gary P. Scavone, gary@music.mcgill.ca
©2001-2007 Gary P. Scavone, McGill University. All Rights Reserved.
Maintained by Gary P. Scavone.
diff --git a/doc/html/functions.html b/doc/html/functions.html index 870481d..2593f8d 100644 --- a/doc/html/functions.html +++ b/doc/html/functions.html @@ -1,103 +1,115 @@ -The RtAudio Tutorial +The RtAudio Home Page +
-Tutorial   Class/Enum List   File List   Compound Members  
+Home   Class/Enum List   File List   Compound Members  
-
a | c | d | g | i | l | m | n | o | p | r | s | t | u | w | ~
+
a | c | d | f | g | i | l | m | n | o | p | r | s | t | u | w | ~

Here is a list of all documented class members with links to the class documentation for each member:

- a -

+: RtAudio
  • Api +: RtAudio

    - c -

    +
  • closeStream() +: RtAudio

    - d -

    +
  • deviceId +: RtAudio::StreamParameters
  • DRIVER_ERROR +: RtError
  • duplexChannels +: RtAudio::DeviceInfo +

    - f -

    - g -

    - i -

    +: RtAudio::DeviceInfo
  • INVALID_DEVICE +: RtError
  • INVALID_PARAMETER +: RtError
  • INVALID_USE +: RtError
  • isDefaultInput +: RtAudio::DeviceInfo
  • isDefaultOutput +: RtAudio::DeviceInfo
  • isStreamOpen() +: RtAudio
  • isStreamRunning() +: RtAudio

    - l -

    - m -

    +: RtError

    - n -

    +: RtAudio::DeviceInfo
  • nativeFormats +: RtAudio::DeviceInfo
  • nChannels +: RtAudio::StreamParameters
  • NO_DEVICES_FOUND +: RtError
  • numberOfBuffers +: RtAudio::StreamOptions

    - o -

    +: RtAudio
  • outputChannels +: RtAudio::DeviceInfo

    - p -

    +: RtAudio::DeviceInfo

    - r -

    - s -

    +: RtAudio::DeviceInfo
  • showWarnings() +: RtAudio
  • startStream() +: RtAudio
  • stopStream() +: RtAudio
  • streamName +: RtAudio::StreamOptions
  • SYSTEM_ERROR +: RtError

    - t -

    +: RtError
  • Type +: RtError

    - u -

    +
  • UNIX_JACK +: RtAudio
  • UNSPECIFIED +: RtError, RtAudio

    - w -

    +
  • what() +: RtError
  • WINDOWS_ASIO +: RtAudio
  • WINDOWS_DS +: RtAudio

    - ~ -


    - +
    ©2001-2005 Gary P. Scavone, McGill University. All Rights Reserved.
    - Maintained by Gary P. Scavone, gary@music.mcgill.ca
    ©2001-2007 Gary P. Scavone, McGill University. All Rights Reserved.
    Maintained by Gary P. Scavone.
    diff --git a/doc/html/functions_enum.html b/doc/html/functions_enum.html index 66b9fa8..1e61aa3 100644 --- a/doc/html/functions_enum.html +++ b/doc/html/functions_enum.html @@ -1,25 +1,25 @@ -The RtAudio Tutorial +The RtAudio Home Page +
    -Tutorial   Class/Enum List   File List   Compound Members  
    +Home   Class/Enum List   File List   Compound Members  

    +: RtError
    - +
    ©2001-2005 Gary P. Scavone, McGill University. All Rights Reserved.
    - Maintained by Gary P. Scavone, gary@music.mcgill.ca
    ©2001-2007 Gary P. Scavone, McGill University. All Rights Reserved.
    Maintained by Gary P. Scavone.
    diff --git a/doc/html/functions_eval.html b/doc/html/functions_eval.html index be92deb..ffa7320 100644 --- a/doc/html/functions_eval.html +++ b/doc/html/functions_eval.html @@ -1,41 +1,39 @@ -The RtAudio Tutorial +The RtAudio Home Page +
    -Tutorial   Class/Enum List   File List   Compound Members  
    +Home   Class/Enum List   File List   Compound Members  

    +: RtError
  • NO_DEVICES_FOUND +: RtError
  • RTAUDIO_DUMMY +: RtAudio
  • SYSTEM_ERROR +: RtError
  • THREAD_ERROR +: RtError
  • UNIX_JACK +: RtAudio
  • UNSPECIFIED +: RtError, RtAudio
  • WINDOWS_ASIO +: RtAudio
  • WINDOWS_DS +: RtAudio
    - +
    ©2001-2005 Gary P. Scavone, McGill University. All Rights Reserved.
    - Maintained by Gary P. Scavone, gary@music.mcgill.ca
    ©2001-2007 Gary P. Scavone, McGill University. All Rights Reserved.
    Maintained by Gary P. Scavone.
    diff --git a/doc/html/functions_func.html b/doc/html/functions_func.html index 633c14e..2392291 100644 --- a/doc/html/functions_func.html +++ b/doc/html/functions_func.html @@ -1,11 +1,12 @@ -The RtAudio Tutorial +The RtAudio Home Page +
    -Tutorial   Class/Enum List   File List   Compound Members  
    +Home   Class/Enum List   File List   Compound Members  
    @@ -13,30 +14,34 @@


    - +
    ©2001-2005 Gary P. Scavone, McGill University. All Rights Reserved.
    - Maintained by Gary P. Scavone, gary@music.mcgill.ca
    ©2001-2007 Gary P. Scavone, McGill University. All Rights Reserved.
    Maintained by Gary P. Scavone.
    diff --git a/doc/html/functions_vars.html b/doc/html/functions_vars.html index 3096b37..2a18219 100644 --- a/doc/html/functions_vars.html +++ b/doc/html/functions_vars.html @@ -1,31 +1,38 @@ -The RtAudio Tutorial +The RtAudio Home Page +
    -Tutorial   Class/Enum List   File List   Compound Members  
    +Home   Class/Enum List   File List   Compound Members  

    +
  • deviceId +: RtAudio::StreamParameters
  • duplexChannels +: RtAudio::DeviceInfo
  • firstChannel +: RtAudio::StreamParameters
  • flags +: RtAudio::StreamOptions
  • inputChannels +: RtAudio::DeviceInfo
  • isDefaultInput +: RtAudio::DeviceInfo
  • isDefaultOutput +: RtAudio::DeviceInfo
  • name +: RtAudio::DeviceInfo
  • nativeFormats +: RtAudio::DeviceInfo
  • nChannels +: RtAudio::StreamParameters
  • numberOfBuffers +: RtAudio::StreamOptions
  • outputChannels +: RtAudio::DeviceInfo
  • probed +: RtAudio::DeviceInfo
  • sampleRates +: RtAudio::DeviceInfo
  • streamName +: RtAudio::StreamOptions
    - +
    ©2001-2005 Gary P. Scavone, McGill University. All Rights Reserved.
    - Maintained by Gary P. Scavone, gary@music.mcgill.ca
    ©2001-2007 Gary P. Scavone, McGill University. All Rights Reserved.
    Maintained by Gary P. Scavone.
    diff --git a/doc/html/globals.html b/doc/html/globals.html new file mode 100644 index 0000000..a63f84d --- /dev/null +++ b/doc/html/globals.html @@ -0,0 +1,28 @@ + + +The RtAudio Home Page + + + + +
    +Home   Class/Enum List   File List   Compound Members  
    +
    + + +Here is a list of all documented file members with links to the documentation: +

    +

    +
    + + + +
    ©2001-2007 Gary P. Scavone, McGill University. All Rights Reserved.
    Maintained by Gary P. Scavone.
    + + + diff --git a/doc/html/globals_enum.html b/doc/html/globals_enum.html new file mode 100644 index 0000000..340698c --- /dev/null +++ b/doc/html/globals_enum.html @@ -0,0 +1,25 @@ + + +The RtAudio Tutorial + + + + +
    +Tutorial   Class/Enum List   File List   Compound Members  
    +
    + + + +

    +

    +
    + + + +
    ©2001-2006 Gary P. Scavone, McGill University. All Rights Reserved.
    Maintained by Gary P. Scavone.
    + + + diff --git a/doc/html/globals_eval.html b/doc/html/globals_eval.html new file mode 100644 index 0000000..94d360b --- /dev/null +++ b/doc/html/globals_eval.html @@ -0,0 +1,33 @@ + + +The RtAudio Tutorial + + + + +
    +Tutorial   Class/Enum List   File List   Compound Members  
    +
    + + + +

    +

    +
    + + + +
    ©2001-2006 Gary P. Scavone, McGill University. All Rights Reserved.
    Maintained by Gary P. Scavone.
    + + + diff --git a/doc/html/globals_type.html b/doc/html/globals_type.html new file mode 100644 index 0000000..c2595f9 --- /dev/null +++ b/doc/html/globals_type.html @@ -0,0 +1,28 @@ + + +The RtAudio Home Page + + + + +
    +Home   Class/Enum List   File List   Compound Members  
    +
    + + + +

    +

    +
    + + + +
    ©2001-2007 Gary P. Scavone, McGill University. All Rights Reserved.
    Maintained by Gary P. Scavone.
    + + + diff --git a/doc/html/index.html b/doc/html/index.html index 8cc5c27..125e928 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -1,596 +1,51 @@ -The RtAudio Tutorial +The RtAudio Home Page +
    -Tutorial   Class/Enum List   File List   Compound Members  
    +Home   Class/Enum List   File List   Compound Members  
    -

    The RtAudio Tutorial

    +

    The RtAudio Home Page

    -

    Introduction    What's New (Version 3.0)   Download    Getting Started    Error Handling    Probing Device Capabilities    Device Settings    Playback (blocking functionality)    Playback (callback functionality)    Recording    Duplex Mode    Using Simultaneous Multiple APIs    Summary of Methods    Compiling    Debugging    API Notes    Possible Future Changes    Acknowledgements    License

    -Introduction

    -RtAudio is a set of C++ classes which provide a common API (Application Programming Interface) for realtime audio input/output across Linux (native ALSA, JACK, and OSS), Macintosh OS X, SGI, and Windows (DirectSound and ASIO) operating systems. RtAudio significantly simplifies the process of interacting with computer audio hardware. It was designed with the following goals:

    +

    4.0

    RtAudio is a set of C++ classes that provide a common API (Application Programming Interface) for realtime audio input/output across Linux, Macintosh OS-X and Windows (DirectSound and ASIO) operating systems. RtAudio significantly simplifies the process of interacting with computer audio hardware. It was designed with the following objectives:

    • -object oriented C++ design
    • +object-oriented C++ design
    • simple, common API across all supported platforms
    • -only two header files and one source file for easy inclusion in programming projects
    • +only one source and two header files for easy inclusion in programming projects
    • allow simultaneous multi-api support
    • -blocking functionality
    • +support dynamic connection of devices
    • -callback functionality
    • +provide extensive audio device parameter control
    • -extensive audio device parameter control
    • +allow audio device capability probing
    • -audio device capability probing
    • -
    • -automatic internal conversion for data format, channel number compensation, de-interleaving, and byte-swapping
    • +automatic internal conversion for data format, channel number compensation, (de)interleaving, and byte-swapping

    -RtAudio incorporates the concept of audio streams, which represent audio output (playback) and/or input (recording). Available audio devices and their capabilities can be enumerated and then specified when opening a stream. Where applicable, multiple API support can be compiled and a particular API specified when creating an RtAudio instance. See the API Notes section for information specific to each of the supported audio APIs.

    -The RtAudio API provides both blocking (synchronous) and callback (asynchronous) functionality. Callbacks are typically used in conjunction with graphical user interfaces (GUI). Blocking functionality is often necessary for explicit control of multiple input/output stream synchronization or when audio must be synchronized with other system events.

    -What's New (Version 3.0)

    -RtAudio now allows simultaneous multi-api support. For example, you can compile RtAudio to provide both DirectSound and ASIO support on Windows platforms or ALSA, JACK, and OSS support on Linux platforms. This was accomplished by creating an abstract base class, RtApi, with subclasses for each supported API (RtApiAlsa, RtApiJack, RtApiOss, RtApiDs, RtApiAsio, RtApiCore, and RtApiAl). The class RtAudio is now a "controller" which creates an instance of an RtApi subclass based on the user's API choice via an optional RtAudio::RtAudioApi instantiation argument. If no API is specified, RtAudio attempts to make a "logical" API selection.

    -Support for the JACK low-latency audio server has been added with this version of RtAudio. It is necessary to have the JACK server running before creating an instance of RtAudio.

    -Several API changes have been made in version 3.0 of RtAudio in an effort to provide more consistent behavior across all supported audio APIs. The most significant of these changes is that multiple stream support from a single RtAudio instance has been discontinued. As a result, stream identifier input arguments are no longer required. Also, the RtAudio::streamWillBlock() function was poorly supported by most APIs and has been deprecated (though the function still exists in those subclasses of RtApi that do allow it to be implemented).

    -The RtAudio::getDeviceInfo() function was modified to return a globally defined RtAudioDeviceInfo structure. This structure is a simplified version of the previous RTAUDIO_DEVICE structure. In addition, the RTAUDIO_FORMAT structure was renamed RtAudioFormat and defined globally within RtAudio.h. These changes were made for clarity and to better conform with standard C++ programming practices.

    -The RtError class declaration and definition have been extracted to a separate file (RtError.h). This was done in preparation for a new release of the RtMidi class (planned for Summer 2004).

    -Download

    -Latest Release (18 November 2005): Version 3.0.3

    -Getting Started

    -With version 3.0, it is now possible to compile multiple API support on a given platform and to specify an API choice during class instantiation. In the examples that follow, no API will be specified (in which case, RtAudio attempts to select the most "logical" available API).

    -The first thing that must be done when using RtAudio is to create an instance of the class. The default constructor scans the underlying audio system to verify that at least one device is available. RtAudio often uses C++ exceptions to report errors, necessitating try/catch blocks around most member functions. The following code example demonstrates default object construction and destruction:

    -

    #include "RtAudio.h"
    -
    -int main()
    -{
    -  RtAudio *audio = 0;
    -
    -  // Default RtAudio constructor
    -  try {
    -    audio = new RtAudio();
    -  }
    -  catch (RtError &error) {
    -    // Handle the exception here
    -    error.printMessage();
    -  }
    -
    -  // Clean up
    -  delete audio;
    -}
    -

    -Obviously, this example doesn't demonstrate any of the real functionality of RtAudio. However, all uses of RtAudio must begin with a constructor (either default or overloaded varieties) and must end with class destruction. Further, it is necessary that all class methods that can throw a C++ exception be called within a try/catch block.

    -Error Handling

    -RtAudio uses a C++ exception handler called RtError, which is declared and defined in RtError.h. The RtError class is quite simple but it does allow errors to be "caught" by RtError::Type. Almost all RtAudio methods can "throw" an RtError, most typically if a driver error occurs or a stream function is called when no stream is open. There are a number of cases within RtAudio where warning messages may be displayed but an exception is not thrown. There is a protected RtAudio method, error(), that can be modified to globally control how these messages are handled and reported. By default, error messages are not automatically displayed in RtAudio unless the preprocessor definition __RTAUDIO_DEBUG__ is defined. Messages associated with caught exceptions can be displayed with, for example, the RtError::printMessage() function.

    -Probing Device Capabilities

    -A programmer may wish to query the available audio device capabilities before deciding which to use. The following example outlines how this can be done.

    -

    // probe.cpp
    -
    -#include <iostream>
    -#include "RtAudio.h"
    -
    -int main()
    -{
    -  RtAudio *audio = 0;
    -
    -  // Default RtAudio constructor
    -  try {
    -    audio = new RtAudio();
    -  }
    -  catch (RtError &error) {
    -    error.printMessage();
    -    exit(EXIT_FAILURE);
    -  }
    -
    -  // Determine the number of devices available
    -  int devices = audio->getDeviceCount();
    -
    -  // Scan through devices for various capabilities
    -  RtAudioDeviceInfo info;
    -  for (int i=1; i<=devices; i++) {
    -
    -    try {
    -      info = audio->getDeviceInfo(i);
    -    }
    -    catch (RtError &error) {
    -      error.printMessage();
    -      break;
    -    }
    -
    -    // Print, for example, the maximum number of output channels for each device
    -    std::cout << "device = " << i;
    -    std::cout << ": maximum output channels = " << info.outputChannels << "\n";
    -  }
    -
    -  // Clean up
    -  delete audio;
    -
    -  return 0;
    -}
    -

    -The RtAudioDeviceInfo structure is defined in RtAudio.h and provides a variety of information useful in assessing the capabilities of a device:

    -

      typedef struct RtAudioDeviceInfo{
    -    std::string name;             // Character string device identifier.
    -    bool probed;                  // true if the device capabilities were successfully probed.
    -    int outputChannels;           // Maximum output channels supported by device.
    -    int inputChannels;            // Maximum input channels supported by device.
    -    int duplexChannels;           // Maximum simultaneous input/output channels supported by device.
    -    bool isDefault;               // true if this is the default output or input device.
    -    std::vector<int> sampleRates; // Supported sample rates.
    -    RtAudioFormat nativeFormats;  // Bit mask of supported data formats.
    -  };
    -

    -The following data formats are defined and fully supported by RtAudio:

    -

      typedef unsigned long RtAudioFormat;
    -  static const RtAudioFormat  RTAUDIO_SINT8;   // Signed 8-bit integer
    -  static const RtAudioFormat  RTAUDIO_SINT16;  // Signed 16-bit integer
    -  static const RtAudioFormat  RTAUDIO_SINT24;  // Signed 24-bit integer (upper 3 bytes of 32-bit signed integer.)
    -  static const RtAudioFormat  RTAUDIO_SINT32;  // Signed 32-bit integer
    -  static const RtAudioFormat  RTAUDIO_FLOAT32; // 32-bit float normalized between +/- 1.0
    -  static const RtAudioFormat  RTAUDIO_FLOAT64; // 64-bit double normalized between +/- 1.0
    -

    -The nativeFormats member of the RtAudioDeviceInfo structure is a bit mask of the above formats that are natively supported by the device. However, RtAudio will automatically provide format conversion if a particular format is not natively supported. When the probed member of the RtAudioDeviceInfo structure is false, the remaining structure members are undefined and the device is probably unuseable.

    -While some audio devices may require a minimum channel value greater than one, RtAudio will provide automatic channel number compensation when the number of channels set by the user is less than that required by the device. Channel compensation is NOT possible when the number of channels set by the user is greater than that supported by the device.

    -It should be noted that the capabilities reported by a device driver or underlying audio API are not always accurate and/or may be dependent on a combination of device settings. For this reason, RtAudio does not typically rely on the queried values when attempting to open a stream.

    -Device Settings

    -The next step in using RtAudio is to open a stream with particular device and parameter settings.

    -

    #include "RtAudio.h"
    -
    -int main()
    -{
    -  int channels = 2;
    -  int sampleRate = 44100;
    -  int bufferSize = 256;  // 256 sample frames
    -  int nBuffers = 4;      // number of internal buffers used by device
    -  int device = 0;        // 0 indicates the default or first available device
    -  RtAudio *audio = 0;
    -
    -  // Instantiate RtAudio and open a stream within a try/catch block
    -  try {
    -    audio = new RtAudio();
    -  }
    -  catch (RtError &error) {
    -    error.printMessage();
    -    exit(EXIT_FAILURE);
    -  }
    -
    -  try {
    -    audio->openStream(device, channels, 0, 0, RTAUDIO_FLOAT32,
    -                      sampleRate, &bufferSize, nBuffers);
    -  }
    -  catch (RtError &error) {
    -    error.printMessage();
    -    // Perhaps try other parameters?
    -  }
    -
    -  // Clean up
    -  delete audio;
    -
    -  return 0;
    -}
    -

    -The RtAudio::openStream() method attempts to open a stream with a specified set of parameter values. In this case, we attempt to open a two channel playback stream with the default output device, 32-bit floating point data, a sample rate of 44100 Hz, a frame rate of 256 sample frames per read/write, and 4 internal device buffers. When device = 0, RtAudio first attempts to open the default audio device with the given parameters. If that attempt fails, RtAudio searches through the remaining available devices in an effort to find a device that will meet the given parameters. If all attempts are unsuccessful, an RtError is thrown. When a non-zero device value is specified, an attempt is made to open that device ONLY (device = 1 specifies the first identified device, as reported by RtAudio::getDeviceInfo()).

    -RtAudio provides four signed integer and two floating point data formats that can be specified using the RtAudioFormat parameter values mentioned earlier. If the opened device does not natively support the given format, RtAudio will automatically perform the necessary data format conversion.

    -The bufferSize parameter specifies the desired number of sample frames that will be written to and/or read from a device per write/read operation. The nBuffers parameter is used in setting the underlying device buffer parameters. Both the bufferSize and nBuffers parameters can be used to control stream latency though there is no guarantee that the passed values will be those used by a device (the nBuffers parameter is ignored when using the OS X CoreAudio, Linux Jack, and the Windows ASIO APIs). In general, lower values for both parameters will produce less latency but perhaps less robust performance. Both parameters can be specified with values of zero, in which case the smallest allowable values will be used. The bufferSize parameter is passed as a pointer and the actual value used by the stream is set during the device setup procedure. bufferSize values should be a power of two. Optimal and allowable buffer values tend to vary between systems and devices. Check the API Notes section for general guidelines.

    -As noted earlier, the device capabilities reported by a driver or underlying audio API are not always accurate and/or may be dependent on a combination of device settings. Because of this, RtAudio does not attempt to query a device's capabilities or use previously reported values when opening a device. Instead, RtAudio simply attempts to set the given parameters on a specified device and then checks whether the setup is successful or not.

    -Playback (blocking functionality)

    -Once the device is open for playback, there are only a few final steps necessary for realtime audio output. We'll first provide an example (blocking functionality) and then discuss the details.

    -

    // playback.cpp
    -
    -#include "RtAudio.h"
    -
    -int main()
    -{
    -  int count;
    -  int channels = 2;
    -  int sampleRate = 44100;
    -  int bufferSize = 256;  // 256 sample frames
    -  int nBuffers = 4;      // number of internal buffers used by device
    -  float *buffer;
    -  int device = 0;        // 0 indicates the default or first available device
    -  RtAudio *audio = 0;
    -
    -  // Open a stream during RtAudio instantiation
    -  try {
    -    audio = new RtAudio(device, channels, 0, 0, RTAUDIO_FLOAT32,
    -                        sampleRate, &bufferSize, nBuffers);
    -  }
    -  catch (RtError &error) {
    -    error.printMessage();
    -    exit(EXIT_FAILURE);
    -  }
    -
    -  try {
    -    // Get a pointer to the stream buffer
    -    buffer = (float *) audio->getStreamBuffer();
    -
    -    // Start the stream
    -    audio->startStream();
    -  }
    -  catch (RtError &error) {
    -    error.printMessage();
    -    goto cleanup;
    -  }
    -
    -  // An example loop that runs for 40000 sample frames
    -  count = 0;
    -  while (count < 40000) {
    -    // Generate your samples and fill the buffer with bufferSize sample frames of data
    -    ...
    -
    -    // Trigger the output of the data buffer
    -    try {
    -      audio->tickStream();
    -    }
    -    catch (RtError &error) {
    -      error.printMessage();
    -      goto cleanup;
    -    }
    -
    -    count += bufferSize;
    -  }
    -
    -  try {
    -    // Stop and close the stream
    -    audio->stopStream();
    -    audio->closeStream();
    -  }
    -  catch (RtError &error) {
    -    error.printMessage();
    -  }
    -
    - cleanup:
    -  delete audio;
    -
    -  return 0;
    -}
    -

    -The first thing to notice in this example is that we attempt to open a stream during class instantiation with an overloaded constructor. This constructor simply combines the functionality of the default constructor, used earlier, and the RtAudio::openStream() method. Again, we have specified a device value of 0, indicating that the default or first available device meeting the given parameters should be used. An attempt is made to open the stream with the specified bufferSize value. However, it is possible that the device will not accept this value, in which case the closest allowable size is used and returned via the pointer value. The constructor can fail if no available devices are found, or a memory allocation or device driver error occurs. Note that you should not call the RtAudio destructor if an exception is thrown during instantiation.

    -Assuming the constructor is successful, it is necessary to get a pointer to the buffer, provided by RtAudio, for use in feeding data to/from the opened stream. Note that the user should NOT attempt to deallocate the stream buffer memory ... memory management for the stream buffer will be automatically controlled by RtAudio. After starting the stream with RtAudio::startStream(), one simply fills that buffer, which is of length equal to the returned bufferSize value, with interleaved audio data (in the specified format) for playback. Finally, a call to the RtAudio::tickStream() routine triggers a blocking write call for the stream.

    -In general, one should call the RtAudio::stopStream() and RtAudio::closeStream() methods after finishing with a stream. However, both methods will implicitly be called during object destruction if necessary.

    -Playback (callback functionality)

    -The primary difference in using RtAudio with callback functionality involves the creation of a user-defined callback function. Here is an example that produces a sawtooth waveform for playback.

    -

    #include <iostream>
    -#include "RtAudio.h"
    -
    -// Two-channel sawtooth wave generator.
    -int sawtooth(char *buffer, int bufferSize, void *data)
    -{
    -  int i, j;
    -  double *my_buffer = (double *) buffer;
    -  double *my_data = (double *) data;
    -
    -  // Write interleaved audio data.
    -  for (i=0; i<bufferSize; i++) {
    -    for (j=0; j<2; j++) {
    -      *my_buffer++ = my_data[j];
    -
    -      my_data[j] += 0.005 * (j+1+(j*0.1));
    -      if (my_data[j] >= 1.0) my_data[j] -= 2.0;
    -    }
    -  }
    -
    -  return 0;
    -}
    -
    -int main()
    -{
    -  int channels = 2;
    -  int sampleRate = 44100;
    -  int bufferSize = 256;  // 256 sample frames
    -  int nBuffers = 4;      // number of internal buffers used by device
    -  int device = 0;        // 0 indicates the default or first available device
    -  double data[2];
    -  char input;
    -  RtAudio *audio = 0;
    -
    -  // Open a stream during RtAudio instantiation
    -  try {
    -    audio = new RtAudio(device, channels, 0, 0, RTAUDIO_FLOAT64,
    -                        sampleRate, &bufferSize, nBuffers);
    -  }
    -  catch (RtError &error) {
    -    error.printMessage();
    -    exit(EXIT_FAILURE);
    -  }
    -
    -  try {
    -    // Set the stream callback function
    -    audio->setStreamCallback(&sawtooth, (void *)data);
    -
    -    // Start the stream
    -    audio->startStream();
    -  }
    -  catch (RtError &error) {
    -    error.printMessage();
    -    goto cleanup;
    -  }
    -
    -  std::cout << "\nPlaying ... press <enter> to quit.\n";
    -  std::cin.get(input);
    -
    -  try {
    -    // Stop and close the stream
    -    audio->stopStream();
    -    audio->closeStream();
    -  }
    -  catch (RtError &error) {
    -    error.printMessage();
    -  }
    -
    - cleanup:
    -  delete audio;
    -
    -  return 0;
    -}
    -

    -After opening the device in exactly the same way as the previous example (except with a data format change), we must set our callback function for the stream using RtAudio::setStreamCallback(). When the underlying audio API uses blocking calls (OSS, ALSA, SGI, and Windows DirectSound), this method will spawn a new process (or thread) that automatically calls the callback function when more data is needed. Callback-based audio APIs (OS X CoreAudio Linux Jack, and ASIO) implement their own event notification schemes. Note that the callback function is called only when the stream is "running" (between calls to the RtAudio::startStream() and RtAudio::stopStream() methods). The last argument to RtAudio::setStreamCallback() is a pointer to arbitrary data that you wish to access from within your callback function.

    -In this example, we stop the stream with an explicit call to RtAudio::stopStream(). When using callback functionality, it is also possible to stop a stream by returning a non-zero value from the callback function.

    -Once set with RtAudio::setStreamCallback, the callback process exists for the life of the stream (until the stream is closed with RtAudio::closeStream() or the RtAudio instance is deleted). It is possible to disassociate a callback function and cancel its process for an open stream using the RtAudio::cancelStreamCallback() method. The stream can then be used with blocking functionality or a new callback can be associated with it.

    -Recording

    -Using RtAudio for audio input is almost identical to the way it is used for playback. Here's the blocking playback example rewritten for recording:

    -

    // record.cpp
    -
    -#include "RtAudio.h"
    -
    -int main()
    -{
    -  int count;
    -  int channels = 2;
    -  int sampleRate = 44100;
    -  int bufferSize = 256;  // 256 sample frames
    -  int nBuffers = 4;      // number of internal buffers used by device
    -  float *buffer;
    -  int device = 0;        // 0 indicates the default or first available device
    -  RtAudio *audio = 0;
    -
    -  // Instantiate RtAudio and open a stream.
    -  try {
    -    audio = new RtAudio(&stream, 0, 0, device, channels,
    -                        RTAUDIO_FLOAT32, sampleRate, &bufferSize, nBuffers);
    -  }
    -  catch (RtError &error) {
    -    error.printMessage();
    -    exit(EXIT_FAILURE);
    -  }
    -
    -  try {
    -    // Get a pointer to the stream buffer
    -    buffer = (float *) audio->getStreamBuffer();
    -
    -    // Start the stream
    -    audio->startStream();
    -  }
    -  catch (RtError &error) {
    -    error.printMessage();
    -    goto cleanup;
    -  }
    -
    -  // An example loop that runs for about 40000 sample frames
    -  count = 0;
    -  while (count < 40000) {
    -
    -    // Read a buffer of data
    -    try {
    -      audio->tickStream();
    -    }
    -    catch (RtError &error) {
    -      error.printMessage();
    -      goto cleanup;
    -    }
    -
    -    // Process the input samples (bufferSize sample frames) that were read
    -    ...
    -
    -    count += bufferSize;
    -  }
    -
    -  try {
    -    // Stop the stream
    -    audio->stopStream();
    -  }
    -  catch (RtError &error) {
    -    error.printMessage();
    -  }
    -
    - cleanup:
    -  delete audio;
    -
    -  return 0;
    -}
    -

    -In this example, the stream was opened for recording with a non-zero inputChannels value. The only other difference between this example and that for playback involves the order of data processing in the loop, where it is necessary to first read a buffer of input data before manipulating it.

    -Duplex Mode

    -Finally, it is easy to use RtAudio for simultaneous audio input/output, or duplex operation. In this example, we use a callback function and simply scale the input data before sending it back to the output.

    -

    // duplex.cpp
    -
    -#include <iostream>
    -#include "RtAudio.h"
    -
    -// Pass-through function.
    -int scale(char *buffer, int bufferSize, void *)
    -{
    -  // Note: do nothing here for pass through.
    -  double *my_buffer = (double *) buffer;
    -
    -  // Scale input data for output.
    -  for (int i=0; i<bufferSize; i++) {
    -    // Do for two channels.
    -    *my_buffer++ *= 0.5;
    -    *my_buffer++ *= 0.5;
    -  }
    -
    -  return 0;
    -}
    -
    -int main()
    -{
    -  int channels = 2;
    -  int sampleRate = 44100;
    -  int bufferSize = 256;  // 256 sample frames
    -  int nBuffers = 4;      // number of internal buffers used by device
    -  int device = 0;        // 0 indicates the default or first available device
    -  char input;
    -  RtAudio *audio = 0;
    -
    -  // Open a stream during RtAudio instantiation
    -  try {
    -    audio = new RtAudio(device, channels, device, channels, RTAUDIO_FLOAT64,
    -                        sampleRate, &bufferSize, nBuffers);
    -  }
    -  catch (RtError &error) {
    -    error.printMessage();
    -    exit(EXIT_FAILURE);
    -  }
    -
    -  try {
    -    // Set the stream callback function
    -    audio->setStreamCallback(&scale, NULL);
    -
    -    // Start the stream
    -    audio->startStream();
    -  }
    -  catch (RtError &error) {
    -    error.printMessage();
    -    goto cleanup;
    -  }
    -
    -  std::cout << "\nRunning duplex ... press <enter> to quit.\n";
    -  std::cin.get(input);
    -
    -  try {
    -    // Stop and close the stream
    -    audio->stopStream();
    -    audio->closeStream();
    -  }
    -  catch (RtError &error) {
    -    error.printMessage();
    -  }
    -
    - cleanup:
    -  delete audio;
    -
    -  return 0;
    -}
    -

    -When an RtAudio stream is running in duplex mode (nonzero input AND output channels), the audio write (playback) operation always occurs before the audio read (record) operation. This sequence allows the use of a single buffer to store both output and input data.

    -As we see with this example, the write-read sequence of operations does not preclude the use of RtAudio in situations where input data is first processed and then output through a duplex stream. When the stream buffer is first allocated, it is initialized with zeros, which produces no audible result when output to the device. In this example, anything recorded by the audio stream input will be scaled and played out during the next round of audio processing.

    -Note that duplex operation can also be achieved by opening one output stream instance and one input stream instance using the same or different devices. However, there may be timing problems when attempting to use two different devices, due to possible device clock variations, unless a common external "sync" is provided. This becomes even more difficult to achieve using two separate callback streams because it is not possible to explicitly control the calling order of the callback functions.

    -Using Simultaneous Multiple APIs

    -Because support for each audio API is encapsulated in a specific RtApi subclass, it is possible to compile and instantiate multiple API-specific subclasses on a given operating system. For example, one can compile both the RtApiDs and RtApiAsio classes on Windows operating systems by providing the appropriate preprocessor definitions, include files, and libraries for each. In a run-time situation, one might first attempt to determine whether any ASIO device drivers exist. This can be done by specifying the api argument RtAudio::WINDOWS_ASIO when attempting to create an instance of RtAudio. If an RtError is thrown (indicating no available drivers), then an instance of RtAudio with the api argument RtAudio::WINDOWS_DS can be created. Alternately, if no api argument is specified, RtAudio will first look for ASIO drivers and then DirectSound drivers (on Linux systems, the default API search order is Jack, Alsa, and finally OSS). In theory, it should also be possible to have separate instances of RtAudio open at the same time with different underlying audio API support, though this has not been tested. It is difficult to know how well different audio APIs can simultaneously coexist on a given operating system. In particular, it is most unlikely that the same device could be simultaneously controlled with two different audio APIs.

    -Summary of Methods

    -The following is a short summary of public methods (not including constructors and the destructor) provided by RtAudio:

    -

    -

    -Compiling

    -In order to compile RtAudio for a specific OS and audio API, it is necessary to supply the appropriate preprocessor definition and library within the compiler statement:

    - - - - - - - - - - - - - - - - - -
    OS: Audio API: C++ Class: Preprocessor Definition: Library or Framework: Example Compiler Statement:
    Linux ALSA RtApiAlsa __LINUX_ALSA__ asound, pthread g++ -Wall -D__LINUX_ALSA__ -o probe probe.cpp RtAudio.cpp -lasound -lpthread
    Linux Jack Audio Server RtApiJack __LINUX_JACK__ jack, pthread g++ -Wall -D__LINUX_JACK__ -o probe probe.cpp RtAudio.cpp `pkg-config --cflags --libs jack` -lpthread
    Linux OSS RtApiOss __LINUX_OSS__ pthread g++ -Wall -D__LINUX_OSS__ -o probe probe.cpp RtAudio.cpp -lpthread
    Macintosh OS X CoreAudio RtApiCore __MACOSX_CORE__ pthread, stdc++, CoreAudio g++ -Wall -D__MACOSX_CORE__ -o probe probe.cpp RtAudio.cpp -framework CoreAudio -lpthread
    Irix AL RtApiAl __IRIX_AL__ audio, pthread CC -Wall -D__IRIX_AL__ -o probe probe.cpp RtAudio.cpp -laudio -lpthread
    Windows Direct Sound RtApiDs __WINDOWS_DS__ dsound.lib (ver. 5.0 or higher), multithreaded compiler specific
    Windows ASIO RtApiAsio __WINDOWS_ASIO__ various ASIO header and source files compiler specific
    +RtAudio incorporates the concept of audio streams, which represent audio output (playback) and/or input (recording). Available audio devices and their capabilities can be enumerated and then specified when opening a stream. Where applicable, multiple API support can be compiled and a particular API specified when creating an RtAudio instance. See the API Notes section for information specific to each of the supported audio APIs.

    +What's New (Version 4.0)

    +RtAudio V4 represents a significant rewrite of the code and includes a number of API and functionality changes form previous versions. A partial list of the changes includes:
      +
    • new support for non-interleaved user data
    • additional input/output parameter specifications, including channel offset
    • new support for dynamic connection of devices
    • new support for stream time
    • revised callback arguments, including separate input and output buffer arguments
    • revised C++ exception handling
    • updated support for OSS version 4.0
    • discontinued support of blocking functionality
    • discontinued support of SGI

    -The example compiler statements above could be used to compile the probe.cpp example file, assuming that probe.cpp, RtAudio.h, RtError.h, and RtAudio.cpp all exist in the same directory.

    -Debugging

    -If you are having problems getting RtAudio to run on your system, try passing the preprocessor definition __RTAUDIO_DEBUG__ to the compiler (or uncomment the definition at the bottom of RtAudio.h). A variety of warning messages will be displayed that may help in determining the problem. Also try using the programs included in the test directory. The program info displays the queried capabilities of all hardware devices found.

    -API Notes

    -RtAudio is designed to provide a common API across the various supported operating systems and audio libraries. Despite that, some issues should be mentioned with regard to each.

    -Linux:

    -RtAudio for Linux was developed under Redhat distributions 7.0 - Fedora. Three different audio APIs are supported on Linux platforms: OSS, ALSA, and Jack. The OSS API has existed for at least 6 years and the Linux kernel is distributed with free versions of OSS audio drivers. Therefore, a generic Linux system is most likely to have OSS support (though the availability and quality of OSS drivers for new hardware is decreasing). The ALSA API, although relatively new, is now part of the Linux development kernel and offers significantly better functionality than the OSS API. RtAudio provides support for the 1.0 and higher versions of ALSA. Jack, which is still in development, is a low-latency audio server, written primarily for the GNU/Linux operating system. It can connect a number of different applications to an audio device, as well as allow them to share audio between themselves. Input/output latency on the order of 15 milliseconds can typically be achieved using any of the Linux APIs by fine-tuning the RtAudio buffer parameters (without kernel modifications). Latencies on the order of 5 milliseconds or less can be achieved using a low-latency kernel patch and increasing FIFO scheduling priority. The pthread library, which is used for callback functionality, is a standard component of all Linux distributions.

    -The ALSA library includes OSS emulation support. That means that you can run programs compiled for the OSS API even when using the ALSA drivers and library. It should be noted however that OSS emulation under ALSA is not perfect. Specifically, channel number queries seem to consistently produce invalid results. While OSS emulation is successful for the majority of RtAudio tests, it is recommended that the native ALSA implementation of RtAudio be used on systems that have ALSA drivers installed.

    -The ALSA implementation of RtAudio makes no use of the ALSA "plug" interface. All necessary data format conversions, channel compensation, de-interleaving, and byte-swapping is handled by internal RtAudio routines.

    -The Jack API is based on a callback scheme. RtAudio provides blocking functionality, in addition to callback functionality, within the context of that behavior. It should be noted, however, that the best performance is achieved when using RtAudio's callback functionality with the Jack API. At the moment, only one RtAudio instance can be connected to the Jack server. Because RtAudio does not provide a mechanism for allowing the user to specify particular channels (or ports) of a device, it simply opens the first N enumerated Jack ports for input/output.

    -Macintosh OS X (CoreAudio):

    -The Apple CoreAudio API is based on a callback scheme. RtAudio provides blocking functionality, in addition to callback functionality, within the context of that behavior. CoreAudio is designed to use a separate callback procedure for each of its audio devices. A single RtAudio duplex stream using two different devices is supported, though it cannot be guaranteed to always behave correctly because we cannot synchronize these two callbacks. This same functionality might be achieved with better synchrony by creating separate instances of RtAudio for each device and making use of RtAudio blocking calls (i.e. RtAudio::tickStream()). The numberOfBuffers parameter to the RtAudio::openStream() function has no affect in this implementation.

    -It is not possible to have multiple instances of RtAudio accessing the same CoreAudio device.

    -Irix (SGI):

    -The Irix version of RtAudio was written and tested on an SGI Indy running Irix version 6.5.4 and the newer "al" audio library. RtAudio does not compile under Irix version 6.3, mainly because the C++ compiler is too old. Despite the relatively slow speed of the Indy, RtAudio was found to behave quite well and input/output latency was very good. No problems were found with respect to using the pthread library.

    -Windows (DirectSound):

    -In order to compile RtAudio under Windows for the DirectSound API, you must have the header and source files for DirectSound version 5.0 or higher. As far as I know, there is no DirectSoundCapture support for Windows NT. Audio output latency with DirectSound can be reasonably good, especially since RtAudio version 3.0.2. Input audio latency still tends to be bad but better since version 3.0.2. RtAudio was originally developed with Visual C++ version 6.0 but has been tested with .NET.

    -The DirectSound version of RtAudio can be compiled with or without the UNICODE preprocessor definition.

    -Windows (ASIO):

    -The Steinberg ASIO audio API is based on a callback scheme. In addition, the API allows only a single device driver to be loaded and accessed at a time. ASIO device drivers must be supplied by audio hardware manufacturers, though ASIO emulation is possible on top of systems with DirectSound drivers. The numberOfBuffers parameter to the RtAudio::openStream() function has no affect in this implementation.

    -A number of ASIO source and header files are required for use with RtAudio. Specifically, an RtAudio project must include the following files: asio.h,cpp; asiodrivers.h,cpp; asiolist.h,cpp; asiodrvr.h; asiosys.h; ginclude.h; iasiodrv.h; iasiothiscallresolver.h,cpp. The Visual C++ projects found in /tests/Windows/ compile both ASIO and DirectSound support.

    -The Steinberg provided asiolist class does not compile when the preprocessor definition UNICODE is defined. Note that this could be an issue when using RtAudio with Qt, though Qt programs appear to compile without the UNICODE definition (try DEFINES -= UNICODE in your .pro file). RtAudio with ASIO support has been tested using the MinGW compiler under Windows XP, as well as in the Visual Studio environment.

    -Possible Future Changes

    -There are a few issues that still need to be addressed in future versions of RtAudio, including:

    -

      -
    • -Provide a mechanism so the user can "pre-fill" audio output buffers to allow precise measurement of an acoustic response;
    • -
    • -Allow the user to read / write non-interleaved data to / from the audio buffer;
    • -
    • -Further support in Windows OS for multi-channel (>2) input / output. This is currently only possible with ASIO interface (in large part due to limitations with the DirectSound API). But perhaps a port to the WinMM API should be investigated?
    • -
    • -Investigate the possibility of allowing the user to select specific channels of a soundcard. For example, if an audio device supports 8 channels and the user wishes to send data out channels 7-8 only, it is currently necessary to open all 8 channels and write the two channels of output data to the correct positions in each audio frame of an interleaved data buffer.
    • -
    -

    -Acknowledgements

    -Many thanks to the following people for providing bug fixes and improvements:
      -
    • -Robin Davies (Windows DS and ASIO)
    • -
    • -Ryan Williams (Windows non-MS compiler ASIO support)
    • -
    • -Ed Wildgoose (Linux ALSA and Jack)
    • -
    -

    -The RtAudio API incorporates many of the concepts developed in the PortAudio project by Phil Burk and Ross Bencina. Early development also incorporated ideas from Bill Schottstaedt's sndlib. The CCRMA SoundWire group provided valuable feedback during the API proposal stages.

    -The early 2.0 version of RtAudio was slowly developed over the course of many months while in residence at the Institut Universitari de L'Audiovisual (IUA) in Barcelona, Spain and the Laboratory of Acoustics and Audio Signal Processing at the Helsinki University of Technology, Finland. Much subsequent development happened while working at the Center for Computer Research in Music and Acoustics (CCRMA) at Stanford University. The most recent version of RtAudio was finished while working as an assistant professor of Music Technology at McGill University. This work was supported in part by the United States Air Force Office of Scientific Research (grant #F49620-99-1-0293).

    -License

    -RtAudio: a realtime audio i/o C++ classes
    - Copyright (c) 2001-2005 Gary P. Scavone

    -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    -Any person wishing to distribute modifications to the Software is requested to send the modifications to the original developer so that they can be incorporated into the canonical version.

    -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


    +Devices are now re-enumerated every time the RtAudio::getDeviceCount(), RtAudio::getDeviceInfo(), and RtAudio::openStream() functions are called. This allows for the proper identification of hot-pluggable (USB, Firewire, ...) devices while a given RtAudio instance exists.

    +Download

    +Latest Release (7 August 2007): Version 4.0.0

    +Documentation Links

    +
      +
    1. Error Handling
    2. Probing Device Capabilities
    3. Device Settings
    4. Playback
    5. Recording
    6. Duplex Mode
    7. Using Simultaneous Multiple APIs
    8. Debugging & Compiling
    9. API Notes
    10. Acknowledgements
    11. License
    12. Bug Tracker
    13. Possible Updates
    14. RtAudio at SourceForge
    +
    - +
    ©2001-2005 Gary P. Scavone, McGill University. All Rights Reserved.
    - Maintained by Gary P. Scavone, gary@music.mcgill.ca
    ©2001-2007 Gary P. Scavone, McGill University. All Rights Reserved.
    Maintained by Gary P. Scavone.
    diff --git a/doc/html/license.html b/doc/html/license.html new file mode 100644 index 0000000..82bc787 --- /dev/null +++ b/doc/html/license.html @@ -0,0 +1,24 @@ + + +The RtAudio Home Page + + + + +
    +Home   Class/Enum List   File List   Compound Members  
    +
    + +

    License

    RtAudio: a set of realtime audio i/o C++ classes
    + Copyright (c) 2001-2007 Gary P. Scavone

    +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    +Any person wishing to distribute modifications to the Software is asked to send the modifications to the original developer so that they can be incorporated into the canonical version. This is, however, not a binding provision of this license.

    +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


    + + + +
    ©2001-2007 Gary P. Scavone, McGill University. All Rights Reserved.
    Maintained by Gary P. Scavone.
    + + + diff --git a/doc/html/multi.html b/doc/html/multi.html new file mode 100644 index 0000000..371aa8a --- /dev/null +++ b/doc/html/multi.html @@ -0,0 +1,20 @@ + + +The RtAudio Home Page + + + + +
    +Home   Class/Enum List   File List   Compound Members  
    +
    + +

    Using Simultaneous Multiple APIs

    Because support for each audio API is encapsulated in a specific RtApi subclass, it is possible to compile and instantiate multiple API-specific subclasses on a given operating system. For example, one can compile both the RtApiDs and RtApiAsio classes on Windows operating systems by providing the appropriate preprocessor definitions, include files, and libraries for each. In a run-time situation, one might first attempt to determine whether any ASIO device drivers exist. This can be done by specifying the api argument RtAudio::WINDOWS_ASIO when attempting to create an instance of RtAudio. If no available devices are found, then an instance of RtAudio with the api argument RtAudio::WINDOWS_DS can be created. Alternately, if no api argument is specified, RtAudio will first look for an ASIO instance and then a DirectSound instance (on Linux systems, the default API search order is Jack, Alsa, and finally OSS). In theory, it should also be possible to have separate instances of RtAudio open at the same time with different underlying audio API support, though this has not been tested. It is difficult to know how well different audio APIs can simultaneously coexist on a given operating system. In particular, it is unlikely that the same device could be simultaneously controlled with two different audio APIs.

    +The static function RtAudio::getCompiledApi() is provided to determine the available compiled API support. The function RtAudio::getCurrentApi() indicates the API selected for a given RtAudio instance.


    + + + +
    ©2001-2007 Gary P. Scavone, McGill University. All Rights Reserved.
    Maintained by Gary P. Scavone.
    + + + diff --git a/doc/html/pages.html b/doc/html/pages.html new file mode 100644 index 0000000..3f9ce29 --- /dev/null +++ b/doc/html/pages.html @@ -0,0 +1,43 @@ + + +The RtAudio Home Page + + + + +
    +Home   Class/Enum List   File List   Compound Members  
    +
    + +

    RtAudio Related Pages

    Here is a list of all related documentation pages: +
    + + + +
    ©2001-2007 Gary P. Scavone, McGill University. All Rights Reserved.
    Maintained by Gary P. Scavone.
    + + + diff --git a/doc/html/playback.html b/doc/html/playback.html new file mode 100644 index 0000000..9a7e918 --- /dev/null +++ b/doc/html/playback.html @@ -0,0 +1,91 @@ + + +The RtAudio Home Page + + + + +
    +Home   Class/Enum List   File List   Compound Members  
    +
    + +

    Playback

    In this example, we provide a complete program that demonstrates the use of RtAudio for audio playback. Our program produces a two-channel sawtooth waveform for output.

    +

    #include "RtAudio.h"
    +#include <iostream>
    +
    +// Two-channel sawtooth wave generator.
    +int saw( void *outputBuffer, void *inputBuffer, unsigned int nBufferFrames,
    +         double streamTime, RtAudioStreamStatus status, void *userData )
    +{
    +  unsigned int i, j;
    +  double *buffer = (double *) outputBuffer;
    +  double *lastValues = (double *) userData;
    +
    +  if ( status )
    +    std::cout << "Stream underflow detected!" << std::endl;
    +
    +  // Write interleaved audio data.
    +  for ( i=0; i<nBufferFrames; i++ ) {
    +    for ( j=0; j<2; j++ ) {
    +      *buffer++ = lastValues[j];
    +
    +      lastValues[j] += 0.005 * (j+1+(j*0.1));
    +      if ( lastValues[j] >= 1.0 ) lastValues[j] -= 2.0;
    +    }
    +  }
    +
    +  return 0;
    +}
    +
    +int main()
    +{
    +  RtAudio dac;
    +  if ( dac.getDeviceCount() < 1 ) {
    +    std::cout << "\nNo audio devices found!\n";
    +    exit( 0 );
    +  }
    +
    +  RtAudio::StreamParameters parameters;
    +  parameters.deviceId = dac.getDefaultOutputDevice();
    +  parameters.nChannels = 2;
    +  parameters.firstChannel = 0;
    +  unsigned int sampleRate = 44100;
    +  unsigned int bufferFrames = 256; // 256 sample frames
    +  double data[2];
    +
    +  try {
    +    dac.openStream( &parameters, NULL, RTAUDIO_FLOAT64,
    +                    sampleRate, &bufferFrames, &saw, (void *)&data );
    +    dac.startStream();
    +  }
    +  catch ( RtError& e ) {
    +    e.printMessage();
    +    exit( 0 );
    +  }
    +  
    +  char input;
    +  std::cout << "\nPlaying ... press <enter> to quit.\n";
    +  std::cin.get( input );
    +
    +  try {
    +    // Stop the stream
    +    dac.stopStream();
    +  }
    +  catch (RtError& e) {
    +    e.printMessage();
    +  }
    +
    +  if ( dac.isStreamOpen() ) dac.closeStream();
    +
    +  return 0;
    +}
    +

    +We open the stream in exactly the same way as the previous example (except with a data format change) and specify the address of our callback function "saw()". The callback function will automatically be invoked when the underlying audio system needs data for output. Note that the callback function is called only when the stream is "running" (between calls to the RtAudio::startStream() and RtAudio::stopStream() functions). We can also pass a pointer value to the RtAudio::openStream() function that is made available in the callback function. In this way, it is possible to gain access to arbitrary data created in our main() function from within the globally defined callback function.

    +In this example, we stop the stream with an explicit call to RtAudio::stopStream(). It is also possible to stop a stream by returning a non-zero value from the callback function. A return value of 1 will cause the stream to finish draining its internal buffers and then halt (equivalent to calling the RtAudio::stopStream() function). A return value of 2 will cause the stream to stop immediately (equivalent to calling the RtAudio::abortStream() function).


    + + + +
    ©2001-2007 Gary P. Scavone, McGill University. All Rights Reserved.
    Maintained by Gary P. Scavone.
    + + + diff --git a/doc/html/probe.html b/doc/html/probe.html new file mode 100644 index 0000000..245a7c3 --- /dev/null +++ b/doc/html/probe.html @@ -0,0 +1,72 @@ + + +The RtAudio Home Page + + + + +
    +Home   Class/Enum List   File List   Compound Members  
    +
    + +

    Probing Device Capabilities

    A programmer may wish to query the available audio device capabilities before deciding which to use. The following example outlines how this can be done.

    +

    // probe.cpp
    +
    +#include <iostream>
    +#include "RtAudio.h"
    +
    +int main()
    +{
    +  RtAudio audio;
    +
    +  // Determine the number of devices available
    +  unsigned int devices = audio.getDeviceCount();
    +
    +  // Scan through devices for various capabilities
    +  RtAudio::DeviceInfo info;
    +  for ( unsigned int i=1; i<=devices; i++ ) {
    +
    +    info = audio.getDeviceInfo( i );
    +
    +    if ( info.probed == true ) {
    +      // Print, for example, the maximum number of output channels for each device
    +      std::cout << "device = " << i;
    +      std::cout << ": maximum output channels = " << info.outputChannels << "\n";
    +    }
    +  }
    +
    +  return 0;
    +}
    +

    +The RtAudio::DeviceInfo structure is defined in RtAudio.h and provides a variety of information useful in assessing the capabilities of a device:

    +

      typedef struct RtAudio::DeviceInfo {
    +    bool probed;                  // true if the device capabilities were successfully probed.
    +    std::string name;             // Character string device identifier.
    +    int outputChannels;           // Maximum output channels supported by device.
    +    int inputChannels;            // Maximum input channels supported by device.
    +    int duplexChannels;           // Maximum simultaneous input/output channels supported by device.
    +    bool isDefaultOutput;         // true if this is the default output device.
    +    bool isDefaultInput;          // true if this is the default input device.
    +    std::vector<int> sampleRates; // Supported sample rates.
    +    RtAudioFormat nativeFormats;  // Bit mask of supported data formats.
    +  };
    +

    +The following data formats are defined and fully supported by RtAudio:

    +

      typedef unsigned long RtAudioFormat;
    +  static const RtAudioFormat  RTAUDIO_SINT8;   // Signed 8-bit integer
    +  static const RtAudioFormat  RTAUDIO_SINT16;  // Signed 16-bit integer
    +  static const RtAudioFormat  RTAUDIO_SINT24;  // Signed 24-bit integer (lower 3 bytes of 32-bit signed integer.)
    +  static const RtAudioFormat  RTAUDIO_SINT32;  // Signed 32-bit integer
    +  static const RtAudioFormat  RTAUDIO_FLOAT32; // 32-bit float normalized between +/- 1.0
    +  static const RtAudioFormat  RTAUDIO_FLOAT64; // 64-bit double normalized between +/- 1.0
    +

    +The nativeFormats member of the RtAudio::DeviceInfo structure is a bit mask of the above formats which are natively supported by the device. However, RtAudio will automatically provide format conversion if a particular format is not natively supported. When the probed member of the RtAudio::DeviceInfo structure is false, the remaining structure members are undefined and the device is probably unusable.

    +Some audio devices may require a minimum channel value greater than one. RtAudio will provide automatic channel number compensation when the number of channels set by the user is less than that required by the device. Channel compensation is NOT possible when the number of channels set by the user is greater than that supported by the device.

    +It should be noted that the capabilities reported by a device driver or underlying audio API are not always accurate and/or may be dependent on a combination of device settings. For this reason, RtAudio does not rely on the queried values when attempting to open a stream.


    + + + +
    ©2001-2007 Gary P. Scavone, McGill University. All Rights Reserved.
    Maintained by Gary P. Scavone.
    + + + diff --git a/doc/html/recording.html b/doc/html/recording.html new file mode 100644 index 0000000..47c0178 --- /dev/null +++ b/doc/html/recording.html @@ -0,0 +1,76 @@ + + +The RtAudio Home Page + + + + +
    +Home   Class/Enum List   File List   Compound Members  
    +
    + +

    Recording

    Using RtAudio for audio input is almost identical to the way it is used for playback. Here's the blocking playback example rewritten for recording:

    +

    #include "RtAudio.h"
    +#include <iostream>
    +
    +int record( void *outputBuffer, void *inputBuffer, unsigned int nBufferFrames,
    +         double streamTime, RtAudioStreamStatus status, void *userData )
    +{
    +  if ( status )
    +    std::cout << "Stream overflow detected!" << std::endl;
    +
    +  // Do something with the data in the "inputBuffer" buffer.
    +
    +  return 0;
    +}
    +
    +int main()
    +{
    +  RtAudio adc;
    +  if ( adc.getDeviceCount() < 1 ) {
    +    std::cout << "\nNo audio devices found!\n";
    +    exit( 0 );
    +  }
    +
    +  RtAudio::StreamParameters parameters;
    +  parameters.deviceId = adc.getDefaultInputDevice();
    +  parameters.nChannels = 2;
    +  parameters.firstChannel = 0;
    +  unsigned int sampleRate = 44100;
    +  unsigned int bufferFrames = 256; // 256 sample frames
    +
    +  try {
    +    adc.openStream( NULL, &parameters, RTAUDIO_SINT16,
    +                    sampleRate, &bufferFrames, &record );
    +    adc.startStream();
    +  }
    +  catch ( RtError& e ) {
    +    e.printMessage();
    +    exit( 0 );
    +  }
    +  
    +  char input;
    +  std::cout << "\nRecording ... press <enter> to quit.\n";
    +  std::cin.get( input );
    +
    +  try {
    +    // Stop the stream
    +    adc.stopStream();
    +  }
    +  catch (RtError& e) {
    +    e.printMessage();
    +  }
    +
    +  if ( adc.isStreamOpen() ) adc.closeStream();
    +
    +  return 0;
    +}
    +

    +In this example, we pass the address of the stream parameter structure as the second argument of the RtAudio::openStream() function and pass a NULL value for the output stream parameters. In this example, the record() callback function performs no specific operations.


    + + + +
    ©2001-2007 Gary P. Scavone, McGill University. All Rights Reserved.
    Maintained by Gary P. Scavone.
    + + + diff --git a/doc/html/settings.html b/doc/html/settings.html new file mode 100644 index 0000000..a95ad8d --- /dev/null +++ b/doc/html/settings.html @@ -0,0 +1,53 @@ + + +The RtAudio Home Page + + + + +
    +Home   Class/Enum List   File List   Compound Members  
    +
    + +

    Device Settings

    The next step in using RtAudio is to open a stream with particular device and parameter settings.

    +

    #include "RtAudio.h"
    +
    +int main()
    +{
    +  RtAudio dac;
    +  if ( dac.getDeviceCount() == 0 ) exit( 0 );
    +
    +  RtAudio::StreamParameters parameters;
    +  parameters.deviceId = dac.getDefaultOutputDevice();
    +  parameters.nChannels = 2;
    +  unsigned int sampleRate = 44100;
    +  unsigned int bufferFrames = 256; // 256 sample frames
    +
    +  RtAudio::StreamOptions options;
    +  options.flags = RTAUDIO_NONINTERLEAVED;
    +
    +  try {
    +    dac.openStream( &parameters, NULL, RTAUDIO_FLOAT32,
    +                    sampleRate, &bufferFrames, &myCallback, NULL, &options );
    +  }
    +  catch ( RtError& e ) {
    +    std::cout << '\n' << e.getMessage() << '\n' << std::endl;
    +    exit( 0 );
    +  }
    +  
    +  return 0;
    +}
    +

    +The RtAudio::openStream() function attempts to open a stream with a specified set of parameter values. In the above example, we attempt to open a two channel playback stream using the default output device, 32-bit floating point data, a sample rate of 44100 Hz, and a frame rate of 256 sample frames per output buffer. If the user specifies an invalid parameter value (such as a device id greater than or equal to the number of enumerated devices), an RtError is thrown of type = INVALID_USE. If a system error occurs or the device does not support the specified parameter values, an RtError of type = SYSTEM_ERROR is thrown. In either case, a descriptive error message is bundled with the exception and can be queried with the RtError::getMessage() or RtError::what() functions.

    +RtAudio provides four signed integer and two floating point data formats which can be specified using the RtAudioFormat parameter values mentioned earlier. If the opened device does not natively support the given format, RtAudio will automatically perform the necessary data format conversion.

    +The bufferFrames parameter specifies the desired number of sample frames that will be written to and/or read from a device per write/read operation. This parameter can be used to control stream latency though there is no guarantee that the passed value will be that used by a device. In general, a lower bufferFrames value will produce less latency but perhaps less robust performance. A value of zero can be specified, in which case the smallest allowable value will be used. The bufferFrames parameter is passed as a pointer and the actual value used by the stream is set during the device setup procedure. bufferFrames values should be a power of two. Optimal and allowable buffer values tend to vary between systems and devices. Stream latency can also be controlled via the optional RtAudio::StreamOptions member numberOfBuffers (not used in the example above), though this tends to be more system dependent. In particular, the numberOfBuffers parameter is ignored when using the OS-X Core Audio, Jack, and the Windows ASIO APIs.

    +As noted earlier, the device capabilities reported by a driver or underlying audio API are not always accurate and/or may be dependent on a combination of device settings. Because of this, RtAudio does not attempt to query a device's capabilities or use previously reported values when opening a device. Instead, RtAudio simply attempts to set the given parameters on a specified device and then checks whether the setup is successful or not.

    +The RtAudioCallback parameter above is a pointer to a user-defined function that will be called whenever the audio system is ready for new output data or has new input data to be read. Further details on the use of a callback function are provided in the next section.

    +Several stream options are available to fine-tune the behavior of an audio stream. In the example above, we specify that data will be written by the user in a non-interleaved format via the RtAudio::StreamOptions member flags. That is, all bufferFrames of the first channel should be written consecutively, followed by all bufferFrames of the second channel. By default (when no option is specified), RtAudio expects data to be written in an interleaved format.


    + + + +
    ©2001-2007 Gary P. Scavone, McGill University. All Rights Reserved.
    Maintained by Gary P. Scavone.
    + + + diff --git a/doc/html/structRtAudioDeviceInfo-members.html b/doc/html/structRtAudioDeviceInfo-members.html index 294b63b..68a0841 100644 --- a/doc/html/structRtAudioDeviceInfo-members.html +++ b/doc/html/structRtAudioDeviceInfo-members.html @@ -2,6 +2,7 @@ The RtAudio Tutorial +
    @@ -11,17 +12,17 @@

    RtAudioDeviceInfo Member List

    This is the complete list of members for RtAudioDeviceInfo, including all inherited members.

    - + + - + - +
    duplexChannelsRtAudioDeviceInfo
    inputChannelsRtAudioDeviceInfo
    isDefaultRtAudioDeviceInfo
    isDefaultInputRtAudioDeviceInfo
    isDefaultOutputRtAudioDeviceInfo
    nameRtAudioDeviceInfo
    nativeFormatsRtAudioDeviceInfo
    nativeFormatsRtAudioDeviceInfo
    outputChannelsRtAudioDeviceInfo
    probedRtAudioDeviceInfo
    sampleRatesRtAudioDeviceInfo
    sampleRatesRtAudioDeviceInfo


    - +
    ©2001-2005 Gary P. Scavone, McGill University. All Rights Reserved.
    - Maintained by Gary P. Scavone, gary@music.mcgill.ca
    ©2001-2006 Gary P. Scavone, McGill University. All Rights Reserved.
    Maintained by Gary P. Scavone.
    diff --git a/doc/html/structRtAudioDeviceInfo.html b/doc/html/structRtAudioDeviceInfo.html index ae1c6a9..c67fbea 100644 --- a/doc/html/structRtAudioDeviceInfo.html +++ b/doc/html/structRtAudioDeviceInfo.html @@ -2,6 +2,7 @@ The RtAudio Tutorial +
    @@ -26,11 +27,13 @@
  • int duplexChannels
    bool isDefault
    bool isDefaultOutput
    std::vector< int > sampleRates
    bool isDefaultInput
    RtAudioFormat nativeFormats
    std::vector< int > sampleRates
    RtAudioFormat nativeFormats


    Detailed Description

    @@ -152,13 +155,36 @@ Maximum input channels supported by device.
    -

    +

    + + + + +
    + + + + +
    bool RtAudioDeviceInfo::isDefaultOutput
    +
    + + + + + +
    +   + + +

    +true if this is the default output device.

    +

    @@ -172,16 +198,16 @@ Maximum simultaneous input/output channels supported by device. +true if this is the default input device.
    - +
    bool RtAudioDeviceInfo::isDefault bool RtAudioDeviceInfo::isDefaultInput

    -true if this is the default output or input device.

    -

    +

    @@ -198,13 +224,13 @@ true if this is the default output or input device. Supported sample rates (queried from list of standard rates).
    - +
    std::vector<int> RtAudioDeviceInfo::sampleRates std::vector<int> RtAudioDeviceInfo::sampleRates
    -

    +

    @@ -226,8 +252,7 @@ Bit mask of supported data formats.
    - +
    RtAudioFormat RtAudioDeviceInfo::nativeFormats RtAudioFormat RtAudioDeviceInfo::nativeFormats
    - +
    ©2001-2005 Gary P. Scavone, McGill University. All Rights Reserved.
    - Maintained by Gary P. Scavone, gary@music.mcgill.ca
    ©2001-2006 Gary P. Scavone, McGill University. All Rights Reserved.
    Maintained by Gary P. Scavone.
    diff --git a/doc/html/structRtAudioStreamParameters-members.html b/doc/html/structRtAudioStreamParameters-members.html new file mode 100644 index 0000000..bf46aed --- /dev/null +++ b/doc/html/structRtAudioStreamParameters-members.html @@ -0,0 +1,23 @@ + + +The RtAudio Tutorial + + + + +

    +Tutorial   Class/Enum List   File List   Compound Members  
    +
    + +

    RtAudioStreamParameters Member List

    This is the complete list of members for RtAudioStreamParameters, including all inherited members.

    + + + +
    deviceIdRtAudioStreamParameters
    firstChannelRtAudioStreamParameters
    nChannelsRtAudioStreamParameters


    + + + +
    ©2001-2006 Gary P. Scavone, McGill University. All Rights Reserved.
    Maintained by Gary P. Scavone.
    + + + diff --git a/doc/html/structRtAudioStreamParameters.html b/doc/html/structRtAudioStreamParameters.html new file mode 100644 index 0000000..a61cf7b --- /dev/null +++ b/doc/html/structRtAudioStreamParameters.html @@ -0,0 +1,109 @@ + + +The RtAudio Tutorial + + + + +
    +Tutorial   Class/Enum List   File List   Compound Members  
    +
    + +

    RtAudioStreamParameters Struct Reference

    The structure for specifying input or ouput stream parameters. +More... +

    +#include <RtAudio.h> +

    +List of all members. + + + + + + + + +

    Public Attributes

    int deviceId
    int nChannels
    int firstChannel
    +


    Detailed Description

    +The structure for specifying input or ouput stream parameters. +

    +


    Member Data Documentation

    +

    + + + + +
    + + + + +
    int RtAudioStreamParameters::deviceId
    +
    + + + + + +
    +   + + +

    +Device index (0 to getDeviceCount() - 1).

    +

    + + + + +
    + + + + +
    int RtAudioStreamParameters::nChannels
    +
    + + + + + +
    +   + + +

    +Number of channels.

    +

    + + + + +
    + + + + +
    int RtAudioStreamParameters::firstChannel
    +
    + + + + + +
    +   + + +

    +First channel index on device (default = 0).

    +


    The documentation for this struct was generated from the following file: +
    + + + +
    ©2001-2006 Gary P. Scavone, McGill University. All Rights Reserved.
    Maintained by Gary P. Scavone.
    + + + diff --git a/doc/html/structRtAudio_1_1DeviceInfo-members.html b/doc/html/structRtAudio_1_1DeviceInfo-members.html new file mode 100644 index 0000000..a8651f2 --- /dev/null +++ b/doc/html/structRtAudio_1_1DeviceInfo-members.html @@ -0,0 +1,29 @@ + + +The RtAudio Home Page + + + + +
    +Home   Class/Enum List   File List   Compound Members  
    +
    + +

    RtAudio::DeviceInfo Member List

    This is the complete list of members for RtAudio::DeviceInfo, including all inherited members.

    + + + + + + + + + +
    duplexChannelsRtAudio::DeviceInfo
    inputChannelsRtAudio::DeviceInfo
    isDefaultInputRtAudio::DeviceInfo
    isDefaultOutputRtAudio::DeviceInfo
    nameRtAudio::DeviceInfo
    nativeFormatsRtAudio::DeviceInfo
    outputChannelsRtAudio::DeviceInfo
    probedRtAudio::DeviceInfo
    sampleRatesRtAudio::DeviceInfo


    + + + +
    ©2001-2007 Gary P. Scavone, McGill University. All Rights Reserved.
    Maintained by Gary P. Scavone.
    + + + diff --git a/doc/html/structRtAudio_1_1DeviceInfo.html b/doc/html/structRtAudio_1_1DeviceInfo.html new file mode 100644 index 0000000..9b795f1 --- /dev/null +++ b/doc/html/structRtAudio_1_1DeviceInfo.html @@ -0,0 +1,261 @@ + + +The RtAudio Home Page + + + + +
    +Home   Class/Enum List   File List   Compound Members  
    +
    + + +

    RtAudio::DeviceInfo Struct Reference

    The public device information structure for returning queried values. +More... +

    +#include <RtAudio.h> +

    +List of all members. + + + + + + + + + + + + + + + + + + + + +

    Public Attributes

    bool probed
    std::string name
    unsigned int outputChannels
    unsigned int inputChannels
    unsigned int duplexChannels
    bool isDefaultOutput
    bool isDefaultInput
    std::vector< unsigned int > sampleRates
    RtAudioFormat nativeFormats
    +


    Detailed Description

    +The public device information structure for returning queried values. +

    +


    Member Data Documentation

    +

    + + + + +
    + + + + +
    bool RtAudio::DeviceInfo::probed
    +
    + + + + + +
    +   + + +

    +true if the device capabilities were successfully probed.

    +

    + + + + +
    + + + + +
    std::string RtAudio::DeviceInfo::name
    +
    + + + + + +
    +   + + +

    +Character string device identifier.

    +

    + + + + +
    + + + + +
    unsigned int RtAudio::DeviceInfo::outputChannels
    +
    + + + + + +
    +   + + +

    +Maximum output channels supported by device.

    +

    + + + + +
    + + + + +
    unsigned int RtAudio::DeviceInfo::inputChannels
    +
    + + + + + +
    +   + + +

    +Maximum input channels supported by device.

    +

    + + + + +
    + + + + +
    unsigned int RtAudio::DeviceInfo::duplexChannels
    +
    + + + + + +
    +   + + +

    +Maximum simultaneous input/output channels supported by device.

    +

    + + + + +
    + + + + +
    bool RtAudio::DeviceInfo::isDefaultOutput
    +
    + + + + + +
    +   + + +

    +true if this is the default output device.

    +

    + + + + +
    + + + + +
    bool RtAudio::DeviceInfo::isDefaultInput
    +
    + + + + + +
    +   + + +

    +true if this is the default input device.

    +

    + + + + +
    + + + + +
    std::vector<unsigned int> RtAudio::DeviceInfo::sampleRates
    +
    + + + + + +
    +   + + +

    +Supported sample rates (queried from list of standard rates).

    +

    + + + + +
    + + + + +
    RtAudioFormat RtAudio::DeviceInfo::nativeFormats
    +
    + + + + + +
    +   + + +

    +Bit mask of supported data formats.

    +


    The documentation for this struct was generated from the following file: +
    + + + +
    ©2001-2007 Gary P. Scavone, McGill University. All Rights Reserved.
    Maintained by Gary P. Scavone.
    + + + diff --git a/doc/html/structRtAudio_1_1StreamOptions-members.html b/doc/html/structRtAudio_1_1StreamOptions-members.html new file mode 100644 index 0000000..109162a --- /dev/null +++ b/doc/html/structRtAudio_1_1StreamOptions-members.html @@ -0,0 +1,23 @@ + + +The RtAudio Home Page + + + + +
    +Home   Class/Enum List   File List   Compound Members  
    +
    + +

    RtAudio::StreamOptions Member List

    This is the complete list of members for RtAudio::StreamOptions, including all inherited members.

    + + + +
    flagsRtAudio::StreamOptions
    numberOfBuffersRtAudio::StreamOptions
    streamNameRtAudio::StreamOptions


    + + + +
    ©2001-2007 Gary P. Scavone, McGill University. All Rights Reserved.
    Maintained by Gary P. Scavone.
    + + + diff --git a/doc/html/structRtAudio_1_1StreamOptions.html b/doc/html/structRtAudio_1_1StreamOptions.html new file mode 100644 index 0000000..244cc66 --- /dev/null +++ b/doc/html/structRtAudio_1_1StreamOptions.html @@ -0,0 +1,121 @@ + + +The RtAudio Home Page + + + + +
    +Home   Class/Enum List   File List   Compound Members  
    +
    + + +

    RtAudio::StreamOptions Struct Reference

    The structure for specifying stream options. +More... +

    +#include <RtAudio.h> +

    +List of all members. + + + + + + + + +

    Public Attributes

    RtAudioStreamFlags flags
    unsigned int numberOfBuffers
    std::string streamName
    +


    Detailed Description

    +The structure for specifying stream options. +

    +The following flags can be OR'ed together to allow a client to make changes to the default stream behavior:

    +

      +
    • RTAUDIO_NONINTERLEAVED: Use non-interleaved buffers (default = interleaved).
    • RTAUDIO_MINIMIZE_LATENCY: Attempt to set stream parameters for lowest possible latency.
    • RTAUDIO_HOG_DEVICE: Attempt grab device for exclusive use.
    +

    +By default, RtAudio streams pass and receive audio data from the client in an interleaved format. By passing the RTAUDIO_NONINTERLEAVED flag to the openStream() function, audio data will instead be presented in non-interleaved buffers. In this case, each buffer argument in the RtAudioCallback function will point to a single array of data, with nFrames samples for each channel concatenated back-to-back. For example, the first sample of data for the second channel would be located at index nFrames (assuming the buffer pointer was recast to the correct data type for the stream).

    +Certain audio APIs offer a number of parameters that influence the I/O latency of a stream. By default, RtAudio will attempt to set these parameters internally for robust (glitch-free) performance (though some APIs, like Windows Direct Sound, make this difficult). By passing the RTAUDIO_MINIMIZE_LATENCY flag to the openStream() function, internal stream settings will be influenced in an attempt to minimize stream latency, though possibly at the expense of stream performance.

    +If the RTAUDIO_HOG_DEVICE flag is set, RtAudio will attempt to open the input and/or output stream device(s) for exclusive use. Note that this is not possible with all supported audio APIs.

    +The numberOfBuffers parameter can be used to control stream latency in the Windows DirectSound, Linux OSS, and Linux Alsa APIs only. A value of two is usually the smallest allowed. Larger numbers can potentially result in more robust stream performance, though likely at the cost of stream latency. The value set by the user is replaced during execution of the RtAudio::openStream() function by the value actually used by the system.

    +The streamName parameter can be used to set the client name when using the Jack API. By default, the client name is set to RtApiJack. However, if you wish to create multiple instances of RtAudio with Jack, each instance must have a unique client name. +

    +


    Member Data Documentation

    +

    + + + + +
    + + + + +
    RtAudioStreamFlags RtAudio::StreamOptions::flags
    +
    + + + + + +
    +   + + +

    +A bit-mask of stream flags (RTAUDIO_NONINTERLEAVED, RTAUDIO_MINIMIZE_LATENCY, RTAUDIO_HOG_DEVICE).

    +

    + + + + +
    + + + + +
    unsigned int RtAudio::StreamOptions::numberOfBuffers
    +
    + + + + + +
    +   + + +

    +Number of stream buffers.

    +

    + + + + +
    + + + + +
    std::string RtAudio::StreamOptions::streamName
    +
    + + + + + +
    +   + + +

    +A stream name (currently used only in Jack).

    +


    The documentation for this struct was generated from the following file: +
    + + + +
    ©2001-2007 Gary P. Scavone, McGill University. All Rights Reserved.
    Maintained by Gary P. Scavone.
    + + + diff --git a/doc/html/structRtAudio_1_1StreamParameters-members.html b/doc/html/structRtAudio_1_1StreamParameters-members.html new file mode 100644 index 0000000..638b8ba --- /dev/null +++ b/doc/html/structRtAudio_1_1StreamParameters-members.html @@ -0,0 +1,23 @@ + + +The RtAudio Home Page + + + + +
    +Home   Class/Enum List   File List   Compound Members  
    +
    + +

    RtAudio::StreamParameters Member List

    This is the complete list of members for RtAudio::StreamParameters, including all inherited members.

    + + + +
    deviceIdRtAudio::StreamParameters
    firstChannelRtAudio::StreamParameters
    nChannelsRtAudio::StreamParameters


    + + + +
    ©2001-2007 Gary P. Scavone, McGill University. All Rights Reserved.
    Maintained by Gary P. Scavone.
    + + + diff --git a/doc/html/structRtAudio_1_1StreamParameters.html b/doc/html/structRtAudio_1_1StreamParameters.html new file mode 100644 index 0000000..05ebd0e --- /dev/null +++ b/doc/html/structRtAudio_1_1StreamParameters.html @@ -0,0 +1,111 @@ + + +The RtAudio Home Page + + + + +
    +Home   Class/Enum List   File List   Compound Members  
    +
    + + +

    RtAudio::StreamParameters Struct Reference

    The structure for specifying input or ouput stream parameters. +More... +

    +#include <RtAudio.h> +

    +List of all members. + + + + + + + + +

    Public Attributes

    unsigned int deviceId
    unsigned int nChannels
    unsigned int firstChannel
    +


    Detailed Description

    +The structure for specifying input or ouput stream parameters. +

    +


    Member Data Documentation

    +

    + + + + +
    + + + + +
    unsigned int RtAudio::StreamParameters::deviceId
    +
    + + + + + +
    +   + + +

    +Device index (0 to getDeviceCount() - 1).

    +

    + + + + +
    + + + + +
    unsigned int RtAudio::StreamParameters::nChannels
    +
    + + + + + +
    +   + + +

    +Number of channels.

    +

    + + + + +
    + + + + +
    unsigned int RtAudio::StreamParameters::firstChannel
    +
    + + + + + +
    +   + + +

    +First channel index on device (default = 0).

    +


    The documentation for this struct was generated from the following file: +
    + + + +
    ©2001-2007 Gary P. Scavone, McGill University. All Rights Reserved.
    Maintained by Gary P. Scavone.
    + + + diff --git a/doc/html/updates.html b/doc/html/updates.html new file mode 100644 index 0000000..55e4639 --- /dev/null +++ b/doc/html/updates.html @@ -0,0 +1,81 @@ + + +RtAudio Updates + + + +

    RtAudio Update Tracker

    + +

    Needed Updates & Possible New Features:

    + + + + + + + + + + + + +
    #DescriptionStatus
    1Check implementation of various stream options (RTAUDIO_HOG_DEVICE, ...) to verify proper implementation.UC
    2Do API-specific implementations of stream time where possible.UC
    3Better support for multichannel (>2) audio devices in Windows DirectSound API.UC
    4Mixer support to set the input volume, output volume, and select the input source (e.g., "Mic" vs "Line In") via following new methods: +
      +
    • double getStreamOutputVolume(): // returns value between 0.0 and 1.0
    • +
    • void setStreamOutputVolume( double volume ): // volume should be value between 0.0 and 1.0
    • +
    • double getStreamInputVolume(): // returns value between 0.0 and 1.0
    • +
    • void setStreamInputVolume( double volume ): // volume should be value between 0.0 and 1.0
    • +
    • void getStreamInputSources( std::vector<std::string>& sources ): // returns a vector of strings with source names
    • +
    • void setStreamInputSource( unsigned int index ): // source index is value between 0 and sources.size()-1, as determined from function above
    • +
    UC4
    5Robust support for full-duplex with different devices. Provide well-defined behavior if the devices get out of sync, with input taking precedence, so no incoming samples are lost (if possible).UC
    6More sophisticated querying of device capabilities - for example, it'd be nice to figure out that a device supports either 4 channels of 16-bit or 2 channels of 24-bit audio.UC
    + +

    +Status Codes: +

    + + + +
    UCUnder Consideration
    API?Approved but need to determine API change
    + + +

    Recently Added Features:

    + + + + + + + + + + + + + + + + + + + + + + + + +
    #DescriptionSolutionVersion
    1Stream time support - ability to query the stream and find out the exact time since the stream was started, according to that device's clock. For APIs where this is not supported, this is estimated based on a count of the bytes that have been sent and the known latency.1New getStreamTime() function (DM)4.0
    2Ability to determine whether stream is currently running.New bool isStreamRunning() function (DM)4.0
    3NetBSD support added to Linux OSS API.__NetBSD__ must be defined (Emmanuel Dreyfus)4.0
    4Added function to return available compiled APIsNew getCompiledApi() function (GS)4.0
    5Changed isDefault member of RtAudioDeviceInfo structure to isDefaultOutput and isDefaultInput to be able to distinguish between default input and output devices.Modified RtAudioDeviceInfo structure (GS)4.0
    6Added function to return current API for RtAudio instanceNew getCurrentApi() function (GS)4.0
    7Added function to return current stream device(s) indexNew getStreamDevice() function (GS)4.0
    8Dummy version that compiles without API compiler flag but does nothingNew RtApiDummy class (GS)4.0
    9Ability to query device latency.2New getStreamLatency() function (GS)4.0
    10Choice of opening a device in exclusive or non-exclusive mode. If opening in non-exclusive mode, try to use the device as-is without changing its sample rate, etc - this is good when users want to use two audio devices at once.3New RtAudio::StreamOptions structure and parameters4.0
    + +

    Details:

    + +1Currently implemented by incrementing a counter every time the tickStream() or callback function is called. If the gettimeofday() function is available (right now it is enabled for all Unix-like systems but not Windows), it also records the time of each tickStream() call. Then, when you call getStreamTime(), it adds the elapsed time since the last tickStream also. This makes the playback counter pretty smooth, but accurate. The intent is that now we could implement something more accurate on platforms that support it - but this is a reasonable baseline. One thing to watch out for: asking OSS for the stream time is problematic; on some devices the counter is only 16-bit and wraps around frequently, and on some devices it will sometimes return bogus values. +

    +

    +2This function could not be implemented for all APIs. If the function returns a value of zero, it should be assumed to be invalid. +

    +

    +3This implementation does not attempt to leave a device as-is. However, the flag RTAUDIO_HOG_DEVICE is provided to attempt to grab exclusive use of a device. +

    +

    +4I actually coded this up for OS-X Core Audio. However, I found it bloated the code and presented a number of interface problems that did more harm than good. Thus, it is currently not being considered further (GS). + +