patch and tweak for mac

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5014 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Brian West 2007-04-25 18:02:28 +00:00
parent 232dc94edd
commit 4b36882d7e
19 changed files with 6063 additions and 5760 deletions

View File

@ -19,7 +19,7 @@ bindir = ${exec_prefix}/bin
libdir = ${exec_prefix}/lib
includedir = ${prefix}/include
CC = gcc
CFLAGS = -g -std=gnu99 -Werror -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.3 $(OPT_LEVEL) -Wall -pedantic -pipe -fPIC -DPA_BIG_ENDIAN -Ipa_common -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DSIZEOF_SHORT=2 -DSIZEOF_INT=4 -DSIZEOF_LONG=4 -DPA_USE_COREAUDIO=1 -Iinclude -Isrc/common
CFLAGS = -g -std=gnu99 -Werror -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.3 $(OPT_LEVEL) -Wall -pedantic -pipe -fPIC -DPA_BIG_ENDIAN -Ipa_common -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DSIZEOF_SHORT=2 -DSIZEOF_INT=4 -DSIZEOF_LONG=4 -DPA_USE_COREAUDIO=1 -DHAVE_LIBKERN_OSATOMIC_H=1 -Iinclude -Isrc/common
LIBS = -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework Carbon
AR = /usr/bin/ar
RANLIB = ranlib
@ -88,6 +88,7 @@ TESTS = \
bin/patest_saw \
bin/patest_sine8 \
bin/patest_sine \
bin/patest_sine_channelmaps \
bin/patest_sine_formats \
bin/patest_sine_time \
bin/patest_start_stop \
@ -144,6 +145,7 @@ ALL_TESTS = \
bin/patest_saw \
bin/patest_sine8 \
bin/patest_sine \
bin/patest_sine_channelmaps \
bin/patest_sine_formats \
bin/patest_sine_time \
bin/patest_start_stop \
@ -220,3 +222,4 @@ lib:

View File

@ -40,7 +40,7 @@ OTHER_OBJS = @OTHER_OBJS@
PALIB = libportaudio.la
PAINC = include/portaudio.h
PA_LDFLAGS = $(LDFLAGS) $(SHARED_FLAGS) -rpath $(libdir) -no-undefined -export-symbols-regex "Pa_.*" -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
PA_LDFLAGS = $(LDFLAGS) $(SHARED_FLAGS) -rpath $(libdir) -no-undefined -export-symbols-regex "(Pa|PaMacCore)_.*" -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
#MAKEFILE = Makefile
COMMON_OBJS = \
@ -51,7 +51,6 @@ COMMON_OBJS = \
src/common/pa_debugprint.o \
src/common/pa_front.o \
src/common/pa_process.o \
src/common/pa_ringbuffer.o \
src/common/pa_skeleton.o \
src/common/pa_stream.o \
src/common/pa_trace.o
@ -82,6 +81,7 @@ TESTS = \
test/patest_saw \
test/patest_sine8 \
test/patest_sine \
test/patest_sine_channelmaps \
test/patest_sine_formats \
test/patest_sine_time \
test/patest_start_stop \
@ -120,7 +120,7 @@ LTOBJS:= $(OBJS:.o=.lo)
SUBDIRS =
@ENABLE_CXX_TRUE@SUBDIRS += bindings/cpp
all: lib/$(PALIB) all-recursive tests
all: lib/$(PALIB) all-recursive
tests: bin-stamp $(TESTS)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,9 @@
#! /bin/sh
# Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
timestamp='2003-02-22'
timestamp='2005-12-11'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@ -21,14 +21,15 @@ timestamp='2003-02-22'
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
# 02110-1301, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Please send patches to <config-patches@gnu.org>. Submit a context
# diff and a properly formatted ChangeLog entry.
#
@ -70,7 +71,7 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\
GNU config.sub ($timestamp)
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
@ -83,11 +84,11 @@ Try \`$me --help' for more information."
while test $# -gt 0 ; do
case $1 in
--time-stamp | --time* | -t )
echo "$timestamp" ; exit 0 ;;
echo "$timestamp" ; exit ;;
--version | -v )
echo "$version" ; exit 0 ;;
echo "$version" ; exit ;;
--help | --h* | -h )
echo "$usage"; exit 0 ;;
echo "$usage"; exit ;;
-- ) # Stop option processing
shift; break ;;
- ) # Use stdin as input.
@ -99,7 +100,7 @@ while test $# -gt 0 ; do
*local*)
# First pass through any local machine types.
echo $1
exit 0;;
exit ;;
* )
break ;;
@ -118,7 +119,9 @@ esac
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
@ -144,7 +147,7 @@ case $os in
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-apple | -axis)
-apple | -axis | -knuth | -cray)
os=
basic_machine=$1
;;
@ -169,6 +172,10 @@ case $os in
-hiux*)
os=-hiuxwe2
;;
-sco6)
os=-sco5v6
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco5)
os=-sco3.2v5
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
@ -185,6 +192,10 @@ case $os in
# Don't forget version if it is 3.2v4 or newer.
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco5v6*)
# Don't forget version if it is 3.2v4 or newer.
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco*)
os=-sco3.2v2
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
@ -228,14 +239,16 @@ case $basic_machine in
| a29k \
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
| clipper \
| bfin \
| c4x | clipper \
| d10v | d30v | dlx | dsp16xx \
| fr30 | frv \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| i370 | i860 | i960 | ia64 \
| ip2k \
| m32r | m68000 | m68k | m88k | mcore \
| ip2k | iq2000 \
| m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
@ -244,30 +257,37 @@ case $basic_machine in
| mips64vr4100 | mips64vr4100el \
| mips64vr4300 | mips64vr4300el \
| mips64vr5000 | mips64vr5000el \
| mips64vr5900 | mips64vr5900el \
| mipsisa32 | mipsisa32el \
| mipsisa32r2 | mipsisa32r2el \
| mipsisa64 | mipsisa64el \
| mipsisa64r2 | mipsisa64r2el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
| mt \
| msp430 \
| ns16k | ns32k \
| openrisc | or32 \
| or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
| pyramid \
| sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
| sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \
| sparcv8 | sparcv9 | sparcv9b \
| strongarm \
| tahoe | thumb | tic80 | tron \
| tahoe | thumb | tic4x | tic80 | tron \
| v850 | v850e \
| we32k \
| x86 | xscale | xstormy16 | xtensa \
| x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
| z8k)
basic_machine=$basic_machine-unknown
;;
m32c)
basic_machine=$basic_machine-unknown
;;
m6811 | m68hc11 | m6812 | m68hc12)
# Motorola 68HC11/12.
basic_machine=$basic_machine-unknown
@ -275,6 +295,9 @@ case $basic_machine in
;;
m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
;;
ms1)
basic_machine=mt-unknown
;;
# We use `pc' rather than `unknown'
# because (1) that's what they normally are, and
@ -295,19 +318,19 @@ case $basic_machine in
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* \
| bs2000-* \
| bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
| clipper-* | cydra-* \
| clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
| h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* \
| m32r-* \
| ip2k-* | iq2000-* \
| m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
| m88110-* | m88k-* | mcore-* \
| m88110-* | m88k-* | maxq-* | mcore-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \
| mips64-* | mips64el-* \
@ -316,33 +339,40 @@ case $basic_machine in
| mips64vr4100-* | mips64vr4100el-* \
| mips64vr4300-* | mips64vr4300el-* \
| mips64vr5000-* | mips64vr5000el-* \
| mips64vr5900-* | mips64vr5900el-* \
| mipsisa32-* | mipsisa32el-* \
| mipsisa32r2-* | mipsisa32r2el-* \
| mipsisa64-* | mipsisa64el-* \
| mipsisa64r2-* | mipsisa64r2el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipstx39-* | mipstx39el-* \
| mmix-* \
| mt-* \
| msp430-* \
| none-* | np1-* | nv1-* | ns16k-* | ns32k-* \
| none-* | np1-* | ns16k-* | ns32k-* \
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
| pyramid-* \
| romp-* | rs6000-* \
| sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
| sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
| sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \
| sparclite-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
| tahoe-* | thumb-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tron-* \
| v850-* | v850e-* | vax-* \
| we32k-* \
| x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
| xtensa-* \
| x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
| xstormy16-* | xtensa-* \
| ymp-* \
| z8k-*)
;;
m32c-*)
;;
# Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS.
386bsd)
@ -359,6 +389,9 @@ case $basic_machine in
basic_machine=a29k-amd
os=-udi
;;
abacus)
basic_machine=abacus-unknown
;;
adobe68k)
basic_machine=m68010-adobe
os=-scout
@ -373,6 +406,12 @@ case $basic_machine in
basic_machine=a29k-none
os=-bsd
;;
amd64)
basic_machine=x86_64-pc
;;
amd64-*)
basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
amdahl)
basic_machine=580-amdahl
os=-sysv
@ -432,12 +471,27 @@ case $basic_machine in
basic_machine=j90-cray
os=-unicos
;;
craynv)
basic_machine=craynv-cray
os=-unicosmp
;;
cr16c)
basic_machine=cr16c-unknown
os=-elf
;;
crds | unos)
basic_machine=m68k-crds
;;
crisv32 | crisv32-* | etraxfs*)
basic_machine=crisv32-axis
;;
cris | cris-* | etrax*)
basic_machine=cris-axis
;;
crx)
basic_machine=crx-unknown
os=-elf
;;
da30 | da30-*)
basic_machine=m68k-da30
;;
@ -460,6 +514,10 @@ case $basic_machine in
basic_machine=m88k-motorola
os=-sysv3
;;
djgpp)
basic_machine=i586-pc
os=-msdosdjgpp
;;
dpx20 | dpx20-*)
basic_machine=rs6000-bull
os=-bosx
@ -638,10 +696,6 @@ case $basic_machine in
mips3*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
;;
mmix*)
basic_machine=mmix-knuth
os=-mmixware
;;
monitor)
basic_machine=m68k-rom68k
os=-coff
@ -654,6 +708,9 @@ case $basic_machine in
basic_machine=i386-pc
os=-msdos
;;
ms1-*)
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
;;
mvs)
basic_machine=i370-ibm
os=-mvs
@ -722,10 +779,6 @@ case $basic_machine in
np1)
basic_machine=np1-gould
;;
nv1)
basic_machine=nv1-cray
os=-unicosmp
;;
nsr-tandem)
basic_machine=nsr-tandem
;;
@ -733,9 +786,12 @@ case $basic_machine in
basic_machine=hppa1.1-oki
os=-proelf
;;
or32 | or32-*)
openrisc | openrisc-*)
basic_machine=or32-unknown
os=-coff
;;
os400)
basic_machine=powerpc-ibm
os=-os400
;;
OSE68000 | ose68000)
basic_machine=m68000-ericsson
@ -768,18 +824,24 @@ case $basic_machine in
pentiumpro | p6 | 6x86 | athlon | athlon_*)
basic_machine=i686-pc
;;
pentiumii | pentium2)
pentiumii | pentium2 | pentiumiii | pentium3)
basic_machine=i686-pc
;;
pentium4)
basic_machine=i786-pc
;;
pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentiumpro-* | p6-* | 6x86-* | athlon-*)
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentiumii-* | pentium2-*)
pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentium4-*)
basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pn)
basic_machine=pn-gould
;;
@ -812,6 +874,10 @@ case $basic_machine in
basic_machine=i586-unknown
os=-pw32
;;
rdos)
basic_machine=i386-pc
os=-rdos
;;
rom68k)
basic_machine=m68k-rom68k
os=-coff
@ -838,6 +904,10 @@ case $basic_machine in
sb1el)
basic_machine=mipsisa64sb1el-unknown
;;
sei)
basic_machine=mips-sei
os=-seiux
;;
sequent)
basic_machine=i386-sequent
;;
@ -845,6 +915,9 @@ case $basic_machine in
basic_machine=sh-hitachi
os=-hms
;;
sh64)
basic_machine=sh64-unknown
;;
sparclite-wrs | simso-wrs)
basic_machine=sparclite-wrs
os=-vxworks
@ -919,10 +992,6 @@ case $basic_machine in
basic_machine=t90-cray
os=-unicos
;;
tic4x | c4x*)
basic_machine=tic4x-unknown
os=-coff
;;
tic54x | c54x*)
basic_machine=tic54x-unknown
os=-coff
@ -948,6 +1017,10 @@ case $basic_machine in
tower | tower-32)
basic_machine=m68k-ncr
;;
tpf)
basic_machine=s390x-ibm
os=-tpf
;;
udi29k)
basic_machine=a29k-amd
os=-udi
@ -991,6 +1064,10 @@ case $basic_machine in
basic_machine=hppa1.1-winbond
os=-proelf
;;
xbox)
basic_machine=i686-pc
os=-mingw32
;;
xps | xps100)
basic_machine=xps100-honeywell
;;
@ -1021,6 +1098,9 @@ case $basic_machine in
romp)
basic_machine=romp-ibm
;;
mmix)
basic_machine=mmix-knuth
;;
rs6000)
basic_machine=rs6000-ibm
;;
@ -1037,13 +1117,10 @@ case $basic_machine in
we32k)
basic_machine=we32k-att
;;
sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele)
sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
basic_machine=sh-unknown
;;
sh64)
basic_machine=sh64-unknown
;;
sparc | sparcv9 | sparcv9b)
sparc | sparcv8 | sparcv9 | sparcv9b)
basic_machine=sparc-sun
;;
cydra)
@ -1116,19 +1193,22 @@ case $os in
| -aos* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
| -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix*)
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
| -skyos* | -haiku* | -rdos*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
@ -1146,12 +1226,15 @@ case $os in
os=`echo $os | sed -e 's|nto|nto-qnx|'`
;;
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
| -windows* | -osx | -abug | -netware* | -os9* | -beos* \
| -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
| -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
;;
-mac*)
os=`echo $os | sed -e 's|mac|macos|'`
;;
-linux-dietlibc)
os=-linux-dietlibc
;;
-linux*)
os=`echo $os | sed -e 's|linux|linux-gnu|'`
;;
@ -1164,6 +1247,9 @@ case $os in
-opened*)
os=-openedition
;;
-os400*)
os=-os400
;;
-wince*)
os=-wince
;;
@ -1185,6 +1271,9 @@ case $os in
-atheos*)
os=-atheos
;;
-syllable*)
os=-syllable
;;
-386bsd)
os=-bsd
;;
@ -1207,6 +1296,9 @@ case $os in
-sinix*)
os=-sysv4
;;
-tpf*)
os=-tpf
;;
-triton*)
os=-sysv3
;;
@ -1243,6 +1335,9 @@ case $os in
-kaos*)
os=-kaos
;;
-zvmoe)
os=-zvmoe
;;
-none)
;;
*)
@ -1274,6 +1369,9 @@ case $basic_machine in
arm*-semi)
os=-aout
;;
c4x-* | tic4x-*)
os=-coff
;;
# This must come before the *-dec entry.
pdp10-*)
os=-tops20
@ -1317,9 +1415,15 @@ case $basic_machine in
*-be)
os=-beos
;;
*-haiku)
os=-haiku
;;
*-ibm)
os=-aix
;;
*-knuth)
os=-mmixware
;;
*-wec)
os=-proelf
;;
@ -1452,9 +1556,15 @@ case $basic_machine in
-mvs* | -opened*)
vendor=ibm
;;
-os400*)
vendor=ibm
;;
-ptx*)
vendor=sequent
;;
-tpf*)
vendor=ibm
;;
-vxsim* | -vxworks* | -windiss*)
vendor=wrs
;;
@ -1479,7 +1589,7 @@ case $basic_machine in
esac
echo $basic_machine$os
exit 0
exit
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)

