提交 4b36882d authored 作者: Brian West's avatar Brian West

patch and tweak for mac

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5014 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 232dc94e
......@@ -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:
......@@ -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)
......
差异被折叠。
差异被折叠。
......@@ -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
......
......@@ -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 );
......
......@@ -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
......
......@@ -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;
......
......@@ -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
......
......@@ -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"),
......
......@@ -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.
*
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论