8600
libs/portaudio/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -90,6 +90,9 @@ dnl AC_CANONICAL_HOST
PKG_CHECK_MODULES(JACK, jack, have_jack=yes, have_jack=no)
dnl checks for header files
AC_CHECK_HEADERS([sys/soundcard.h linux/soundcard.h machine/soundcard.h])
dnl sizeof checks: we will need a 16-bit and a 32-bit type
AC_CHECK_SIZEOF(short)
@ -136,10 +139,11 @@ case "${host_os}" in
dnl Mac OS X configuration
AC_DEFINE(PA_USE_COREAUDIO)
CFLAGS="$CFLAGS -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.3";
OTHER_OBJS="src/os/mac_osx/pa_mac_hostapis.o src/os/unix/pa_unix_util.o src/hostapi/coreaudio/pa_mac_core.o src/hostapi/coreaudio/pa_mac_core_utilities.o src/hostapi/coreaudio/pa_mac_core_blocking.o";
LIBS="-framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework Carbon";
PADLL="libportaudio.dylib";
SHARED_FLAGS="-framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework Carbon -dynamiclib";
SHARED_FLAGS="-framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework Carbon -dynamiclib -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.3";
if [[ $with_macapi = "asio" ]] ; then
if [[ $with_asiodir ]] ; then
ASIODIR="$with_asiodir";
@ -271,7 +275,7 @@ case "${host_os}" in
if [[ $have_jack = "yes" ] && [ $with_jack != "no" ]] ; then
DLL_LIBS="$DLL_LIBS $JACK_LIBS"
CFLAGS="$CFLAGS $JACK_CFLAGS"
OTHER_OBJS="$OTHER_OBJS src/hostapi/jack/pa_jack.o"
OTHER_OBJS="$OTHER_OBJS src/hostapi/jack/pa_jack.o src/common/pa_ringbuffer.o"
AC_DEFINE(PA_USE_JACK)
fi

View File

@ -42,6 +42,7 @@
/** @file
* ALSA-specific PortAudio API extension header file.
*/
#include "portaudio.h"
#ifdef __cplusplus
extern "C" {
@ -61,7 +62,9 @@ void PaAlsa_InitializeStreamInfo( PaAlsaStreamInfo *info );
void PaAlsa_EnableRealtimeScheduling( PaStream *s, int enable );
#if 0
void PaAlsa_EnableWatchdog( PaStream *s, int enable );
#endif
int PaAlsa_GetStreamInputCard( PaStream *s, int *card );

View File

@ -38,6 +38,9 @@
* license above.
*/
#include <AudioUnit/AudioUnit.h>
//#include <AudioToolbox/AudioToolbox.h>
#ifdef __cplusplus
extern "C" {
#endif
@ -52,10 +55,12 @@ extern "C" {
*/
typedef struct
{
unsigned long size; /**size of whole structure including this header */
PaHostApiTypeId hostApiType;/**host API for which this data is intended */
unsigned long version; /**structure version */
unsigned long flags; /* flags to modify behaviour */
unsigned long size; /**size of whole structure including this header */
PaHostApiTypeId hostApiType; /**host API for which this data is intended */
unsigned long version; /**structure version */
unsigned long flags; /* flags to modify behaviour */
long const * channelMap; /* Channel map for HAL channel mapping , if not needed, use NULL;*/
unsigned long channelMapSize; /* Channel map size for HAL channel mapping , if not needed, use 0;*/
} PaMacCoreStreamInfo;
/*
@ -64,15 +69,25 @@ typedef struct
/* Use this function to initialize a paMacCoreStreamInfo struct
using the requested flags. */
void paSetupMacCoreStreamInfo( PaMacCoreStreamInfo *data, unsigned long flags ) ;
* using the requested flags. Note that channel mapping is turned
* off after a call to this function.
* @param data The datastructure to initialize
* @param flags The flags to initialize the datastructure with.
*/
void PaMacCore_SetupStreamInfo( PaMacCoreStreamInfo *data, unsigned long flags );
/* call this after pa_SetupMacCoreStreamInfo to use channel mapping as described in notes.txt.
* @param data The stream info structure to assign a channel mapping to
* @param channelMap The channel map array, as described in notes.txt. This array pointer will be used directly (ie the underlying data will not be copied), so the caller should not free the array until after the stream has been opened.
* @param channelMapSize The size of the channel map array.
*/
void PaMacCore_SetupChannelMap( PaMacCoreStreamInfo *data, const long * const channelMap, unsigned long channelMapSize );
/*
* Retrieve the AudioDeviceID of the input device assigned to an open stream
*
* @param s The stream to query.
*`
*
* @return A valid AudioDeviceID, or NULL if an error occurred.
*/
AudioDeviceID PaMacCore_GetStreamInputDevice( PaStream* s );
@ -86,6 +101,21 @@ AudioDeviceID PaMacCore_GetStreamInputDevice( PaStream* s );
*/
AudioDeviceID PaMacCore_GetStreamOutputDevice( PaStream* s );
/*
* Returns a statically allocated string with the device's name
* for the given channel. NULL will be returned on failure.
*
* This function's implemenation is not complete!
*
* @param device The PortAudio device index.
* @param channel The channel number who's name is requested.
* @return a statically allocated string with the name of the device.
* Because this string is statically allocated, it must be
* coppied if it is to be saved and used by the user after
* another call to this function.
*
*/
const char *PaMacCore_GetChannelName( int device, int channelIndex, bool input );
/*
* Flags

View File

@ -153,10 +153,10 @@ PaError Pa_Terminate( void );
/** The type used to refer to audio devices. Values of this type usually
range from 0 to (Pa_DeviceCount-1), and may also take on the PaNoDevice
range from 0 to (Pa_GetDeviceCount()-1), and may also take on the PaNoDevice
and paUseHostApiSpecificDeviceSpecification values.
@see Pa_DeviceCount, paNoDevice, paUseHostApiSpecificDeviceSpecification
@see Pa_GetDeviceCount, paNoDevice, paUseHostApiSpecificDeviceSpecification
*/
typedef int PaDeviceIndex;

View File

@ -33,9 +33,6 @@ basename="s,^.*/,,g"
# function.
progpath="$0"
# define SED for historic ltconfig's generated by Libtool 1.3
test -z "$SED" && SED=sed
# The name of this program:
progname=`echo "$progpath" | $SED $basename`
modename="$progname"
@ -54,13 +51,6 @@ TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
if test -n "${ZSH_VERSION+set}" ; then
setopt NO_GLOB_SUBST
fi
# Same for EGREP, and just to be sure, do LTCC as well
if test "X$EGREP" = X ; then
EGREP=egrep
fi
if test "X$LTCC" = X ; then
LTCC=${CC-gcc}
fi
# Check that we have a working $echo.
if test "X$1" = X--no-reexec; then
@ -147,30 +137,6 @@ preserve_args=
lo2o="s/\\.lo\$/.${objext}/"
o2lo="s/\\.${objext}\$/.lo/"
if test -z "$max_cmd_len"; then
i=0
testring="ABCD"
new_result=
# If test is not a shell built-in, we'll probably end up computing a
# maximum length that is only half of the actual maximum length, but
# we can't tell.
while (test "X"`$SHELL $0 --fallback-echo "X$testring" 2>/dev/null` \
= "XX$testring") >/dev/null 2>&1 &&
new_result=`expr "X$testring" : ".*" 2>&1` &&
max_cmd_len="$new_result" &&
test "$i" != 17 # 1/2 MB should be enough
do
i=`expr $i + 1`
testring="$testring$testring"
done
testring=
# Add a significant safety factor because C++ compilers can tack on massive
# amounts of additional arguments before passing them to the linker.
# It appears as though 1/2 is a usable value.
max_cmd_len=`expr $max_cmd_len \/ 2`
fi
#####################################
# Shell function definitions:
# This seems to be the best place for them
@ -291,21 +257,7 @@ func_infer_tag ()
esac
CC_quoted="$CC_quoted $arg"
done
# user sometimes does CC=<HOST>-gcc so we need to match that to 'gcc'
trimedcc=`echo ${CC} | $SED -e "s/${host}-//g"`
# and sometimes libtool has CC=<HOST>-gcc but user does CC=gcc
extendcc=${host}-${CC}
# and sometimes libtool has CC=<OLDHOST>-gcc but user has CC=<NEWHOST>-gcc
# (Gentoo-specific hack because we always export $CHOST)
mungedcc=${CHOST-${host}}-${trimedcc}
case "$@ " in
"cc "* | " cc "* | "${host}-cc "* | " ${host}-cc "*|\
"gcc "* | " gcc "* | "${host}-gcc "* | " ${host}-gcc "*)
tagname=CC
break ;;
"$trimedcc "* | " $trimedcc "* | "`$echo $trimedcc` "* | " `$echo $trimedcc` "*|\
"$extendcc "* | " $extendcc "* | "`$echo $extendcc` "* | " `$echo $extendcc` "*|\
"$mungedcc "* | " $mungedcc "* | "`$echo $mungedcc` "* | " `$echo $mungedcc` "*|\
" $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
# The compiler in the base compile command matches
# the one in the tagged configuration.
@ -899,7 +851,7 @@ if test -z "$show_help"; then
# Lock this critical section if it is needed
# We use this script file to make the link, it avoids creating a new file
if test "$need_locks" = yes; then
until $run ln "$srcfile" "$lockfile" 2>/dev/null; do
until $run ln "$progpath" "$lockfile" 2>/dev/null; do
$show "Waiting for $lockfile to be removed"
sleep 2
done
@ -3690,13 +3642,6 @@ EOF
*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
esac
done
# It is ok to link against an archive when
# building a shared library.
if $AR -t $potlib > /dev/null 2>&1; then
newdeplibs="$newdeplibs $a_deplib"
a_deplib=""
break 2
fi
if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
| ${SED} 10q \
| $EGREP "$file_magic_regex" > /dev/null; then
@ -5434,11 +5379,6 @@ else
$echo >> $output "\
if test \"\$libtool_execute_magic\" != \"$magic\"; then
# Run the actual program with our arguments.
# Make sure env LD_LIBRARY_PATH does not mess us up
if test -n \"\${LD_LIBRARY_PATH+set}\"; then
export LD_LIBRARY_PATH=\$progdir:\$LD_LIBRARY_PATH
fi
"
case $host in
# Backslashes separate directories on plain windows
@ -5666,53 +5606,9 @@ fi\
$echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
exit $EXIT_FAILURE
fi
if test "X$EGREP" = X ; then
EGREP=egrep
fi
# We do not want portage's install root ($D) present. Check only for
# this if the .la is being installed.
if test "$installed" = yes && test "$D"; then
eval mynewdependency_lib=`echo "$libdir/$name" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
else
mynewdependency_lib="$libdir/$name"
fi
# Do not add duplicates
if test "$mynewdependency_lib"; then
my_little_ninja_foo_1=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
if test -z "$my_little_ninja_foo_1"; then
newdependency_libs="$newdependency_libs $mynewdependency_lib"
fi
fi
;;
*)
if test "$installed" = yes; then
# Rather use S=WORKDIR if our version of portage supports it.
# This is because some ebuild (gcc) do not use $S as buildroot.
if test "$PWORKDIR"; then
S="$PWORKDIR"
fi
# We do not want portage's build root ($S) present.
my_little_ninja_foo_2=`echo $deplib |$EGREP -e "$S"`
# We do not want portage's install root ($D) present.
my_little_ninja_foo_3=`echo $deplib |$EGREP -e "$D"`
if test -n "$my_little_ninja_foo_2" && test "$S"; then
mynewdependency_lib=""
elif test -n "$my_little_ninja_foo_3" && test "$D"; then
eval mynewdependency_lib=`echo "$deplib" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
else
mynewdependency_lib="$deplib"
fi
else
mynewdependency_lib="$deplib"
fi
# Do not add duplicates
if test "$mynewdependency_lib"; then
my_little_ninja_foo_4=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
if test -z "$my_little_ninja_foo_4"; then
newdependency_libs="$newdependency_libs $mynewdependency_lib"
fi
fi
newdependency_libs="$newdependency_libs $libdir/$name"
;;
*) newdependency_libs="$newdependency_libs $deplib" ;;
esac
done
dependency_libs="$newdependency_libs"
@ -5764,10 +5660,6 @@ fi\
case $host,$output,$installed,$module,$dlname in
*cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
esac
# Do not add duplicates
if test "$installed" = yes && test "$D"; then
install_libdir=`echo "$install_libdir" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
fi
$echo > $output "\
# $outputname - a libtool library file
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP

View File

@ -135,6 +135,12 @@ if checkSymbol(conf, "time.h", "rt", "clock_gettime"):
conf.env.Append(CPPDEFINES=["HAVE_CLOCK_GETTIME"])
if checkSymbol(conf, "time.h", symbol="nanosleep"):
conf.env.Append(CPPDEFINES=["HAVE_NANOSLEEP"])
if conf.CheckCHeader("sys/soundcard.h"):
conf.env.Append(CPPDEFINES=["HAVE_SYS_SOUNDCARD_H"])
if conf.CheckCHeader("linux/soundcard.h"):
conf.env.Append(CPPDEFINES=["HAVE_LINUX_SOUNDCARD_H"])
if conf.CheckCHeader("machine/soundcard.h"):
conf.env.Append(CPPDEFINES=["HAVE_MACHINE_SOUNDCARD_H"])
# Look for needed libraries and link with them
for lib, hdr, sym in neededLibs:
@ -188,8 +194,9 @@ testNames = ["patest_sine", "paqa_devs", "paqa_errs", "patest1", "patest_buffer"
"patest_dither", "patest_hang", "patest_in_overflow", "patest_latency", "patest_leftright", "patest_longsine", \
"patest_many", "patest_maxsines", "patest_multi_sine", "patest_out_underflow", "patest_pink", "patest_prime", \
"patest_read_record", "patest_record", "patest_ringmix", "patest_saw", "patest_sine8", "patest_sine", \
"patest_sine_time", "patest_start_stop", "patest_stop", "patest_sync", \
"patest_toomanysines", "patest_underflow", "patest_wire", "patest_write_sine", "pa_devs", "pa_fuzz", "pa_minlat"]
"patest_sine_time", "patest_start_stop", "patest_stop", "patest_sync", "patest_toomanysines", \
"patest_underflow", "patest_wire", "patest_write_sine", "pa_devs", "pa_fuzz", "pa_minlat", \
"patest_sine_channelmaps",]
# The test directory ("bin") should be in the top-level PA directory
tests = [env.Program(target=os.path.join("#", "bin", name), source=[os.path.join("#", "test", name + ".c"),

View File

@ -136,6 +136,7 @@ typedef struct PaAlsaStream
int primeBuffers;
int callbackMode; /* bool: are we running in callback mode? */
int pcmsSynced; /* Have we successfully synced pcms */
int rtSched;
/* the callback thread uses these to poll the sound device(s), waiting
* for data to be ready/available */
@ -445,7 +446,43 @@ typedef struct
int isPlug;
int hasPlayback;
int hasCapture;
} DeviceNames;
} HwDevInfo;
HwDevInfo predefinedNames[] = {
{ "center_lfe", NULL, 0, 1, 0 },
/* { "default", NULL, 0, 1, 0 }, */
/* { "dmix", NULL, 0, 1, 0 }, */
/* { "dpl", NULL, 0, 1, 0 }, */
/* { "dsnoop", NULL, 0, 1, 0 }, */
{ "front", NULL, 0, 1, 0 },
{ "iec958", NULL, 0, 1, 0 },
/* { "modem", NULL, 0, 1, 0 }, */
{ "rear", NULL, 0, 1, 0 },
{ "side", NULL, 0, 1, 0 },
/* { "spdif", NULL, 0, 0, 0 }, */
{ "surround40", NULL, 0, 1, 0 },
{ "surround41", NULL, 0, 1, 0 },
{ "surround50", NULL, 0, 1, 0 },
{ "surround51", NULL, 0, 1, 0 },
{ "surround71", NULL, 0, 1, 0 },
{ NULL, NULL, 0, 1, 0 }
};
static const HwDevInfo *FindDeviceName( const char *name )
{
int i;
for( i = 0; predefinedNames[i].alsaName; i++ )
{
if( strcmp( name, predefinedNames[i].alsaName ) == 0 )
{
return &predefinedNames[i];
}
}
return NULL;
}
static PaError PaAlsa_StrDup( PaAlsaHostApiRepresentation *alsaApi,
char **dst,
@ -469,7 +506,7 @@ error:
static int IgnorePlugin( const char *pluginId )
{
static const char *ignoredPlugins[] = {"hw", "plughw", "plug", "dsnoop", "tee",
"file", "null", "shm", "cards", NULL};
"file", "null", "shm", "cards", "rate_convert", NULL};
int i = 0;
while( ignoredPlugins[i] )
{
@ -483,26 +520,110 @@ static int IgnorePlugin( const char *pluginId )
return 0;
}
/* Wrapper around snd_pcm_open which sleeps for a second and retries if the device is dmix and it
* is busy. */
/* Wrapper around snd_pcm_open which repeatedly retries opening a device for up to a second
* if it is busy. This is because dmix may temporarily hold on to a device after it (dmix)
* has been opened and closed. */
static int OpenPcm( snd_pcm_t **pcmp, const char *name, snd_pcm_stream_t stream, int mode )
{
int tries = 0;
int ret = snd_pcm_open( pcmp, name, stream, mode );
for( tries = 0; tries < 100 && ret == -EBUSY; ++tries )
for( tries = 0; tries < 100 && -EBUSY == ret; ++tries )
{
Pa_Sleep( 10 );
ret = snd_pcm_open( pcmp, name, stream, mode );
if( -EBUSY != ret )
{
PA_DEBUG(( "\n%s: Successfully opened initially busy device after %d tries\n\n",
PA_DEBUG(( "%s: Successfully opened initially busy device after %d tries\n",
__FUNCTION__, tries ));
}
}
if( -EBUSY == ret )
{
PA_DEBUG(( "%s: Failed to open busy device\n",
__FUNCTION__ ));
}
return ret;
}
static PaError FillInDevInfo( PaAlsaHostApiRepresentation *alsaApi, HwDevInfo* deviceName, int blocking,
PaAlsaDeviceInfo* devInfo, int* devIdx )
{
PaError result = 0;
PaDeviceInfo *baseDeviceInfo = &devInfo->baseDeviceInfo;
snd_pcm_t *pcm;
int canMmap = -1;
PaUtilHostApiRepresentation *baseApi = &alsaApi->baseHostApiRep;
/* Zero fields */
InitializeDeviceInfo( baseDeviceInfo );
/* to determine device capabilities, we must open the device and query the
* hardware parameter configuration space */
/* Query capture */
if( deviceName->hasCapture &&
OpenPcm( &pcm, deviceName->alsaName, SND_PCM_STREAM_CAPTURE, blocking )
>= 0 )
{
if( GropeDevice( pcm, deviceName->isPlug, StreamDirection_In, blocking, devInfo,
&canMmap ) != paNoError )
{
/* Error */
PA_DEBUG(("%s: Failed groping %s for capture\n", __FUNCTION__, deviceName->alsaName));
goto end;
}
}
/* Query playback */
if( deviceName->hasPlayback &&
OpenPcm( &pcm, deviceName->alsaName, SND_PCM_STREAM_PLAYBACK, blocking )
>= 0 )
{
if( GropeDevice( pcm, deviceName->isPlug, StreamDirection_Out, blocking, devInfo,
&canMmap ) != paNoError )
{
/* Error */
PA_DEBUG(("%s: Failed groping %s for playback\n", __FUNCTION__, deviceName->alsaName));
goto end;
}
}
if( 0 == canMmap )
{
PA_DEBUG(("%s: Device %s doesn't support mmap\n", __FUNCTION__, deviceName->alsaName));
goto end;
}
baseDeviceInfo->structVersion = 2;
baseDeviceInfo->hostApi = alsaApi->hostApiIndex;
baseDeviceInfo->name = deviceName->name;
devInfo->alsaName = deviceName->alsaName;
devInfo->isPlug = deviceName->isPlug;
/* A: Storing pointer to PaAlsaDeviceInfo object as pointer to PaDeviceInfo object.
* Should now be safe to add device info, unless the device supports neither capture nor playback
*/
if( baseDeviceInfo->maxInputChannels > 0 || baseDeviceInfo->maxOutputChannels > 0 )
{
/* Make device default if there isn't already one or it is the ALSA "default" device */
if( baseApi->info.defaultInputDevice == paNoDevice && baseDeviceInfo->maxInputChannels > 0 )
baseApi->info.defaultInputDevice = *devIdx;
if( (baseApi->info.defaultOutputDevice == paNoDevice || !strcmp(deviceName->alsaName,
"default" )) && baseDeviceInfo->maxOutputChannels > 0 )
{
baseApi->info.defaultOutputDevice = *devIdx;
PA_DEBUG(("Default output device: %s\n", deviceName->name));
}
PA_DEBUG(("%s: Adding device %s: %d\n", __FUNCTION__, deviceName->name, *devIdx));
baseApi->deviceInfos[*devIdx] = (PaDeviceInfo *) devInfo;
(*devIdx) += 1;
}
end:
return result;
}
/* Build PaDeviceInfo list, ignore devices for which we cannot determine capabilities (possibly busy, sigh) */
static PaError BuildDeviceList( PaAlsaHostApiRepresentation *alsaApi )
{
@ -512,7 +633,7 @@ static PaError BuildDeviceList( PaAlsaHostApiRepresentation *alsaApi )
snd_ctl_card_info_t *cardInfo;
PaError result = paNoError;
size_t numDeviceNames = 0, maxDeviceNames = 1, i;
DeviceNames *deviceNames = NULL;
HwDevInfo *hwDevInfos = NULL;
snd_config_t *topNode = NULL;
snd_pcm_info_t *pcmInfo;
int res;
@ -525,9 +646,9 @@ static PaError BuildDeviceList( PaAlsaHostApiRepresentation *alsaApi )
baseApi->info.defaultInputDevice = paNoDevice;
baseApi->info.defaultOutputDevice = paNoDevice;
/* count the devices by enumerating all the card numbers */
/* Gather info about hw devices
/* snd_card_next() modifies the integer passed to it to be:
* snd_card_next() modifies the integer passed to it to be:
* the index of the first card if the parameter is -1
* the index of the next card if the parameter is the index of a card
* -1 if there are no more cards
@ -561,7 +682,7 @@ static PaError BuildDeviceList( PaAlsaHostApiRepresentation *alsaApi )
char *alsaDeviceName, *deviceName;
size_t len;
int hasPlayback = 0, hasCapture = 0;
snprintf( buf, sizeof (buf), "%s:%d,%d", "hw", cardIdx, devIdx );
snprintf( buf, sizeof (buf), "hw:%d,%d", cardIdx, devIdx );
/* Obtain info about this particular device */
snd_pcm_info_set_device( pcmInfo, devIdx );
@ -580,7 +701,8 @@ static PaError BuildDeviceList( PaAlsaHostApiRepresentation *alsaApi )
if( !hasPlayback && !hasCapture )
{
continue; /* Error */
/* Error */
continue;
}
/* The length of the string written by snprintf plus terminating 0 */
@ -591,25 +713,26 @@ static PaError BuildDeviceList( PaAlsaHostApiRepresentation *alsaApi )
snd_pcm_info_get_name( pcmInfo ), buf );
++numDeviceNames;
if( !deviceNames || numDeviceNames > maxDeviceNames )
if( !hwDevInfos || numDeviceNames > maxDeviceNames )
{
maxDeviceNames *= 2;
PA_UNLESS( deviceNames = (DeviceNames *) realloc( deviceNames, maxDeviceNames * sizeof (DeviceNames) ),
PA_UNLESS( hwDevInfos = (HwDevInfo *) realloc( hwDevInfos, maxDeviceNames * sizeof (HwDevInfo) ),
paInsufficientMemory );
}
PA_ENSURE( PaAlsa_StrDup( alsaApi, &alsaDeviceName, buf ) );
deviceNames[ numDeviceNames - 1 ].alsaName = alsaDeviceName;
deviceNames[ numDeviceNames - 1 ].name = deviceName;
deviceNames[ numDeviceNames - 1 ].isPlug = 0;
deviceNames[ numDeviceNames - 1 ].hasPlayback = hasPlayback;
deviceNames[ numDeviceNames - 1 ].hasCapture = hasCapture;
hwDevInfos[ numDeviceNames - 1 ].alsaName = alsaDeviceName;
hwDevInfos[ numDeviceNames - 1 ].name = deviceName;
hwDevInfos[ numDeviceNames - 1 ].isPlug = 0;
hwDevInfos[ numDeviceNames - 1 ].hasPlayback = hasPlayback;
hwDevInfos[ numDeviceNames - 1 ].hasCapture = hasCapture;
}
snd_ctl_close( ctl );
}
/* Iterate over plugin devices */
if( NULL == snd_config )
{
/* snd_config_update is called implicitly by some functions, if this hasn't happened snd_config will be NULL (bleh) */
@ -627,6 +750,7 @@ static PaError BuildDeviceList( PaAlsaHostApiRepresentation *alsaApi )
int err = 0;
char *alsaDeviceName, *deviceName;
const HwDevInfo *predefined = NULL;
snd_config_t *n = snd_config_iterator_entry( i ), * tp = NULL;;
if( (err = snd_config_search( n, "type", &tp )) < 0 )
@ -656,18 +780,31 @@ static PaError BuildDeviceList( PaAlsaHostApiRepresentation *alsaApi )
strcpy( deviceName, idStr );
++numDeviceNames;
if( !deviceNames || numDeviceNames > maxDeviceNames )
if( !hwDevInfos || numDeviceNames > maxDeviceNames )
{
maxDeviceNames *= 2;
PA_UNLESS( deviceNames = (DeviceNames *) realloc( deviceNames, maxDeviceNames * sizeof (DeviceNames) ),
PA_UNLESS( hwDevInfos = (HwDevInfo *) realloc( hwDevInfos, maxDeviceNames * sizeof (HwDevInfo) ),
paInsufficientMemory );
}
deviceNames[numDeviceNames - 1].alsaName = alsaDeviceName;
deviceNames[numDeviceNames - 1].name = deviceName;
deviceNames[numDeviceNames - 1].isPlug = 1;
deviceNames[numDeviceNames - 1].hasPlayback = 1;
deviceNames[numDeviceNames - 1].hasCapture = 1;
predefined = FindDeviceName( alsaDeviceName );
hwDevInfos[numDeviceNames - 1].alsaName = alsaDeviceName;
hwDevInfos[numDeviceNames - 1].name = deviceName;
hwDevInfos[numDeviceNames - 1].isPlug = 1;
if( predefined )
{
hwDevInfos[numDeviceNames - 1].hasPlayback =
predefined->hasPlayback;
hwDevInfos[numDeviceNames - 1].hasCapture =
predefined->hasCapture;
}
else
{
hwDevInfos[numDeviceNames - 1].hasPlayback = 1;
hwDevInfos[numDeviceNames - 1].hasCapture = 1;
}
}
}
else
@ -681,82 +818,35 @@ static PaError BuildDeviceList( PaAlsaHostApiRepresentation *alsaApi )
PA_UNLESS( deviceInfoArray = (PaAlsaDeviceInfo*)PaUtil_GroupAllocateMemory(
alsaApi->allocations, sizeof(PaAlsaDeviceInfo) * numDeviceNames ), paInsufficientMemory );
/* Loop over list of cards, filling in info, if a device is deemed unavailable (can't get name),
/* Loop over list of cards, filling in info. If a device is deemed unavailable (can't get name),
* it's ignored.
*/
/* while( snd_card_next( &cardIdx ) == 0 && cardIdx >= 0 ) */
for( i = 0, devIdx = 0; i < numDeviceNames; ++i )
{
snd_pcm_t *pcm;
PaAlsaDeviceInfo *deviceInfo = &deviceInfoArray[devIdx];
PaDeviceInfo *baseDeviceInfo = &deviceInfo->baseDeviceInfo;
int canMmap = -1;
/* Zero fields */
InitializeDeviceInfo( baseDeviceInfo );
/* to determine device capabilities, we must open the device and query the
* hardware parameter configuration space */
/* Query capture */
if( deviceNames[i].hasCapture &&
OpenPcm( &pcm, deviceNames[i].alsaName, SND_PCM_STREAM_CAPTURE, blocking )
>= 0 )
PaAlsaDeviceInfo* devInfo = &deviceInfoArray[i];
HwDevInfo* hwInfo = &hwDevInfos[i];
if( !strcmp( hwInfo->name, "dmix" ) || !strcmp( hwInfo->name, "default" ) )
{
if( GropeDevice( pcm, deviceNames[i].isPlug, StreamDirection_In, blocking, deviceInfo,
&canMmap ) != paNoError )
{
/* Error */
PA_DEBUG(("%s: Failed groping %s for capture\n", __FUNCTION__, deviceNames[i].alsaName));
continue;
}
}
/* Query playback */
if( deviceNames[i].hasPlayback &&
OpenPcm( &pcm, deviceNames[i].alsaName, SND_PCM_STREAM_PLAYBACK, blocking )
>= 0 )
{
if( GropeDevice( pcm, deviceNames[i].isPlug, StreamDirection_Out, blocking, deviceInfo,
&canMmap ) != paNoError )
{
/* Error */
PA_DEBUG(("%s: Failed groping %s for playback\n", __FUNCTION__, deviceNames[i].alsaName));
continue;
}
}
if( 0 == canMmap )
{
PA_DEBUG(("%s: Device %s doesn't support mmap\n", __FUNCTION__, deviceNames[i].alsaName));
continue;
}
baseDeviceInfo->structVersion = 2;
baseDeviceInfo->hostApi = alsaApi->hostApiIndex;
baseDeviceInfo->name = deviceNames[i].name;
deviceInfo->alsaName = deviceNames[i].alsaName;
deviceInfo->isPlug = deviceNames[i].isPlug;
/* A: Storing pointer to PaAlsaDeviceInfo object as pointer to PaDeviceInfo object.
* Should now be safe to add device info, unless the device supports neither capture nor playback
*/
if( baseDeviceInfo->maxInputChannels > 0 || baseDeviceInfo->maxOutputChannels > 0 )
{
/* Make device default if there isn't already one or it is the ALSA "default" device */
if( baseApi->info.defaultInputDevice == paNoDevice && baseDeviceInfo->maxInputChannels > 0 )
baseApi->info.defaultInputDevice = devIdx;
if( (baseApi->info.defaultOutputDevice == paNoDevice || !strcmp(deviceNames[i].alsaName,
"default" )) && baseDeviceInfo->maxOutputChannels > 0 )
{
baseApi->info.defaultOutputDevice = devIdx;
PA_DEBUG(("Default output device: %s\n", deviceNames[i].name));
}
PA_DEBUG(("%s: Adding device %s: %d\n", __FUNCTION__, deviceNames[i].name, devIdx));
baseApi->deviceInfos[devIdx++] = (PaDeviceInfo *) deviceInfo;
}
PA_ENSURE( FillInDevInfo( alsaApi, hwInfo, blocking, devInfo, &devIdx ) );
}
free( deviceNames );
assert( devIdx < numDeviceNames );
for( i = 0; i < numDeviceNames; ++i )
{
PaAlsaDeviceInfo* devInfo = &deviceInfoArray[i];
HwDevInfo* hwInfo = &hwDevInfos[i];
if( strcmp( hwInfo->name, "dmix" ) && strcmp( hwInfo->name, "default" ) )
{
continue;
}
PA_ENSURE( FillInDevInfo( alsaApi, hwInfo, blocking, devInfo,
&devIdx ) );
}
free( hwDevInfos );
baseApi->info.deviceCount = devIdx; /* Number of successfully queried devices */
@ -1089,11 +1179,13 @@ static void PaAlsaStreamComponent_Terminate( PaAlsaStreamComponent *self )
PaUtil_FreeMemory( self->userBuffers );
}
int nearbyint_(float value) {
/*
static int nearbyint_(float value) {
if( value - (int)value > .5 )
return (int)ceil( value );
return (int)floor( value );
}
*/
/** Initiate configuration, preparing for determining a period size suitable for both capture and playback components.
*
@ -1985,7 +2077,7 @@ static PaError StartStream( PaStream *s )
if( stream->callbackMode )
{
PA_ENSURE( PaUnixThread_New( &stream->thread, &CallbackThreadFunc, stream, 1. ) );
PA_ENSURE( PaUnixThread_New( &stream->thread, &CallbackThreadFunc, stream, 1., stream->rtSched ) );
}
else
{
@ -3356,7 +3448,7 @@ error:
/* Extensions */
/* Initialize host api specific structure */
/** Initialize host API specific structure, call this before setting relevant attributes. */
void PaAlsa_InitializeStreamInfo( PaAlsaStreamInfo *info )
{
info->size = sizeof (PaAlsaStreamInfo);
@ -3365,22 +3457,26 @@ void PaAlsa_InitializeStreamInfo( PaAlsaStreamInfo *info )
info->deviceString = NULL;
}
/** Instruct whether to enable real-time priority when starting the audio thread.
*
* If this is turned on by the stream is started, the audio callback thread will be created
* with the FIFO scheduling policy, which is suitable for realtime operation.
**/
void PaAlsa_EnableRealtimeScheduling( PaStream *s, int enable )
{
#if 0
PaAlsaStream *stream = (PaAlsaStream *) s;
stream->threading.rtSched = enable;
#endif
stream->rtSched = enable;
}
#if 0
void PaAlsa_EnableWatchdog( PaStream *s, int enable )
{
#if 0
PaAlsaStream *stream = (PaAlsaStream *) s;
stream->threading.useWatchdog = enable;
#endif
stream->thread.useWatchdog = enable;
}
#endif
/** Get the ALSA-lib card index of this stream's input device. */
PaError PaAlsa_GetStreamInputCard(PaStream* s, int* card) {
PaAlsaStream *stream = (PaAlsaStream *) s;
snd_pcm_info_t* pcmInfo;
@ -3397,6 +3493,7 @@ error:
return result;
}
/** Get the ALSA-lib card index of this stream's output device. */
PaError PaAlsa_GetStreamOutputCard(PaStream* s, int* card) {
PaAlsaStream *stream = (PaAlsaStream *) s;
snd_pcm_info_t* pcmInfo;

View File

@ -11,43 +11,6 @@ current core audio technology. To select use the old implementation, replace
pa_mac_core.c with pa_mac_core_old.c (eg. "cp pa_mac_core_auhal.c
pa_mac_core.c"), then run configure and make as usual.
----------------------------------------
Notes on Original implementation:
by Phil Burk and Darren Gibbs
Last updated March 20, 2002
WHAT WORKS
Output with very low latency, <10 msec.
Half duplex input or output.
Full duplex on the same CoreAudio device.
The paFLoat32, paInt16, paInt8, paUInt8 sample formats.
Pa_GetCPULoad()
Pa_StreamTime()
KNOWN BUGS OR LIMITATIONS
We do not yet support simultaneous input and output on different
devices. Note that some CoreAudio devices like the Roland UH30 look
like one device but are actually two different CoreAudio devices. The
Built-In audio is typically one CoreAudio device.
Mono doesn't work.
DEVICE MAPPING
CoreAudio devices can support both input and output. But the sample
rates supported may be different. So we have map one or two PortAudio
device to each CoreAudio device depending on whether it supports
input, output or both.
When we query devices, we first get a list of CoreAudio devices. Then
we scan the list and add a PortAudio device for each CoreAudio device
that supports input. Then we make a scan for output devices.
-------------------------------------------
Notes on Newer/Default AUHAL implementation:
@ -104,6 +67,9 @@ change the device for optimal playback ("Pro" mode), which may interrupt
other programs playing back audio, or simple use a sample-rate coversion,
which allows for friendlier sharing of the device ("Play Nice" mode).
Additionally, the user may define a "channel mapping" by calling
paSetupMacCoreChannelMap() on their stream info structure before opening
the stream with it. See below for creating a channel map.
Known issues:
@ -120,7 +86,9 @@ where the buffer size and sample rate of the audio device is most likely
to match the expected values.
- Timing info. It reports on stream time, but I'm probably doing something
wrong since patest_sine_time often reports negative latency numbers.
wrong since patest_sine_time often reports negative latency numbers. Also,
there are currently issues with some devices whehn plugging/unplugging
devices.
- xrun detection: The only xrun detection performed is when reading
and writing the ring buffer. There is probably more that can be done.
@ -130,16 +98,93 @@ but latency should be low enough to make the lack of a separate abort
unnecessary. Apple clarifies its AudioOutputUnitStop() call here:
http://lists.apple.com/archives/coreaudio-api/2005/Dec/msg00055.html
- blocking interface: Not implemented.
- blocking interface: should work fine.
- multichannel: It has been tested successfully on multichannel hardware
from MOTU: traveler and 896HD.
from MOTU: traveler and 896HD. Also Presonus firepod and others. It is
believed to work with all Core Audio devices, including virtual devices
such as soundflower.
- sample rate conversion quality: By default, SR conversion is the maximum
available. This can be tweaked using flags pa_mac_core.h. Note that the AU
render quyality property is used to set the sample rat conversion quality
render quyality property is used to set the sample rate conversion quality
as "documented" here:
http://lists.apple.com/archives/coreaudio-api/2004/Jan/msg00141.html
- x86: I haven't tested it on an x86 Mac myself, but users have reported
being able to comiple and run it.
- x86/Universal Binary: to build a universal binary, be sure to use
the darwin makefile and not the usual configure && make combo.
Creating a channel map:
How to create the map array - Text taken From AUHAL.rtfd :
[3] Channel Maps
Clients can tell the AUHAL units which channels of the device they are interested in. For example, the client may be processing stereo data, but outputting to a six-channel device. This is done by using the kAudioOutputUnitProperty_ChannelMap property. To use this property:
For Output:
Create an array of SInt32 that is the size of the number of channels of the device (Get the Format of the AUHAL's output Element == 0)
Initialize each of the array's values to -1 (-1 indicates that that channel is NOT to be presented in the conversion.)
Next, for each channel of your app's output, set:
channelMapArray[deviceOutputChannel] = desiredAppOutputChannel.
For example: we have a 6 channel output device and our application has a stereo source it wants to provide to the device. Suppose we want that stereo source to go to the 3rd and 4th channels of the device. The channel map would look like this: { -1, -1, 0, 1, -1, -1 }
Where the formats are:
Input Element == 0: 2 channels (- client format - settable)
Output Element == 0: 6 channels (- device format - NOT settable)
So channel 2 (zero-based) of the device will take the first channel of output and channel 3 will take the second channel of output. (This translates to the 3rd and 4th plugs of the 6 output plugs of the device of course!)
For Input:
Create an array of SInt32 that is the size of the number of channels of the format you require for input. Get (or Set in this case as needed) the AUHAL's output Element == 1.
Next, for each channel of input you require, set:
channelMapArray[desiredAppInputChannel] = deviceOutputChannel;
For example: we have a 6 channel input device from which we wish to receive stereo input from the 3rd and 4th channels. The channel map looks like this: { 2, 3 }
Where the formats are:
Input Element == 0: 2 channels (- device format - NOT settable)
Output Element == 0: 6 channels (- client format - settable)
----------------------------------------
Notes on Original implementation:
by Phil Burk and Darren Gibbs
Last updated March 20, 2002
WHAT WORKS
Output with very low latency, <10 msec.
Half duplex input or output.
Full duplex on the same CoreAudio device.
The paFLoat32, paInt16, paInt8, paUInt8 sample formats.
Pa_GetCPULoad()
Pa_StreamTime()
KNOWN BUGS OR LIMITATIONS
We do not yet support simultaneous input and output on different
devices. Note that some CoreAudio devices like the Roland UH30 look
like one device but are actually two different CoreAudio devices. The
Built-In audio is typically one CoreAudio device.
Mono doesn't work.
DEVICE MAPPING
CoreAudio devices can support both input and output. But the sample
rates supported may be different. So we have map one or two PortAudio
device to each CoreAudio device depending on whether it supports
input, output or both.
When we query devices, we first get a list of CoreAudio devices. Then
we scan the list and add a PortAudio device for each CoreAudio device
that supports input. Then we make a scan for output devices.

View File

@ -82,16 +82,127 @@ PaError PaMacCore_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIn
/*
* Function declared in pa_mac_core.h. Sets up a PaMacCoreStreamInfoStruct
* with the requested flags.
* with the requested flags and initializes channel map.
*/
void paSetupMacCoreStreamInfo( PaMacCoreStreamInfo *data, unsigned long flags )
void PaMacCore_SetupStreamInfo( PaMacCoreStreamInfo *data, const unsigned long flags )
{
bzero( data, sizeof( PaMacCoreStreamInfo ) );
data->size = sizeof( PaMacCoreStreamInfo );
data->hostApiType = paCoreAudio;
data->version = 0x01;
data->flags = flags;
data->channelMap = NULL;
data->channelMapSize = 0;
}
/*
* Function declared in pa_mac_core.h. Adds channel mapping to a PaMacCoreStreamInfoStruct
*/
void PaMacCore_SetupChannelMap( PaMacCoreStreamInfo *data, const long * const channelMap, const unsigned long channelMapSize )
{
data->channelMap = channelMap;
data->channelMapSize = channelMapSize;
}
static char *channelName = NULL;
static int channelNameSize = 0;
static bool ensureChannelNameSize( int size )
{
if( size >= channelNameSize ) {
free( channelName );
channelName = (char *) malloc( ( channelNameSize = size ) + 1 );
if( !channelName ) {
channelNameSize = 0;
return false;
}
}
return true;
}
/*
* Function declared in pa_mac_core.h. retrives channel names.
*/
const char *PaMacCore_GetChannelName( int device, int channelIndex, bool input )
{
struct PaUtilHostApiRepresentation *hostApi;
PaError err;
OSStatus error;
err = PaUtil_GetHostApiRepresentation( &hostApi, paCoreAudio );
assert(err == paNoError);
PaMacAUHAL *macCoreHostApi = (PaMacAUHAL*)hostApi;
AudioDeviceID hostApiDevice = macCoreHostApi->devIds[device];
UInt32 size = 0;
error = AudioDeviceGetPropertyInfo( hostApiDevice,
channelIndex + 1,
input,
kAudioDevicePropertyChannelName,
&size,
NULL );
if( error ) {
//try the CFString
CFStringRef name;
bool isDeviceName = false;
size = sizeof( name );
error = AudioDeviceGetProperty( hostApiDevice,
channelIndex + 1,
input,
kAudioDevicePropertyChannelNameCFString,
&size,
&name );
if( error ) { //as a last-ditch effort, get the device name. Later we'll append the channel number.
size = sizeof( name );
error = AudioDeviceGetProperty( hostApiDevice,
channelIndex + 1,
input,
kAudioDevicePropertyDeviceNameCFString,
&size,
&name );
if( error )
return NULL;
isDeviceName = true;
}
if( isDeviceName ) {
name = CFStringCreateWithFormat( NULL, NULL, CFSTR( "%@: %d"), name, channelIndex + 1 );
}
CFIndex length = CFStringGetLength(name);
while( ensureChannelNameSize( length * sizeof(UniChar) + 1 ) ) {
if( CFStringGetCString( name, channelName, channelNameSize, kCFStringEncodingUTF8 ) ) {
if( isDeviceName )
CFRelease( name );
return channelName;
}
if( length == 0 )
++length;
length *= 2;
}
if( isDeviceName )
CFRelease( name );
return NULL;
}
//continue with C string:
if( !ensureChannelNameSize( size ) )
return NULL;
error = AudioDeviceGetProperty( hostApiDevice,
channelIndex + 1,
input,
kAudioDevicePropertyChannelName,
&size,
channelName );
if( error ) {
ERR( error );
return NULL;
}
return channelName;
}
AudioDeviceID PaMacCore_GetStreamInputDevice( PaStream* s )
{
PaMacCoreStream *stream = (PaMacCoreStream*)s;
@ -649,6 +760,10 @@ static PaError OpenAndSetupOneAudioUnit(
AURenderCallbackStruct rcbs;
unsigned long macInputStreamFlags = paMacCorePlayNice;
unsigned long macOutputStreamFlags = paMacCorePlayNice;
SInt32 const *inChannelMap = NULL;
SInt32 const *outChannelMap = NULL;
unsigned long inChannelMapSize = 0;
unsigned long outChannelMapSize = 0;
VVDBUG(("OpenAndSetupOneAudioUnit(): in chan=%d, in fmt=%ld, out chan=%d, out fmt=%ld, requestedFramesPerBuffer=%ld\n",
inStreamParams ? inStreamParams->channelCount : -1,
@ -666,13 +781,25 @@ static PaError OpenAndSetupOneAudioUnit(
/* -- get the user's api specific info, if they set any -- */
if( inStreamParams && inStreamParams->hostApiSpecificStreamInfo )
{
macInputStreamFlags=
((PaMacCoreStreamInfo*)inStreamParams->hostApiSpecificStreamInfo)
->flags;
inChannelMap = ((PaMacCoreStreamInfo*)inStreamParams->hostApiSpecificStreamInfo)
->channelMap;
inChannelMapSize = ((PaMacCoreStreamInfo*)inStreamParams->hostApiSpecificStreamInfo)
->channelMapSize;
}
if( outStreamParams && outStreamParams->hostApiSpecificStreamInfo )
{
macOutputStreamFlags=
((PaMacCoreStreamInfo*)outStreamParams->hostApiSpecificStreamInfo)
->flags;
outChannelMap = ((PaMacCoreStreamInfo*)outStreamParams->hostApiSpecificStreamInfo)
->channelMap;
outChannelMapSize = ((PaMacCoreStreamInfo*)outStreamParams->hostApiSpecificStreamInfo)
->channelMapSize;
}
/* Override user's flags here, if desired for testing. */
/*
@ -717,8 +844,7 @@ static PaError OpenAndSetupOneAudioUnit(
/* -- if there is input, we have to explicitly enable input -- */
if( inStreamParams )
{
UInt32 enableIO;
enableIO = 1;
UInt32 enableIO = 1;
ERR_WRAP( AudioUnitSetProperty( *audioUnit,
kAudioOutputUnitProperty_EnableIO,
kAudioUnitScope_Input,
@ -729,8 +855,7 @@ static PaError OpenAndSetupOneAudioUnit(
/* -- if there is no output, we must explicitly disable output -- */
if( !outStreamParams )
{
UInt32 enableIO;
enableIO = 0;
UInt32 enableIO = 0;
ERR_WRAP( AudioUnitSetProperty( *audioUnit,
kAudioOutputUnitProperty_EnableIO,
kAudioUnitScope_Output,
@ -738,6 +863,7 @@ static PaError OpenAndSetupOneAudioUnit(
&enableIO,
sizeof(enableIO) ) );
}
/* -- set the devices -- */
/* make sure input and output are the same device if we are doing input and
output. */
@ -993,8 +1119,33 @@ static PaError OpenAndSetupOneAudioUnit(
&rcbs,
sizeof(rcbs)) );
/*IMPLEMENTME: may need to worry about channel mapping.*/
/* channel mapping. */
if(inChannelMap)
{
UInt32 mapSize = inChannelMapSize *sizeof(SInt32);
//for each channel of desired input, map the channel from
//the device's output channel.
ERR_WRAP( AudioUnitSetProperty(*audioUnit,
kAudioOutputUnitProperty_ChannelMap,
kAudioUnitScope_Output,
INPUT_ELEMENT,
inChannelMap,
mapSize));
}
if(outChannelMap)
{
UInt32 mapSize = outChannelMapSize *sizeof(SInt32);
//for each channel of desired output, map the channel from
//the device's output channel.
ERR_WRAP(AudioUnitSetProperty(*audioUnit,
kAudioOutputUnitProperty_ChannelMap,
kAudioUnitScope_Output,
OUTPUT_ELEMENT,
outChannelMap,
mapSize));
}
/* initialize the audio unit */
ERR_WRAP( AudioUnitInitialize(*audioUnit) );
@ -1136,7 +1287,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
{
PaUtil_InitializeStreamRepresentation( &stream->streamRepresentation,
&auhalHostApi->blockingStreamInterface,
BlioCallback, &stream->blio );
BlioCallback, &stream->blio );
}
PaUtil_InitializeCpuLoadMeasurer( &stream->cpuLoadMeasurer, sampleRate );

View File

@ -85,7 +85,7 @@ static char *jackErr_ = NULL;
{ \
if( (paErr_) == paUnanticipatedHostError && pthread_self() == mainThread_ ) \
{ \
assert( jackErr_ ); \
if (! jackErr_ ) jackErr_ = "unknown error";\
PaUtil_SetLastHostErrorInfo( paJACK, -1, jackErr_ ); \
} \
PaUtil_DebugPrint(( "Expression '" #expr "' failed in '" __FILE__ "', line: " STRINGIZE( __LINE__ ) "\n" )); \
@ -100,7 +100,7 @@ static char *jackErr_ = NULL;
{ \
if( (code) == paUnanticipatedHostError && pthread_self() == mainThread_ ) \
{ \
assert( jackErr_ ); \
if (!jackErr_) jackErr_ = "unknown error";\
PaUtil_SetLastHostErrorInfo( paJACK, -1, jackErr_ ); \
} \
PaUtil_DebugPrint(( "Expression '" #expr "' failed in '" __FILE__ "', line: " STRINGIZE( __LINE__ ) "\n" )); \
@ -451,11 +451,6 @@ static PaError BuildDeviceList( PaJackHostApiRepresentation *jackApi )
{
/* Utility macros for the repetitive process of allocating memory */
/* ... MALLOC: allocate memory as part of the device list
* allocation group */
#define MALLOC(size) \
(PaUtil_GroupAllocateMemory( jackApi->deviceInfoMemory, (size) ))
/* JACK has no concept of a device. To JACK, there are clients
* which have an arbitrary number of ports. To make this
* intelligible to PortAudio clients, we will group each JACK client
@ -484,8 +479,8 @@ static PaError BuildDeviceList( PaJackHostApiRepresentation *jackApi )
* associated with the previous list */
PaUtil_FreeAllAllocations( jackApi->deviceInfoMemory );
regex_pattern = MALLOC( jack_client_name_size() + 3 );
tmp_client_name = MALLOC( jack_client_name_size() );
regex_pattern = PaUtil_GroupAllocateMemory( jackApi->deviceInfoMemory, jack_client_name_size() + 3 );
tmp_client_name = PaUtil_GroupAllocateMemory( jackApi->deviceInfoMemory, jack_client_name_size() );
/* We can only retrieve the list of clients indirectly, by first
* asking for a list of all ports, then parsing the port names
@ -497,7 +492,8 @@ static PaError BuildDeviceList( PaJackHostApiRepresentation *jackApi )
while( jack_ports[numPorts] )
++numPorts;
/* At least there will be one port per client :) */
UNLESS( client_names = MALLOC( numPorts * sizeof (char *) ), paInsufficientMemory );
UNLESS( client_names = PaUtil_GroupAllocateMemory( jackApi->deviceInfoMemory, numPorts *
sizeof (char *) ), paInsufficientMemory );
/* Build a list of clients from the list of ports */
for( numClients = 0, port_index = 0; jack_ports[port_index] != NULL; port_index++ )
@ -524,7 +520,8 @@ static PaError BuildDeviceList( PaJackHostApiRepresentation *jackApi )
if (client_seen)
continue; /* A: Nothing to see here, move along */
UNLESS( client_names[numClients] = (char*)MALLOC(strlen(tmp_client_name) + 1), paInsufficientMemory );
UNLESS( client_names[numClients] = (char*)PaUtil_GroupAllocateMemory( jackApi->deviceInfoMemory,
strlen(tmp_client_name) + 1), paInsufficientMemory );
/* The alsa_pcm client should go in spot 0. If this
* is the alsa_pcm client AND we are NOT about to put
@ -550,8 +547,8 @@ static PaError BuildDeviceList( PaJackHostApiRepresentation *jackApi )
/* there is one global sample rate all clients must conform to */
globalSampleRate = jack_get_sample_rate( jackApi->jack_client );
UNLESS( commonApi->deviceInfos = (PaDeviceInfo**)MALLOC( sizeof(PaDeviceInfo*) *
numClients ), paInsufficientMemory );
UNLESS( commonApi->deviceInfos = (PaDeviceInfo**)PaUtil_GroupAllocateMemory( jackApi->deviceInfoMemory,
sizeof(PaDeviceInfo*) * numClients ), paInsufficientMemory );
assert( commonApi->info.deviceCount == 0 );
@ -561,8 +558,10 @@ static PaError BuildDeviceList( PaJackHostApiRepresentation *jackApi )
PaDeviceInfo *curDevInfo;
const char **clientPorts = NULL;
UNLESS( curDevInfo = (PaDeviceInfo*)MALLOC( sizeof(PaDeviceInfo) ), paInsufficientMemory );
UNLESS( curDevInfo->name = (char*)MALLOC( strlen(client_names[client_index]) + 1 ), paInsufficientMemory );
UNLESS( curDevInfo = (PaDeviceInfo*)PaUtil_GroupAllocateMemory( jackApi->deviceInfoMemory,
sizeof(PaDeviceInfo) ), paInsufficientMemory );
UNLESS( curDevInfo->name = (char*)PaUtil_GroupAllocateMemory( jackApi->deviceInfoMemory,
strlen(client_names[client_index]) + 1 ), paInsufficientMemory );
strcpy( (char *)curDevInfo->name, client_names[client_index] );
curDevInfo->structVersion = 2;
@ -633,7 +632,6 @@ error:
free( jack_ports );
return result;
}
#undef MALLOC
static void UpdateSampleRate( PaJackStream *stream, double sampleRate )
{
@ -647,9 +645,8 @@ static void JackErrorCallback( const char *msg )
if( pthread_self() == mainThread_ )
{
assert( msg );
free( jackErr_ );
jackErr_ = malloc( strlen( msg ) );
sprintf( jackErr_, msg );
jackErr_ = realloc( jackErr_, strlen( msg ) + 1 );
strcpy( jackErr_, msg );
}
}

View File

@ -63,15 +63,17 @@
#include <limits.h>
#include <semaphore.h>
#ifdef __FreeBSD__
#ifdef HAVE_SYS_SOUNDCARD_H
# include <sys/soundcard.h>
# define DEVICE_NAME_BASE "/dev/dsp"
#elif defined __linux__
#elif defined(HAVE_LINUX_SOUNDCARD_H)
# include <linux/soundcard.h>
# define DEVICE_NAME_BASE "/dev/dsp"
#else
#elif defined(HAVE_MACHINE_SOUNDCARD_H)
# include <machine/soundcard.h> /* JH20010905 */
# define DEVICE_NAME_BASE "/dev/audio"
#else
# error No sound card header file
#endif
#include "portaudio.h"
@ -1612,7 +1614,11 @@ static void *PaOSS_AudioThreadProc( void *userData )
if ( stream->capture )
{
PA_ENSURE( PaOssStreamComponent_Read( stream->capture, &frames ) );
assert( frames == framesAvail );
if( frames < framesAvail )
{
PA_DEBUG(( "Read %lu less frames than requested\n", framesAvail - frames ));
framesAvail = frames;
}
}
#if ( SOUND_VERSION >= 0x030904 )
@ -1648,9 +1654,11 @@ static void *PaOSS_AudioThreadProc( void *userData )
frames = framesAvail;
PA_ENSURE( PaOssStreamComponent_Write( stream->playback, &frames ) );
assert( frames == framesAvail );
/* TODO: handle bytesWritten != bytesRequested (slippage?) */
if( frames < framesAvail )
{
/* TODO: handle bytesWritten != bytesRequested (slippage?) */
PA_DEBUG(( "Wrote %lu less frames than requested\n", framesAvail - frames ));
}
}
framesAvail -= framesProcessed;
@ -1933,3 +1941,4 @@ static signed long GetStreamWriteAvailable( PaStream* s )
return (PaOssStreamComponent_BufferSize( stream->playback ) - delay) / PaOssStreamComponent_FrameSize( stream->playback );
}

View File

@ -208,23 +208,31 @@ PaError PaUnixThreading_Initialize()
return paNoError;
}
#if 0
PaError PaUnixThread_Initialize( PaUnixThread* self )
static PaError BoostPriority( PaUnixThread* self )
{
th->watchdogRunning = 0;
th->rtSched = 0;
th->callbackTime = 0;
th->callbackCpuTime = 0;
th->useWatchdog = 1;
th->throttledSleepTime = 0;
th->cpuLoadMeasurer = clm;
PaError result = paNoError;
struct sched_param spm = { 0 };
/* Priority should only matter between contending FIFO threads? */
spm.sched_priority = 1;
th->rtPrio = (sched_get_priority_max( SCHED_FIFO ) - sched_get_priority_min( SCHED_FIFO )) / 2
+ sched_get_priority_min( SCHED_FIFO );
assert( self );
if( pthread_setschedparam( self->thread, SCHED_FIFO, &spm ) != 0 )
{
PA_UNLESS( errno == EPERM, paInternalError ); /* Lack permission to raise priority */
PA_DEBUG(( "Failed bumping priority\n" ));
result = 0;
}
else
{
result = 1; /* Success */
}
error:
return result;
}
#endif
PaError PaUnixThread_New( PaUnixThread* self, void* (*threadFunc)( void* ), void* threadArg, PaTime waitForChild )
PaError PaUnixThread_New( PaUnixThread* self, void* (*threadFunc)( void* ), void* threadArg, PaTime waitForChild,
int rtSched )
{
PaError result = paNoError;
pthread_attr_t attr;
@ -238,8 +246,10 @@ PaError PaUnixThread_New( PaUnixThread* self, void* (*threadFunc)( void* ), void
/* Spawn thread */
#if 0 && defined _POSIX_MEMLOCK && (_POSIX_MEMLOCK != -1)
if( th->rtSched )
/* Temporarily disabled since we should test during configuration for presence of required mman.h header */
#if 0
#if defined _POSIX_MEMLOCK && (_POSIX_MEMLOCK != -1)
if( rtSched )
{
if( mlockall( MCL_CURRENT | MCL_FUTURE ) < 0 )
{
@ -251,6 +261,7 @@ PaError PaUnixThread_New( PaUnixThread* self, void* (*threadFunc)( void* ), void
else
PA_DEBUG(( "%s: Successfully locked memory\n", __FUNCTION__ ));
}
#endif
#endif
PA_UNLESS( !pthread_attr_init( &attr ), paInternalError );
@ -260,15 +271,15 @@ PaError PaUnixThread_New( PaUnixThread* self, void* (*threadFunc)( void* ), void
PA_UNLESS( !pthread_create( &self->thread, &attr, threadFunc, threadArg ), paInternalError );
started = 1;
#if 0
if( th->rtSched )
if( rtSched )
{
if( th->useWatchdog )
#if 0
if( self->useWatchdog )
{
int err;
struct sched_param wdSpm = { 0 };
/* Launch watchdog, watchdog sets callback thread priority */
int prio = PA_MIN( th->rtPrio + 4, sched_get_priority_max( SCHED_FIFO ) );
int prio = PA_MIN( self->rtPrio + 4, sched_get_priority_max( SCHED_FIFO ) );
wdSpm.sched_priority = prio;
PA_UNLESS( !pthread_attr_init( &attr ), paInternalError );
@ -276,7 +287,7 @@ PaError PaUnixThread_New( PaUnixThread* self, void* (*threadFunc)( void* ), void
PA_UNLESS( !pthread_attr_setscope( &attr, PTHREAD_SCOPE_SYSTEM ), paInternalError );
PA_UNLESS( !pthread_attr_setschedpolicy( &attr, SCHED_FIFO ), paInternalError );
PA_UNLESS( !pthread_attr_setschedparam( &attr, &wdSpm ), paInternalError );
if( (err = pthread_create( &th->watchdogThread, &attr, &WatchdogFunc, th )) )
if( (err = pthread_create( &self->watchdogThread, &attr, &WatchdogFunc, self )) )
{
PA_UNLESS( err == EPERM, paInternalError );
/* Permission error, go on without realtime privileges */
@ -285,8 +296,8 @@ PaError PaUnixThread_New( PaUnixThread* self, void* (*threadFunc)( void* ), void
else
{
int policy;
th->watchdogRunning = 1;
PA_ENSURE_SYSTEM( pthread_getschedparam( th->watchdogThread, &policy, &wdSpm ), 0 );
self->watchdogRunning = 1;
PA_ENSURE_SYSTEM( pthread_getschedparam( self->watchdogThread, &policy, &wdSpm ), 0 );
/* Check if priority is right, policy could potentially differ from SCHED_FIFO (but that's alright) */
if( wdSpm.sched_priority != prio )
{
@ -296,9 +307,15 @@ PaError PaUnixThread_New( PaUnixThread* self, void* (*threadFunc)( void* ), void
}
}
else
PA_ENSURE( BoostPriority( th ) );
}
#endif
PA_ENSURE( BoostPriority( self ) );
{
int policy;
struct sched_param spm;
pthread_getschedparam(self->thread, &policy, &spm);
}
}
if( self->parentWaiting )
{
@ -486,22 +503,8 @@ error:
return result;
}
#if 0
/* Threading utility struct */
typedef struct PaAlsaThreading
{
pthread_t watchdogThread;
pthread_t callbackThread;
int watchdogRunning;
int rtSched;
int rtPrio;
int useWatchdog;
unsigned long throttledSleepTime;
volatile PaTime callbackTime;
volatile PaTime callbackCpuTime;
PaUtilCpuLoadMeasurer *cpuLoadMeasurer;
} PaAlsaThreading;
#if 0
static void OnWatchdogExit( void *userData )
{
PaAlsaThreading *th = (PaAlsaThreading *) userData;
@ -512,26 +515,6 @@ static void OnWatchdogExit( void *userData )
PA_DEBUG(( "Watchdog exiting\n" ));
}
static PaError BoostPriority( PaAlsaThreading *th )
{
PaError result = paNoError;
struct sched_param spm = { 0 };
spm.sched_priority = th->rtPrio;
assert( th );
if( pthread_setschedparam( th->callbackThread, SCHED_FIFO, &spm ) != 0 )
{
PA_UNLESS( errno == EPERM, paInternalError ); /* Lack permission to raise priority */
PA_DEBUG(( "Failed bumping priority\n" ));
result = 0;
}
else
result = 1; /* Success */
error:
return result;
}
static void *WatchdogFunc( void *userData )
{
PaError result = paNoError, *pres = NULL;
@ -661,7 +644,6 @@ static void CallbackUpdate( PaAlsaThreading *th )
th->callbackTime = PaUtil_GetTime();
th->callbackCpuTime = PaUtil_GetCpuLoad( th->cpuLoadMeasurer );
}
#endif
/*
static void *CanaryFunc( void *userData )
@ -680,3 +662,4 @@ static void *CanaryFunc( void *userData )
pthread_exit( NULL );
}
*/
#endif

View File

@ -189,7 +189,8 @@ PaError PaUnixThreading_Initialize();
* wait for ever, greater than 0 wait for the specified time.
* @return: If timed out waiting on child, paTimedOut.
*/
PaError PaUnixThread_New( PaUnixThread* self, void* (*threadFunc)( void* ), void* threadArg, PaTime waitForChild );
PaError PaUnixThread_New( PaUnixThread* self, void* (*threadFunc)( void* ), void* threadArg, PaTime waitForChild,
int rtSched );
/** Terminate thread.
*