Update portaudio to upstream r1966

------------------------------------------------------------------------
r1966 | philburk | 2016-02-15 11:06:54 -0600 (Mon, 15 Feb 2016) | 3 lines

Update docs for building on Linux

------------------------------------------------------------------------
r1965 | philburk | 2016-01-04 11:22:56 -0600 (Mon, 04 Jan 2016) | 6 lines

Files needed for compiling on El Capitan.

These files were autogenerated using autoreconf based
on changes from the previous commit.

------------------------------------------------------------------------
r1964 | philburk | 2016-01-04 11:22:00 -0600 (Mon, 04 Jan 2016) | 9 lines

Add support for 10.11 SDK so PortAudio can compile on Mac.

Also allow deprecated APIs until we can remove them.

Note that this commit only includes the source files that were changed.
The next commit will include the files that are generated by autoreconf.
So look at this commit to see what really changed.

------------------------------------------------------------------------
r1963 | dmitrykos | 2015-10-21 09:25:07 -0500 (Wed, 21 Oct 2015) | 1 line

wasapi: correction to the previous commit
------------------------------------------------------------------------
r1962 | dmitrykos | 2015-10-20 11:02:39 -0500 (Tue, 20 Oct 2015) | 1 line

wasapi: workaround to avoid PaWasapi_Initialize() failure when enumerating devices and device fails to report min/default periods with IAudioClient::GetDevicePeriod(): ignore error and assign WASAPI common known period values for min/default
------------------------------------------------------------------------
r1961 | dmitrykos | 2015-10-19 06:03:31 -0500 (Mon, 19 Oct 2015) | 1 line

wasapi: support for setting the WASAPI's AudioClientProperties options via PaWasapiStreamInfo struct (__IAudioClient2_INTERFACE_DEFINED__ must be defined by Windows SDK (for Windows 8 and up) to have effect from these new options, otherwise it will be noop)
------------------------------------------------------------------------
r1960 | rbencina | 2015-09-06 08:17:05 -0500 (Sun, 06 Sep 2015) | 1 line

update doxygen main page to reference developer guidelines and implementation style guidelines on the Wiki
------------------------------------------------------------------------
r1959 | rbencina | 2015-09-06 07:43:06 -0500 (Sun, 06 Sep 2015) | 1 line

checkfiledocs.py: blacklist mingw-include from doc check
------------------------------------------------------------------------
r1958 | rbencina | 2015-09-06 07:37:38 -0500 (Sun, 06 Sep 2015) | 1 line

checkfiledocs.py: only check source code under src and include
------------------------------------------------------------------------
r1957 | rbencina | 2015-09-06 05:55:01 -0500 (Sun, 06 Sep 2015) | 1 line

Issue #234 fixed typo in configure and configure.in affecting mingw builds. Rename: pa_win_wdmks_util.o --> pa_win_wdmks_utils.o
------------------------------------------------------------------------
r1956 | rbencina | 2015-09-06 05:26:16 -0500 (Sun, 06 Sep 2015) | 1 line

removed bindings/java from doxygen generated documentation
------------------------------------------------------------------------
r1954 | gineera | 2015-04-19 13:48:38 -0500 (Sun, 19 Apr 2015) | 1 line

Pa_process: Fix output channel adaption by not skipping the conversion when the host and user number-of-channels are not equal.  Reported by Leif Asbrink when using an envy24 soundcard on Linux at it's native Int32 format with 1 or 2 channels.  Corresponding fix for input already in r1913.
------------------------------------------------------------------------
r1953 | philburk | 2015-04-09 23:00:09 -0500 (Thu, 09 Apr 2015) | 4 lines

Add Pa_GetVersionInfo()
Add scripts to update pa_svnrevision.h

------------------------------------------------------------------------
r1952 | philburk | 2015-03-12 11:23:11 -0500 (Thu, 12 Mar 2015) | 3 lines

Test adding a second file with SVN keywords.

------------------------------------------------------------------------
r1951 | philburk | 2015-03-12 11:21:04 -0500 (Thu, 12 Mar 2015) | 3 lines

Used propset to enable SVN keywords on test file.

------------------------------------------------------------------------
r1950 | philburk | 2015-03-12 11:16:44 -0500 (Thu, 12 Mar 2015) | 3 lines

Experiment with the SVN version keywords.

------------------------------------------------------------------------
r1949 | philburk | 2015-03-03 11:28:15 -0600 (Tue, 03 Mar 2015) | 4 lines

Add version numbering with major.minor.subminor format.
Bump version to 19.5.0

------------------------------------------------------------------------
r1948 | rbencina | 2015-01-21 00:52:11 -0600 (Wed, 21 Jan 2015) | 1 line

pa/wmme: avoid potential (but highly unlikely) overflow in buffer size in call to WideCharToMultiByte if a device name length exceeds INT_MAX. should also fix compiler warning about size_t to int assignment.
------------------------------------------------------------------------
r1947 | rbencina | 2015-01-21 00:32:29 -0600 (Wed, 21 Jan 2015) | 1 line

removed declaration of unused variable
------------------------------------------------------------------------
r1946 | rbencina | 2015-01-21 00:30:53 -0600 (Wed, 21 Jan 2015) | 1 line

fixed compiler warning: conversion from 'double' to 'float', possible loss of data
------------------------------------------------------------------------
r1945 | rbencina | 2015-01-21 00:24:32 -0600 (Wed, 21 Jan 2015) | 1 line

disabled deprecated API warning for GetVersionEx in dsound, wmme and wdmks host APIs.
------------------------------------------------------------------------
r1944 | rbencina | 2015-01-20 23:35:39 -0600 (Tue, 20 Jan 2015) | 1 line

Removed MSVC dependence on ksguid.lib from src/os/win/pa_win_wdmks_utils.c (ksguid.lib is no longer in Platform SDK 8.0). Always use static instances of GUIDs like the GCC builds do. Removed ksguid.lib from MSVC project file. The following symbols are no longer used: PA_WDMKS_NO_KSGUID_LIB, PAWIN_WDMKS_NO_KSGUID_LIB; removed them from CMakeLists.txt and the MSVC project file.
------------------------------------------------------------------------
r1943 | rbencina | 2015-01-19 23:10:17 -0600 (Mon, 19 Jan 2015) | 1 line

cpp binding: make operator == and != const. thanks to Riot for this patch. ticket #230
------------------------------------------------------------------------
r1934 | rbencina | 2014-11-04 19:03:57 -0600 (Tue, 04 Nov 2014) | 1 line

PA/CoreAudio: fixed copy-pasto: last host error was being associated with paInDevelopment host api not paCoreAudio
------------------------------------------------------------------------
r1933 | robiwan | 2014-08-28 00:59:40 -0500 (Thu, 28 Aug 2014) | 1 line

Added more debugging info in wdmks/pa_win_wdmks.c
------------------------------------------------------------------------
r1932 | robiwan | 2014-08-15 01:35:32 -0500 (Fri, 15 Aug 2014) | 1 line

Committing Lelands patch for WDM-KS, should take care of some of the problems referenced here http://music.columbia.edu/pipermail/portaudio/2014-August/016246.html
------------------------------------------------------------------------
r1930 | bejayoharen | 2014-06-28 11:28:17 -0500 (Sat, 28 Jun 2014) | 1 line

olivier's device name patch for os x
------------------------------------------------------------------------
r1928 | rbencina | 2014-04-11 00:46:40 -0500 (Fri, 11 Apr 2014) | 1 line

pa_win_ds.c converted tabs to spaces (only a small amount of code was incorrectly using tabs).
------------------------------------------------------------------------
r1927 | rbencina | 2014-04-11 00:44:50 -0500 (Fri, 11 Apr 2014) | 1 line

DirectSound: correctly output device names as UTF-8 when compiled with UNICODE defined. Note that this patch may not be correct if UNICODE is not defined. Patch from Tobias Erichsen. See ticket #224 for details.
------------------------------------------------------------------------
r1926 | rbencina | 2014-04-11 00:31:13 -0500 (Fri, 11 Apr 2014) | 1 line

pa_win_wmme.c: converted tabs to spaces (just a few sections)
------------------------------------------------------------------------
r1925 | rbencina | 2014-04-11 00:25:48 -0500 (Fri, 11 Apr 2014) | 1 line

WMME: correctly convert device names to UTF-8, see ticket #224. Thanks to Tobias Erichsen for the patch.
------------------------------------------------------------------------
r1924 | robiwan | 2014-04-09 09:27:21 -0500 (Wed, 09 Apr 2014) | 4 lines

CMake: Added PA_WDMKS_NO_KSGUID_LIB to WDMKS and solution folders
WDMKS: Support for default device (see caveat for input devices though in ScanDeviceInfos)
       Added possibility to set channel mask

------------------------------------------------------------------------
r1920 | bejayoharen | 2014-02-05 12:43:31 -0600 (Wed, 05 Feb 2014) | 1 line

Clarified safety of operations in callback (doc)
------------------------------------------------------------------------
r1919 | rbencina | 2014-01-30 05:46:42 -0600 (Thu, 30 Jan 2014) | 1 line

updated Windows+ASIO build tutorial: Building Portaudio for Windows with ASIO support using MSVC. The tutorial was out of date and contained a number of errors that broke the build process.
------------------------------------------------------------------------
r1918 | rbencina | 2014-01-30 04:12:02 -0600 (Thu, 30 Jan 2014) | 1 line

tweaked Windows build tutorial: Building PortAudio for Windows using Microsoft Visual Studio - various improvements to clarity of text. Fixed broken ASIO SDK URL.
------------------------------------------------------------------------
r1916 | philburk | 2014-01-16 21:45:15 -0600 (Thu, 16 Jan 2014) | 6 lines

Add stub to pa_trace.c to eliminate warning.

"make install" was causing a warning if PA_TRACE_REALTIME_EVENTS
was not defined.

------------------------------------------------------------------------
r1915 | philburk | 2014-01-16 11:51:26 -0600 (Thu, 16 Jan 2014) | 5 lines

[tests] Add EOL to patest_mono.c

Build was failing on Mac because of the missing end-of-line.

------------------------------------------------------------------------
r1914 | philburk | 2014-01-16 11:49:33 -0600 (Thu, 16 Jan 2014) | 6 lines

[macosx] Add support for SDK 10.8 and 10.9.

This was required to fix a broken build caused
by not having SDK 10.7 or earlier.

------------------------------------------------------------------------
r1913 | gineera | 2013-11-18 05:42:27 -0600 (Mon, 18 Nov 2013) | 1 line

Pa_process: Fix input channel adaption by not skipping the input conversion when the host and user number-of-channels are not equal.  The bug manifested when recording mono from a stereo-only device (eg with Alsa hw: devices on some sound-cards), and was reported by the Mixxx team -see https://bugs.launchpad.net/mixxx/+bug/900364.  (In the long-term, some refactoring may be preferable.)  Also fixed copy-paste typos in comments.
------------------------------------------------------------------------
r1912 | gineera | 2013-11-15 06:27:07 -0600 (Fri, 15 Nov 2013) | 1 line

Jack: Add a port-type filter expression to calls to jack_get_ports() so that only audio ports are listed (removing eg Midi etc) as reported by 'sqweek'.
------------------------------------------------------------------------
r1911 | gineera | 2013-10-17 07:44:09 -0500 (Thu, 17 Oct 2013) | 1 line

Alsa: Revise the use of the environment variable 'PA_ALSA_PLUGHW' so it correctly influences the Device-List and the capabilities reported.  Also rename a mis-leading variable and add one additional DEBUG line.
This commit is contained in:
Leland Lucius 2016-03-08 00:52:13 -06:00
parent aee12f5755
commit 126aec1824
73 changed files with 20988 additions and 3123 deletions

View File

@ -7,6 +7,8 @@ PROJECT( portaudio )
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
OPTION(PA_CONFIG_LIB_OUTPUT_PATH "Make sure that output paths are kept neat" OFF)
IF(CMAKE_CL_64)
SET(TARGET_POSTFIX x64)
@ -50,8 +52,6 @@ FIND_PACKAGE(DXSDK)
# Try to find ASIO SDK (assumes that portaudio and asiosdk folders are side-by-side, see
# http://www.portaudio.com/trac/wiki/TutorialDir/Compile/WindowsASIOMSVC)
FIND_PACKAGE(ASIOSDK)
# Try to find JACK SDK
FIND_PACKAGE(JACKSDK)
IF(ASIOSDK_FOUND)
OPTION(PA_USE_ASIO "Enable support for ASIO" ON)
@ -189,23 +189,6 @@ SOURCE_GROUP("hostapi\\wdmks" FILES
)
ENDIF(PA_USE_WDMKS)
IF(PA_USE_JACK)
SET(PA_JACK_INCLUDES
include/pa_jack.h
src/hostapi/jack/pa_jack_dynload.h
)
SET(PA_JACK_SOURCES
src/hostapi/jack/pa_jack.c
src/hostapi/jack/pa_jack_dynload.h
)
SOURCE_GROUP("hostapi\\jack" FILES
${PA_WASAPI_SOURCES}
)
ENDIF(PA_USE_JACK)
SET(PA_SKELETON_SOURCES
src/hostapi/skeleton/pa_hostapi_skeleton.c
)
@ -222,7 +205,6 @@ SET(PA_INCLUDES
${PA_WMME_INCLUDES}
${PA_WASAPI_INCLUDES}
${PA_WDMKS_INCLUDES}
${PA_JACK_INCLUDES}
)
ENDIF(WIN32)
@ -236,7 +218,6 @@ SET(PA_COMMON_INCLUDES
src/common/pa_cpuload.h
src/common/pa_debugprint.h
src/common/pa_dither.h
src/common/pa_dynload.h
src/common/pa_endianness.h
src/common/pa_hostapi.h
src/common/pa_memorybarrier.h
@ -254,7 +235,6 @@ SET(PA_COMMON_SOURCES
src/common/pa_cpuload.c
src/common/pa_debugprint.c
src/common/pa_dither.c
src/common/pa_dynload.c
src/common/pa_front.c
src/common/pa_process.c
src/common/pa_ringbuffer.c
@ -304,7 +284,6 @@ SET(SOURCES_LESS_ASIO_SDK
${PA_WMME_SOURCES}
${PA_WASAPI_SOURCES}
${PA_WDMKS_SOURCES}
${PA_JACK_SOURCES}
${PA_SKELETON_SOURCES}
${PA_PLATFORM_SOURCES}
)
@ -351,8 +330,10 @@ IF(PA_USE_WDMKS)
TARGET_LINK_LIBRARIES(portaudio setupapi)
ENDIF(PA_USE_WDMKS)
SET_TARGET_PROPERTIES(portaudio PROPERTIES OUTPUT_NAME portaudio_${TARGET_POSTFIX})
SET_TARGET_PROPERTIES(portaudio_static PROPERTIES OUTPUT_NAME portaudio_static_${TARGET_POSTFIX})
SET_TARGET_PROPERTIES(portaudio PROPERTIES OUTPUT_NAME portaudio_${TARGET_POSTFIX}
FOLDER "Portaudio")
SET_TARGET_PROPERTIES(portaudio_static PROPERTIES OUTPUT_NAME portaudio_static_${TARGET_POSTFIX}
FOLDER "Portaudio")
ENDIF(WIN32)
OPTION(PA_BUILD_TESTS "Include test projects" OFF)

View File

@ -84,7 +84,6 @@ WARN_LOGFILE =
#---------------------------------------------------------------------------
INPUT = doc/src \
include \
bindings/java \
examples
FILE_PATTERNS = *.h \
*.c \

View File

@ -84,7 +84,6 @@ WARN_LOGFILE =
#---------------------------------------------------------------------------
INPUT = doc/src \
include \
bindings/java \
examples \
src \
test \

View File

@ -52,7 +52,6 @@ COMMON_OBJS = \
src/common/pa_converters.o \
src/common/pa_cpuload.o \
src/common/pa_dither.o \
src/common/pa_dynload.o \
src/common/pa_debugprint.o \
src/common/pa_front.o \
src/common/pa_process.o \
@ -156,10 +155,7 @@ SRC_DIRS = \
SUBDIRS =
@ENABLE_CXX_TRUE@SUBDIRS += bindings/cpp
prep:
mkdir -p qa/loopback/src/ src/hostapi/skeleton/ $(SRC_DIRS)
all: prep lib/$(PALIB) all-recursive tests examples selftests
all: lib/$(PALIB) all-recursive tests examples selftests
tests: bin-stamp $(TESTS)

View File

@ -1,16 +1,26 @@
PortAudio uses "autoconf" tools to generate Makefiles for Linux and Mac platforms.
The source for these are configure.in and Makefile.in
If you modify either of these files then please run this command before
testing and checking in your changes.
testing and checking in your changes. I run this command on Linux.
autoreconf -if
If you do not have autoreconf then do:
sudo apt-get install autoconf
If you get error like "possibly undefined macro: AC_LIBTOOL_WIN32_DLL"
then you try installing some more packages and then try again.
sudo apt-get install build-essential
sudo apt-get install pkg-config
sudo apt-get install libtool
autoreconf -if
Then test a build by doing:
./configure
make clean
make
sudo make install
then check in the related files that are modified.
These might include files like:

8776
lib-src/portaudio-v19/aclocal.m4 vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
Installation Instructions
*************************
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
2006, 2007, 2008, 2009 Free Software Foundation, Inc.
Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation,
Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
@ -12,8 +12,8 @@ without warranty of any kind.
Basic Installation
==================
Briefly, the shell commands `./configure; make; make install' should
configure, build, and install this package. The following
Briefly, the shell command `./configure && make && make install'
should configure, build, and install this package. The following
more-detailed instructions are generic; see the `README' file for
instructions specific to this package. Some packages provide this
`INSTALL' file but do not implement all of the features documented
@ -226,6 +226,11 @@ order to use an ANSI C compiler:
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
HP-UX `make' updates targets which have the same time stamps as
their prerequisites, which makes it generally unusable when shipped
generated files such as `configure' are involved. Use GNU `make'
instead.
On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
parse its `<wchar.h>' header file. The option `-nodtk' can be used as
a workaround. If GNU CC is not installed, it is therefore recommended
@ -304,9 +309,10 @@ causes the specified `gcc' to be used as the C compiler (unless it is
overridden in the site shell script).
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
an Autoconf bug. Until the bug is fixed you can use this workaround:
an Autoconf limitation. Until the limitation is lifted, you can use
this workaround:
CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
`configure' Invocation
======================
@ -362,4 +368,3 @@ operates.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,57 @@
dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
dnl also defines GSTUFF_PKG_ERRORS on error
AC_DEFUN(PKG_CHECK_MODULES, [
succeeded=no
if test -z "$PKG_CONFIG"; then
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
fi
if test "$PKG_CONFIG" = "no" ; then
echo "*** The pkg-config script could not be found. Make sure it is"
echo "*** in your path, or set the PKG_CONFIG environment variable"
echo "*** to the full path to pkg-config."
echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
else
PKG_CONFIG_MIN_VERSION=0.9.0
if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
AC_MSG_CHECKING(for $2)
if $PKG_CONFIG --exists "$2" ; then
AC_MSG_RESULT(yes)
succeeded=yes
AC_MSG_CHECKING($1_CFLAGS)
$1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
AC_MSG_RESULT($$1_CFLAGS)
AC_MSG_CHECKING($1_LIBS)
$1_LIBS=`$PKG_CONFIG --libs "$2"`
AC_MSG_RESULT($$1_LIBS)
else
$1_CFLAGS=""
$1_LIBS=""
## If we have a custom action on failure, don't print errors, but
## do set a variable so people can do so.
$1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
ifelse([$4], ,echo $$1_PKG_ERRORS,)
fi
AC_SUBST($1_CFLAGS)
AC_SUBST($1_LIBS)
else
echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
echo "*** See http://www.freedesktop.org/software/pkgconfig"
fi
fi
if test $succeeded = yes; then
ifelse([$3], , :, [$3])
else
ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4])
fi
])

0
lib-src/portaudio-v19/bindings/cpp/build/gnu/configure vendored Executable file → Normal file
View File

View File

@ -60,8 +60,8 @@ namespace portaudio
bool isHostApiDefaultInputDevice() const; // extended
bool isHostApiDefaultOutputDevice() const; // extended
bool operator==(const Device &rhs);
bool operator!=(const Device &rhs);
bool operator==(const Device &rhs) const;
bool operator!=(const Device &rhs) const;
// host api reference
HostApi &hostApi();

View File

@ -48,8 +48,8 @@ namespace portaudio
DeviceIterator &operator--();
DeviceIterator operator--(int);
bool operator==(const DeviceIterator &rhs);
bool operator!=(const DeviceIterator &rhs);
bool operator==(const DeviceIterator &rhs) const;
bool operator!=(const DeviceIterator &rhs) const;
private:
friend class System;

View File

@ -45,8 +45,8 @@ namespace portaudio
HostApiIterator &operator--();
HostApiIterator operator--(int);
bool operator==(const HostApiIterator &rhs);
bool operator!=(const HostApiIterator &rhs);
bool operator==(const HostApiIterator &rhs) const;
bool operator!=(const HostApiIterator &rhs) const;
private:
friend class System;

View File

@ -131,12 +131,12 @@ namespace portaudio
// -------------------------------------------------------------------------------
bool Device::operator==(const Device &rhs)
bool Device::operator==(const Device &rhs) const
{
return (index_ == rhs.index_);
}
bool Device::operator!=(const Device &rhs)
bool Device::operator!=(const Device &rhs) const
{
return !(*this == rhs);
}

View File

@ -44,12 +44,12 @@ namespace portaudio
// -----------------------------------------------------------------------------------
bool System::DeviceIterator::operator==(const System::DeviceIterator &rhs)
bool System::DeviceIterator::operator==(const System::DeviceIterator &rhs) const
{
return (ptr_ == rhs.ptr_);
}
bool System::DeviceIterator::operator!=(const System::DeviceIterator &rhs)
bool System::DeviceIterator::operator!=(const System::DeviceIterator &rhs) const
{
return !(*this == rhs);
}

View File

@ -44,12 +44,12 @@ namespace portaudio
// -----------------------------------------------------------------------------------
bool System::HostApiIterator::operator==(const System::HostApiIterator &rhs)
bool System::HostApiIterator::operator==(const System::HostApiIterator &rhs) const
{
return (ptr_ == rhs.ptr_);
}
bool System::HostApiIterator::operator!=(const System::HostApiIterator &rhs)
bool System::HostApiIterator::operator!=(const System::HostApiIterator &rhs) const
{
return !(*this == rhs);
}

View File

@ -152,7 +152,7 @@
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
AdditionalIncludeDirectories="..\..\src\common;..\..\include;.\;..\..\src\os\win"
PreprocessorDefinitions="_WIN64;NDEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE;PAWIN_USE_WDMKS_DEVICE_INFO;PA_WDMKS_NO_KSGUID_LIB;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=1"
PreprocessorDefinitions="_WIN64;NDEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=1"
StringPooling="true"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
@ -272,7 +272,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="ksguid.lib"
AdditionalDependencies=""
OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio_x86.dll"
LinkIncremental="2"
SuppressStartupBanner="true"
@ -343,7 +343,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\src\common,..\..\include,.\,..\..\src\os\win"
PreprocessorDefinitions="_WIN64;_DEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE;PAWIN_USE_WDMKS_DEVICE_INFO;PA_WDMKS_NO_KSGUID_LIB;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=1"
PreprocessorDefinitions="_WIN64;_DEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=1"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
@ -368,7 +368,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="ksguid.lib"
AdditionalDependencies=""
OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio_x64.dll"
LinkIncremental="2"
SuppressStartupBanner="true"
@ -540,7 +540,7 @@
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
AdditionalIncludeDirectories="..\..\src\common;..\..\include;.\;..\..\src\os\win"
PreprocessorDefinitions="_WIN64;NDEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE;PAWIN_USE_WDMKS_DEVICE_INFO;PA_WDMKS_NO_KSGUID_LIB;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=1"
PreprocessorDefinitions="_WIN64;NDEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=1"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"

View File

@ -0,0 +1,12 @@
#!/bin/bash
#
# Clear the SVN revision in the include file.
# This should be run before checking in code to SVN.
#
revision_filename=src/common/pa_svnrevision.h
# Update the include file with the current SVN revision.
echo "#define PA_SVN_REVISION unknown" > ${revision_filename}
echo ${revision_filename} now contains
cat ${revision_filename}

View File

@ -26,7 +26,6 @@
#cmakedefine01 PA_USE_WMME
#cmakedefine01 PA_USE_WASAPI
#cmakedefine01 PA_USE_WDMKS
#cmakedefine01 PA_USE_JACK
#else
#error "Platform currently not supported by CMake script"
#endif

View File

@ -51,5 +51,3 @@ PaUtil_SetDebugPrintFunction @55
@DEF_EXCLUDE_WASAPI_SYMBOLS@PaWasapi_GetFramesPerHostBuffer @60
@DEF_EXCLUDE_WASAPI_SYMBOLS@PaWasapi_GetJackDescription @61
@DEF_EXCLUDE_WASAPI_SYMBOLS@PaWasapi_GetJackCount @62
@DEF_EXCLUDE_WASAPI_SYMBOLS@PaJack_SetClientName @63
@DEF_EXCLUDE_WASAPI_SYMBOLS@PaJack_GetClientName @64

View File

@ -1,347 +0,0 @@
#! /bin/sh
# Wrapper for compilers which do not understand '-c -o'.
scriptversion=2012-10-14.11; # UTC
# Copyright (C) 1999-2013 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# 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.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
nl='
'
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent tools from complaining about whitespace usage.
IFS=" "" $nl"
file_conv=
# func_file_conv build_file lazy
# Convert a $build file to $host form and store it in $file
# Currently only supports Windows hosts. If the determined conversion
# type is listed in (the comma separated) LAZY, no conversion will
# take place.
func_file_conv ()
{
file=$1
case $file in
/ | /[!/]*) # absolute file, and not a UNC file
if test -z "$file_conv"; then
# lazily determine how to convert abs files
case `uname -s` in
MINGW*)
file_conv=mingw
;;
CYGWIN*)
file_conv=cygwin
;;
*)
file_conv=wine
;;
esac
fi
case $file_conv/,$2, in
*,$file_conv,*)
;;
mingw/*)
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
;;
cygwin/*)
file=`cygpath -m "$file" || echo "$file"`
;;
wine/*)
file=`winepath -w "$file" || echo "$file"`
;;
esac
;;
esac
}
# func_cl_dashL linkdir
# Make cl look for libraries in LINKDIR
func_cl_dashL ()
{
func_file_conv "$1"
if test -z "$lib_path"; then
lib_path=$file
else
lib_path="$lib_path;$file"
fi
linker_opts="$linker_opts -LIBPATH:$file"
}
# func_cl_dashl library
# Do a library search-path lookup for cl
func_cl_dashl ()
{
lib=$1
found=no
save_IFS=$IFS
IFS=';'
for dir in $lib_path $LIB
do
IFS=$save_IFS
if $shared && test -f "$dir/$lib.dll.lib"; then
found=yes
lib=$dir/$lib.dll.lib
break
fi
if test -f "$dir/$lib.lib"; then
found=yes
lib=$dir/$lib.lib
break
fi
if test -f "$dir/lib$lib.a"; then
found=yes
lib=$dir/lib$lib.a
break
fi
done
IFS=$save_IFS
if test "$found" != yes; then
lib=$lib.lib
fi
}
# func_cl_wrapper cl arg...
# Adjust compile command to suit cl
func_cl_wrapper ()
{
# Assume a capable shell
lib_path=
shared=:
linker_opts=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
eat=1
case $2 in
*.o | *.[oO][bB][jJ])
func_file_conv "$2"
set x "$@" -Fo"$file"
shift
;;
*)
func_file_conv "$2"
set x "$@" -Fe"$file"
shift
;;
esac
;;
-I)
eat=1
func_file_conv "$2" mingw
set x "$@" -I"$file"
shift
;;
-I*)
func_file_conv "${1#-I}" mingw
set x "$@" -I"$file"
shift
;;
-l)
eat=1
func_cl_dashl "$2"
set x "$@" "$lib"
shift
;;
-l*)
func_cl_dashl "${1#-l}"
set x "$@" "$lib"
shift
;;
-L)
eat=1
func_cl_dashL "$2"
;;
-L*)
func_cl_dashL "${1#-L}"
;;
-static)
shared=false
;;
-Wl,*)
arg=${1#-Wl,}
save_ifs="$IFS"; IFS=','
for flag in $arg; do
IFS="$save_ifs"
linker_opts="$linker_opts $flag"
done
IFS="$save_ifs"
;;
-Xlinker)
eat=1
linker_opts="$linker_opts $2"
;;
-*)
set x "$@" "$1"
shift
;;
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
func_file_conv "$1"
set x "$@" -Tp"$file"
shift
;;
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
func_file_conv "$1" mingw
set x "$@" "$file"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -n "$linker_opts"; then
linker_opts="-link$linker_opts"
fi
exec "$@" $linker_opts
exit 1
}
eat=
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]
Wrapper for compilers which do not understand '-c -o'.
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.
If you are trying to build a whole package this is not the
right script to run: please start by reading the file 'INSTALL'.
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "compile $scriptversion"
exit $?
;;
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
func_cl_wrapper "$@" # Doesn't return...
;;
esac
ofile=
cfile=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
# So we strip '-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
ofile=$2
;;
*)
set x "$@" -o "$2"
shift
;;
esac
;;
*.c)
cfile=$1
set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# If no '-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# '.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi
# Name of file we expect compiler to create.
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
# Create the lock directory.
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
while true; do
if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir '$lockdir'; exit 1" 1 2 15
# Run the compile.
"$@"
ret=$?
if test -f "$cofile"; then
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"
exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

View File

@ -1,14 +1,12 @@
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011 Free Software Foundation, Inc.
# Copyright 1992-2013 Free Software Foundation, Inc.
timestamp='2011-05-11'
timestamp='2013-06-10'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
@ -17,26 +15,22 @@ timestamp='2011-05-11'
# General Public License for more details.
#
# 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., 51 Franklin Street - Fifth Floor, Boston, MA
# 02110-1301, USA.
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
# 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.
# Originally written by Per Bothner. Please send patches (context
# diff format) to <config-patches@gnu.org> and include a ChangeLog
# entry.
# the same distribution terms that you use for the rest of that
# program. This Exception is an additional permission under section 7
# of the GNU General Public License, version 3 ("GPLv3").
#
# This script attempts to guess a canonical system name similar to
# config.sub. If it succeeds, it prints the system name on stdout, and
# exits with 0. Otherwise, it exits with 1.
# Originally written by Per Bothner.
#
# You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
#
# Please send patches with a ChangeLog entry to config-patches@gnu.org.
me=`echo "$0" | sed -e 's,.*/,,'`
@ -56,9 +50,7 @@ version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free
Software Foundation, Inc.
Copyright 1992-2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@ -140,12 +132,33 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
case "${UNAME_SYSTEM}" in
Linux|GNU|GNU/*)
# If the system lacks a compiler, then just pick glibc.
# We could probably try harder.
LIBC=gnu
eval $set_cc_for_build
cat <<-EOF > $dummy.c
#include <features.h>
#if defined(__UCLIBC__)
LIBC=uclibc
#elif defined(__dietlibc__)
LIBC=dietlibc
#else
LIBC=gnu
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
;;
esac
# Note: order is significant - the case branches are not exclusive.
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:NetBSD:*:*)
# NetBSD (nbsd) targets should (where applicable) match one or
# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
# *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
# switched to ELF, *-*-netbsd* would select the old
# object file format. This provides both forward
@ -202,6 +215,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}"
exit ;;
*:Bitrig:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
exit ;;
*:OpenBSD:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
@ -304,7 +321,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit ;;
arm:riscos:*:*|arm:RISCOS:*:*)
arm*:riscos:*:*|arm*:RISCOS:*:*)
echo arm-unknown-riscos
exit ;;
SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
@ -792,21 +809,26 @@ EOF
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
exit ;;
*:FreeBSD:*:*)
case ${UNAME_MACHINE} in
pc98)
echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
UNAME_PROCESSOR=`/usr/bin/uname -p`
case ${UNAME_PROCESSOR} in
amd64)
echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
*)
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
esac
exit ;;
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
exit ;;
*:MINGW64*:*)
echo ${UNAME_MACHINE}-pc-mingw64
exit ;;
*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
exit ;;
i*:MSYS*:*)
echo ${UNAME_MACHINE}-pc-msys
exit ;;
i*:windows32*:*)
# uname -m includes "-pc" on this system.
echo ${UNAME_MACHINE}-mingw32
@ -852,15 +874,22 @@ EOF
exit ;;
*:GNU:*:*)
# the GNU system
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit ;;
*:GNU/*:*:*)
# other systems with GNU libc and userland
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
exit ;;
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
exit ;;
aarch64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
aarch64_be:Linux:*:*)
UNAME_MACHINE=aarch64_be
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
EV5) UNAME_MACHINE=alphaev5 ;;
@ -872,56 +901,54 @@ EOF
EV68*) UNAME_MACHINE=alphaev68 ;;
esac
objdump --private-headers /bin/sh | grep -q ld.so.1
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
arc:Linux:*:* | arceb:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
arm*:Linux:*:*)
eval $set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_EABI__
then
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
else
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_PCS_VFP
then
echo ${UNAME_MACHINE}-unknown-linux-gnueabi
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
else
echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
fi
fi
exit ;;
avr32*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
cris:Linux:*:*)
echo cris-axis-linux-gnu
echo ${UNAME_MACHINE}-axis-linux-${LIBC}
exit ;;
crisv32:Linux:*:*)
echo crisv32-axis-linux-gnu
echo ${UNAME_MACHINE}-axis-linux-${LIBC}
exit ;;
frv:Linux:*:*)
echo frv-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
hexagon:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
i*86:Linux:*:*)
LIBC=gnu
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#ifdef __dietlibc__
LIBC=dietlibc
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
echo ${UNAME_MACHINE}-pc-linux-${LIBC}
exit ;;
ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
m32r*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
m68*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
mips:Linux:*:* | mips64:Linux:*:*)
eval $set_cc_for_build
@ -940,54 +967,63 @@ EOF
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
;;
or1k:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
or32:Linux:*:*)
echo or32-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
padre:Linux:*:*)
echo sparc-unknown-linux-gnu
echo sparc-unknown-linux-${LIBC}
exit ;;
parisc64:Linux:*:* | hppa64:Linux:*:*)
echo hppa64-unknown-linux-gnu
echo hppa64-unknown-linux-${LIBC}
exit ;;
parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
PA7*) echo hppa1.1-unknown-linux-gnu ;;
PA8*) echo hppa2.0-unknown-linux-gnu ;;
*) echo hppa-unknown-linux-gnu ;;
PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
*) echo hppa-unknown-linux-${LIBC} ;;
esac
exit ;;
ppc64:Linux:*:*)
echo powerpc64-unknown-linux-gnu
echo powerpc64-unknown-linux-${LIBC}
exit ;;
ppc:Linux:*:*)
echo powerpc-unknown-linux-gnu
echo powerpc-unknown-linux-${LIBC}
exit ;;
ppc64le:Linux:*:*)
echo powerpc64le-unknown-linux-${LIBC}
exit ;;
ppcle:Linux:*:*)
echo powerpcle-unknown-linux-${LIBC}
exit ;;
s390:Linux:*:* | s390x:Linux:*:*)
echo ${UNAME_MACHINE}-ibm-linux
echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
exit ;;
sh64*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
sh*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
sparc:Linux:*:* | sparc64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
tile*:Linux:*:*)
echo ${UNAME_MACHINE}-tilera-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
vax:Linux:*:*)
echo ${UNAME_MACHINE}-dec-linux-gnu
echo ${UNAME_MACHINE}-dec-linux-${LIBC}
exit ;;
x86_64:Linux:*:*)
echo x86_64-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
xtensa*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
i*86:DYNIX/ptx:4*:*)
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
@ -1191,6 +1227,9 @@ EOF
BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
echo i586-pc-haiku
exit ;;
x86_64:Haiku:*:*)
echo x86_64-unknown-haiku
exit ;;
SX-4:SUPER-UX:*:*)
echo sx4-nec-superux${UNAME_RELEASE}
exit ;;
@ -1217,19 +1256,21 @@ EOF
exit ;;
*:Darwin:*:*)
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
case $UNAME_PROCESSOR in
i386)
eval $set_cc_for_build
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
UNAME_PROCESSOR="x86_64"
fi
fi ;;
unknown) UNAME_PROCESSOR=powerpc ;;
esac
eval $set_cc_for_build
if test "$UNAME_PROCESSOR" = unknown ; then
UNAME_PROCESSOR=powerpc
fi
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
case $UNAME_PROCESSOR in
i386) UNAME_PROCESSOR=x86_64 ;;
powerpc) UNAME_PROCESSOR=powerpc64 ;;
esac
fi
fi
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
exit ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
@ -1246,7 +1287,7 @@ EOF
NEO-?:NONSTOP_KERNEL:*:*)
echo neo-tandem-nsk${UNAME_RELEASE}
exit ;;
NSE-?:NONSTOP_KERNEL:*:*)
NSE-*:NONSTOP_KERNEL:*:*)
echo nse-tandem-nsk${UNAME_RELEASE}
exit ;;
NSR-?:NONSTOP_KERNEL:*:*)
@ -1315,11 +1356,11 @@ EOF
i*86:AROS:*:*)
echo ${UNAME_MACHINE}-pc-aros
exit ;;
x86_64:VMkernel:*:*)
echo ${UNAME_MACHINE}-unknown-esx
exit ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
eval $set_cc_for_build
cat >$dummy.c <<EOF
#ifdef _SEQUENT_

View File

@ -1,38 +1,31 @@
#! /bin/sh
# Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011 Free Software Foundation, Inc.
# Copyright 1992-2013 Free Software Foundation, Inc.
timestamp='2011-03-23'
timestamp='2013-08-10'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
# can handle that machine. It does not imply ALL GNU software can.
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# 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., 51 Franklin Street - Fifth Floor, Boston, MA
# 02110-1301, USA.
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
# 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.
# the same distribution terms that you use for the rest of that
# program. This Exception is an additional permission under section 7
# of the GNU General Public License, version 3 ("GPLv3").
# Please send patches to <config-patches@gnu.org>. Submit a context
# diff and a properly formatted GNU ChangeLog entry.
# Please send patches with a ChangeLog entry to config-patches@gnu.org.
#
# Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument.
@ -75,9 +68,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, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free
Software Foundation, Inc.
Copyright 1992-2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@ -125,13 +116,17 @@ esac
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
knetbsd*-gnu* | netbsd*-gnu* | \
kopensolaris*-gnu* | \
storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
android-linux)
os=-linux-android
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
;;
*)
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
if [ $basic_machine != $1 ]
@ -154,7 +149,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 | -knuth | -cray | -microblaze)
-apple | -axis | -knuth | -cray | -microblaze*)
os=
basic_machine=$1
;;
@ -223,6 +218,12 @@ case $os in
-isc*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-lynx*178)
os=-lynxos178
;;
-lynx*5)
os=-lynxos5
;;
-lynx*)
os=-lynxos
;;
@ -247,20 +248,27 @@ case $basic_machine in
# Some are omitted here because they have special meanings below.
1750a | 580 \
| a29k \
| aarch64 | aarch64_be \
| 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 | avr32 \
| arc | arceb \
| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
| avr | avr32 \
| be32 | be64 \
| bfin \
| c4x | clipper \
| c4x | c8051 | clipper \
| d10v | d30v | dlx | dsp16xx \
| epiphany \
| fido | fr30 | frv \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| hexagon \
| i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \
| le32 | le64 \
| lm32 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \
| maxq | mb | microblaze | mcore | mep | metag \
| maxq | mb | microblaze | microblazeel | mcore | mep | metag \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
@ -278,20 +286,21 @@ case $basic_machine in
| mipsisa64r2 | mipsisa64r2el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
| mipsr5900 | mipsr5900el \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
| moxie \
| mt \
| msp430 \
| nds32 | nds32le | nds32be \
| nios | nios2 \
| nios | nios2 | nios2eb | nios2el \
| ns16k | ns32k \
| open8 \
| or32 \
| or1k | or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle \
| pyramid \
| rx \
| rl78 | rx \
| score \
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
@ -300,7 +309,7 @@ case $basic_machine in
| spu \
| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
| ubicom32 \
| v850 | v850e \
| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
| we32k \
| x86 | xc16x | xstormy16 | xtensa \
| z8k | z80)
@ -315,8 +324,7 @@ case $basic_machine in
c6x)
basic_machine=tic6x-unknown
;;
m6811 | m68hc11 | m6812 | m68hc12 | picochip)
# Motorola 68HC11/12.
m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
basic_machine=$basic_machine-unknown
os=-none
;;
@ -329,7 +337,10 @@ case $basic_machine in
strongarm | thumb | xscale)
basic_machine=arm-unknown
;;
xgate)
basic_machine=$basic_machine-unknown
os=-none
;;
xscaleeb)
basic_machine=armeb-unknown
;;
@ -352,25 +363,30 @@ case $basic_machine in
# Recognize the basic CPU types with company name.
580-* \
| a29k-* \
| aarch64-* | aarch64_be-* \
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* | avr32-* \
| be32-* | be64-* \
| bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* \
| clipper-* | craynv-* | cydra-* \
| c8051-* | clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
| h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| hexagon-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \
| le32-* | le64-* \
| lm32-* \
| m32c-* | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
| microblaze-* | microblazeel-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \
| mips64-* | mips64el-* \
@ -388,19 +404,20 @@ case $basic_machine in
| mipsisa64r2-* | mipsisa64r2el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipsr5900-* | mipsr5900el-* \
| mipstx39-* | mipstx39el-* \
| mmix-* \
| mt-* \
| msp430-* \
| nds32-* | nds32le-* | nds32be-* \
| nios-* | nios2-* \
| nios-* | nios2-* | nios2eb-* | nios2el-* \
| none-* | np1-* | ns16k-* | ns32k-* \
| open8-* \
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
| pyramid-* \
| romp-* | rs6000-* | rx-* \
| rl78-* | romp-* | rs6000-* | rx-* \
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
@ -408,10 +425,11 @@ case $basic_machine in
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
| tahoe-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tile-* | tilegx-* \
| tile*-* \
| tron-* \
| ubicom32-* \
| v850-* | v850e-* | vax-* \
| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
| vax-* \
| we32k-* \
| x86-* | x86_64-* | xc16x-* | xps100-* \
| xstormy16-* | xtensa*-* \
@ -711,7 +729,6 @@ case $basic_machine in
i370-ibm* | ibm*)
basic_machine=i370-ibm
;;
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
i*86v32)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv32
@ -769,11 +786,15 @@ case $basic_machine in
basic_machine=ns32k-utek
os=-sysv
;;
microblaze)
microblaze*)
basic_machine=microblaze-xilinx
;;
mingw64)
basic_machine=x86_64-pc
os=-mingw64
;;
mingw32)
basic_machine=i386-pc
basic_machine=i686-pc
os=-mingw32
;;
mingw32ce)
@ -808,10 +829,18 @@ case $basic_machine in
ms1-*)
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
;;
msys)
basic_machine=i686-pc
os=-msys
;;
mvs)
basic_machine=i370-ibm
os=-mvs
;;
nacl)
basic_machine=le32-unknown
os=-nacl
;;
ncr3000)
basic_machine=i486-ncr
os=-sysv4
@ -992,7 +1021,11 @@ case $basic_machine in
basic_machine=i586-unknown
os=-pw32
;;
rdos)
rdos | rdos64)
basic_machine=x86_64-pc
os=-rdos
;;
rdos32)
basic_machine=i386-pc
os=-rdos
;;
@ -1120,13 +1153,8 @@ case $basic_machine in
basic_machine=t90-cray
os=-unicos
;;
# This must be matched before tile*.
tilegx*)
basic_machine=tilegx-unknown
os=-linux-gnu
;;
tile*)
basic_machine=tile-unknown
basic_machine=$basic_machine-unknown
os=-linux-gnu
;;
tx39)
@ -1324,21 +1352,21 @@ case $os in
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
| -sym* | -kopensolaris* \
| -sym* | -kopensolaris* | -plan9* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* | -aros* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
| -openbsd* | -solidbsd* \
| -bitrig* | -openbsd* | -solidbsd* \
| -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* | -cegcc* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux-gnu* | -linux-android* \
| -linux-newlib* | -linux-uclibc* \
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
| -linux-newlib* | -linux-musl* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
@ -1470,9 +1498,6 @@ case $os in
-aros*)
os=-aros
;;
-kaos*)
os=-kaos
;;
-zvmoe)
os=-zvmoe
;;
@ -1521,6 +1546,12 @@ case $basic_machine in
c4x-* | tic4x-*)
os=-coff
;;
c8051-*)
os=-elf
;;
hexagon-*)
os=-elf
;;
tic54x-*)
os=-coff
;;
@ -1548,9 +1579,6 @@ case $basic_machine in
;;
m68000-sun)
os=-sunos3
# This also exists in the configure program, but was not the
# default.
# os=-sunos4
;;
m68*-cisco)
os=-aout
@ -1564,6 +1592,9 @@ case $basic_machine in
mips*-*)
os=-elf
;;
or1k-*)
os=-elf
;;
or32-*)
os=-coff
;;

View File

@ -15822,7 +15822,7 @@ case "${host_os}" in
$as_echo "#define PA_USE_COREAUDIO 1" >>confdefs.h
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/os/unix -Werror"
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/os/unix -Wno-deprecated -Werror"
LIBS="-framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework Carbon"
if test "x$enable_mac_universal" = "xyes" ; then
@ -15848,8 +15848,23 @@ case "${host_os}" in
elif xcodebuild -version -sdk macosx10.7 Path >/dev/null 2>&1 ; then
mac_version_min="-mmacosx-version-min=10.4"
mac_sysroot="-isysroot `xcodebuild -version -sdk macosx10.7 Path`"
elif xcodebuild -version -sdk macosx10.8 Path >/dev/null 2>&1 ; then
mac_version_min="-mmacosx-version-min=10.4"
mac_sysroot="-isysroot `xcodebuild -version -sdk macosx10.8 Path`"
elif xcodebuild -version -sdk macosx10.9 Path >/dev/null 2>&1 ; then
mac_version_min="-mmacosx-version-min=10.4"
mac_sysroot="-isysroot `xcodebuild -version -sdk macosx10.9 Path`"
elif xcodebuild -version -sdk macosx10.10 Path >/dev/null 2>&1 ; then
mac_version_min="-mmacosx-version-min=10.4"
mac_sysroot="-isysroot `xcodebuild -version -sdk macosx10.10 Path`"
elif xcodebuild -version -sdk macosx10.11 Path >/dev/null 2>&1 ; then
mac_version_min="-mmacosx-version-min=10.4"
mac_sysroot="-isysroot `xcodebuild -version -sdk macosx10.11 Path`"
elif xcodebuild -version -sdk macosx10.12 Path >/dev/null 2>&1 ; then
mac_version_min="-mmacosx-version-min=10.4"
mac_sysroot="-isysroot `xcodebuild -version -sdk macosx10.12 Path`"
else
as_fn_error $? "Couldn't find 10.5, 10.6, or 10.7 SDK" "$LINENO" 5
as_fn_error $? "Could not find 10.5 to 10.12 SDK." "$LINENO" 5
fi
esac
@ -15923,7 +15938,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
if [ "x$with_wdmks" = "xyes" ]; then
DXDIR="$with_dxdir"
add_objects src/hostapi/wdmks/pa_win_wdmks.o src/common/pa_ringbuffer.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o src/os/win/pa_win_wdmks_util.o src/os/win/pa_win_waveformat.o
add_objects src/hostapi/wdmks/pa_win_wdmks.o src/common/pa_ringbuffer.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o src/os/win/pa_win_wdmks_utils.o src/os/win/pa_win_waveformat.o
LIBS="${LIBS} -lwinmm -lm -luuid -lsetupapi -lole32"
DLL_LIBS="${DLL_LIBS} -lwinmm -lm -L$DXDIR/lib -luuid -lsetupapi -lole32"
#VC98="\"/c/Program Files/Microsoft Visual Studio/VC98/Include\""
@ -16173,7 +16188,7 @@ fi
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 src/hostapi/jack/pa_jack_dynload.o src/common/pa_ringbuffer.o"
OTHER_OBJS="$OTHER_OBJS src/hostapi/jack/pa_jack.o src/common/pa_ringbuffer.o"
INCLUDES="$INCLUDES pa_jack.h"
$as_echo "#define PA_USE_JACK 1" >>confdefs.h

View File

@ -204,7 +204,7 @@ case "${host_os}" in
AC_DEFINE(PA_USE_COREAUDIO,1)
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/os/unix -Werror"
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/os/unix -Wno-deprecated -Werror"
LIBS="-framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework Carbon"
if test "x$enable_mac_universal" = "xyes" ; then
@ -243,8 +243,23 @@ case "${host_os}" in
elif xcodebuild -version -sdk macosx10.7 Path >/dev/null 2>&1 ; then
mac_version_min="-mmacosx-version-min=10.4"
mac_sysroot="-isysroot `xcodebuild -version -sdk macosx10.7 Path`"
elif xcodebuild -version -sdk macosx10.8 Path >/dev/null 2>&1 ; then
mac_version_min="-mmacosx-version-min=10.4"
mac_sysroot="-isysroot `xcodebuild -version -sdk macosx10.8 Path`"
elif xcodebuild -version -sdk macosx10.9 Path >/dev/null 2>&1 ; then
mac_version_min="-mmacosx-version-min=10.4"
mac_sysroot="-isysroot `xcodebuild -version -sdk macosx10.9 Path`"
elif xcodebuild -version -sdk macosx10.10 Path >/dev/null 2>&1 ; then
mac_version_min="-mmacosx-version-min=10.4"
mac_sysroot="-isysroot `xcodebuild -version -sdk macosx10.10 Path`"
elif xcodebuild -version -sdk macosx10.11 Path >/dev/null 2>&1 ; then
mac_version_min="-mmacosx-version-min=10.4"
mac_sysroot="-isysroot `xcodebuild -version -sdk macosx10.11 Path`"
elif xcodebuild -version -sdk macosx10.12 Path >/dev/null 2>&1 ; then
mac_version_min="-mmacosx-version-min=10.4"
mac_sysroot="-isysroot `xcodebuild -version -sdk macosx10.12 Path`"
else
AC_MSG_ERROR([Couldn't find 10.5, 10.6, or 10.7 SDK])
AC_MSG_ERROR([Could not find 10.5 to 10.12 SDK.])
fi
esac
@ -312,7 +327,7 @@ case "${host_os}" in
if [[ "x$with_wdmks" = "xyes" ]]; then
DXDIR="$with_dxdir"
add_objects src/hostapi/wdmks/pa_win_wdmks.o src/common/pa_ringbuffer.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o src/os/win/pa_win_wdmks_util.o src/os/win/pa_win_waveformat.o
add_objects src/hostapi/wdmks/pa_win_wdmks.o src/common/pa_ringbuffer.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o src/os/win/pa_win_wdmks_utils.o src/os/win/pa_win_waveformat.o
LIBS="${LIBS} -lwinmm -lm -luuid -lsetupapi -lole32"
DLL_LIBS="${DLL_LIBS} -lwinmm -lm -L$DXDIR/lib -luuid -lsetupapi -lole32"
#VC98="\"/c/Program Files/Microsoft Visual Studio/VC98/Include\""
@ -394,7 +409,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 src/hostapi/jack/pa_jack_dynload.o src/common/pa_ringbuffer.o"
OTHER_OBJS="$OTHER_OBJS src/hostapi/jack/pa_jack.o src/common/pa_ringbuffer.o"
INCLUDES="$INCLUDES pa_jack.h"
AC_DEFINE(PA_USE_JACK,1)
fi

View File

@ -1,10 +1,9 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2009-04-28.21; # UTC
scriptversion=2013-05-30.07; # UTC
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free
# Software Foundation, Inc.
# Copyright (C) 1999-2013 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,9 +27,9 @@ scriptversion=2009-04-28.21; # UTC
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1;
;;
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
@ -40,11 +39,11 @@ as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by `PROGRAMS ARGS'.
object Object file output by `PROGRAMS ARGS'.
source Source file read by 'PROGRAMS ARGS'.
object Object file output by 'PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputing dependencies.
tmpdepfile Temporary file to use when outputting dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
@ -57,6 +56,66 @@ EOF
;;
esac
# Get the directory component of the given path, and save it in the
# global variables '$dir'. Note that this directory component will
# be either empty or ending with a '/' character. This is deliberate.
set_dir_from ()
{
case $1 in
*/*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
*) dir=;;
esac
}
# Get the suffix-stripped basename of the given path, and save it the
# global variable '$base'.
set_base_from ()
{
base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
}
# If no dependency file was actually created by the compiler invocation,
# we still have to create a dummy depfile, to avoid errors with the
# Makefile "include basename.Plo" scheme.
make_dummy_depfile ()
{
echo "#dummy" > "$depfile"
}
# Factor out some common post-processing of the generated depfile.
# Requires the auxiliary global variable '$tmpdepfile' to be set.
aix_post_process_depfile ()
{
# If the compiler actually managed to produce a dependency file,
# post-process it.
if test -f "$tmpdepfile"; then
# Each line is of the form 'foo.o: dependency.h'.
# Do two passes, one to just change these to
# $object: dependency.h
# and one to simply output
# dependency.h:
# which is needed to avoid the deleted-header problem.
{ sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
} > "$depfile"
rm -f "$tmpdepfile"
else
make_dummy_depfile
fi
}
# A tabulation character.
tab=' '
# A newline character.
nl='
'
# Character ranges might be problematic outside the C locale.
# These definitions help.
upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
lower=abcdefghijklmnopqrstuvwxyz
digits=0123456789
alpha=${upper}${lower}
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
@ -69,6 +128,9 @@ tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Avoid interferences from the environment.
gccflag= dashmflag=
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
@ -80,18 +142,32 @@ if test "$depmode" = hp; then
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
cygpath_u="cygpath -u -f -"
if test "$depmode" = msvcmsys; then
# This is just like msvisualcpp but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u="sed s,\\\\\\\\,/,g"
depmode=msvisualcpp
# This is just like msvisualcpp but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u='sed s,\\\\,/,g'
depmode=msvisualcpp
fi
if test "$depmode" = msvc7msys; then
# This is just like msvc7 but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u='sed s,\\\\,/,g'
depmode=msvc7
fi
if test "$depmode" = xlc; then
# IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
gccflag=-qmakedep=gcc,-MF
depmode=gcc
fi
case "$depmode" in
@ -114,8 +190,7 @@ gcc3)
done
"$@"
stat=$?
if test $stat -eq 0; then :
else
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
@ -123,13 +198,17 @@ gcc3)
;;
gcc)
## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
## (see the conditional assignment to $gccflag above).
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say).
## -MM, not -M (despite what the docs say). Also, it might not be
## supported by the other compilers which use the 'gcc' depmode.
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
@ -137,31 +216,31 @@ gcc)
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## The second -e expression handles DOS-style file names with drive letters.
# The second -e expression handles DOS-style file names with drive
# letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the `deleted header file' problem.
## This next piece of magic avoids the "deleted header file" problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
tr ' ' '
' < "$tmpdepfile" |
## Some versions of gcc put a space before the `:'. On the theory
## Some versions of gcc put a space before the ':'. On the theory
## that the space means something, we add a space to the output as
## well.
## well. hp depmode also adds that space, but also prefixes the VPATH
## to the object. Take care to not repeat it in the output.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
@ -179,8 +258,7 @@ sgi)
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -eq 0; then :
else
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
@ -188,43 +266,41 @@ sgi)
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like `#:fec' to the end of the
# the IRIX cc adds comments like '#:fec' to the end of the
# dependency line.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr '
' ' ' >> "$depfile"
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
| tr "$nl" ' ' >> "$depfile"
echo >> "$depfile"
# The second pass generates a dummy entry for each header file.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> "$depfile"
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
make_dummy_depfile
fi
rm -f "$tmpdepfile"
;;
xlc)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts `$object:' at the
# current directory. Also, the AIX compiler puts '$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
set_dir_from "$object"
set_base_from "$object"
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.u
tmpdepfile2=$base.u
@ -237,9 +313,7 @@ aix)
"$@" -M
fi
stat=$?
if test $stat -eq 0; then :
else
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
@ -248,44 +322,100 @@ aix)
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
# Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
aix_post_process_depfile
;;
tcc)
# tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
# FIXME: That version still under development at the moment of writing.
# Make that this statement remains true also for stable, released
# versions.
# It will wrap lines (doesn't matter whether long or short) with a
# trailing '\', as in:
#
# foo.o : \
# foo.c \
# foo.h \
#
# It will put a trailing '\' even on the last line, and will use leading
# spaces rather than leading tabs (at least since its commit 0394caf7
# "Emit spaces for -MD").
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
# We have to change lines of the first kind to '$object: \'.
sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
# And for each line of the second kind, we have to emit a 'dep.h:'
# dummy dependency, to avoid the deleted-header problem.
sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
rm -f "$tmpdepfile"
;;
icc)
# Intel's C compiler understands `-MD -MF file'. However on
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
# ICC 7.0 will fill foo.d with something like
# foo.o: sub/foo.c
# foo.o: sub/foo.h
# which is wrong. We want:
# sub/foo.o: sub/foo.c
# sub/foo.o: sub/foo.h
# sub/foo.c:
# sub/foo.h:
# ICC 7.1 will output
## The order of this option in the case statement is important, since the
## shell code in configure will try each of these formats in the order
## listed in this file. A plain '-MD' option would be understood by many
## compilers, so we must ensure this comes after the gcc and icc options.
pgcc)
# Portland's C compiler understands '-MD'.
# Will always output deps to 'file.d' where file is the root name of the
# source file under compilation, even if file resides in a subdirectory.
# The object file name does not affect the name of the '.d' file.
# pgcc 10.2 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using \ :
# and will wrap long lines using '\' :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
set_dir_from "$object"
# Use the source, not the object, to determine the base name, since
# that's sadly what pgcc will do too.
set_base_from "$source"
tmpdepfile=$base.d
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
# For projects that build the same source file twice into different object
# files, the pgcc approach of using the *source* file root name can cause
# problems in parallel builds. Use a locking strategy to avoid stomping on
# the same $tmpdepfile.
lockdir=$base.d-lock
trap "
echo '$0: caught signal, cleaning up...' >&2
rmdir '$lockdir'
exit 1
" 1 2 13 15
numtries=100
i=$numtries
while test $i -gt 0; do
# mkdir is a portable test-and-set.
if mkdir "$lockdir" 2>/dev/null; then
# This process acquired the lock.
"$@" -MD
stat=$?
# Release the lock.
rmdir "$lockdir"
break
else
# If the lock is being held by a different process, wait
# until the winning process is done or we timeout.
while test -d "$lockdir" && test $i -gt 0; do
sleep 1
i=`expr $i - 1`
done
fi
i=`expr $i - 1`
done
trap - 1 2 13 15
if test $i -le 0; then
echo "$0: failed to acquire lock after $numtries attempts" >&2
echo "$0: check lockdir '$lockdir'" >&2
exit 1
fi
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
@ -297,8 +427,8 @@ icc)
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
sed -e 's/$/ :/' >> "$depfile"
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
@ -309,9 +439,8 @@ hp2)
# 'foo.d', which lands next to the object file, wherever that
# happens to be.
# Much of this is similar to the tru64 case; see comments there.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
set_dir_from "$object"
set_base_from "$object"
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir.libs/$base.d
@ -322,8 +451,7 @@ hp2)
"$@" +Maked
fi
stat=$?
if test $stat -eq 0; then :
else
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
@ -333,77 +461,107 @@ hp2)
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
# Add `dependent.h:' lines.
sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
# Add 'dependent.h:' lines.
sed -ne '2,${
s/^ *//
s/ \\*$//
s/$/:/
p
}' "$tmpdepfile" >> "$depfile"
s/^ *//
s/ \\*$//
s/$/:/
p
}' "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
make_dummy_depfile
fi
rm -f "$tmpdepfile" "$tmpdepfile2"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in `foo.d' instead, so we check for that too.
# Subdirectories are respected.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in 'foo.d' instead, so we check for that too.
# Subdirectories are respected.
set_dir_from "$object"
set_base_from "$object"
if test "$libtool" = yes; then
# With Tru64 cc, shared objects can also be used to make a
# static library. This mechanism is used in libtool 1.4 series to
# handle both shared and static libraries in a single compilation.
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
#
# With libtool 1.5 this exception was removed, and libtool now
# generates 2 separate objects for the 2 libraries. These two
# compilations output dependencies in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
# automatically cleaned when .libs/ is deleted, while ignoring
# the former would cause a distcleancheck panic.
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
tmpdepfile2=$dir$base.o.d # libtool 1.5
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.o.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
tmpdepfile4=$dir$base.d
"$@" -MD
fi
if test "$libtool" = yes; then
# Libtool generates 2 separate objects for the 2 libraries. These
# two compilations output dependencies in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
# automatically cleaned when .libs/ is deleted, while ignoring
# the former would cause a distcleancheck panic.
tmpdepfile1=$dir$base.o.d # libtool 1.5
tmpdepfile2=$dir.libs/$base.o.d # Likewise.
tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
exit $stat
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
# Same post-processing that is required for AIX mode.
aix_post_process_depfile
;;
msvc7)
if test "$libtool" = yes; then
showIncludes=-Wc,-showIncludes
else
showIncludes=-showIncludes
fi
"$@" $showIncludes > "$tmpdepfile"
stat=$?
grep -v '^Note: including file: ' "$tmpdepfile"
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
# The first sed program below extracts the file names and escapes
# backslashes for cygpath. The second sed program outputs the file
# name when reading, but also accumulates all include files in the
# hold buffer in order to output them again at the end. This only
# works with sed implementations that can handle large buffers.
sed < "$tmpdepfile" -n '
/^Note: including file: *\(.*\)/ {
s//\1/
s/\\/\\\\/g
p
}' | $cygpath_u | sort -u | sed -n '
s/ /\\ /g
s/\(.*\)/'"$tab"'\1 \\/p
s/.\(.*\) \\/\1:/
H
$ {
s/.*/'"$tab"'/
G
p
}' >> "$depfile"
echo >> "$depfile" # make sure the fragment doesn't end with a backslash
rm -f "$tmpdepfile"
;;
msvc7msys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
@ -422,7 +580,7 @@ dashmstdout)
shift
fi
# Remove `-o $object'.
# Remove '-o $object'.
IFS=" "
for arg
do
@ -442,18 +600,18 @@ dashmstdout)
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for `:'
# Require at least two characters before searching for ':'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
# a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
"$@" $dashmflag |
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' '
' < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
# Some versions of the HPUX 10.20 sed can't process this sed invocation
# correctly. Breaking it into two sed invocations is a workaround.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
@ -503,12 +661,15 @@ makedepend)
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
sed '1,2d' "$tmpdepfile" | tr ' ' '
' | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
# makedepend may prepend the VPATH from the source file name to the object.
# No need to regex-escape $object, excess matching of '.' is harmless.
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process the last invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed '1,2d' "$tmpdepfile" \
| tr ' ' "$nl" \
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
@ -525,7 +686,7 @@ cpp)
shift
fi
# Remove `-o $object'.
# Remove '-o $object'.
IFS=" "
for arg
do
@ -544,10 +705,10 @@ cpp)
esac
done
"$@" -E |
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
sed '$ s: \\$::' > "$tmpdepfile"
"$@" -E \
| sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
| sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
@ -579,23 +740,23 @@ msvisualcpp)
shift
;;
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E 2>/dev/null |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
echo " " >> "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
echo "$tab" >> "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;

View File

@ -49,7 +49,9 @@ Documentation for the Java JNI interface to PortAudio
- <a href="http://www.assembla.com/spaces/portaudio/wiki">Our wiki and issue tracking system</a>
- <a href="http://www.portaudio.com/docs/proposals/014-StyleGuide.html">Coding guidelines</a>
- <a href="https://www.assembla.com/spaces/portaudio/wiki/DeveloperGuidelines">Developer guidelines</a>
- <a href="https://www.assembla.com/spaces/portaudio/wiki/ImplementationStyleGuidelines">Implementation style guidelines</a>
If you're interested in helping out with PortAudio development we're more than happy for you to be involved. Just drop by the PortAudio mailing list and ask how you can help. Or <a href="http://www.assembla.com/spaces/portaudio/tickets">check out the starter tickets</a>.

View File

@ -32,7 +32,7 @@ That will build PortAudio using Jack, ALSA and OSS in whatever combination they
To use PortAudio in your apps, you can simply install the .so files:
@code
make install
sudo make install
@endcode
Projects built this way will expect PortAudio to be installed on target systems in order to run. If you want to build a more self-contained binary, you may use the libportaudio.a file:
@ -41,10 +41,16 @@ Projects built this way will expect PortAudio to be installed on target systems
cp lib/.libs/libportaudio.a /YOUR/PROJECT/DIR
@endcode
On some systems you may need to use:
@code
cp /usr/local/lib/libportaudio.a /YOUR/PROJECT/DIR
@endcode
You may also need to copy portaudio.h, located in the include/ directory of PortAudio into your project. Note that you will usually need to link with the approriate libraries that you used, such as ALSA and JACK, as well as with librt and libpthread. For example:
@code
gcc -lrt -lasound -ljack -lpthread -o YOUR_BINARY main.c libportaudio.a
gcc main.c libportaudio.a -lrt -lm -lasound -ljack -pthread -o YOUR_BINARY
@endcode
@section comp_linux4 Linux Extensions

View File

@ -1,33 +1,39 @@
/** @page compile_windows Building Portaudio for Windows using Microsoft Visual Studio
/** @page compile_windows Building PortAudio for Windows using Microsoft Visual Studio
@ingroup tutorial
Below is a list of steps to build PortAudio into a dll and lib file. The resulting dll file may contain all five current win32 PortAudio APIs: MME, DirectSound, WASAPI, WDM/KS and ASIO, depending on the preprocessor definitions set in step 9 below.
PortAudio can be compiled using Visual C++ Express Edition which is available free from Microsoft. If you do not already have a C++ development environment, simply download and install. These instructions have been observed to succeed using Visual Studio 2010 as well.
1) PortAudio for Windows requires the files <i>dsound.h</i> and <i>dsconf.h</i>. Download and install the DirectX SDK from http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=3021d52b-514e-41d3-ad02-438a3ba730ba to obtain these files. If you installed the DirectX SDK then the !DirectSound libraries and header files should be found automatically by Visual !Studio/Visual C++. If you get an error saying dsound.h or dsconf.h is missing, you can declare these paths by hand. Alternatively, you can copy dsound.h and dsconf.h to portaudio\\include. There should also be a file named ''dsound.lib'' in C:\\Program Files\\Microsoft SDKs\\Windows\\v6.0A\\Lib.
1) Building PortAudio with DirectSound support requires the files <i>dsound.h</i> and <i>dsconf.h</i>. Download and install the DirectX SDK from http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=3021d52b-514e-41d3-ad02-438a3ba730ba to obtain these files. If you installed the DirectX SDK then the DirectSound libraries and header files should be found automatically by Visual Studio/Visual C++. If you get an error saying dsound.h or dsconf.h is missing, you will need to add an extra include path to the Visual Studio project file referencing the DirectX includes directory.
2) For ASIO support, download the ASIO SDK from Steinberg at http://www.steinberg.net/en/company/developer.html. The SDK is free but you will need to set up a developer account with Steinberg. Copy the entire ASIOSDK2 folder into src\\hostapi\\asio\\. Rename it from ASIOSDK2 to ASIOSDK. To build without ASIO (or other host API) see the "Building without ASIO support" section below.
2) For ASIO support, download the ASIO SDK from Steinberg at http://www.steinberg.net/en/company/developer.html . The SDK is free, but you will need to set up a developer account with Steinberg. To use the Visual Studio projects mentioned below, copy the entire ASIOSDK2 folder into src\\hostapi\\asio\\. Rename it from ASIOSDK2 to ASIOSDK. To build without ASIO (or other host API) see the "Building without ASIO support" section below.
3) If you have Visual Studio 6.0, 7.0(VC.NET/2001) or 7.1(VC.2003), open portaudio.dsp and convert if needed.
4) If you have Visual Studio 2005, Visual C++ 2008 Express Edition or Visual Studio 2010, double click the portaudio.sln file located in build\\msvc\\. Doing so will open Visual Studio or Visual C++. Click "Finish" if a wizard appears. The sln file contains four configurations: Win32 and Win64 in both Release and Debug variants.
4) If you have Visual Studio 2005, Visual C++ 2008 Express Edition or Visual Studio 2010, open the portaudio.sln file located in build\\msvc\\. Doing so will open Visual Studio or Visual C++. Click "Finish" if a conversion wizard appears. The sln file contains four configurations: Win32 and Win64 in both Release and Debug variants.
@section comp_win1 For Visual Studio 2005, Visual C++ 2008 Express Edition or Visual Studio 2010
The steps below describe settings for recent versions of Visual Studio. Similar settings can be set in earlier versions of Visual Studio.
5) Open Project -> portaudio Properties and select "Configuration Properties" in the tree view.
6) Select "all configurations" in the "Configurations" combo box above. Select "All Platforms" in the "Platforms" combo box.
7) Now set a few options:
C/C++ -> Optimization -> Omit frame pointers = Yes
Required:
C/C++ -> Code Generation -> Runtime library = /MT
Optional:
C/C++ -> Optimization -> Omit frame pointers = Yes
Optional: C/C++ -> Code Generation -> Floating point model = fast
NOTE: For most users it is not necessary to explicitly set the structure member alignment; the default should work fine. However some languages require, for example, 4-byte alignment. If you are having problems with portaudio.h structure members not being properly read or written to, it may be necessary to explicitly set this value by going to C/C++ -> Code Generation -> Struct member alignment and setting it to an appropriate value (four is a common value). If your compiler is configurable, you should ensure that it is set to use the same structure member alignment value as used for the PortAudio build.
NOTE: When using PortAudio from C/C++ it is not usually necessary to explicitly set the structure member alignment; the default should work fine. However some languages require, for example, 4-byte alignment. If you are having problems with portaudio.h structure members not being properly read or written to, it may be necessary to explicitly set this value by going to C/C++ -> Code Generation -> Struct member alignment and setting it to an appropriate value (four is a common value). If your compiler is configurable, you should ensure that it is set to use the same structure member alignment value as used for the PortAudio build.
Click "Ok" when you have finished setting these parameters.
@ -37,7 +43,7 @@ Since the preprocessor definitions are different for each configuration and plat
8) To suppress PortAudio runtime debug console output, go to Project -> Properties -> Configuration Properties -> C/C++ -> Preprocessor. In the field 'Preprocessor Definitions', find PA_ENABLE_DEBUG_OUTPUT and remove it. The console will not output debug messages.
9) Also in the preprocessor definitions you need to explicitly define the audio APIs you wish to use. For Windows the available API definitions are:
9) Also in the preprocessor definitions you need to explicitly define the native audio APIs you wish to use. For Windows the available API definitions are:
PA_USE_ASIO<br>
PA_USE_DS (DirectSound)<br>
@ -46,7 +52,7 @@ PA_USE_WASAPI<br>
PA_USE_WDMKS<br>
PA_USE_SKELETON
For each of these, the value of 0 indicates that support for this API should not be included. The value 1 indicates that support for this API should be included.
For each of these, the value of 0 indicates that support for this API should not be included. The value 1 indicates that support for this API should be included. (PA_USE_SKELETON is not usually used, it is a code sample for developers wanting to support a new API).
@section comp_win3 Building
@ -54,7 +60,7 @@ As when setting Preprocessor definitions, building is a per-configuration per-pl
10) From the Build menu click Build -> Build solution. For 32-bit compilations, the dll file created by this process (portaudio_x86.dll) can be found in the directory build\\msvc\\Win32\\Release. For 64-bit compilations, the dll file is called portaudio_x64.dll, and is found in the directory build\\msvc\\x64\\Release.
11) Now, any project which requires portaudio can be linked with portaudio_x86.lib (or _x64) and include the relevant headers (portaudio.h, and/or pa_asio.h , pa_x86_plain_converters.h) You may want to add/remove some DLL entry points. Right now those 6 entries are not from portaudio.h:
11) Now, any project that requires portaudio can be linked with portaudio_x86.lib (or _x64) and include the relevant headers (portaudio.h, and/or pa_asio.h , pa_x86_plain_converters.h) You may want to add/remove some DLL entry points. At the time of writing the following 6 entries are not part of the official PortAudio API defined in portaudio.h:
(from portaudio.def)
@code
@ -71,13 +77,16 @@ PaUtil_SetLogPrintFunction @55
To build PortAudio without ASIO support you need to:
1) Make sure your project doesn't try to build any ASIO SDK files. If you're using one of the shipped projects, remove the ASIO related files from the project.
1) Make sure your project doesn't try to build any ASIO SDK files. If you're using one of the shipped projects, remove the ASIO related files from the project. In the shipped projects you can find them in the project tree under portaudio > Source Files > hostapi > ASIO > ASIOSDK
2) Make sure your project doesn't try to build the PortAudio ASIO implementation files:
src\\hostapi\\pa_asio.cpp src\\hostapi\\iasiothiscallresolver.cpp
@code
src\\hostapi\\pa_asio.cpp
src\\hostapi\\iasiothiscallresolver.cpp
@endcode
If you're using one of the shipped projects, remove them from the project.
If you're using one of the shipped projects, remove them from the project. In the shipped projects you can find them in the project tree under portaudio > Source Files > hostapi > ASIO
3) Define the preprocessor symbols in the project properties as described in step 9 above. In VS2005 this can be accomplished by selecting
Project Properties -> Configuration Properties -> C/C++ -> Preprocessor -> Preprocessor Definitions. Omitting PA_USE_ASIO or setting it to 0 stops src\\os\\win\\pa_win_hostapis.c from trying to initialize the PortAudio ASIO implementation.
@ -92,6 +101,8 @@ Updated by Chris on 5/26/2011
Improvements by John Clements on 12/15/2011
Edits by Ross on 1/20/2014
Back to the Tutorial: \ref tutorial_start
*/

View File

@ -7,14 +7,14 @@ This tutorial describes how to build PortAudio with ASIO support using MSVC *fro
ASIO is a low latency audio API from Steinberg. To compile an ASIO
application, you must first download the ASIO SDK from Steinberg. You also
need to obtain ASIO drivers for your audio device. Download the ASIO SDK from Steinberg at http://www.steinberg.net/en/company/developer.html. The SDK is free but you will need to set up a developer account with Steinberg.
need to obtain ASIO drivers for your audio device. Download the ASIO SDK from Steinberg at http://www.steinberg.net/en/company/developer.html . The SDK is free but you will need to set up a developer account with Steinberg.
This tutorial assumes that you have 3 directories set up at the same level (side by side), one containing PortAudio, one containing the ASIO SDK and one containing your Visual Studio project:
@code
/ASIOSDK2
/portaudio
/DirContainingYourVisualStudioProject
/DirContainingYourVisualStudioProject (should directly contain the .sln, .vcproj or .vcprojx etc.)
@endcode
First, make sure that the Steinberg SDK and the portaudio files are "side by side" in the same directory.
@ -54,10 +54,11 @@ pa_stream.c (portaudio\src\common)
pa_trace.c (portaudio\src\common)
pa_win_hostapis.c (portaudio\src\os\win)
pa_win_util.c (portaudio\src\os\win)
pa_win_coinitialize.c (portaudio\src\os\win)
pa_win_waveformat.c (portaudio\src\os\win)
pa_x86_plain_converters.c (portaudio\src\os\win)
patest_saw.c (portaudio\test) (Or another file containing main()
for the console exe to be built.)
paex_saw.c (portaudio\examples) (Or another file containing main()
for the console exe to be built.)
@endcode
@ -71,25 +72,26 @@ pa_asio.h (portaudio\include)
These header files define the interfaces to the PortAudio API.
Next, go to Project Settings > All Configurations > C/C++ > Preprocessor > Preprocessor definitions and add
Next, go to Project Settings > All Configurations > C/C++ > Preprocessor > Preprocessor Definitions and add
PA_USE_ASIO=1 to any entries that might be there.
eg: WIN32;_CONSOLE;_MBCS changes to WIN32;_CONSOLE,_MBCS;PA_USE_ASIO=1
Then, on the same Project Settings tab, go down to Additional include directories: and enter the following relative include paths.
Then, on the same Project Settings tab, go down to Additional Include Directories (in VS2010 you'll find this setting under C/C++ > General) and enter the following relative include paths:
@code
..\portaudio\include,..\portaudio\src\common,..\asiosdk2\common,..\asiosdk2\host,..\asiosdk2\host\pc
..\portaudio\include;..\portaudio\src\common;..\portaudio\src\os\win;..\asiosdk2\common;..\asiosdk2\host;..\asiosdk2\host\pc
@endcode
You'll need to make sure the relative paths are correct for the particular directory layout you're using. The above should work fine if you use the side-by-side layout we recommended earlier.
You should now be able to build any of the test executables in the portaudio\test directory.
We suggest that you start with patest_saw.c because it's one of the simplest test files.
Some source code in the ASIO SDK is not compatible with the Win32 API UNICODE mode (The ASIO SDK expects the non-Unicode Win32 API). Therefore you need to make sure your project is set to not use Unicode. You do this by setting the project Character Set to "Use Multi-Byte Character Set" (NOT "Use Unicode Character Set"). In VS2010 the Character Set option can be found at Configuration Properties > General > Character Set. (An alternative to setting the project to non-Unicode is to patch asiolist.cpp to work when UNICODE is defined: put #undef UNICODE at the top of the file before windows.h is included.)
You should now be able to build any of the test executables in the portaudio\\examples directory.
We suggest that you start with paex_saw.c because it's one of the simplest example files.
--- Chris Share, Tom McCandless, Ross Bencina
[wiki:UsingThePortAudioSvnRepository SVN instructions]
Back to the Tutorial: \ref tutorial_start
*/

View File

@ -7,7 +7,11 @@ To write a program using PortAudio, you must include the "portaudio.h" include f
@endcode
The next task is to write your own "callback" function. The "callback" is a function that is called by the PortAudio engine whenever it has captured audio data, or when it needs more audio data for output.
Before we begin, it's important to realize that the callback is a delicate place. This is because some systems perform the callback in a special thread, or interrupt handler, and it is rarely treated the same as the rest of your code. In addition, if you want your audio to reach the speakers on time, you'll need to make sure whatever code you run in the callback runs quickly. What is safe or not safe will vary from platform to platform, but as a rule of thumb, don't do anything like allocating or freeing memory, reading or writing files, printf(), or anything else that might take an unbounded amount of time or rely on the OS or require a context switch. <i>Ed: is this still true?: Also do not call any PortAudio functions in the callback except for Pa_StreamTime() and Pa_GetCPULoad().</i>
Before we begin, it's important to realize that the callback is a delicate place. This is because some systems perform the callback in a special thread, or interrupt handler, and it is rarely treated the same as the rest of your code.
For most modern systems, you won't be able to cause crashes by making disallowed calls in the callback, but if you want your code to produce glitch-free audio, you will have to make sure you avoid function calls that may take an unbounded amount of time
to execute. Exactly what these are depend on your platform but almost certainly include the following: memory allocation/deallocation, I/O (including file I/O as well as console I/O, such as printf()), context switching (such as exec() or
yield()), mutex operations, or anything else that might rely on the OS. If you think short critical sections are safe please go read about priority inversion. Windows amd Mac OS schedulers have no real-time safe priority inversion prevention. Other platforms require special mutex flags. In addition, it is not safe to call any PortAudio API functions in the callback except as explicitly permitted in the documentation.
Your callback function must return an int and accept the exact parameters specified in this typedef:
@ -63,4 +67,4 @@ static int patestCallback( const void *inputBuffer, void *outputBuffer,
Previous: \ref tutorial_start | Next: \ref initializing_portaudio
*/
*/

View File

@ -18,14 +18,23 @@ paHtmlDocDirectory = os.path.join( paRootDirectory, "doc", "html" )
## This can be used as a first-level check to make sure the documentation is in order.
##
## The idea is to get a list of which files are missing doxygen documentation.
##
## How to run:
## $ cd doc/utils
## $ python checkfiledocs.py
def oneOf_a_in_b(a, b):
for x in a:
if x in b:
return True
return False
# recurse from top and return a list of all with the given
# extensions. ignore .svn directories. return absolute paths
def recursiveFindFiles( top, extensions, includePaths ):
def recursiveFindFiles( top, extensions, dirBlacklist, includePaths ):
result = []
for (dirpath, dirnames, filenames) in os.walk(top):
if not '.svn' in dirpath:
if not oneOf_a_in_b(dirBlacklist, dirpath):
for f in filenames:
if os.path.splitext(f)[1] in extensions:
if includePaths:
@ -41,8 +50,9 @@ def doxygenHtmlDocFileName( sourceFile ):
return sourceFile.replace( '_', '__' ).replace( '.', '_8' ) + '.html'
sourceFiles = recursiveFindFiles( paRootDirectory, [ '.c', '.h', '.cpp' ], True );
docFiles = recursiveFindFiles( paHtmlDocDirectory, [ '.html' ], False );
sourceFiles = recursiveFindFiles( os.path.join(paRootDirectory,'src'), [ '.c', '.h', '.cpp' ], ['.svn', 'mingw-include'], True );
sourceFiles += recursiveFindFiles( os.path.join(paRootDirectory,'include'), [ '.c', '.h', '.cpp' ], ['.svn'], True );
docFiles = recursiveFindFiles( paHtmlDocDirectory, [ '.html' ], ['.svn'], False );

View File

@ -3,11 +3,19 @@
MACRO(ADD_EXAMPLE appl_name)
ADD_EXECUTABLE(${appl_name} "${appl_name}.c")
TARGET_LINK_LIBRARIES(${appl_name} portaudio_static)
SET_TARGET_PROPERTIES(${appl_name}
PROPERTIES
FOLDER "Examples C"
)
ENDMACRO(ADD_EXAMPLE)
MACRO(ADD_EXAMPLE_CPP appl_name)
ADD_EXECUTABLE(${appl_name} "${appl_name}.cpp")
TARGET_LINK_LIBRARIES(${appl_name} portaudio_static)
SET_TARGET_PROPERTIES(${appl_name}
PROPERTIES
FOLDER "Examples C++"
)
ENDMACRO(ADD_EXAMPLE_CPP)
ADD_EXAMPLE(pa_devs)

View File

@ -7,7 +7,7 @@
ASIO support.
*/
/*
* $Id: pa_devs.c 1817 2012-02-22 12:44:10Z robiwan $
* $Id: pa_devs.c 1953 2015-04-10 04:00:09Z philburk $
*
* This program uses the PortAudio Portable Audio Library.
* For more information see: http://www.portaudio.com
@ -113,11 +113,10 @@ int main(void)
printf( "ERROR: Pa_Initialize returned 0x%x\n", err );
goto error;
}
printf( "PortAudio version: 0x%08X\n", Pa_GetVersion());
printf( "Version text: '%s'\n", Pa_GetVersionInfo()->versionText );
printf( "PortAudio version number = %d\nPortAudio version text = '%s'\n",
Pa_GetVersion(), Pa_GetVersionText() );
numDevices = Pa_GetDeviceCount();
if( numDevices < 0 )
{

View File

@ -19,7 +19,7 @@
Robert Bielik
*/
/*
* $Id: paex_ocean_shore.c 1816 2012-02-22 12:20:26Z robiwan $
* $Id: paex_ocean_shore.c 1946 2015-01-21 06:30:53Z rbencina $
*
* This program uses the PortAudio Portable Audio Library.
* For more information see: http://www.portaudio.com
@ -381,7 +381,7 @@ OceanWave* InitializeWave(double SR, float attackInSeconds, float maxLevel, floa
wave->wave_attack_incr = wave->wave_envelope_max_level / (attackInSeconds * (float)SR);
wave->wave_decay_incr = - wave->wave_envelope_max_level / (attackInSeconds * 4 * (float)SR);
wave->wave_pan_left = sqrtf(1.0 - positionLeftRight);
wave->wave_pan_left = sqrtf(1.0f - positionLeftRight);
wave->wave_pan_right = sqrtf(positionLeftRight);
}
return wave;

View File

@ -78,6 +78,12 @@ public:
return false;
}
const PaDeviceInfo* pInfo = Pa_GetDeviceInfo(index);
if (pInfo != 0)
{
printf("Output device name: '%s'\r", pInfo->name);
}
outputParameters.channelCount = 2; /* stereo output */
outputParameters.sampleFormat = paFloat32; /* 32 bit floating point output */
outputParameters.suggestedLatency = Pa_GetDeviceInfo( outputParameters.device )->defaultLowOutputLatency;
@ -88,7 +94,7 @@ public:
NULL, /* no input */
&outputParameters,
SAMPLE_RATE,
FRAMES_PER_BUFFER,
paFramesPerBufferUnspecified,
paClipOff, /* we won't output out of range samples so don't bother clipping them */
&Sine::paCallback,
this /* Using 'this' for userData so we can cast to Sine* in paCallback method */
@ -212,18 +218,38 @@ private:
char message[20];
};
class ScopedPaHandler
{
public:
ScopedPaHandler()
: _result(Pa_Initialize())
{
}
~ScopedPaHandler()
{
if (_result == paNoError)
{
Pa_Terminate();
}
}
PaError result() const { return _result; }
private:
PaError _result;
};
/*******************************************************************/
int main(void);
int main(void)
{
PaError err;
Sine sine;
printf("PortAudio Test: output sine wave. SR = %d, BufSize = %d\n", SAMPLE_RATE, FRAMES_PER_BUFFER);
err = Pa_Initialize();
if( err != paNoError ) goto error;
ScopedPaHandler paInit;
if( paInit.result() != paNoError ) goto error;
if (sine.open(Pa_GetDefaultOutputDevice()))
{
@ -238,15 +264,12 @@ int main(void)
sine.close();
}
Pa_Terminate();
printf("Test finished.\n");
return err;
return paNoError;
error:
Pa_Terminate();
fprintf( stderr, "An error occured while using the portaudio stream\n" );
fprintf( stderr, "Error number: %d\n", err );
fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
return err;
fprintf( stderr, "Error number: %d\n", paInit.result() );
fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( paInit.result() ) );
return 1;
}

View File

@ -113,7 +113,6 @@ int main(int argc, char* argv[])
PaStream *stream;
PaError err;
paTestData data;
int i;
int deviceIndex;
FILE *fp;
const char *fileName = "c:\\test_48k.ac3.spdif";

View File

@ -1,104 +0,0 @@
#ifndef PA_UNIX_OSS_H
#define PA_UNIX_OSS_H
/*
* $Id: pa_unix_oss.h,v 1.6 2008-12-31 15:38:31 richardash1981 Exp $
* PortAudio Portable Real-Time Audio Library
* OSS-specific extensions
*
* Copyright (c) 1999-2000 Ross Bencina and Phil Burk
*
* 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.
*
*/
/** @file
* OSS-specific PortAudio API extension header file.
*/
#ifdef __cplusplus
extern "C" {
#endif
const char *PaOSS_GetStreamInputDevice( PaStream *s );
const char *PaOSS_GetStreamOutputDevice( PaStream *s );
#ifdef __cplusplus
}
#endif
#endif
#ifndef PA_UNIX_OSS_H
#define PA_UNIX_OSS_H
/*
* $Id: pa_unix_oss.h,v 1.6 2008-12-31 15:38:31 richardash1981 Exp $
* PortAudio Portable Real-Time Audio Library
* OSS-specific extensions
*
* Copyright (c) 1999-2000 Ross Bencina and Phil Burk
*
* 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.
*
*/
/** @file
* OSS-specific PortAudio API extension header file.
*/
#ifdef __cplusplus
extern "C" {
#endif
const char *PaOSS_GetStreamInputDevice( PaStream *s );
const char *PaOSS_GetStreamOutputDevice( PaStream *s );
#ifdef __cplusplus
}
#endif
#endif

View File

@ -87,22 +87,6 @@ typedef struct PaWinDirectSoundStreamInfo{
}PaWinDirectSoundStreamInfo;
/** Retrieve the GUID of the input device.
@param stream The stream to query.
@return A pointer to the GUID, or NULL if none.
*/
LPGUID PaWinDS_GetStreamInputGUID( PaStream* s );
/** Retrieve the GUID of the output device.
@param stream The stream to query.
@return A pointer to the GUID, or NULL if none.
*/
LPGUID PaWinDS_GetStreamOutputGUID( PaStream* s );
#ifdef __cplusplus
}

View File

@ -69,8 +69,8 @@ typedef enum PaWasapiFlags
method can only provide 15-20ms latency. */
paWinWasapiPolling = (1 << 3),
/* forces custom thread priority setting. must be used if PaWasapiStreamInfo::threadPriority
is set to custom value. */
/* forces custom thread priority setting, must be used if PaWasapiStreamInfo::threadPriority
is set to a custom value */
paWinWasapiThreadPriority = (1 << 4)
}
PaWasapiFlags;
@ -91,7 +91,7 @@ typedef void (*PaWasapiHostProcessorCallback) (void *inputBuffer, long inputFra
void *outputBuffer, long outputFrames,
void *userData);
/* Device role */
/* Device role. */
typedef enum PaWasapiDeviceRole
{
eRoleRemoteNetworkDevice = 0,
@ -109,7 +109,7 @@ typedef enum PaWasapiDeviceRole
PaWasapiDeviceRole;
/* Jack connection type */
/* Jack connection type. */
typedef enum PaWasapiJackConnectionType
{
eJackConnTypeUnknown,
@ -128,10 +128,10 @@ typedef enum PaWasapiJackConnectionType
PaWasapiJackConnectionType;
/* Jack geometric location */
/* Jack geometric location. */
typedef enum PaWasapiJackGeoLocation
{
eJackGeoLocUnk = 0,
eJackGeoLocUnk = 0,
eJackGeoLocRear = 0x1, /* matches EPcxGeoLocation::eGeoLocRear */
eJackGeoLocFront,
eJackGeoLocLeft,
@ -151,7 +151,7 @@ typedef enum PaWasapiJackGeoLocation
PaWasapiJackGeoLocation;
/* Jack general location */
/* Jack general location. */
typedef enum PaWasapiJackGenLocation
{
eJackGenLocPrimaryBox = 0,
@ -162,7 +162,7 @@ typedef enum PaWasapiJackGenLocation
PaWasapiJackGenLocation;
/* Jack's type of port */
/* Jack's type of port. */
typedef enum PaWasapiJackPortConnection
{
eJackPortConnJack = 0,
@ -173,7 +173,7 @@ typedef enum PaWasapiJackPortConnection
PaWasapiJackPortConnection;
/* Thread priority */
/* Thread priority. */
typedef enum PaWasapiThreadPriority
{
eThreadPriorityNone = 0,
@ -202,6 +202,42 @@ typedef struct PaWasapiJackDescription
PaWasapiJackDescription;
/* Stream category.
Note:
- values are equal to WASAPI AUDIO_STREAM_CATEGORY enum
- supported since Windows 8.0, noop on earler versions
- values 1,2 are deprecated on Windows 10 and not included into enumeration
*/
typedef enum PaWasapiStreamCategory
{
eAudioCategoryOther = 0,
eAudioCategoryCommunications = 3,
eAudioCategoryAlerts = 4,
eAudioCategorySoundEffects = 5,
eAudioCategoryGameEffects = 6,
eAudioCategoryGameMedia = 7,
eAudioCategoryGameChat = 8,
eAudioCategorySpeech = 9,
eAudioCategoryMovie = 10,
eAudioCategoryMedia = 11
}
PaWasapiStreamCategory;
/* Stream option.
Note:
- values are equal to WASAPI AUDCLNT_STREAMOPTIONS enum
- supported since Windows 8.1, noop on earler versions
*/
typedef enum PaWasapiStreamOption
{
eStreamOptionNone = 0, //!< default
eStreamOptionRaw = 1, //!< bypass WASAPI Audio Engine DSP effects, supported since Windows 8.1
eStreamOptionMatchFormat = 2 //!< force WASAPI Audio Engine into a stream format, supported since Windows 10
}
PaWasapiStreamOption;
/* Stream descriptor. */
typedef struct PaWasapiStreamInfo
{
@ -235,6 +271,12 @@ typedef struct PaWasapiStreamInfo
to setup thread priority.
*/
PaWasapiThreadPriority threadPriority;
/* Stream category. */
PaWasapiStreamCategory streamCategory;
/* Stream option. */
PaWasapiStreamOption streamOption;
}
PaWasapiStreamInfo;
@ -263,25 +305,6 @@ int PaWasapi_GetDeviceDefaultFormat( void *pFormat, unsigned int nFormatSize, Pa
int/*PaWasapiDeviceRole*/ PaWasapi_GetDeviceRole( PaDeviceIndex nDevice );
/** Returns device loopback indicator.
@param nDevice device index.
@return 0 = Not loopback, 1 = loopback, < 0 = PaErrorCode
if PortAudio is not initialized or an error is encountered.
*/
int PaWasapi_IsLoopback( PaDeviceIndex nDevice );
/** Returns Windows device ID.
@param nDevice device index.
@return 0 = Not loopback, 1 = loopback, < 0 = PaErrorCode
if PortAudio is not initialized or an error is encountered.
*/
const wchar_t *PaWasapi_GetInputDeviceID( PaStream* s );
const wchar_t *PaWasapi_GetOutputDeviceID( PaStream* s );
/** Boost thread priority of calling thread (MMCSS). Use it for Blocking Interface only for thread
which makes calls to Pa_WriteStream/Pa_ReadStream.
@ -322,7 +345,7 @@ PaError PaWasapi_GetFramesPerHostBuffer( PaStream *pStream, unsigned int *nInput
/** Get number of jacks associated with a WASAPI device. Use this method to determine if
there are any jacks associated with the provided WASAPI device. Not all audio devices
will support this capability. This is valid for both input and output devices.
will support this capability. This is valid for both input and output devices.
@param nDevice device index.
@param jcount Number of jacks is returned in this variable
@return Error code indicating success or failure
@ -333,9 +356,9 @@ PaError PaWasapi_GetJackCount(PaDeviceIndex nDevice, int *jcount);
/** Get the jack description associated with a WASAPI device and jack number
Before this function is called, use PaWasapi_GetJackCount to determine the
number of jacks associated with device. If jcount is greater than zero, then
each jack from 0 to jcount can be queried with this function to get the jack
description.
number of jacks associated with device. If jcount is greater than zero, then
each jack from 0 to jcount can be queried with this function to get the jack
description.
@param nDevice device index.
@param jindex Which jack to return information
@param KSJACK_DESCRIPTION This structure filled in on success.
@ -366,7 +389,7 @@ PaError PaWasapi_GetJackDescription(PaDeviceIndex nDevice, int jindex, PaWasapiJ
This is the most powerful WASAPI implementation which provides glitch-free
audio at around 3ms latency in Exclusive mode. Lowest possible latency for this mode is
3 ms for HD Audio class audio chips. For the Shared mode latency can not be
lower than 20 ms.
lower than 20 ms.
2) Poll-Driven:
Polling is another 2-nd method to operate with WASAPI. It is less efficient than Event-Driven

View File

@ -1,7 +1,7 @@
#ifndef PA_WIN_WDMKS_H
#define PA_WIN_WDMKS_H
/*
* $Id: pa_win_wdmks.h 1812 2012-02-14 09:32:57Z robiwan $
* $Id: pa_win_wdmks.h 1924 2014-04-09 14:27:21Z robiwan $
* PortAudio Portable Real-Time Audio Library
* WDM/KS specific extensions
*
@ -52,13 +52,29 @@
extern "C"
{
#endif /* __cplusplus */
/* Setup flags */
typedef enum PaWinWDMKSFlags
{
/* Makes WDMKS use the supplied latency figures instead of relying on the frame size reported
by the WaveCyclic device. Use at own risk! */
paWinWDMKSOverrideFramesize = (1 << 0),
/* Makes WDMKS (output stream) use the given channelMask instead of the default */
paWinWDMKSUseGivenChannelMask = (1 << 1),
} PaWinWDMKSFlags;
typedef struct PaWinWDMKSInfo{
unsigned long size; /**< sizeof(PaWinWDMKSInfo) */
PaHostApiTypeId hostApiType; /**< paWDMKS */
unsigned long version; /**< 1 */
unsigned long flags;
/* The number of packets to use for WaveCyclic devices, range is [2, 8]. Set to zero for default value of 2. */
unsigned noOfPackets;
/* If paWinWDMKSUseGivenChannelMask bit is set in flags, use this as channelMask instead of default */
unsigned channelMask;
} PaWinWDMKSInfo;
typedef enum PaWDMKSType

View File

@ -1,7 +1,7 @@
#ifndef PORTAUDIO_H
#define PORTAUDIO_H
/*
* $Id: portaudio.h 1859 2012-09-01 00:10:13Z philburk $
* $Id: portaudio.h 1953 2015-04-10 04:00:09Z philburk $
* PortAudio Portable Real-Time Audio Library
* PortAudio API Header File
* Latest version available at: http://www.portaudio.com/
@ -50,18 +50,52 @@ extern "C"
{
#endif /* __cplusplus */
/** Retrieve the release number of the currently running PortAudio build,
eg 1900.
*/
/** Retrieve the release number of the currently running PortAudio build.
* For example, for version "19.5.1" this will return 0x00130501.
*/
int Pa_GetVersion( void );
/** Retrieve a textual description of the current PortAudio build,
eg "PortAudio V19-devel 13 October 2002".
*/
* eg "PortAudio V19.5.0-devel, revision 1952M".
* The format of the text may change so do not try to parse the returned string.
* @deprecated use PaVersionInfo() instead
*/
const char* Pa_GetVersionText( void );
/**
* Generate a packed integer version number in the same format used
* by Pa_GetVersion(). Use this to compare a specified version number with
* the currently running version. For example:
*
* if (Pa_GetVersion() < paMakeVersionNumber(19,5,1)) {}
*/
#define paMakeVersionNumber(major, minor, subminor) \
(((major)&0xFF)<<16 | ((minor)&0xFF)<<8 | ((subminor)&0xFF))
/**
* A structure containing the components of the version numbers.
*/
typedef struct PaVersionInfo {
int versionMajor;
int versionMinor;
int versionSubMinor;
/**
* This is currently the SVN revision but may change in the future.
* The versionControlRevision is updated by running a script before compiling code.
* If the update does not occur then this value may be less
* than the actual SVN revision number.
*/
const char *versionControlRevision;
/** Version as a string, for example "PortAudio V19.5.0-devel, revision 1952M" */
const char *versionText;
} PaVersionInfo;
/**
* The structure that this points to is statically allocated.
* Do not attempt to free it or modify it.
*/
const PaVersionInfo* Pa_GetVersionInfo();
/** Error codes returned by PortAudio functions.
Note that with the exception of paNoError, all PaErrorCodes are negative.
@ -1146,15 +1180,6 @@ signed long Pa_GetStreamReadAvailable( PaStream* stream );
signed long Pa_GetStreamWriteAvailable( PaStream* stream );
/** Retrieve the host type handling an open stream.
@return Returns a non-negative value representing the host API type
handling an open stream or, a PaErrorCode (which are always negative)
if PortAudio is not initialized or an error is encountered.
*/
PaHostApiTypeId Pa_GetStreamHostApiType( PaStream* stream );
/* Miscellaneous utilities */

View File

@ -1,7 +1,7 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2009-04-28.21; # UTC
scriptversion=2011-11-20.07; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
@ -35,7 +35,7 @@ scriptversion=2009-04-28.21; # UTC
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# 'make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
@ -156,6 +156,10 @@ while test $# -ne 0; do
-s) stripcmd=$stripprog;;
-t) dst_arg=$2
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
shift;;
-T) no_target_directory=true;;
@ -186,6 +190,10 @@ if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
fi
shift # arg
dst_arg=$arg
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
done
fi
@ -194,13 +202,17 @@ if test $# -eq 0; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call `install-sh -d' without argument.
# It's OK to call 'install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
trap '(exit $?); exit' 1 2 13 15
do_exit='(exit $ret); exit $ret'
trap "ret=129; $do_exit" 1
trap "ret=130; $do_exit" 2
trap "ret=141; $do_exit" 13
trap "ret=143; $do_exit" 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
@ -228,9 +240,9 @@ fi
for src
do
# Protect names starting with `-'.
# Protect names problematic for 'test' and other utilities.
case $src in
-*) src=./$src;;
-* | [=\(\)!]) src=./$src;;
esac
if test -n "$dir_arg"; then
@ -252,12 +264,7 @@ do
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
# Protect names starting with `-'.
case $dst in
-*) dst=./$dst;;
esac
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
@ -347,7 +354,7 @@ do
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writeable bit of parent directory when it shouldn't.
# other-writable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in
@ -385,7 +392,7 @@ do
case $dstdir in
/*) prefix='/';;
-*) prefix='./';;
[-=\(\)!]*) prefix='./';;
*) prefix='';;
esac
@ -403,7 +410,7 @@ do
for d
do
test -z "$d" && continue
test X"$d" = X && continue
prefix=$prefix$d
if test -d "$prefix"; then

View File

@ -70,7 +70,7 @@
# compiler: $LTCC
# compiler flags: $LTCFLAGS
# linker: $LD (gnu? $with_gnu_ld)
# $progname: (GNU libtool) 2.4.2
# $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1.7ubuntu1
# automake: $automake_version
# autoconf: $autoconf_version
#
@ -80,7 +80,7 @@
PROGRAM=libtool
PACKAGE=libtool
VERSION=2.4.2
VERSION="2.4.2 Debian-2.4.2-1.7ubuntu1"
TIMESTAMP=""
package_revision=1.3337
@ -6124,7 +6124,10 @@ func_mode_link ()
case $pass in
dlopen) libs="$dlfiles" ;;
dlpreopen) libs="$dlprefiles" ;;
link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
link)
libs="$deplibs %DEPLIBS%"
test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
;;
esac
fi
if test "$linkmode,$pass" = "lib,dlpreopen"; then
@ -6444,19 +6447,19 @@ func_mode_link ()
# It is a libtool convenience library, so add in its objects.
func_append convenience " $ladir/$objdir/$old_library"
func_append old_convenience " $ladir/$objdir/$old_library"
tmp_libs=
for deplib in $dependency_libs; do
deplibs="$deplib $deplibs"
if $opt_preserve_dup_deps ; then
case "$tmp_libs " in
*" $deplib "*) func_append specialdeplibs " $deplib" ;;
esac
fi
func_append tmp_libs " $deplib"
done
elif test "$linkmode" != prog && test "$linkmode" != lib; then
func_fatal_error "\`$lib' is not a convenience library"
fi
tmp_libs=
for deplib in $dependency_libs; do
deplibs="$deplib $deplibs"
if $opt_preserve_dup_deps ; then
case "$tmp_libs " in
*" $deplib "*) func_append specialdeplibs " $deplib" ;;
esac
fi
func_append tmp_libs " $deplib"
done
continue
fi # $pass = conv
@ -7349,6 +7352,9 @@ func_mode_link ()
revision="$number_minor"
lt_irix_increment=no
;;
*)
func_fatal_configuration "$modename: unknown library version type \`$version_type'"
;;
esac
;;
no)

View File

@ -1,11 +1,10 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
# Common wrapper for a few potentially missing GNU programs.
scriptversion=2009-04-28.21; # UTC
scriptversion=2013-10-28.13; # UTC
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
# 2008, 2009 Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -26,69 +25,40 @@ scriptversion=2009-04-28.21; # UTC
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try \`$0 --help' for more information"
echo 1>&2 "Try '$0 --help' for more information"
exit 1
fi
run=:
sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
# In the cases where this matters, `missing' is being run in the
# srcdir already.
if test -f configure.ac; then
configure_ac=configure.ac
else
configure_ac=configure.in
fi
msg="missing on your system"
case $1 in
--run)
# Try to run requested program, and just exit if it succeeds.
run=
shift
"$@" && exit 0
# Exit code 63 means version mismatch. This often happens
# when the user try to use an ancient version of a tool on
# a file that requires a minimum version. In this case we
# we should proceed has if the program had been absent, or
# if --run hadn't been passed.
if test $? = 63; then
run=:
msg="probably too old"
fi
;;
--is-lightweight)
# Used by our autoconf macros to check whether the available missing
# script is modern enough.
exit 0
;;
--run)
# Back-compat with the calling convention used by older automake.
shift
;;
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
error status if there is no known handling for PROGRAM.
Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
to PROGRAM being missing or too old.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
--run try to run the given command, and emulate it if it fails
Supported PROGRAM values:
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
autom4te touch the output file, or create a stub one
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
help2man touch the output file
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
tar try tar, gnutar, gtar, then tar without non-portable flags
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
aclocal autoconf autoheader autom4te automake makeinfo
bison yacc flex lex help2man
Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
\`g' are ignored when checking the name.
Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
'g' are ignored when checking the name.
Send bug reports to <bug-automake@gnu.org>."
exit $?
@ -100,272 +70,141 @@ Send bug reports to <bug-automake@gnu.org>."
;;
-*)
echo 1>&2 "$0: Unknown \`$1' option"
echo 1>&2 "Try \`$0 --help' for more information"
echo 1>&2 "$0: unknown '$1' option"
echo 1>&2 "Try '$0 --help' for more information"
exit 1
;;
esac
# normalize program name to check for.
program=`echo "$1" | sed '
s/^gnu-//; t
s/^gnu//; t
s/^g//; t'`
# Run the given program, remember its exit status.
"$@"; st=$?
# Now exit if we have it, but it failed. Also exit now if we
# don't have it and --version was passed (most likely to detect
# the program). This is about non-GNU programs, so use $1 not
# $program.
case $1 in
lex*|yacc*)
# Not GNU programs, they don't have --version.
# If it succeeded, we are done.
test $st -eq 0 && exit 0
# Also exit now if we it failed (or wasn't found), and '--version' was
# passed; such an option is passed most likely to detect whether the
# program is present and works.
case $2 in --version|--help) exit $st;; esac
# Exit code 63 means version mismatch. This often happens when the user
# tries to use an ancient version of a tool on a file that requires a
# minimum version.
if test $st -eq 63; then
msg="probably too old"
elif test $st -eq 127; then
# Program was missing.
msg="missing on your system"
else
# Program was found and executed, but failed. Give up.
exit $st
fi
perl_URL=http://www.perl.org/
flex_URL=http://flex.sourceforge.net/
gnu_software_URL=http://www.gnu.org/software
program_details ()
{
case $1 in
aclocal|automake)
echo "The '$1' program is part of the GNU Automake package:"
echo "<$gnu_software_URL/automake>"
echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
echo "<$gnu_software_URL/autoconf>"
echo "<$gnu_software_URL/m4/>"
echo "<$perl_URL>"
;;
autoconf|autom4te|autoheader)
echo "The '$1' program is part of the GNU Autoconf package:"
echo "<$gnu_software_URL/autoconf/>"
echo "It also requires GNU m4 and Perl in order to run:"
echo "<$gnu_software_URL/m4/>"
echo "<$perl_URL>"
;;
esac
}
give_advice ()
{
# Normalize program name to check for.
normalized_program=`echo "$1" | sed '
s/^gnu-//; t
s/^gnu//; t
s/^g//; t'`
printf '%s\n' "'$1' is $msg."
configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
case $normalized_program in
autoconf*)
echo "You should only need it if you modified 'configure.ac',"
echo "or m4 files included by it."
program_details 'autoconf'
;;
autoheader*)
echo "You should only need it if you modified 'acconfig.h' or"
echo "$configure_deps."
program_details 'autoheader'
;;
automake*)
echo "You should only need it if you modified 'Makefile.am' or"
echo "$configure_deps."
program_details 'automake'
;;
aclocal*)
echo "You should only need it if you modified 'acinclude.m4' or"
echo "$configure_deps."
program_details 'aclocal'
;;
autom4te*)
echo "You might have modified some maintainer files that require"
echo "the 'autom4te' program to be rebuilt."
program_details 'autom4te'
;;
bison*|yacc*)
echo "You should only need it if you modified a '.y' file."
echo "You may want to install the GNU Bison package:"
echo "<$gnu_software_URL/bison/>"
;;
lex*|flex*)
echo "You should only need it if you modified a '.l' file."
echo "You may want to install the Fast Lexical Analyzer package:"
echo "<$flex_URL>"
;;
help2man*)
echo "You should only need it if you modified a dependency" \
"of a man page."
echo "You may want to install the GNU Help2man package:"
echo "<$gnu_software_URL/help2man/>"
;;
makeinfo*)
echo "You should only need it if you modified a '.texi' file, or"
echo "any other file indirectly affecting the aspect of the manual."
echo "You might want to install the Texinfo package:"
echo "<$gnu_software_URL/texinfo/>"
echo "The spurious makeinfo call might also be the consequence of"
echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
echo "want to install GNU make:"
echo "<$gnu_software_URL/make/>"
;;
*)
echo "You might have modified some files without having the proper"
echo "tools for further handling them. Check the 'README' file, it"
echo "often tells you about the needed prerequisites for installing"
echo "this package. You may also peek at any GNU archive site, in"
echo "case some other package contains this missing '$1' program."
;;
esac
}
tar*)
if test -n "$run"; then
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
exit 1
fi
;;
give_advice "$1" | sed -e '1s/^/WARNING: /' \
-e '2,$s/^/ /' >&2
*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
# Could not run --version or --help. This is probably someone
# running `$TOOL --version' or `$TOOL --help' to check whether
# $TOOL exists and not knowing $TOOL uses missing.
exit 1
fi
;;
esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
case $program in
aclocal*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
touch aclocal.m4
;;
autoconf*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`${configure_ac}'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
touch configure
;;
autoheader*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
case $f in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
esac
done
touch $touch_files
;;
automake*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
find . -type f -name Makefile.am -print |
sed 's/\.am$/.in/' |
while read f; do touch "$f"; done
;;
autom4te*)
echo 1>&2 "\
WARNING: \`$1' is needed, but is $msg.
You might have modified some files without having the
proper tools for further handling them.
You can get \`$1' as part of \`Autoconf' from any GNU
archive site."
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo "#! /bin/sh"
echo "# Created by GNU Automake missing as a replacement of"
echo "# $ $@"
echo "exit 0"
chmod +x $file
exit 1
fi
;;
bison*|yacc*)
echo 1>&2 "\
WARNING: \`$1' $msg. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
if test $# -ne 1; then
eval LASTARG="\${$#}"
case $LASTARG in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
if test ! -f y.tab.h; then
echo >y.tab.h
fi
if test ! -f y.tab.c; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
lex*|flex*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if test $# -ne 1; then
eval LASTARG="\${$#}"
case $LASTARG in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
if test ! -f lex.yy.c; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
help2man*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a dependency of a manual page. You may need the
\`Help2man' package in order for those modifications to take
effect. You can get \`Help2man' from any GNU archive site."
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page"
exit $?
fi
;;
makeinfo*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy \`make' (AIX,
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
# The file to touch is that specified with -o ...
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -z "$file"; then
# ... or it is the one specified with @setfilename ...
infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '
/^@setfilename/{
s/.* \([^ ]*\) *$/\1/
p
q
}' $infile`
# ... or it is derived from the source name (dir/f.texi becomes f.info)
test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
fi
# If the file does not exist, the user really needs makeinfo;
# let's fail without touching anything.
test -f $file || exit 1
touch $file
;;
tar*)
shift
# We have already tried tar in the generic part.
# Look for gnutar/gtar before invocation to avoid ugly error
# messages.
if (gnutar --version > /dev/null 2>&1); then
gnutar "$@" && exit 0
fi
if (gtar --version > /dev/null 2>&1); then
gtar "$@" && exit 0
fi
firstarg="$1"
if shift; then
case $firstarg in
*o*)
firstarg=`echo "$firstarg" | sed s/o//`
tar "$firstarg" "$@" && exit 0
;;
esac
case $firstarg in
*h*)
firstarg=`echo "$firstarg" | sed s/h//`
tar "$firstarg" "$@" && exit 0
;;
esac
fi
echo 1>&2 "\
WARNING: I can't seem to be able to run \`tar' with the given arguments.
You may want to install GNU tar or Free paxutils, or check the
command line arguments."
exit 1
;;
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and is $msg.
You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequisites for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program."
exit 1
;;
esac
exit 0
# Propagate the correct exit status (expected to be 127 for a program
# not found, 63 for a program that failed due to version mismatch).
exit $st
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)

View File

@ -14,7 +14,7 @@
as in test pa_devs.c.
*/
/*
* $Id: paqa_devs.c 1756 2011-09-08 06:09:29Z philburk $
* $Id: paqa_devs.c 1910 2013-09-07 10:14:52Z gineera $
*
* This program uses the PortAudio Portable Audio Library.
* For more information see: http://www.portaudio.com

View File

@ -1,108 +0,0 @@
/*
* $Id: pa_dynlink.c 1339 2008-02-15 07:50:33Z rossb $
* Portable Audio I/O Library
* dynamic library helper
*
* Based on the Open Source API proposed by Ross Bencina
* Copyright (c) 2008 Ross Bencina
*
* 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.
*
* 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.
*/
/*
* The text above constitutes the entire PortAudio license; however,
* the PortAudio community also makes the following non-binding requests:
*
* 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. It is also
* requested that these non-binding requests be included along with the
* license above.
*/
/** @file
@ingroup common_src
@brief dynamic library helper functions.
*/
#if defined(WIN32)
#include <windows.h>
#else
#include <dlfcn.h>
#endif
#include "pa_debugprint.h"
#include "pa_dynload.h"
#if !defined(NULL)
#define NULL 0
#endif
paDynamicLib PaDL_Load( char *name )
{
paDynamicLib lib;
#if defined(WIN32)
lib = LoadLibrary(name);
#else
lib = dlopen(name, RTLD_LAZY);
#endif
if (!lib) {
#if defined(WIN32)
PA_DEBUG(("Couldn't load %s, error code: %d\n", name, GetLastError()));
#else
PA_DEBUG(("Couldn't load %s, error: %s\n", name, dlerror()));
#endif
}
return lib;
}
void PaDL_Unload( paDynamicLib lib )
{
#if defined(WIN32)
FreeLibrary(lib);
#else
dlclose(lib);
#endif
}
void *PaDL_FindSymbol( paDynamicLib lib, char *name )
{
void *addr;
#if defined(WIN32)
addr = (void *) GetProcAddress(lib, name);
#else
addr = dlsym(lib, name);
#endif
if (addr == NULL) {
#if defined(WIN32)
PA_DEBUG(("Couldn't find %s function, error code: %d\n", name, GetLastError()));
#else
PA_DEBUG(("Couldn't find %s function, error: %s\n", name, dlerror()));
#endif
}
return addr;
}

View File

@ -1,136 +0,0 @@
#ifndef PA_DYNLINK_H
#define PA_DYNLINK_H
/*
* $Id: pa_dynlink.h 1339 2008-02-15 07:50:33Z rossb $
* Portable Audio I/O Library
* Dynamic library helper
*
* Based on the Open Source API proposed by Ross Bencina
* Copyright (c) 1999-2008 Ross Bencina, Phil Burk
*
* 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.
*
* 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.
*/
/*
* The text above constitutes the entire PortAudio license; however,
* the PortAudio community also makes the following non-binding requests:
*
* 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. It is also
* requested that these non-binding requests be included along with the
* license above.
*/
/** @file
@ingroup common_src
@brief Dynamic library helper functions.
*/
#include "pa_debugprint.h"
#if defined(WIN32)
#include <windows.h>
#endif
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
#if defined(WIN32)
typedef HANDLE paDynamicLib;
#define PADL_INLINE __inline
#else
typedef void * paDynamicLib;
#define PADL_INLINE inline
#endif
paDynamicLib PaDL_Load( char *name );
void PaDL_Unload( paDynamicLib lib );
void *PaDL_FindSymbol( paDynamicLib lib, char *name );
/* A little explanation of what's going on here.
*
* Only one source file should define PADL_DEFINE_POINTERS before including the header which
* defines the functions. This will cause the compiler to dump all of the function pointers
* to a single object file and prevent duplicate symbol definitions during link.
*
* The PADL_FUNC_WITH_RETURN and PADL_FUNC_NO_RETURN macros do two things each:
* 1) Define or reference the variable that contains the actual function pointer
* 2) Define an inline function to pass control to the real function
*
* Since the macros redefine the real functions of the same name, the compiler will make
* sure that the definitions are the same. If not, it will complain. For this to occur,
* the functions MUST be defined in an extern "C" block otherwise the compiler just thinks the
* functions are being overloaded.
*
* The compiler should optimize away the inline function since it just passes control to the real
* function and we should wind up with about the same function call we had before, only now it is
* safer due to the validation.
*
* The PADL_FUNC_WITH_RETURN takes 4 arguments:
* 1) The return type <---|
* 2) The function name | Taken from the real funciton prototype
* 3) The function arguments <---|
* 4) The argument list to pass to the real function
*
* The PADL_FUNC_NO_RETURN takes 3 arguments:
* 1) The function name <---| Taken from the FFmpeg funciton prototype
* 2) The function arguments <---|
* 3) The argument list to pass to the real function
*
* The PADL_FINDSYMBOL macro is responsible for retrieving the address of the real function
* and storing that address in the function pointer variable.
*/
#if defined(PADL_DEFINE_POINTERS)
#define FFX
#else
#define FFX extern
#endif
#define PADL_FUNC_WITH_RETURN(r, n, a, p) \
FFX r (*paDynFunc_ ## n ## _fp) a; \
PADL_INLINE r n a \
{ \
return paDynFunc_ ## n ## _fp p; \
} \
#define PADL_FUNC_NO_RETURN(n, a, p) \
FFX void (*paDynFunc_ ## n ## _fp) a; \
PADL_INLINE void n a \
{ \
paDynFunc_ ## n ## _fp p; \
} \
#define PADL_FINDSYMBOL(l, f, e) \
*(void**)& paDynFunc_ ## f ## _fp = PaDL_FindSymbol(l, #f); \
if (!paDynFunc_ ## f ## _fp) \
{ \
PA_DEBUG(("Could not locate address of %s\n", #f)); \
e; \
}
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* PA_DYNLINK_H */

View File

@ -1,5 +1,5 @@
/*
* $Id: pa_front.c 1880 2012-12-04 18:39:48Z rbencina $
* $Id: pa_front.c 1953 2015-04-10 04:00:09Z philburk $
* Portable Audio I/O Library Multi-Host API front end
* Validate function parameters and manage multiple host APIs.
*
@ -65,6 +65,7 @@
#include <stdio.h>
#include <memory.h>
#include <string.h>
#include <stdlib.h> /* needed for strtol() */
#include <assert.h> /* needed by PA_VALIDATE_ENDIANNESS */
#include "portaudio.h"
@ -76,25 +77,63 @@
#include "pa_trace.h" /* still usefull?*/
#include "pa_debugprint.h"
#ifndef PA_SVN_REVISION
#include "pa_svnrevision.h"
#endif
#define PA_VERSION_ 1899
#define PA_VERSION_TEXT_ "PortAudio V19-devel (built " __DATE__ " " __TIME__ ")"
/**
* This is incremented if we make incompatible API changes.
* This version scheme is based loosely on http://semver.org/
*/
#define paVersionMajor 19
/**
* This is incremented when we add functionality in a backwards-compatible manner.
* Or it is set to zero when paVersionMajor is incremented.
*/
#define paVersionMinor 5
/**
* This is incremented when we make backwards-compatible bug fixes.
* Or it is set to zero when paVersionMinor changes.
*/
#define paVersionSubMinor 0
/**
* This is a combination of paVersionMajor, paVersionMinor and paVersionSubMinor.
* It will always increase so that version numbers can be compared as integers to
* see which is later.
*/
#define paVersion paMakeVersionNumber(paVersionMajor, paVersionMinor, paVersionSubMinor)
#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)
#define PA_VERSION_STRING_ TOSTRING(paVersionMajor) "." TOSTRING(paVersionMinor) "." TOSTRING(paVersionSubMinor)
#define PA_VERSION_TEXT_ "PortAudio V" PA_VERSION_STRING_ "-devel, revision " TOSTRING(PA_SVN_REVISION)
int Pa_GetVersion( void )
{
return PA_VERSION_;
return paVersion;
}
const char* Pa_GetVersionText( void )
{
return PA_VERSION_TEXT_;
}
static PaVersionInfo versionInfo_ = {
.versionMajor = paVersionMajor,
.versionMinor = paVersionMinor,
.versionSubMinor = paVersionSubMinor,
.versionControlRevision = TOSTRING(PA_SVN_REVISION),
.versionText = PA_VERSION_TEXT_
};
const PaVersionInfo* Pa_GetVersionInfo()
{
return &versionInfo_;
}
#define PA_LAST_HOST_ERROR_TEXT_LENGTH_ 1024
@ -1216,10 +1255,8 @@ PaError Pa_OpenStream( PaStream** stream,
hostApiInputParametersPtr, hostApiOutputParametersPtr,
sampleRate, framesPerBuffer, streamFlags, streamCallback, userData );
if( result == paNoError ) {
if( result == paNoError )
AddOpenStream( *stream );
PA_STREAM_REP(*stream)->hostApiType = hostApi->info.type;
}
PA_LOGAPI(("Pa_OpenStream returned:\n" ));
@ -1731,32 +1768,6 @@ signed long Pa_GetStreamWriteAvailable( PaStream* stream )
return result;
}
PaHostApiTypeId Pa_GetStreamHostApiType( PaStream* stream )
{
PaError error = PaUtil_ValidateStreamPointer( stream );
PaHostApiTypeId result;
#ifdef PA_LOG_API_CALLS
PaUtil_DebugPrint("Pa_GetStreamHostApiType called:\n" );
PaUtil_DebugPrint("\tPaStream* stream: 0x%p\n", stream );
#endif
if( error == paNoError )
{
result = PA_STREAM_REP(stream)->hostApiType;
}
else
{
result = (PaHostApiTypeId) error;
}
#ifdef PA_LOG_API_CALLS
PaUtil_DebugPrint("Pa_GetStreamHostApiType returned:\n" );
PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) );
#endif
return result;
}
PaError Pa_GetSampleSize( PaSampleFormat format )
{

View File

@ -1,5 +1,5 @@
/*
* $Id: pa_process.c 1706 2011-07-21 18:44:58Z philburk $
* $Id: pa_process.c 1954 2015-04-19 18:48:38Z gineera $
* Portable Audio I/O Library
* streamCallback <-> host buffer processing adapter
*
@ -743,8 +743,10 @@ static unsigned long NonAdaptingProcess( PaUtilBufferProcessor *bp,
destSampleStrideSamples = bp->inputChannelCount;
destChannelStrideBytes = bp->bytesPerUserInputSample;
/* process host buffer directly, or use temp buffer if formats differ or host buffer non-interleaved */
if( bp->userInputSampleFormatIsEqualToHost && bp->hostInputIsInterleaved && bp->hostInputChannels[0][0].data)
/* process host buffer directly, or use temp buffer if formats differ or host buffer non-interleaved,
* or if num channels differs between the host (set in stride) and the user (eg with some Alsa hw:) */
if( bp->userInputSampleFormatIsEqualToHost && bp->hostInputIsInterleaved
&& bp->hostInputChannels[0][0].data && bp->inputChannelCount == hostInputChannels[0].stride )
{
userInput = hostInputChannels[0].data;
destBytePtr = (unsigned char *)hostInputChannels[0].data;
@ -832,8 +834,10 @@ static unsigned long NonAdaptingProcess( PaUtilBufferProcessor *bp,
{
if( bp->userOutputIsInterleaved )
{
/* process host buffer directly, or use temp buffer if formats differ or host buffer non-interleaved */
if( bp->userOutputSampleFormatIsEqualToHost && bp->hostOutputIsInterleaved )
/* process host buffer directly, or use temp buffer if formats differ or host buffer non-interleaved,
* or if num channels differs between the host (set in stride) and the user (eg with some Alsa hw:) */
if( bp->userOutputSampleFormatIsEqualToHost && bp->hostOutputIsInterleaved
&& bp->outputChannelCount == hostOutputChannels[0].stride )
{
userOutput = hostOutputChannels[0].data;
skipOutputConvert = 1;
@ -1683,9 +1687,9 @@ unsigned long PaUtil_CopyInput( PaUtilBufferProcessor* bp,
hostInputChannels[i].stride,
framesToCopy, &bp->ditherGenerator );
destBytePtr += destChannelStrideBytes; /* skip to next source channel */
destBytePtr += destChannelStrideBytes; /* skip to next dest channel */
/* advance dest ptr for next iteration */
/* advance source ptr for next iteration */
hostInputChannels[i].data = ((unsigned char*)hostInputChannels[i].data) +
framesToCopy * hostInputChannels[i].stride * bp->bytesPerHostInputSample;
}
@ -1715,7 +1719,7 @@ unsigned long PaUtil_CopyInput( PaUtilBufferProcessor* bp,
destBytePtr += bp->bytesPerUserInputSample * framesToCopy;
nonInterleavedDestPtrs[i] = destBytePtr;
/* advance dest ptr for next iteration */
/* advance source ptr for next iteration */
hostInputChannels[i].data = ((unsigned char*)hostInputChannels[i].data) +
framesToCopy * hostInputChannels[i].stride * bp->bytesPerHostInputSample;
}

View File

@ -93,8 +93,6 @@ void PaUtil_InitializeStreamRepresentation( PaUtilStreamRepresentation *streamRe
streamRepresentation->streamInfo.inputLatency = 0.;
streamRepresentation->streamInfo.outputLatency = 0.;
streamRepresentation->streamInfo.sampleRate = 0.;
streamRepresentation->hostApiType = 0;
}

View File

@ -152,7 +152,6 @@ typedef struct PaUtilStreamRepresentation {
PaStreamFinishedCallback *streamFinishedCallback;
void *userData;
PaStreamInfo streamInfo;
PaHostApiTypeId hostApiType;
} PaUtilStreamRepresentation;

View File

@ -0,0 +1 @@
#define PA_SVN_REVISION unknown

View File

@ -1,5 +1,5 @@
/*
* $Id: pa_trace.c 1812 2012-02-14 09:32:57Z robiwan $
* $Id: pa_trace.c 1916 2014-01-17 03:45:15Z philburk $
* Portable Audio I/O Library Trace Facility
* Store trace information in real-time for later printing.
*
@ -227,4 +227,12 @@ void PaUtil_DiscardHighSpeedLog( LogHandle hLog )
PaUtil_FreeMemory(pLog);
}
#else
/* This stub was added so that this file will generate a symbol.
* Otherwise linker/archiver programs will complain.
*/
int PaUtil_TraceStubToSatisfyLinker(void)
{
return 0;
}
#endif /* TRACE_REALTIME_EVENTS */

View File

@ -1,5 +1,5 @@
/*
* $Id: pa_linux_alsa.c 1834 2012-05-18 16:04:30Z gineera $
* $Id: pa_linux_alsa.c 1911 2013-10-17 12:44:09Z gineera $
* PortAudio Portable Real-Time Audio Library
* Latest Version at: http://www.portaudio.com
* ALSA implementation by Joshua Haberman and Arve Knudsen
@ -621,7 +621,6 @@ typedef struct
StreamDirection streamDir;
snd_pcm_channel_area_t *channelAreas; /* Needed for channel adaption */
int card;
} PaAlsaStreamComponent;
/* Implementation specific stream structure */
@ -1121,8 +1120,10 @@ static char *SkipCardDetailsInName( char *infoSkipName, char *cardRefName )
**/
static int OpenPcm( snd_pcm_t **pcmp, const char *name, snd_pcm_stream_t stream, int mode, int waitOnBusy )
{
int tries = 0, maxTries = waitOnBusy ? busyRetries_ : 0;
int ret = alsa_snd_pcm_open( pcmp, name, stream, mode );
int ret, tries = 0, maxTries = waitOnBusy ? busyRetries_ : 0;
ret = alsa_snd_pcm_open( pcmp, name, stream, mode );
for( tries = 0; tries < maxTries && -EBUSY == ret; ++tries )
{
Pa_Sleep( 10 );
@ -1145,7 +1146,7 @@ static int OpenPcm( snd_pcm_t **pcmp, const char *name, snd_pcm_stream_t stream,
return ret;
}
static PaError FillInDevInfo( PaAlsaHostApiRepresentation *alsaApi, HwDevInfo* deviceName, int blocking,
static PaError FillInDevInfo( PaAlsaHostApiRepresentation *alsaApi, HwDevInfo* deviceHwInfo, int blocking,
PaAlsaDeviceInfo* devInfo, int* devIdx )
{
PaError result = 0;
@ -1153,43 +1154,43 @@ static PaError FillInDevInfo( PaAlsaHostApiRepresentation *alsaApi, HwDevInfo* d
snd_pcm_t *pcm = NULL;
PaUtilHostApiRepresentation *baseApi = &alsaApi->baseHostApiRep;
PA_DEBUG(( "%s: Filling device info for: %s\n", __FUNCTION__, deviceName->name ));
PA_DEBUG(( "%s: Filling device info for: %s\n", __FUNCTION__, deviceHwInfo->name ));
/* Zero fields */
InitializeDeviceInfo( baseDeviceInfo );
/* to determine device capabilities, we must open the device and query the
/* 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 ) >= 0 )
if( deviceHwInfo->hasCapture &&
OpenPcm( &pcm, deviceHwInfo->alsaName, SND_PCM_STREAM_CAPTURE, blocking, 0 ) >= 0 )
{
if( GropeDevice( pcm, deviceName->isPlug, StreamDirection_In, blocking, devInfo ) != paNoError )
if( GropeDevice( pcm, deviceHwInfo->isPlug, StreamDirection_In, blocking, devInfo ) != paNoError )
{
/* Error */
PA_DEBUG(( "%s: Failed groping %s for capture\n", __FUNCTION__, deviceName->alsaName ));
PA_DEBUG(( "%s: Failed groping %s for capture\n", __FUNCTION__, deviceHwInfo->alsaName ));
goto end;
}
}
/* Query playback */
if( deviceName->hasPlayback &&
OpenPcm( &pcm, deviceName->alsaName, SND_PCM_STREAM_PLAYBACK, blocking, 0 ) >= 0 )
if( deviceHwInfo->hasPlayback &&
OpenPcm( &pcm, deviceHwInfo->alsaName, SND_PCM_STREAM_PLAYBACK, blocking, 0 ) >= 0 )
{
if( GropeDevice( pcm, deviceName->isPlug, StreamDirection_Out, blocking, devInfo ) != paNoError )
if( GropeDevice( pcm, deviceHwInfo->isPlug, StreamDirection_Out, blocking, devInfo ) != paNoError )
{
/* Error */
PA_DEBUG(( "%s: Failed groping %s for playback\n", __FUNCTION__, deviceName->alsaName ));
PA_DEBUG(( "%s: Failed groping %s for playback\n", __FUNCTION__, deviceHwInfo->alsaName ));
goto end;
}
}
baseDeviceInfo->structVersion = 2;
baseDeviceInfo->hostApi = alsaApi->hostApiIndex;
baseDeviceInfo->name = deviceName->name;
devInfo->alsaName = deviceName->alsaName;
devInfo->isPlug = deviceName->isPlug;
baseDeviceInfo->name = deviceHwInfo->name;
devInfo->alsaName = deviceHwInfo->alsaName;
devInfo->isPlug = deviceHwInfo->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
@ -1198,24 +1199,24 @@ static PaError FillInDevInfo( PaAlsaHostApiRepresentation *alsaApi, HwDevInfo* d
{
/* Make device default if there isn't already one or it is the ALSA "default" device */
if( ( baseApi->info.defaultInputDevice == paNoDevice ||
!strcmp( deviceName->alsaName, "default" ) ) && baseDeviceInfo->maxInputChannels > 0 )
!strcmp( deviceHwInfo->alsaName, "default" ) ) && baseDeviceInfo->maxInputChannels > 0 )
{
baseApi->info.defaultInputDevice = *devIdx;
PA_DEBUG(( "Default input device: %s\n", deviceName->name ));
PA_DEBUG(( "Default input device: %s\n", deviceHwInfo->name ));
}
if( ( baseApi->info.defaultOutputDevice == paNoDevice ||
!strcmp( deviceName->alsaName, "default" ) ) && baseDeviceInfo->maxOutputChannels > 0 )
!strcmp( deviceHwInfo->alsaName, "default" ) ) && baseDeviceInfo->maxOutputChannels > 0 )
{
baseApi->info.defaultOutputDevice = *devIdx;
PA_DEBUG(( "Default output device: %s\n", deviceName->name ));
PA_DEBUG(( "Default output device: %s\n", deviceHwInfo->name ));
}
PA_DEBUG(( "%s: Adding device %s: %d\n", __FUNCTION__, deviceName->name, *devIdx ));
PA_DEBUG(( "%s: Adding device %s: %d\n", __FUNCTION__, deviceHwInfo->name, *devIdx ));
baseApi->deviceInfos[*devIdx] = (PaDeviceInfo *) devInfo;
(*devIdx) += 1;
}
else
{
PA_DEBUG(( "%s: Skipped device: %s, all channels == 0\n", __FUNCTION__, deviceName->name ));
PA_DEBUG(( "%s: Skipped device: %s, all channels == 0\n", __FUNCTION__, deviceHwInfo->name ));
}
end:
@ -1236,6 +1237,8 @@ static PaError BuildDeviceList( PaAlsaHostApiRepresentation *alsaApi )
snd_pcm_info_t *pcmInfo;
int res;
int blocking = SND_PCM_NONBLOCK;
int usePlughw = 0;
char *hwPrefix = "";
char alsaCardName[50];
#ifdef PA_ENABLE_DEBUG_OUTPUT
PaTime startTime = PaUtil_GetTime();
@ -1244,6 +1247,14 @@ static PaError BuildDeviceList( PaAlsaHostApiRepresentation *alsaApi )
if( getenv( "PA_ALSA_INITIALIZE_BLOCK" ) && atoi( getenv( "PA_ALSA_INITIALIZE_BLOCK" ) ) )
blocking = 0;
/* If PA_ALSA_PLUGHW is 1 (non-zero), use the plughw: pcm throughout instead of hw: */
if( getenv( "PA_ALSA_PLUGHW" ) && atoi( getenv( "PA_ALSA_PLUGHW" ) ) )
{
usePlughw = 1;
hwPrefix = "plug";
PA_DEBUG(( "%s: Using Plughw\n", __FUNCTION__ ));
}
/* These two will be set to the first working input and output device, respectively */
baseApi->info.defaultInputDevice = paNoDevice;
baseApi->info.defaultOutputDevice = paNoDevice;
@ -1284,7 +1295,8 @@ static PaError BuildDeviceList( PaAlsaHostApiRepresentation *alsaApi )
char *alsaDeviceName, *deviceName, *infoName;
size_t len;
int hasPlayback = 0, hasCapture = 0;
snprintf( buf, sizeof (buf), "hw:%d,%d", cardIdx, devIdx );
snprintf( buf, sizeof (buf), "%s%s,%d", hwPrefix, alsaCardName, devIdx );
/* Obtain info about this particular device */
alsa_snd_pcm_info_set_device( pcmInfo, devIdx );
@ -1327,7 +1339,7 @@ static PaError BuildDeviceList( PaAlsaHostApiRepresentation *alsaApi )
hwDevInfos[ numDeviceNames - 1 ].alsaName = alsaDeviceName;
hwDevInfos[ numDeviceNames - 1 ].name = deviceName;
hwDevInfos[ numDeviceNames - 1 ].isPlug = 0;
hwDevInfos[ numDeviceNames - 1 ].isPlug = usePlughw;
hwDevInfos[ numDeviceNames - 1 ].hasPlayback = hasPlayback;
hwDevInfos[ numDeviceNames - 1 ].hasCapture = hasCapture;
}
@ -1694,32 +1706,22 @@ static snd_pcm_format_t Pa2AlsaFormat( PaSampleFormat paFormat )
/** Open an ALSA pcm handle.
*
* The device to be open can be specified in a custom PaAlsaStreamInfo struct, or it will be a device number. In case of a
* device number, it maybe specified through an env variable (PA_ALSA_PLUGHW) that we should open the corresponding plugin
* device.
* The device to be open can be specified by name in a custom PaAlsaStreamInfo struct, or it will be by
* the Portaudio device number supplied in the stream parameters.
*/
static PaError AlsaOpen( const PaUtilHostApiRepresentation *hostApi, const PaStreamParameters *params, StreamDirection
streamDir, snd_pcm_t **pcm )
{
PaError result = paNoError;
int ret;
char dnameArray[50];
const char* deviceName = dnameArray;
const char* deviceName = "";
const PaAlsaDeviceInfo *deviceInfo = NULL;
PaAlsaStreamInfo *streamInfo = (PaAlsaStreamInfo *)params->hostApiSpecificStreamInfo;
if( !streamInfo )
{
int usePlug = 0;
deviceInfo = GetDeviceInfo( hostApi, params->device );
/* If device name starts with hw: and PA_ALSA_PLUGHW is 1, we open the plughw device instead */
if( !strncmp( "hw:", deviceInfo->alsaName, 3 ) && getenv( "PA_ALSA_PLUGHW" ) )
usePlug = atoi( getenv( "PA_ALSA_PLUGHW" ) );
if( usePlug )
snprintf( dnameArray, 50, "plug%s", deviceInfo->alsaName );
else
deviceName = deviceInfo->alsaName;
deviceName = deviceInfo->alsaName;
}
else
deviceName = streamInfo->deviceString;
@ -1872,7 +1874,6 @@ static PaError PaAlsaStreamComponent_Initialize( PaAlsaStreamComponent *self, Pa
PaError result = paNoError;
PaSampleFormat userSampleFormat = params->sampleFormat, hostSampleFormat = paNoError;
assert( params->channelCount > 0 );
snd_pcm_info_t* pcmInfo;
/* Make sure things have an initial value */
memset( self, 0, sizeof (PaAlsaStreamComponent) );
@ -1883,6 +1884,7 @@ static PaError PaAlsaStreamComponent_Initialize( PaAlsaStreamComponent *self, Pa
self->numHostChannels = PA_MAX( params->channelCount, StreamDirection_In == streamDir ? devInfo->minInputChannels
: devInfo->minOutputChannels );
self->deviceIsPlug = devInfo->isPlug;
PA_DEBUG(( "%s: Host Chans %c %i\n", __FUNCTION__, streamDir == StreamDirection_In ? 'C' : 'P', self->numHostChannels ));
}
else
{
@ -1900,9 +1902,6 @@ static PaError PaAlsaStreamComponent_Initialize( PaAlsaStreamComponent *self, Pa
PA_ENSURE( AlsaOpen( &alsaApi->baseHostApiRep, params, streamDir, &self->pcm ) );
self->nfds = alsa_snd_pcm_poll_descriptors_count( self->pcm );
snd_pcm_info_alloca( &pcmInfo );
self->card = snd_pcm_info_get_card( pcmInfo );
PA_ENSURE( hostSampleFormat = PaUtil_SelectClosestAvailableFormat( GetAvailableFormats( self->pcm ), userSampleFormat ) );
self->hostSampleFormat = hostSampleFormat;
@ -4589,7 +4588,9 @@ PaError PaAlsa_GetStreamInputCard( PaStream* s, int* card )
/* XXX: More descriptive error? */
PA_UNLESS( stream->capture.pcm, paDeviceUnavailable );
*card = stream->capture.card;
alsa_snd_pcm_info_alloca( &pcmInfo );
PA_ENSURE( alsa_snd_pcm_info( stream->capture.pcm, pcmInfo ) );
*card = alsa_snd_pcm_info_get_card( pcmInfo );
error:
return result;
@ -4606,7 +4607,9 @@ PaError PaAlsa_GetStreamOutputCard( PaStream* s, int* card )
/* XXX: More descriptive error? */
PA_UNLESS( stream->playback.pcm, paDeviceUnavailable );
*card = stream->capture.card;
alsa_snd_pcm_info_alloca( &pcmInfo );
PA_ENSURE( alsa_snd_pcm_info( stream->playback.pcm, pcmInfo ) );
*card = alsa_snd_pcm_info_get_card( pcmInfo );
error:
return result;

View File

@ -1,5 +1,5 @@
/*
* $Id: pa_asio.cpp 1879 2012-12-04 14:45:31Z rbencina $
* $Id: pa_asio.cpp 1890 2013-05-02 01:06:01Z rbencina $
* Portable Audio I/O Library for ASIO Drivers
*
* Author: Stephane Letz

View File

@ -125,47 +125,47 @@ static bool ensureChannelNameSize( int size )
*/
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);
if( err != paNoError )
return NULL;
PaMacAUHAL *macCoreHostApi = (PaMacAUHAL*)hostApi;
AudioDeviceID hostApiDevice = macCoreHostApi->devIds[device];
struct PaUtilHostApiRepresentation *hostApi;
PaError err;
OSStatus error;
err = PaUtil_GetHostApiRepresentation( &hostApi, paCoreAudio );
assert(err == paNoError);
if( err != paNoError )
return NULL;
PaMacAUHAL *macCoreHostApi = (PaMacAUHAL*)hostApi;
AudioDeviceID hostApiDevice = macCoreHostApi->devIds[device];
CFStringRef nameRef;
/* First try with CFString */
UInt32 size = sizeof(nameRef);
error = AudioDeviceGetProperty( hostApiDevice,
channelIndex + 1,
input,
kAudioDevicePropertyChannelNameCFString,
&size,
error = AudioDeviceGetProperty( hostApiDevice,
channelIndex + 1,
input,
kAudioDevicePropertyChannelNameCFString,
&size,
&nameRef );
if( error )
{
/* try the C String */
size = 0;
error = AudioDeviceGetPropertyInfo( hostApiDevice,
channelIndex + 1,
input,
channelIndex + 1,
input,
kAudioDevicePropertyChannelName,
&size,
&size,
NULL);
if( !error )
{
if( !ensureChannelNameSize( size ) )
return NULL;
error = AudioDeviceGetProperty( hostApiDevice,
channelIndex + 1,
input,
kAudioDevicePropertyChannelName,
&size,
channelName );
if( !ensureChannelNameSize( size ) )
return NULL;
error = AudioDeviceGetProperty( hostApiDevice,
channelIndex + 1,
input,
kAudioDevicePropertyChannelName,
&size,
channelName );
if( !error )
return channelName;
@ -190,13 +190,13 @@ const char *PaMacCore_GetChannelName( int device, int channelIndex, bool input )
if( !ensureChannelNameSize( size ) )
{
CFRelease( nameRef );
return NULL;
}
return NULL;
}
CFStringGetCString( nameRef, channelName, size+1, kCFStringEncodingUTF8 );
CFRelease( nameRef );
}
return channelName;
return channelName;
}
@ -661,23 +661,23 @@ static PaError InitializeDeviceInfo( PaMacAUHAL *auhalHostApi,
deviceInfo->structVersion = 2;
deviceInfo->hostApi = hostApiIndex;
/* Get the device name using CFString */
propSize = sizeof(nameRef);
err = ERR(AudioDeviceGetProperty(macCoreDeviceId, 0, 0, kAudioDevicePropertyDeviceNameCFString, &propSize, &nameRef));
if (err)
{
/* Get the device name using c string. Fail if we can't get it. */
err = ERR(AudioDeviceGetPropertyInfo(macCoreDeviceId, 0, 0, kAudioDevicePropertyDeviceName, &propSize, NULL));
if (err)
return err;
err = ERR(AudioDeviceGetPropertyInfo(macCoreDeviceId, 0, 0, kAudioDevicePropertyDeviceName, &propSize, NULL));
if (err)
return err;
name = PaUtil_GroupAllocateMemory(auhalHostApi->allocations,propSize+1);
if ( !name )
return paInsufficientMemory;
err = ERR(AudioDeviceGetProperty(macCoreDeviceId, 0, 0, kAudioDevicePropertyDeviceName, &propSize, name));
if (err)
return err;
if ( !name )
return paInsufficientMemory;
err = ERR(AudioDeviceGetProperty(macCoreDeviceId, 0, 0, kAudioDevicePropertyDeviceName, &propSize, name));
if (err)
return err;
}
else
{

View File

@ -1,5 +1,5 @@
/*
* $Id: pa_win_ds.c 1877 2012-11-10 02:55:20Z rbencina $
* $Id: pa_win_ds.c 1945 2015-01-21 06:24:32Z rbencina $
* Portable Audio I/O Library DirectSound implementation
*
* Authors: Phil Burk, Robert Marsanyi & Ross Bencina
@ -208,9 +208,9 @@ static signed long GetStreamWriteAvailable( PaStream* stream );
PaUtil_SetLastHostErrorInfo( paDirectSound, hr, "DirectSound error" )
/************************************************* DX Prototypes **********/
static BOOL CALLBACK CollectGUIDsProcA(LPGUID lpGUID,
LPCSTR lpszDesc,
LPCSTR lpszDrvName,
static BOOL CALLBACK CollectGUIDsProcW(LPGUID lpGUID,
LPCWSTR lpszDesc,
LPCWSTR lpszDrvName,
LPVOID lpContext );
/************************************************************************************/
@ -257,7 +257,6 @@ typedef struct PaWinDsStream
#endif
/* Output */
LPGUID pOutputGuid;
LPDIRECTSOUND pDirectSound;
LPDIRECTSOUNDBUFFER pDirectSoundPrimaryBuffer;
LPDIRECTSOUNDBUFFER pDirectSoundOutputBuffer;
@ -273,7 +272,6 @@ typedef struct PaWinDsStream
INT finalZeroBytesWritten; /* used to determine when we've flushed the whole buffer */
/* Input */
LPGUID pInputGuid;
LPDIRECTSOUNDCAPTURE pDirectSoundCapture;
LPDIRECTSOUNDCAPTUREBUFFER pDirectSoundInputBuffer;
INT inputFrameSizeBytes;
@ -320,30 +318,43 @@ typedef struct PaWinDsStream
*/
static double PaWinDS_GetMinSystemLatencySeconds( void )
{
/*
NOTE: GetVersionEx() is deprecated as of Windows 8.1 and can not be used to reliably detect
versions of Windows higher than Windows 8 (due to manifest requirements for reporting higher versions).
Microsoft recommends switching to VerifyVersionInfo (available on Win 2k and later), however GetVersionEx
is is faster, for now we just disable the deprecation warning.
See: https://msdn.microsoft.com/en-us/library/windows/desktop/ms724451(v=vs.85).aspx
See: http://www.codeproject.com/Articles/678606/Part-Overcoming-Windows-s-deprecation-of-GetVe
*/
#pragma warning (disable : 4996) /* use of GetVersionEx */
double minLatencySeconds;
/* Set minimal latency based on whether NT or other OS.
* NT has higher latency.
*/
OSVERSIONINFO osvi;
osvi.dwOSVersionInfoSize = sizeof( osvi );
GetVersionEx( &osvi );
osvi.dwOSVersionInfoSize = sizeof( osvi );
GetVersionEx( &osvi );
DBUG(("PA - PlatformId = 0x%x\n", osvi.dwPlatformId ));
DBUG(("PA - MajorVersion = 0x%x\n", osvi.dwMajorVersion ));
DBUG(("PA - MinorVersion = 0x%x\n", osvi.dwMinorVersion ));
/* Check for NT */
if( (osvi.dwMajorVersion == 4) && (osvi.dwPlatformId == 2) )
{
minLatencySeconds = PA_DS_WIN_NT_DEFAULT_LATENCY_;
}
else if(osvi.dwMajorVersion >= 5)
{
minLatencySeconds = PA_DS_WIN_WDM_DEFAULT_LATENCY_;
}
else
{
minLatencySeconds = PA_DS_WIN_9X_DEFAULT_LATENCY_;
}
if( (osvi.dwMajorVersion == 4) && (osvi.dwPlatformId == 2) )
{
minLatencySeconds = PA_DS_WIN_NT_DEFAULT_LATENCY_;
}
else if(osvi.dwMajorVersion >= 5)
{
minLatencySeconds = PA_DS_WIN_WDM_DEFAULT_LATENCY_;
}
else
{
minLatencySeconds = PA_DS_WIN_9X_DEFAULT_LATENCY_;
}
return minLatencySeconds;
#pragma warning (default : 4996)
}
@ -387,20 +398,35 @@ static double PaWinDs_GetMinLatencySeconds( double sampleRate )
/************************************************************************************
** Duplicate the input string using the allocations allocator.
** Duplicate and convert the input string using the group allocations allocator.
** A NULL string is converted to a zero length string.
** If memory cannot be allocated, NULL is returned.
**/
static char *DuplicateDeviceNameString( PaUtilAllocationGroup *allocations, const char* src )
static char *DuplicateDeviceNameString( PaUtilAllocationGroup *allocations, const wchar_t* src )
{
char *result = 0;
if( src != NULL )
{
size_t len = strlen(src);
#if !defined(_UNICODE) && !defined(UNICODE)
size_t len = WideCharToMultiByte(CP_ACP, 0, src, -1, NULL, 0, NULL, NULL);
result = (char*)PaUtil_GroupAllocateMemory( allocations, (long)(len + 1) );
if( result )
memcpy( (void *) result, src, len+1 );
if( result ) {
if (WideCharToMultiByte(CP_ACP, 0, src, -1, result, (int)len, NULL, NULL) == 0) {
result = 0;
}
}
#else
size_t len = WideCharToMultiByte(CP_UTF8, 0, src, -1, NULL, 0, NULL, NULL);
result = (char*)PaUtil_GroupAllocateMemory( allocations, (long)(len + 1) );
if( result ) {
if (WideCharToMultiByte(CP_UTF8, 0, src, -1, result, (int)len, NULL, NULL) == 0) {
result = 0;
}
}
#endif
}
else
{
@ -515,9 +541,9 @@ static PaError TerminateDSDeviceNameAndGUIDVector( DSDeviceNameAndGUIDVector *gu
/************************************************************************************
** Collect preliminary device information during DirectSound enumeration
*/
static BOOL CALLBACK CollectGUIDsProcA(LPGUID lpGUID,
LPCSTR lpszDesc,
LPCSTR lpszDrvName,
static BOOL CALLBACK CollectGUIDsProcW(LPGUID lpGUID,
LPCWSTR lpszDesc,
LPCWSTR lpszDrvName,
LPVOID lpContext )
{
DSDeviceNameAndGUIDVector *namesAndGUIDs = (DSDeviceNameAndGUIDVector*)lpContext;
@ -940,7 +966,7 @@ static PaError AddOutputDeviceInfoFromDirectSound(
}
else
{
deviceInfo->defaultSampleRate = caps.dwMaxSecondarySampleRate;
deviceInfo->defaultSampleRate = caps.dwMaxSecondarySampleRate;
}
}
else if( (caps.dwMinSecondarySampleRate < 1000.0) && (caps.dwMaxSecondarySampleRate > 50000.0) )
@ -1213,9 +1239,9 @@ PaError PaWinDs_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiInde
if( result != paNoError )
goto error;
paWinDsDSoundEntryPoints.DirectSoundCaptureEnumerateA( (LPDSENUMCALLBACKA)CollectGUIDsProcA, (void *)&deviceNamesAndGUIDs.inputNamesAndGUIDs );
paWinDsDSoundEntryPoints.DirectSoundCaptureEnumerateW( (LPDSENUMCALLBACKW)CollectGUIDsProcW, (void *)&deviceNamesAndGUIDs.inputNamesAndGUIDs );
paWinDsDSoundEntryPoints.DirectSoundEnumerateA( (LPDSENUMCALLBACKA)CollectGUIDsProcA, (void *)&deviceNamesAndGUIDs.outputNamesAndGUIDs );
paWinDsDSoundEntryPoints.DirectSoundEnumerateW( (LPDSENUMCALLBACKW)CollectGUIDsProcW, (void *)&deviceNamesAndGUIDs.outputNamesAndGUIDs );
if( deviceNamesAndGUIDs.inputNamesAndGUIDs.enumerationError != paNoError )
{
@ -1349,13 +1375,13 @@ static PaError ValidateWinDirectSoundSpecificStreamInfo(
const PaStreamParameters *streamParameters,
const PaWinDirectSoundStreamInfo *streamInfo )
{
if( streamInfo )
{
if( streamInfo->size != sizeof( PaWinDirectSoundStreamInfo )
|| streamInfo->version != 2 )
{
return paIncompatibleHostApiSpecificStreamInfo;
}
if( streamInfo )
{
if( streamInfo->size != sizeof( PaWinDirectSoundStreamInfo )
|| streamInfo->version != 2 )
{
return paIncompatibleHostApiSpecificStreamInfo;
}
if( streamInfo->flags & paWinDirectSoundUseLowLevelLatencyParameters )
{
@ -1363,9 +1389,9 @@ static PaError ValidateWinDirectSoundSpecificStreamInfo(
return paIncompatibleHostApiSpecificStreamInfo;
}
}
}
return paNoError;
return paNoError;
}
/***********************************************************************************/
@ -1402,8 +1428,8 @@ static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi,
/* validate inputStreamInfo */
inputStreamInfo = (PaWinDirectSoundStreamInfo*)inputParameters->hostApiSpecificStreamInfo;
result = ValidateWinDirectSoundSpecificStreamInfo( inputParameters, inputStreamInfo );
if( result != paNoError ) return result;
result = ValidateWinDirectSoundSpecificStreamInfo( inputParameters, inputStreamInfo );
if( result != paNoError ) return result;
}
else
{
@ -1431,8 +1457,8 @@ static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi,
/* validate outputStreamInfo */
outputStreamInfo = (PaWinDirectSoundStreamInfo*)outputParameters->hostApiSpecificStreamInfo;
result = ValidateWinDirectSoundSpecificStreamInfo( outputParameters, outputStreamInfo );
if( result != paNoError ) return result;
result = ValidateWinDirectSoundSpecificStreamInfo( outputParameters, outputStreamInfo );
if( result != paNoError ) return result;
}
else
{
@ -1856,8 +1882,8 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
PaWinDsDeviceInfo *inputWinDsDeviceInfo, *outputWinDsDeviceInfo;
PaDeviceInfo *inputDeviceInfo, *outputDeviceInfo;
int inputChannelCount, outputChannelCount;
PaSampleFormat inputSampleFormat = 0, outputSampleFormat = 0;
PaSampleFormat hostInputSampleFormat = 0, hostOutputSampleFormat = 0;
PaSampleFormat inputSampleFormat, outputSampleFormat;
PaSampleFormat hostInputSampleFormat, hostOutputSampleFormat;
int userRequestedHostInputBufferSizeFrames = 0;
int userRequestedHostOutputBufferSizeFrames = 0;
unsigned long suggestedInputLatencyFrames, suggestedOutputLatencyFrames;
@ -1889,8 +1915,8 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
/* validate hostApiSpecificStreamInfo */
inputStreamInfo = (PaWinDirectSoundStreamInfo*)inputParameters->hostApiSpecificStreamInfo;
result = ValidateWinDirectSoundSpecificStreamInfo( inputParameters, inputStreamInfo );
if( result != paNoError ) return result;
result = ValidateWinDirectSoundSpecificStreamInfo( inputParameters, inputStreamInfo );
if( result != paNoError ) return result;
if( inputStreamInfo && inputStreamInfo->flags & paWinDirectSoundUseLowLevelLatencyParameters )
userRequestedHostInputBufferSizeFrames = inputStreamInfo->framesPerBuffer;
@ -1903,7 +1929,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
else
{
inputChannelCount = 0;
inputSampleFormat = 0;
inputSampleFormat = 0;
suggestedInputLatencyFrames = 0;
}
@ -1929,8 +1955,8 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
/* validate hostApiSpecificStreamInfo */
outputStreamInfo = (PaWinDirectSoundStreamInfo*)outputParameters->hostApiSpecificStreamInfo;
result = ValidateWinDirectSoundSpecificStreamInfo( outputParameters, outputStreamInfo );
if( result != paNoError ) return result;
result = ValidateWinDirectSoundSpecificStreamInfo( outputParameters, outputStreamInfo );
if( result != paNoError ) return result;
if( outputStreamInfo && outputStreamInfo->flags & paWinDirectSoundUseLowLevelLatencyParameters )
userRequestedHostOutputBufferSizeFrames = outputStreamInfo->framesPerBuffer;
@ -1943,7 +1969,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
else
{
outputChannelCount = 0;
outputSampleFormat = 0;
outputSampleFormat = 0;
suggestedOutputLatencyFrames = 0;
}
@ -2024,10 +2050,10 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
hostInputSampleFormat =
PaUtil_SelectClosestAvailableFormat( nativeInputFormats, inputParameters->sampleFormat );
}
else
{
hostInputSampleFormat = 0;
}
else
{
hostInputSampleFormat = 0;
}
if( outputParameters )
{
@ -2039,9 +2065,9 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
PaUtil_SelectClosestAvailableFormat( nativeOutputFormats, outputParameters->sampleFormat );
}
else
{
hostOutputSampleFormat = 0;
}
{
hostOutputSampleFormat = 0;
}
result = PaUtil_InitializeBufferProcessor( &stream->bufferProcessor,
inputChannelCount, inputSampleFormat, hostInputSampleFormat,
@ -2084,7 +2110,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
#endif
#ifndef PA_WIN_DS_USE_WMME_TIMER
stream->processingThreadCompleted = CreateEvent( NULL, /* bManualReset = */ TRUE, /* bInitialState = */ FALSE, NULL );
stream->processingThreadCompleted = CreateEvent( NULL, /* bManualReset = */ TRUE, /* bInitialState = */ FALSE, NULL );
if( stream->processingThreadCompleted == NULL )
{
result = paUnanticipatedHostError;
@ -2148,13 +2174,6 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
goto error;
}
/* Portmixer support - fill in the GUID of the output stream */
stream->pOutputGuid = outputWinDsDeviceInfo->lpGUID;
if( stream->pOutputGuid == NULL )
{
stream->pOutputGuid = (GUID *) &DSDEVID_DefaultPlayback;
}
/* Calculate value used in latency calculation to avoid real-time divides. */
stream->secondsPerHostByte = 1.0 /
(stream->bufferProcessor.bytesPerHostOutputSample *
@ -2196,13 +2215,6 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
result = paBufferTooBig;
goto error;
}
/* Portmixer support - store the GUID of the input stream */
stream->pInputGuid = inputWinDsDeviceInfo->lpGUID;
if( stream->pInputGuid == NULL )
{
stream->pInputGuid = (GUID *)&DSDEVID_DefaultCapture;
}
}
/* open/create the DirectSound buffers */
@ -2246,12 +2258,6 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
if( outputParameters && !stream->pDirectSoundOutputBuffer )
{
stream->pOutputGuid = outputWinDsDeviceInfo->lpGUID;
if( stream->pOutputGuid == NULL )
{
stream->pOutputGuid = (GUID *) &DSDEVID_DefaultPlayback;
}
hr = InitOutputBuffer( stream,
(PaWinDsDeviceInfo*)hostApi->deviceInfos[outputParameters->device],
hostOutputSampleFormat,
@ -2504,8 +2510,8 @@ static int TimeSlice( PaWinDsStream *stream )
framesToXfer = numOutFramesReady = bytesEmpty / stream->outputFrameSizeBytes;
/* Check for underflow */
/* FIXME QueryOutputSpace should not adjust underflow count as a side effect.
A query function should be a const operator on the stream and return a flag on underflow. */
/* FIXME QueryOutputSpace should not adjust underflow count as a side effect.
A query function should be a const operator on the stream and return a flag on underflow. */
if( stream->outputUnderflowCount != previousUnderflowCount )
stream->callbackFlags |= paOutputUnderflow;
@ -2570,8 +2576,8 @@ static int TimeSlice( PaWinDsStream *stream )
if( stream->bufferProcessor.outputChannelCount > 0 )
{
/*
We don't currently add outputLatency here because it appears to produce worse
results than not adding it. Need to do more testing to verify this.
We don't currently add outputLatency here because it appears to produce worse
results than not adding it. Need to do more testing to verify this.
*/
/* timeInfo.outputBufferDacTime = timeInfo.currentTime + outputLatency; */
timeInfo.outputBufferDacTime = timeInfo.currentTime;
@ -2820,7 +2826,7 @@ static PaError CloseStream( PaStream* s )
#endif
#ifndef PA_WIN_DS_USE_WMME_TIMER
CloseHandle( stream->processingThreadCompleted );
CloseHandle( stream->processingThreadCompleted );
#endif
// Cleanup the sound buffers
@ -2918,7 +2924,7 @@ static PaError StartStream( PaStream *s )
ResetEvent( stream->processingCompleted );
#ifndef PA_WIN_DS_USE_WMME_TIMER
ResetEvent( stream->processingThreadCompleted );
ResetEvent( stream->processingThreadCompleted );
#endif
if( stream->bufferProcessor.inputChannelCount > 0 )
@ -3028,9 +3034,9 @@ static PaError StartStream( PaStream *s )
goto error;
}
#else
/* Create processing thread which calls TimerCallback */
/* Create processing thread which calls TimerCallback */
stream->processingThread = CREATE_THREAD( 0, 0, ProcessingThreadProc, stream, 0, &stream->processingThreadId );
stream->processingThread = CREATE_THREAD( 0, 0, ProcessingThreadProc, stream, 0, &stream->processingThreadId );
if( !stream->processingThread )
{
result = paUnanticipatedHostError;
@ -3100,8 +3106,8 @@ static PaError StopStream( PaStream *s )
#else
if( stream->processingThread )
{
if( WaitForSingleObject( stream->processingThreadCompleted, 30*100 ) == WAIT_TIMEOUT )
return paUnanticipatedHostError;
if( WaitForSingleObject( stream->processingThreadCompleted, 30*100 ) == WAIT_TIMEOUT )
return paUnanticipatedHostError;
#ifdef CLOSE_THREAD_HANDLE
CloseHandle( stream->processingThread ); /* Delete thread. */
@ -3260,18 +3266,3 @@ static signed long GetStreamWriteAvailable( PaStream* s )
return 0;
}
/***********************************************************************************/
LPGUID PaWinDS_GetStreamInputGUID( PaStream* s )
{
PaWinDsStream *stream = (PaWinDsStream*)s;
return stream->pInputGuid;
}
/***********************************************************************************/
LPGUID PaWinDS_GetStreamOutputGUID( PaStream* s )
{
PaWinDsStream *stream = (PaWinDsStream*)s;
return stream->pOutputGuid;
}

View File

@ -1,5 +1,5 @@
/*
* $Id: pa_jack.c 1668 2011-05-02 17:07:11Z rossb $
* $Id: pa_jack.c 1912 2013-11-15 12:27:07Z gineera $
* PortAudio Portable Real-Time Audio Library
* Latest Version at: http://www.portaudio.com
* JACK Implementation by Joshua Haberman
@ -48,22 +48,16 @@
*/
#include <string.h>
#include <regex.h>
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <sys/types.h>
#if !defined(_WIN32)
#include <unistd.h>
#endif
#include <errno.h> /* EBUSY */
#include <signal.h> /* sig_atomic_t */
#include <math.h>
#if defined(_WIN32)
#include <windows.h>
#else
#include <semaphore.h>
#include <pthread.h>
#endif
#include <jack/types.h>
#include <jack/jack.h>
@ -77,13 +71,7 @@
#include "pa_ringbuffer.h"
#include "pa_debugprint.h"
#include "pa_jack_dynload.h"
#if defined(WIN32)
static DWORD mainThread_;
#else
static pthread_t mainThread_;
#endif
static char *jackErr_ = NULL;
static const char* clientName_ = "PortAudio";
@ -96,7 +84,7 @@ static const char* clientName_ = "PortAudio";
PaError paErr; \
if( (paErr = (expr)) < paNoError ) \
{ \
if( (paErr) == paUnanticipatedHostError && PaJack_IsOnMainThread() ) \
if( (paErr) == paUnanticipatedHostError && pthread_self() == mainThread_ ) \
{ \
const char *err = jackErr_; \
if (! err ) err = "unknown error"; \
@ -112,7 +100,7 @@ static const char* clientName_ = "PortAudio";
do { \
if( (expr) == 0 ) \
{ \
if( (code) == paUnanticipatedHostError && PaJack_IsOnMainThread() ) \
if( (code) == paUnanticipatedHostError && pthread_self() == mainThread_ ) \
{ \
const char *err = jackErr_; \
if (!err) err = "unknown error"; \
@ -178,13 +166,8 @@ typedef struct
int jack_buffer_size;
PaHostApiIndex hostApiIndex;
#if defined(WIN32)
HANDLE mtx;
HANDLE cond;
#else
pthread_mutex_t mtx;
pthread_cond_t cond;
#endif
unsigned long inputBase, outputBase;
/* For dealing with the process thread */
@ -241,11 +224,7 @@ typedef struct PaJackStream
PaUtilRingBuffer inFIFO;
PaUtilRingBuffer outFIFO;
volatile sig_atomic_t data_available;
#if defined(WIN32)
HANDLE data_event;
#else
sem_t data_semaphore;
#endif
int bytesPerFrame;
int samplesPerFrame;
@ -253,6 +232,10 @@ typedef struct PaJackStream
}
PaJackStream;
/* In calls to jack_get_ports() this filter expression is used instead of ""
* to prevent any other types (eg Midi ports etc) being listed */
#define JACK_PORT_TYPE_FILTER "audio"
#define TRUE 1
#define FALSE 0
@ -269,178 +252,6 @@ static int JackCallback( jack_nframes_t frames, void *userData );
*
*/
static void PaJack_InitMainThread( void )
{
#if defined(WIN32)
mainThread_ = GetCurrentThreadId();
#else
mainThread_ = pthread_self();
#endif
}
static int PaJack_IsOnMainThread( void )
{
#if defined(WIN32)
return GetCurrentThreadId() == mainThread_;
#else
return pthread_self() == mainThread_;
#endif
}
static void PaJack_InitHostApiMutex( PaJackHostApiRepresentation *hostApi )
{
#if defined(WIN32)
ASSERT_CALL( (hostApi->mtx = CreateMutex( NULL, FALSE, NULL )) == NULL, 0 );
#else
ASSERT_CALL( pthread_mutex_init( &hostApi->mtx, NULL ), 0 );
#endif
}
static void PaJack_TerminateHostApiMutex( PaJackHostApiRepresentation *hostApi )
{
#if defined(WIN32)
CloseHandle( hostApi->mtx );
hostApi->mtx = NULL;
#else
ASSERT_CALL( pthread_mutex_destroy( &hostApi->mtx ), 0 );
#endif
}
static void PaJack_LockHostAPI( PaJackHostApiRepresentation *hostApi )
{
#if defined(WIN32)
ASSERT_CALL( WaitForSingleObject( hostApi->mtx, INFINITE ), 0 );
#else
ASSERT_CALL( pthread_mutex_lock( &hostApi->mtx ), 0 );
#endif
}
/* returns 0 on success, -1 on failure ??? or similar. document make sure it's correct etc */
static int PaJack_TryLockHostAPI( PaJackHostApiRepresentation *hostApi )
{
#if defined(WIN32)
return WaitForSingleObject( hostApi->mtx, 0 ) == WAIT_OBJECT_0 ? 0 : -1;
#else
return ( pthread_mutex_trylock( &hostApi->mtx ) == 0 ? 0 : -1 );
#endif
}
static void PaJack_UnlockHostAPI( PaJackHostApiRepresentation *hostApi )
{
#if defined(WIN32)
ReleaseMutex( hostApi->mtx );
#else
ASSERT_CALL( pthread_mutex_unlock( &hostApi->mtx ), 0 );
#endif
}
static void PaJack_InitCommandSync( PaJackHostApiRepresentation *hostApi )
{
#if defined(WIN32)
hostApi->cond = CreateEvent( NULL, FALSE, FALSE, NULL );
assert( hostApi->cond );
#else
ASSERT_CALL( pthread_cond_init( &hostApi->cond, NULL ), 0 );
#endif
}
static void PaJack_TerminateCommandSync( PaJackHostApiRepresentation *hostApi )
{
#if defined(WIN32)
CloseHandle( hostApi->cond );
hostApi->cond = NULL;
#else
ASSERT_CALL( pthread_cond_init( &hostApi->cond, NULL ), 0 );
#endif
}
static void PaJack_SignalCommandCompleted( PaJackHostApiRepresentation *hostApi )
{
#if defined(WIN32)
ASSERT_CALL( !SetEvent( hostApi->cond ), 0 );
#else
ASSERT_CALL( pthread_cond_signal( &hostApi->cond ), 0 );
#endif
}
static PaError WaitForCommandToComplete( PaJackHostApiRepresentation *hostApi )
{
PaError result = paNoError;
#if defined(WIN32)
switch( SignalObjectAndWait( hostApi->mtx, hostApi->cond, 10 * 60 * 1000, FALSE ) )
{
case WAIT_OBJECT_0:
result = paNoError;
break;
case WAIT_TIMEOUT:
result = paTimedOut;
break;
default:
result = paInternalError;
break;
}
PaJack_LockHostAPI( hostApi );
#else
int err = 0;
PaTime pt = PaUtil_GetTime();
struct timespec ts;
ts.tv_sec = (time_t) floor( pt + 10 * 60 /* 10 minutes */ );
ts.tv_nsec = (long) ((pt - floor( pt )) * 1000000000);
/* XXX: Best enclose in loop, in case of spurious wakeups? */
err = pthread_cond_timedwait( &hostApi->cond, &hostApi->mtx, &ts );
/* Make sure we didn't time out */
UNLESS( err != ETIMEDOUT, paTimedOut );
UNLESS( !err, paInternalError );
error:
#endif
return result;
}
static void PaJack_InitStreamDataSync( PaJackStream *stream )
{
#if defined(WIN32)
stream->data_event = CreateEvent( NULL, FALSE, FALSE, NULL );
assert( stream->data_event );
#else
ASSERT_CALL( sem_init( &stream->data_semaphore, 0, 0 ) == -1, 0);
#endif
}
static void PaJack_TerminateStreamDataSync( PaJackStream *stream )
{
#if defined(WIN32)
CloseHandle( stream->data_event );
#else
sem_destroy( &stream->data_semaphore );
#endif
}
static void PaJack_SignalStreamDataAvailable( PaJackStream *stream )
{
#if defined(WIN32)
SetEvent( stream->data_event );
#else
sem_post( &stream->data_semaphore );
#endif
}
static void PaJack_WaitForStreamDataToBecomeAvailable( PaJackStream *stream )
{
#if defined(WIN32)
WaitForSingleObject( stream->data_event, INFINITE );
#else
sem_wait( &stream->data_semaphore );
#endif
}
#if defined(WIN32)
#define snprintf _snprintf
#endif
/* ---- blocking emulation layer ---- */
/* Allocate buffer. */
@ -487,7 +298,7 @@ BlockingCallback( const void *inputBuffer,
if( !stream->data_available )
{
stream->data_available = 1;
PaJack_SignalStreamDataAvailable( stream );
sem_post( &stream->data_semaphore );
}
return paContinue;
}
@ -526,7 +337,7 @@ BlockingBegin( PaJackStream *stream, int minimum_buffer_size )
}
stream->data_available = 0;
PaJack_InitStreamDataSync( stream );
sem_init( &stream->data_semaphore, 0, 0 );
error:
return result;
@ -538,7 +349,7 @@ BlockingEnd( PaJackStream *stream )
BlockingTermFIFO( &stream->inFIFO );
BlockingTermFIFO( &stream->outFIFO );
PaJack_TerminateStreamDataSync( stream );
sem_destroy( &stream->data_semaphore );
}
static PaError BlockingReadStream( PaStream* s, void *data, unsigned long numFrames )
@ -560,7 +371,7 @@ static PaError BlockingReadStream( PaStream* s, void *data, unsigned long numFra
if( stream->data_available )
stream->data_available = 0;
else
PaJack_WaitForStreamDataToBecomeAvailable( stream );
sem_wait( &stream->data_semaphore );
}
}
@ -598,7 +409,7 @@ static PaError BlockingWriteStream( PaStream* s, const void *data, unsigned long
if( stream->data_available )
stream->data_available = 0;
else
PaJack_WaitForStreamDataToBecomeAvailable( stream );
sem_wait( &stream->data_semaphore );
}
}
@ -631,7 +442,7 @@ BlockingWaitEmpty( PaStream *s )
while( PaUtil_GetRingBufferReadAvailable( &stream->outFIFO ) > 0 )
{
stream->data_available = 0;
PaJack_WaitForStreamDataToBecomeAvailable( stream );
sem_wait( &stream->data_semaphore );
}
return 0;
}
@ -662,6 +473,7 @@ static PaError BuildDeviceList( PaJackHostApiRepresentation *jackApi )
char *regex_pattern = NULL;
int port_index, client_index, i;
double globalSampleRate;
regex_t port_regex;
unsigned long numClients = 0, numPorts = 0;
char *tmp_client_name = NULL;
@ -669,6 +481,9 @@ static PaError BuildDeviceList( PaJackHostApiRepresentation *jackApi )
commonApi->info.defaultOutputDevice = paNoDevice;
commonApi->info.deviceCount = 0;
/* Parse the list of ports, using a regex to grab the client names */
ASSERT_CALL( regcomp( &port_regex, "^[^:]*", REG_EXTENDED ), 0 );
/* since we are rebuilding the list of devices, free all memory
* associated with the previous list */
PaUtil_FreeAllAllocations( jackApi->deviceInfoMemory );
@ -681,7 +496,7 @@ static PaError BuildDeviceList( PaJackHostApiRepresentation *jackApi )
* according to the client_name:port_name convention (which is
* enforced by jackd)
* A: If jack_get_ports returns NULL, there's nothing for us to do */
UNLESS( (jack_ports = jack_get_ports( jackApi->jack_client, "^[^:]*", "", 0 )) && jack_ports[0], paNoError );
UNLESS( (jack_ports = jack_get_ports( jackApi->jack_client, "", JACK_PORT_TYPE_FILTER, 0 )) && jack_ports[0], paNoError );
/* Find number of ports */
while( jack_ports[numPorts] )
++numPorts;
@ -693,15 +508,16 @@ static PaError BuildDeviceList( PaJackHostApiRepresentation *jackApi )
for( numClients = 0, port_index = 0; jack_ports[port_index] != NULL; port_index++ )
{
int client_seen = FALSE;
regmatch_t match_info;
const char *port = jack_ports[port_index];
const char *colon;
/* extract the client name from the port name, using a regex
* that parses the clientname:portname syntax */
UNLESS( colon = strchr(port, ':'), paInternalError );
assert(colon - port < jack_client_name_size());
memcpy( tmp_client_name, port, colon - port );
tmp_client_name[colon - port] = '\0';
UNLESS( !regexec( &port_regex, port, 1, &match_info, 0 ), paInternalError );
assert(match_info.rm_eo - match_info.rm_so < jack_client_name_size());
memcpy( tmp_client_name, port + match_info.rm_so,
match_info.rm_eo - match_info.rm_so );
tmp_client_name[match_info.rm_eo - match_info.rm_so] = '\0';
/* do we know about this port's client yet? */
for( i = 0; i < numClients; i++ )
@ -771,7 +587,7 @@ static PaError BuildDeviceList( PaJackHostApiRepresentation *jackApi )
/* ... what are your output ports (that we could input from)? */
clientPorts = jack_get_ports( jackApi->jack_client, regex_pattern,
NULL, JackPortIsOutput);
JACK_PORT_TYPE_FILTER, JackPortIsOutput);
curDevInfo->maxInputChannels = 0;
curDevInfo->defaultLowInputLatency = 0.;
curDevInfo->defaultHighInputLatency = 0.;
@ -787,12 +603,12 @@ static PaError BuildDeviceList( PaJackHostApiRepresentation *jackApi )
* We don't care what they are, we just care how many */
curDevInfo->maxInputChannels++;
}
jack_free(clientPorts);
free(clientPorts);
}
/* ... what are your input ports (that we could output to)? */
clientPorts = jack_get_ports( jackApi->jack_client, regex_pattern,
NULL, JackPortIsInput);
JACK_PORT_TYPE_FILTER, JackPortIsInput);
curDevInfo->maxOutputChannels = 0;
curDevInfo->defaultLowOutputLatency = 0.;
curDevInfo->defaultHighOutputLatency = 0.;
@ -808,7 +624,7 @@ static PaError BuildDeviceList( PaJackHostApiRepresentation *jackApi )
* We don't care what they are, we just care how many */
curDevInfo->maxOutputChannels++;
}
jack_free(clientPorts);
free(clientPorts);
}
/* Add this client to the list of devices */
@ -821,7 +637,8 @@ static PaError BuildDeviceList( PaJackHostApiRepresentation *jackApi )
}
error:
jack_free( jack_ports );
regfree( &port_regex );
free( jack_ports );
return result;
}
@ -834,7 +651,7 @@ static void UpdateSampleRate( PaJackStream *stream, double sampleRate )
static void JackErrorCallback( const char *msg )
{
if( PaJack_IsOnMainThread() )
if( pthread_self() == mainThread_ )
{
assert( msg );
jackErr_ = realloc( jackErr_, strlen( msg ) + 1 );
@ -854,10 +671,11 @@ static void JackOnShutdown( void *arg )
}
/* Make sure that the main thread doesn't get stuck waiting on the condition */
PaJack_LockHostAPI( jackApi );
ASSERT_CALL( pthread_mutex_lock( &jackApi->mtx ), 0 );
jackApi->jackIsDown = 1;
PaJack_SignalCommandCompleted( jackApi );
PaJack_UnlockHostAPI( jackApi );
ASSERT_CALL( pthread_cond_signal( &jackApi->cond ), 0 );
ASSERT_CALL( pthread_mutex_unlock( &jackApi->mtx ), 0 );
}
static int JackSrCb( jack_nframes_t nframes, void *arg )
@ -892,20 +710,18 @@ PaError PaJack_Initialize( PaUtilHostApiRepresentation **hostApi,
PaHostApiIndex hostApiIndex )
{
PaError result = paNoError;
PaJackHostApiRepresentation *jackHostApi = NULL;
PaJackHostApiRepresentation *jackHostApi;
int activated = 0;
jack_status_t jackStatus = 0;
*hostApi = NULL; /* Initialize to NULL */
UNLESS( PaJack_Load(), paNoError );
UNLESS( jackHostApi = (PaJackHostApiRepresentation*)
PaUtil_AllocateMemory( sizeof(PaJackHostApiRepresentation) ), paInsufficientMemory );
UNLESS( jackHostApi->deviceInfoMemory = PaUtil_CreateAllocationGroup(), paInsufficientMemory );
PaJack_InitMainThread();
PaJack_InitHostApiMutex( jackHostApi );
PaJack_InitCommandSync( jackHostApi );
mainThread_ = pthread_self();
ASSERT_CALL( pthread_mutex_init( &jackHostApi->mtx, NULL ), 0 );
ASSERT_CALL( pthread_cond_init( &jackHostApi->cond, NULL ), 0 );
/* Try to become a client of the JACK server. If we cannot do
* this, then this API cannot be used.
@ -991,9 +807,6 @@ error:
PaUtil_FreeMemory( jackHostApi );
}
PaJack_Unload();
return result;
}
@ -1006,8 +819,8 @@ static void Terminate( struct PaUtilHostApiRepresentation *hostApi )
* client is not allowed to have any ports connected */
ASSERT_CALL( jack_deactivate( jackHostApi->jack_client ), 0 );
PaJack_TerminateHostApiMutex( jackHostApi );
PaJack_TerminateCommandSync( jackHostApi );
ASSERT_CALL( pthread_mutex_destroy( &jackHostApi->mtx ), 0 );
ASSERT_CALL( pthread_cond_destroy( &jackHostApi->cond ), 0 );
ASSERT_CALL( jack_client_close( jackHostApi->jack_client ), 0 );
@ -1021,8 +834,6 @@ static void Terminate( struct PaUtilHostApiRepresentation *hostApi )
free( jackErr_ );
jackErr_ = NULL;
PaJack_Unload();
}
static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi,
@ -1190,19 +1001,39 @@ static void CleanUpStream( PaJackStream *stream, int terminateStreamRepresentati
PaUtil_FreeMemory( stream );
}
static PaError WaitCondition( PaJackHostApiRepresentation *hostApi )
{
PaError result = paNoError;
int err = 0;
PaTime pt = PaUtil_GetTime();
struct timespec ts;
ts.tv_sec = (time_t) floor( pt + 10 * 60 /* 10 minutes */ );
ts.tv_nsec = (long) ((pt - floor( pt )) * 1000000000);
/* XXX: Best enclose in loop, in case of spurious wakeups? */
err = pthread_cond_timedwait( &hostApi->cond, &hostApi->mtx, &ts );
/* Make sure we didn't time out */
UNLESS( err != ETIMEDOUT, paTimedOut );
UNLESS( !err, paInternalError );
error:
return result;
}
static PaError AddStream( PaJackStream *stream )
{
PaError result = paNoError;
PaJackHostApiRepresentation *hostApi = stream->hostApi;
/* Add to queue of streams that should be processed */
PaJack_LockHostAPI( hostApi );
ASSERT_CALL( pthread_mutex_lock( &hostApi->mtx ), 0 );
if( !hostApi->jackIsDown )
{
hostApi->toAdd = stream;
/* Unlock mutex and await signal from processing thread */
result = WaitForCommandToComplete( stream->hostApi );
result = WaitCondition( stream->hostApi );
}
PaJack_UnlockHostAPI( hostApi );
ASSERT_CALL( pthread_mutex_unlock( &hostApi->mtx ), 0 );
ENSURE_PA( result );
UNLESS( !hostApi->jackIsDown, paDeviceUnavailable );
@ -1218,14 +1049,14 @@ static PaError RemoveStream( PaJackStream *stream )
PaJackHostApiRepresentation *hostApi = stream->hostApi;
/* Add to queue over streams that should be processed */
PaJack_LockHostAPI( hostApi );
ASSERT_CALL( pthread_mutex_lock( &hostApi->mtx ), 0 );
if( !hostApi->jackIsDown )
{
hostApi->toRemove = stream;
/* Unlock mutex and await signal from processing thread */
result = WaitForCommandToComplete( stream->hostApi );
result = WaitCondition( stream->hostApi );
}
PaJack_UnlockHostAPI( hostApi );
ASSERT_CALL( pthread_mutex_unlock( &hostApi->mtx ), 0 );
ENSURE_PA( result );
error:
@ -1338,7 +1169,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
stream->isBlockingStream = !streamCallback;
if( stream->isBlockingStream )
{
PaTime latency = 0.001f; /* 1ms is the absolute minimum we support */
float latency = 0.001; /* 1ms is the absolute minimum we support */
int minimum_buffer_frames = 0;
if( inputParameters && inputParameters->suggestedLatency > latency )
@ -1408,7 +1239,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
/* Get output ports of our capture device */
snprintf( regex_pattern, regexSz, "%s:.*", hostApi->deviceInfos[ inputParameters->device ]->name );
UNLESS( jack_ports = jack_get_ports( jackHostApi->jack_client, regex_pattern,
NULL, JackPortIsOutput ), paUnanticipatedHostError );
JACK_PORT_TYPE_FILTER, JackPortIsOutput ), paUnanticipatedHostError );
for( i = 0; i < inputChannelCount && jack_ports[i]; i++ )
{
if( (stream->remote_output_ports[i] = jack_port_by_name(
@ -1418,7 +1249,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
break;
}
}
jack_free( jack_ports );
free( jack_ports );
UNLESS( !err, paInsufficientMemory );
/* Fewer ports than expected? */
@ -1432,7 +1263,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
/* Get input ports of our playback device */
snprintf( regex_pattern, regexSz, "%s:.*", hostApi->deviceInfos[ outputParameters->device ]->name );
UNLESS( jack_ports = jack_get_ports( jackHostApi->jack_client, regex_pattern,
NULL, JackPortIsInput ), paUnanticipatedHostError );
JACK_PORT_TYPE_FILTER, JackPortIsInput ), paUnanticipatedHostError );
for( i = 0; i < outputChannelCount && jack_ports[i]; i++ )
{
if( (stream->remote_input_ports[i] = jack_port_by_name(
@ -1442,7 +1273,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
break;
}
}
jack_free( jack_ports );
free( jack_ports );
UNLESS( !err , paInsufficientMemory );
/* Fewer ports than expected? */
@ -1596,9 +1427,9 @@ static PaError UpdateQueue( PaJackHostApiRepresentation *hostApi )
const double jackSr = jack_get_sample_rate( hostApi->jack_client );
int err;
if( (err = PaJack_TryLockHostAPI( hostApi )) != 0 )
if( (err = pthread_mutex_trylock( &hostApi->mtx )) != 0 )
{
assert( err );
assert( err == EBUSY );
return paNoError;
}
@ -1657,11 +1488,11 @@ static PaError UpdateQueue( PaJackHostApiRepresentation *hostApi )
if( queueModified )
{
/* Signal that we've done what was asked of us */
PaJack_SignalCommandCompleted( hostApi );
ASSERT_CALL( pthread_cond_signal( &hostApi->cond ), 0 );
}
error:
PaJack_UnlockHostAPI( hostApi );
ASSERT_CALL( pthread_mutex_unlock( &hostApi->mtx ), 0 );
return result;
}
@ -1690,7 +1521,7 @@ static int JackCallback( jack_nframes_t frames, void *userData )
if( stream->doStart )
{
/* If we can't obtain a lock, we'll try next time */
int err = PaJack_TryLockHostAPI( stream->hostApi );
int err = pthread_mutex_trylock( &stream->hostApi->mtx );
if( !err )
{
if( stream->doStart ) /* Could potentially change before obtaining the lock */
@ -1698,12 +1529,12 @@ static int JackCallback( jack_nframes_t frames, void *userData )
stream->is_active = 1;
stream->doStart = 0;
PA_DEBUG(( "%s: Starting stream\n", __FUNCTION__ ));
PaJack_SignalCommandCompleted( hostApi );
ASSERT_CALL( pthread_cond_signal( &stream->hostApi->cond ), 0 );
stream->callbackResult = paContinue;
stream->isSilenced = 0;
}
PaJack_UnlockHostAPI( stream->hostApi );
ASSERT_CALL( pthread_mutex_unlock( &stream->hostApi->mtx ), 0 );
}
else
assert( err == EBUSY );
@ -1741,15 +1572,15 @@ static int JackCallback( jack_nframes_t frames, void *userData )
if( !stream->is_active ) /* Ok, signal to the main thread that we've carried out the operation */
{
/* If we can't obtain a lock, we'll try next time */
int err = PaJack_TryLockHostAPI( stream->hostApi );
int err = pthread_mutex_trylock( &stream->hostApi->mtx );
if( !err )
{
stream->doStop = stream->doAbort = 0;
PaJack_SignalCommandCompleted( stream->hostApi );
PaJack_UnlockHostAPI( stream->hostApi );
ASSERT_CALL( pthread_cond_signal( &stream->hostApi->cond ), 0 );
ASSERT_CALL( pthread_mutex_unlock( &stream->hostApi->mtx ), 0 );
}
else
assert( err );
assert( err == EBUSY );
}
}
}
@ -1795,11 +1626,11 @@ static PaError StartStream( PaStream *s )
/* Enable processing */
PaJack_LockHostAPI( stream->hostApi );
ASSERT_CALL( pthread_mutex_lock( &stream->hostApi->mtx ), 0 );
stream->doStart = 1;
/* Wait for stream to be started */
result = WaitForCommandToComplete( stream->hostApi );
result = WaitCondition( stream->hostApi );
/*
do
{
@ -1811,7 +1642,7 @@ static PaError StartStream( PaStream *s )
stream->doStart = 0;
stream->is_active = 0; /* Cancel any processing */
}
PaJack_UnlockHostAPI( stream->hostApi );
ASSERT_CALL( pthread_mutex_unlock( &stream->hostApi->mtx ), 0 );
ENSURE_PA( result );
@ -1830,15 +1661,15 @@ static PaError RealStop( PaJackStream *stream, int abort )
if( stream->isBlockingStream )
BlockingWaitEmpty ( stream );
PaJack_LockHostAPI( stream->hostApi );
ASSERT_CALL( pthread_mutex_lock( &stream->hostApi->mtx ), 0 );
if( abort )
stream->doAbort = 1;
else
stream->doStop = 1;
/* Wait for stream to be stopped */
result = WaitForCommandToComplete( stream->hostApi );
PaJack_UnlockHostAPI( stream->hostApi );
result = WaitCondition( stream->hostApi );
ASSERT_CALL( pthread_mutex_unlock( &stream->hostApi->mtx ), 0 );
ENSURE_PA( result );
UNLESS( !stream->is_active, paInternalError );

View File

@ -1,162 +0,0 @@
/*
* $Id: pa_jack.c 1668 2011-05-02 17:07:11Z rossb $
* PortAudio Portable Real-Time Audio Library
* Latest Version at: http://www.portaudio.com
* JACK Implementation by Joshua Haberman
*
* Copyright (c) 2004 Stefan Westerfeld <stefan@space.twc.de>
* Copyright (c) 2004 Arve Knudsen <aknuds-1@broadpark.no>
* Copyright (c) 2002 Joshua Haberman <joshua@haberman.com>
*
* Based on the Open Source API proposed by Ross Bencina
* Copyright (c) 1999-2002 Ross Bencina, Phil Burk
*
* 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.
*
* 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.
*/
/*
* The text above constitutes the entire PortAudio license; however,
* the PortAudio community also makes the following non-binding requests:
*
* 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. It is also
* requested that these non-binding requests be included along with the
* license above.
*/
/**
@file
@ingroup hostapi_src
*/
#define PADL_DEFINE_POINTERS
#include "pa_dynload.h"
#include "pa_jack_dynload.h"
#if defined(PA_DYNAMIC_JACK)
static paDynamicLib jacklib = NULL;
#endif
int PaJack_Load(void)
{
#if !defined(PA_DYNAMIC_JACK)
return 1;
#else
#if defined(__APPLE__)
jacklib = PaDL_Load("libjack.dylib");
#elif defined(_WIN64)
jacklib = PaDL_Load("libjack64.dll");
#elif defined(WIN32)
jacklib = PaDL_Load("libjack.dll");
#else
jacklib = PaDL_Load("libjack.so");
#endif
if (!jacklib) {
return 0;
}
PADL_FINDSYMBOL(jacklib, jack_client_name_size, goto error);
PADL_FINDSYMBOL(jacklib, jack_client_name_size, goto error);
PADL_FINDSYMBOL(jacklib, jack_get_ports, goto error);
PADL_FINDSYMBOL(jacklib, jack_get_sample_rate, goto error);
PADL_FINDSYMBOL(jacklib, jack_get_ports, goto error);
PADL_FINDSYMBOL(jacklib, jack_port_by_name, goto error);
PADL_FINDSYMBOL(jacklib, jack_port_get_latency, goto error);
PADL_FINDSYMBOL(jacklib, jack_free, goto error);
PADL_FINDSYMBOL(jacklib, jack_get_ports, goto error);
PADL_FINDSYMBOL(jacklib, jack_port_by_name, goto error);
PADL_FINDSYMBOL(jacklib, jack_port_get_latency, goto error);
PADL_FINDSYMBOL(jacklib, jack_free, goto error);
PADL_FINDSYMBOL(jacklib, jack_client_open, goto error);
PADL_FINDSYMBOL(jacklib, jack_on_shutdown, goto error);
PADL_FINDSYMBOL(jacklib, jack_set_error_function, goto error);
PADL_FINDSYMBOL(jacklib, jack_get_buffer_size, goto error);
PADL_FINDSYMBOL(jacklib, jack_set_sample_rate_callback, goto error);
PADL_FINDSYMBOL(jacklib, jack_set_xrun_callback, goto error);
PADL_FINDSYMBOL(jacklib, jack_set_process_callback, goto error);
PADL_FINDSYMBOL(jacklib, jack_activate, goto error);
PADL_FINDSYMBOL(jacklib, jack_deactivate, goto error);
PADL_FINDSYMBOL(jacklib, jack_client_close, goto error);
PADL_FINDSYMBOL(jacklib, jack_deactivate, goto error);
PADL_FINDSYMBOL(jacklib, jack_client_close, goto error);
PADL_FINDSYMBOL(jacklib, jack_get_sample_rate, goto error);
PADL_FINDSYMBOL(jacklib, jack_port_unregister, goto error);
PADL_FINDSYMBOL(jacklib, jack_port_unregister, goto error);
PADL_FINDSYMBOL(jacklib, jack_port_name_size, goto error);
PADL_FINDSYMBOL(jacklib, jack_client_name_size, goto error);
PADL_FINDSYMBOL(jacklib, jack_get_sample_rate, goto error);
PADL_FINDSYMBOL(jacklib, jack_get_sample_rate, goto error);
PADL_FINDSYMBOL(jacklib, jack_port_name_size, goto error);
PADL_FINDSYMBOL(jacklib, jack_port_register, goto error);
PADL_FINDSYMBOL(jacklib, jack_port_name_size, goto error);
PADL_FINDSYMBOL(jacklib, jack_port_register, goto error);
PADL_FINDSYMBOL(jacklib, jack_get_ports, goto error);
PADL_FINDSYMBOL(jacklib, jack_port_by_name, goto error);
PADL_FINDSYMBOL(jacklib, jack_free, goto error);
PADL_FINDSYMBOL(jacklib, jack_get_ports, goto error);
PADL_FINDSYMBOL(jacklib, jack_port_by_name, goto error);
PADL_FINDSYMBOL(jacklib, jack_free, goto error);
PADL_FINDSYMBOL(jacklib, jack_port_get_latency, goto error);
PADL_FINDSYMBOL(jacklib, jack_get_buffer_size, goto error);
PADL_FINDSYMBOL(jacklib, jack_port_get_latency, goto error);
PADL_FINDSYMBOL(jacklib, jack_get_buffer_size, goto error);
PADL_FINDSYMBOL(jacklib, jack_frame_time, goto error);
PADL_FINDSYMBOL(jacklib, jack_get_sample_rate, goto error);
PADL_FINDSYMBOL(jacklib, jack_frame_time, goto error);
PADL_FINDSYMBOL(jacklib, jack_port_get_latency, goto error);
PADL_FINDSYMBOL(jacklib, jack_port_get_latency, goto error);
PADL_FINDSYMBOL(jacklib, jack_port_get_buffer, goto error);
PADL_FINDSYMBOL(jacklib, jack_port_get_buffer, goto error);
PADL_FINDSYMBOL(jacklib, jack_get_sample_rate, goto error);
PADL_FINDSYMBOL(jacklib, jack_port_get_buffer, goto error);
PADL_FINDSYMBOL(jacklib, jack_connect, goto error);
PADL_FINDSYMBOL(jacklib, jack_port_name, goto error);
PADL_FINDSYMBOL(jacklib, jack_connect, goto error);
PADL_FINDSYMBOL(jacklib, jack_port_name, goto error);
PADL_FINDSYMBOL(jacklib, jack_port_connected, goto error);
PADL_FINDSYMBOL(jacklib, jack_port_disconnect, goto error);
PADL_FINDSYMBOL(jacklib, jack_port_connected, goto error);
PADL_FINDSYMBOL(jacklib, jack_port_disconnect, goto error);
PADL_FINDSYMBOL(jacklib, jack_frame_time, goto error);
PADL_FINDSYMBOL(jacklib, jack_client_name_size, goto error);
PADL_FINDSYMBOL(jacklib, jack_get_client_name, goto error);
return 1;
error:
PaJack_Unload();
return 0;
#endif
}
void PaJack_Unload(void)
{
#if defined(PA_DYNAMIC_JACK)
if (jacklib) {
PaDL_Unload(jacklib);
jacklib = NULL;
}
#endif
}

View File

@ -1,224 +0,0 @@
/*
* $Id: pa_jack.c 1668 2011-05-02 17:07:11Z rossb $
* PortAudio Portable Real-Time Audio Library
* Latest Version at: http://www.portaudio.com
* JACK Implementation by Joshua Haberman
*
* Copyright (c) 2004 Stefan Westerfeld <stefan@space.twc.de>
* Copyright (c) 2004 Arve Knudsen <aknuds-1@broadpark.no>
* Copyright (c) 2002 Joshua Haberman <joshua@haberman.com>
*
* Based on the Open Source API proposed by Ross Bencina
* Copyright (c) 1999-2002 Ross Bencina, Phil Burk
*
* 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.
*
* 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.
*/
/*
* The text above constitutes the entire PortAudio license; however,
* the PortAudio community also makes the following non-binding requests:
*
* 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. It is also
* requested that these non-binding requests be included along with the
* license above.
*/
/**
@file
@ingroup hostapi_src
*/
#ifndef INCLUDED_PA_JACK_DYNLINK_H
#define INCLUDED_PA_JACK_DYNLINK_H
#include <jack/jack.h>
#include "pa_dynload.h"
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
#if defined(PA_DYNAMIC_JACK)
PADL_FUNC_WITH_RETURN(
int,
jack_activate,
(jack_client_t *client),
(client)
);
PADL_FUNC_WITH_RETURN(
int,
jack_client_close,
(jack_client_t *client),
(client)
);
PADL_FUNC_WITH_RETURN(
int,
jack_client_name_size,
(void),
()
);
PADL_FUNC_WITH_RETURN(
jack_client_t *,
jack_client_open,
(const char *client_name, jack_options_t options, jack_status_t *status, ...),
(client_name, options, status)
);
PADL_FUNC_WITH_RETURN(
int,
jack_connect,
(jack_client_t *client, const char *source_port, const char *destination_port),
(client, source_port, destination_port)
);
PADL_FUNC_WITH_RETURN(
int,
jack_deactivate,
(jack_client_t *client),
(client)
);
PADL_FUNC_WITH_RETURN(
jack_nframes_t,
jack_frame_time,
(const jack_client_t *client),
(client)
);
PADL_FUNC_NO_RETURN(
jack_free,
(void *ptr),
(ptr)
);
PADL_FUNC_WITH_RETURN(
jack_nframes_t,
jack_get_buffer_size,
(jack_client_t *client),
(client)
);
PADL_FUNC_WITH_RETURN(
char *,
jack_get_client_name,
(jack_client_t *client),
(client)
);
PADL_FUNC_WITH_RETURN(
const char **,
jack_get_ports,
(jack_client_t *client, const char *port_name_pattern, const char *type_name_pattern, unsigned long flags),
(client, port_name_pattern, type_name_pattern, flags)
);
PADL_FUNC_WITH_RETURN(
jack_nframes_t,
jack_get_sample_rate,
(jack_client_t *client),
(client)
);
PADL_FUNC_NO_RETURN(
jack_on_shutdown,
(jack_client_t *client, JackShutdownCallback shutdown_callback, void *arg),
(client, shutdown_callback, arg)
);
PADL_FUNC_WITH_RETURN(
jack_port_t *,
jack_port_by_name,
(jack_client_t *client, const char *port_name),
(client, port_name)
);
PADL_FUNC_WITH_RETURN(
int,
jack_port_connected,
(const jack_port_t *port),
(port)
);
PADL_FUNC_WITH_RETURN(
int,
jack_port_disconnect,
(jack_client_t *client, jack_port_t *port),
(client, port)
);
PADL_FUNC_WITH_RETURN(
void *,
jack_port_get_buffer,
(jack_port_t *port, jack_nframes_t frames),
(port, frames)
);
PADL_FUNC_WITH_RETURN(
jack_nframes_t,
jack_port_get_latency,
(jack_port_t *port),
(port)
);
PADL_FUNC_WITH_RETURN(
const char *,
jack_port_name,
(const jack_port_t *port),
(port)
);
PADL_FUNC_WITH_RETURN(
int,
jack_port_name_size,
(void),
()
);
PADL_FUNC_WITH_RETURN(
jack_port_t *,
jack_port_register,
(jack_client_t *client, const char *port_name, const char *port_type, unsigned long flags, unsigned long buffer_size),
(client, port_name, port_type, flags, buffer_size)
);
PADL_FUNC_WITH_RETURN(
int,
jack_port_unregister,
(jack_client_t *client, jack_port_t *port),
(client, port)
);
PADL_FUNC_NO_RETURN(
jack_set_error_function,
(void (*func)(const char *)),
(func)
);
PADL_FUNC_WITH_RETURN(
int,
jack_set_process_callback,
(jack_client_t *client, JackProcessCallback process_callback, void *arg),
(client, process_callback, arg)
);
PADL_FUNC_WITH_RETURN(
int,
jack_set_sample_rate_callback,
(jack_client_t *client, JackSampleRateCallback srate_callback, void *arg),
(client, srate_callback, arg)
);
PADL_FUNC_WITH_RETURN(
int,
jack_set_xrun_callback,
(jack_client_t *client, JackXRunCallback xrun_callback, void *arg),
(client, xrun_callback, arg)
);
#endif /* PA_DYNAMIC_JACK */
int PaJack_Load(void);
void PaJack_Unload(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* INCLUDED_PA_JACK_DYNLINK_H */

View File

@ -1,5 +1,5 @@
/*
* $Id: pa_unix_oss.c 1668 2011-05-02 17:07:11Z rossb $
* $Id: pa_unix_oss.c 1894 2013-06-08 19:30:41Z gineera $
* PortAudio Portable Real-Time Audio Library
* Latest Version at: http://www.portaudio.com
* OSS implementation by:
@ -2043,26 +2043,3 @@ error:
#endif
}
const char *PaOSS_GetStreamInputDevice( PaStream* s )
{
PaOssStream *stream = (PaOssStream*)s;
if( stream->capture )
{
return stream->capture->devName;
}
return NULL;
}
const char *PaOSS_GetStreamOutputDevice( PaStream* s )
{
PaOssStream *stream = (PaOssStream*)s;
if( stream->playback )
{
return stream->playback->devName;
}
return NULL;
}

View File

@ -174,6 +174,8 @@
// "1CB9AD4C-DBFA-4c32-B178-C2F568A703B2"
PA_DEFINE_IID(IAudioClient, 1cb9ad4c, dbfa, 4c32, b1, 78, c2, f5, 68, a7, 03, b2);
// "726778CD-F60A-4EDA-82DE-E47610CD78AA"
PA_DEFINE_IID(IAudioClient2, 726778cd, f60a, 4eda, 82, de, e4, 76, 10, cd, 78, aa);
// "1BE09788-6894-4089-8586-9A2A6C265AC5"
PA_DEFINE_IID(IMMEndpoint, 1be09788, 6894, 4089, 85, 86, 9a, 2a, 6c, 26, 5a, c5);
// "A95664D2-9614-4F35-A746-DE8DB63617E6"
@ -195,6 +197,22 @@ __DEFINE_GUID(pa_KSDATAFORMAT_SUBTYPE_PCM, 0x00000001, 0x0000, 0x0010, 0x
__DEFINE_GUID(pa_KSDATAFORMAT_SUBTYPE_ADPCM, 0x00000002, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 );
__DEFINE_GUID(pa_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, 0x00000003, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 );
#ifdef __IAudioClient2_INTERFACE_DEFINED__
typedef enum _pa_AUDCLNT_STREAMOPTIONS {
pa_AUDCLNT_STREAMOPTIONS_NONE = 0x00,
pa_AUDCLNT_STREAMOPTIONS_RAW = 0x01,
pa_AUDCLNT_STREAMOPTIONS_MATCH_FORMAT = 0x02
} pa_AUDCLNT_STREAMOPTIONS;
typedef struct _pa_AudioClientProperties {
UINT32 cbSize;
BOOL bIsOffload;
AUDIO_STREAM_CATEGORY eCategory;
pa_AUDCLNT_STREAMOPTIONS Options;
} pa_AudioClientProperties;
#define PA_AUDIOCLIENTPROPERTIES_SIZE_CATEGORY (sizeof(pa_AudioClientProperties) - sizeof(pa_AUDCLNT_STREAMOPTIONS))
#define PA_AUDIOCLIENTPROPERTIES_SIZE_OPTIONS sizeof(pa_AudioClientProperties)
#endif // __IAudioClient2_INTERFACE_DEFINED__
/* use CreateThread for CYGWIN/Windows Mobile, _beginthreadex for all others */
#if !defined(__CYGWIN__) && !defined(_WIN32_WCE)
#define CREATE_THREAD(PROC) (HANDLE)_beginthreadex( NULL, 0, (PROC), stream, 0, &stream->dwThreadId )
@ -357,9 +375,6 @@ typedef struct PaWasapiDeviceInfo
// Formfactor
EndpointFormFactor formFactor;
// Loopback indicator
int loopBack;
}
PaWasapiDeviceInfo;
@ -484,9 +499,6 @@ typedef struct PaWasapiStream
// thread is being started
volatile BOOL running;
// stream has not or is no longer started
BOOL stopped;
PA_THREAD_ID dwThreadId;
HANDLE hThread;
HANDLE hCloseRequest;
@ -512,14 +524,22 @@ typedef struct PaWasapiStream
}
PaWasapiStream;
// COM marshaling
static HRESULT MarshalSubStreamComPointers(PaWasapiSubStream *substream);
static HRESULT MarshalStreamComPointers(PaWasapiStream *stream);
static HRESULT UnmarshalSubStreamComPointers(PaWasapiSubStream *substream);
static HRESULT UnmarshalStreamComPointers(PaWasapiStream *stream);
static void ReleaseUnmarshaledSubComPointers(PaWasapiSubStream *substream);
static void ReleaseUnmarshaledComPointers(PaWasapiStream *stream);
// Local stream methods
void _StreamOnStop(PaWasapiStream *stream);
void _StreamFinish(PaWasapiStream *stream);
void _StreamCleanup(PaWasapiStream *stream);
HRESULT _PollGetOutputFramesAvailable(PaWasapiStream *stream, UINT32 *available);
HRESULT _PollGetInputFramesAvailable(PaWasapiStream *stream, UINT32 *available);
void *PaWasapi_ReallocateMemory(void *ptr, size_t size);
void PaWasapi_FreeMemory(void *ptr);
static void _StreamOnStop(PaWasapiStream *stream);
static void _StreamFinish(PaWasapiStream *stream);
static void _StreamCleanup(PaWasapiStream *stream);
static HRESULT _PollGetOutputFramesAvailable(PaWasapiStream *stream, UINT32 *available);
static HRESULT _PollGetInputFramesAvailable(PaWasapiStream *stream, UINT32 *available);
static void *PaWasapi_ReallocateMemory(void *ptr, size_t size);
static void PaWasapi_FreeMemory(void *ptr);
// Local statics
@ -850,19 +870,49 @@ static BOOL IsWow64()
// ------------------------------------------------------------------------------------------
typedef enum EWindowsVersion
{
WINDOWS_UNKNOWN = 0,
WINDOWS_VISTA_SERVER2008 = (1 << 0),
WINDOWS_7_SERVER2008R2 = (1 << 1),
WINDOWS_FUTURE = (1 << 2)
WINDOWS_UNKNOWN = 0,
WINDOWS_VISTA_SERVER2008,
WINDOWS_7_SERVER2008R2,
WINDOWS_8_SERVER2012,
WINDOWS_8_1_SERVER2012R2,
WINDOWS_10_SERVER2016,
WINDOWS_FUTURE
}
EWindowsVersion;
// Defines Windows 7/Windows Server 2008 R2 and up (future versions)
#define WINDOWS_7_SERVER2008R2_AND_UP (WINDOWS_7_SERVER2008R2|WINDOWS_FUTURE)
// The function is limited to Vista/7 mostly as we need just to find out Vista/WOW64 combination
// in order to use WASAPI WOW64 workarounds.
static UINT32 GetWindowsVersion()
// Alternative way for checking Windows version (allows to check version on Windows 8.1 and up)
static BOOL IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WORD wServicePackMajor)
{
static UINT32 version = WINDOWS_UNKNOWN;
typedef ULONGLONG (NTAPI *LPFN_VERSETCONDITIONMASK)(ULONGLONG ConditionMask, DWORD TypeMask, BYTE Condition);
typedef BOOL (WINAPI *LPFN_VERIFYVERSIONINFO)(LPOSVERSIONINFOEXA lpVersionInformation, DWORD dwTypeMask, DWORDLONG dwlConditionMask);
LPFN_VERSETCONDITIONMASK fnVerSetConditionMask;
LPFN_VERIFYVERSIONINFO fnVerifyVersionInfo;
OSVERSIONINFOEXA osvi = { sizeof(osvi), 0, 0, 0, 0, {0}, 0, 0 };
DWORDLONG dwlConditionMask;
fnVerSetConditionMask = (LPFN_VERSETCONDITIONMASK)GetProcAddress(GetModuleHandleA("kernel32"), "VerSetConditionMask");
fnVerifyVersionInfo = (LPFN_VERIFYVERSIONINFO)GetProcAddress(GetModuleHandleA("kernel32"), "VerifyVersionInfoA");
if ((fnVerSetConditionMask == NULL) || (fnVerifyVersionInfo == NULL))
return FALSE;
dwlConditionMask = fnVerSetConditionMask(
fnVerSetConditionMask(
fnVerSetConditionMask(
0, VER_MAJORVERSION, VER_GREATER_EQUAL),
VER_MINORVERSION, VER_GREATER_EQUAL),
VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL);
osvi.dwMajorVersion = wMajorVersion;
osvi.dwMinorVersion = wMinorVersion;
osvi.wServicePackMajor = wServicePackMajor;
return (fnVerifyVersionInfo(&osvi, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR, dwlConditionMask) != FALSE);
}
// Get Windows version
static EWindowsVersion GetWindowsVersion()
{
static EWindowsVersion version = WINDOWS_UNKNOWN;
if (version == WINDOWS_UNKNOWN)
{
@ -874,45 +924,75 @@ static UINT32 GetWindowsVersion()
typedef DWORD (WINAPI *LPFN_GETVERSION)(VOID);
LPFN_GETVERSION fnGetVersion;
fnGetVersion = (LPFN_GETVERSION) GetProcAddress(GetModuleHandleA("kernel32"), "GetVersion");
if (fnGetVersion == NULL)
return WINDOWS_UNKNOWN;
dwVersion = fnGetVersion();
// Get the Windows version
dwMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
dwMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion)));
// Get the build number
if (dwVersion < 0x80000000)
dwBuild = (DWORD)(HIWORD(dwVersion));
switch (dwMajorVersion)
fnGetVersion = (LPFN_GETVERSION)GetProcAddress(GetModuleHandleA("kernel32"), "GetVersion");
if (fnGetVersion != NULL)
{
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
break; // skip lower
case 6:
switch (dwMinorVersion)
PRINT(("WASAPI: getting Windows version with GetVersion()\n"));
dwVersion = fnGetVersion();
// Get the Windows version
dwMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
dwMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion)));
// Get the build number
if (dwVersion < 0x80000000)
dwBuild = (DWORD)(HIWORD(dwVersion));
switch (dwMajorVersion)
{
case 0:
version |= WINDOWS_VISTA_SERVER2008;
break;
case 1:
version |= WINDOWS_7_SERVER2008R2;
case 2:
case 3:
case 4:
case 5:
break; // skip lower
case 6:
switch (dwMinorVersion)
{
case 0: version = WINDOWS_VISTA_SERVER2008; break;
case 1: version = WINDOWS_7_SERVER2008R2; break;
case 2: version = WINDOWS_8_SERVER2012; break;
case 3: version = WINDOWS_8_1_SERVER2012R2; break;
default: version = WINDOWS_FUTURE; break;
}
break;
case 10:
switch (dwMinorVersion)
{
case 0: version = WINDOWS_10_SERVER2016; break;
default: version = WINDOWS_FUTURE; break;
}
break;
default:
version |= WINDOWS_FUTURE;
version = WINDOWS_FUTURE;
break;
}
break;
default:
version |= WINDOWS_FUTURE;
}
else
{
PRINT(("WASAPI: getting Windows version with VerifyVersionInfo()\n"));
if (IsWindowsVersionOrGreater(10, 0, 0))
version = WINDOWS_10_SERVER2016;
else
if (IsWindowsVersionOrGreater(6, 3, 0))
version = WINDOWS_8_1_SERVER2012R2;
else
if (IsWindowsVersionOrGreater(6, 2, 0))
version = WINDOWS_8_SERVER2012;
else
if (IsWindowsVersionOrGreater(6, 1, 0))
version = WINDOWS_7_SERVER2008R2;
else
if (IsWindowsVersionOrGreater(6, 0, 0))
version = WINDOWS_VISTA_SERVER2008;
else
version = WINDOWS_FUTURE;
}
PRINT(("WASAPI: Windows version = %d\n", version));
}
return version;
@ -924,7 +1004,45 @@ static BOOL UseWOW64Workaround()
// note: WOW64 bug is common to Windows Vista x64, thus we fall back to safe Poll-driven
// method. Windows 7 x64 seems has WOW64 bug fixed.
return (IsWow64() && (GetWindowsVersion() & WINDOWS_VISTA_SERVER2008));
return (IsWow64() && (GetWindowsVersion() == WINDOWS_VISTA_SERVER2008));
}
// ------------------------------------------------------------------------------------------
static UINT32 GetAudioClientVersion()
{
if (GetWindowsVersion() >= WINDOWS_10_SERVER2016)
return 3;
else
if (GetWindowsVersion() >= WINDOWS_8_SERVER2012)
return 2;
return 1;
}
// ------------------------------------------------------------------------------------------
static const IID *GetAudioClientIID()
{
static const IID *cli_iid = NULL;
if (cli_iid == NULL)
{
UINT32 cli_version = GetAudioClientVersion();
if (cli_version <= 1)
{
cli_iid = &pa_IID_IAudioClient;
}
else
{
switch (cli_version)
{
case 3: cli_iid = &pa_IID_IAudioClient2; cli_version = 2; break; // use IAudioClient2 for Windows 10+ until IAudioClient3 functions are required
default: cli_iid = &pa_IID_IAudioClient2; cli_version = 2; break;
}
}
PRINT(("WASAPI: IAudioClient version = %d\n", cli_version));
}
return cli_iid;
}
// ------------------------------------------------------------------------------------------
@ -1058,8 +1176,6 @@ PaError PaWasapi_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiInd
HRESULT hr = S_OK;
IMMDeviceCollection* pEndPoints = NULL;
UINT i;
UINT renderCount;
UINT devIndex;
if (!SetupAVRT())
{
@ -1156,19 +1272,6 @@ PaError PaWasapi_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiInd
}
}
hr = IMMDeviceEnumerator_EnumAudioEndpoints(paWasapi->enumerator, eRender, DEVICE_STATE_ACTIVE, &pEndPoints);
// We need to set the result to a value otherwise we will return paNoError
// [IF_FAILED_JUMP(hResult, error);]
IF_FAILED_INTERNAL_ERROR_JUMP(hr, result, error);
hr = IMMDeviceCollection_GetCount(pEndPoints, &renderCount);
// We need to set the result to a value otherwise we will return paNoError
// [IF_FAILED_JUMP(hResult, error);]
IF_FAILED_INTERNAL_ERROR_JUMP(hr, result, error);
SAFE_RELEASE(pEndPoints);
pEndPoints = NULL;
hr = IMMDeviceEnumerator_EnumAudioEndpoints(paWasapi->enumerator, eAll, DEVICE_STATE_ACTIVE, &pEndPoints);
// We need to set the result to a value otherwise we will return paNoError
// [IF_FAILED_JUMP(hResult, error);]
@ -1179,9 +1282,12 @@ PaError PaWasapi_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiInd
// [IF_FAILED_JUMP(hResult, error);]
IF_FAILED_INTERNAL_ERROR_JUMP(hr, result, error);
paWasapi->deviceCount += renderCount;
paWasapi->devInfo = (PaWasapiDeviceInfo *)PaUtil_AllocateMemory(sizeof(PaWasapiDeviceInfo) * paWasapi->deviceCount);
if (paWasapi->devInfo == NULL)
{
result = paInsufficientMemory;
goto error;
}
for (i = 0; i < paWasapi->deviceCount; ++i)
memset(&paWasapi->devInfo[i], 0, sizeof(PaWasapiDeviceInfo));
@ -1204,7 +1310,7 @@ PaError PaWasapi_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiInd
goto error;
}
for (devIndex = 0, i = 0; i < paWasapi->deviceCount; ++i, ++devIndex)
for (i = 0; i < paWasapi->deviceCount; ++i)
{
DWORD state = 0;
PaDeviceInfo *deviceInfo = &deviceInfoArray[i];
@ -1214,7 +1320,7 @@ PaError PaWasapi_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiInd
PA_DEBUG(("WASAPI: device idx: %02d\n", i));
PA_DEBUG(("WASAPI: ---------------\n"));
hr = IMMDeviceCollection_Item(pEndPoints, devIndex, &paWasapi->devInfo[i].device);
hr = IMMDeviceCollection_Item(pEndPoints, i, &paWasapi->devInfo[i].device);
// We need to set the result to a value otherwise we will return paNoError
// [IF_FAILED_JUMP(hResult, error);]
IF_FAILED_INTERNAL_ERROR_JUMP(hr, result, error);
@ -1336,7 +1442,7 @@ PaError PaWasapi_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiInd
{
IAudioClient *tmpClient = NULL;
hr = IMMDevice_Activate(paWasapi->devInfo[i].device, &pa_IID_IAudioClient,
hr = IMMDevice_Activate(paWasapi->devInfo[i].device, GetAudioClientIID(),
CLSCTX_INPROC_SERVER, NULL, (void **)&tmpClient);
// We need to set the result to a value otherwise we will return paNoError
// [IF_FAILED_JUMP(hResult, error);]
@ -1345,9 +1451,17 @@ PaError PaWasapi_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiInd
hr = IAudioClient_GetDevicePeriod(tmpClient,
&paWasapi->devInfo[i].DefaultDevicePeriod,
&paWasapi->devInfo[i].MinimumDevicePeriod);
// We need to set the result to a value otherwise we will return paNoError
// [IF_FAILED_JUMP(hResult, error);]
IF_FAILED_INTERNAL_ERROR_JUMP(hr, result, error);
if (FAILED(hr))
{
PA_DEBUG(("WASAPI:%d| failed getting min/default periods by IAudioClient::GetDevicePeriod() with error[%08X], will use 30000/100000 hns\n", i, (UINT32)hr));
// assign WASAPI common values
paWasapi->devInfo[i].DefaultDevicePeriod = 100000;
paWasapi->devInfo[i].MinimumDevicePeriod = 30000;
// ignore error, let continue further without failing with paInternalError
hr = S_OK;
}
//hr = tmpClient->GetMixFormat(&paWasapi->devInfo[i].MixFormat);
@ -1391,48 +1505,11 @@ PaError PaWasapi_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiInd
// We need to set the result to a value otherwise we will return paNoError
result = paInternalError;
//continue; // do not skip from list, allow to initialize
break;
break;
}
(*hostApi)->deviceInfos[i] = deviceInfo;
++(*hostApi)->info.deviceCount;
if (paWasapi->devInfo[i].flow == eRender)
{
char *deviceName;
UINT deviceNameLen;
memcpy(&deviceInfoArray[i + 1], deviceInfo, sizeof(*deviceInfo));
memcpy(&paWasapi->devInfo[i + 1], &paWasapi->devInfo[i], sizeof(*paWasapi->devInfo));
i++;
paWasapi->devInfo[i].loopBack = 1;
deviceInfo = &deviceInfoArray[i];
deviceInfo->maxInputChannels = deviceInfo->maxOutputChannels;
deviceInfo->defaultHighInputLatency = deviceInfo->defaultHighOutputLatency;
deviceInfo->defaultLowInputLatency = deviceInfo->defaultLowOutputLatency;
deviceInfo->maxOutputChannels = 0;
deviceInfo->defaultHighOutputLatency = 0;
deviceInfo->defaultLowOutputLatency = 0;
PA_DEBUG(("WASAPI:%d| def.SR[%d] max.CH[%d] latency{hi[%f] lo[%f]}\n", i, (UINT32)deviceInfo->defaultSampleRate,
deviceInfo->maxInputChannels, (float)deviceInfo->defaultHighInputLatency, (float)deviceInfo->defaultLowInputLatency));
IMMDevice_AddRef(paWasapi->devInfo[i].device);
deviceName = (char *)PaUtil_GroupAllocateMemory(paWasapi->allocations, MAX_STR_LEN + 1);
if (deviceName == NULL)
{
result = paInsufficientMemory;
goto error;
}
_snprintf(deviceName, MAX_STR_LEN-1, "%s (loopback)", deviceInfo->name);
deviceInfo->name = deviceName;
(*hostApi)->deviceInfos[i] = deviceInfo;
++(*hostApi)->info.deviceCount;
}
}
}
@ -1584,55 +1661,6 @@ int PaWasapi_GetDeviceRole( PaDeviceIndex nDevice )
return paWasapi->devInfo[ index ].formFactor;
}
// ------------------------------------------------------------------------------------------
int PaWasapi_IsLoopback( PaDeviceIndex nDevice )
{
PaError ret;
PaDeviceIndex index;
// Get API
PaWasapiHostApiRepresentation *paWasapi = _GetHostApi(&ret);
if (paWasapi == NULL)
return paNotInitialized;
// Get device index
ret = PaUtil_DeviceIndexToHostApiDeviceIndex(&index, nDevice, &paWasapi->inheritedHostApiRep);
if (ret != paNoError)
return ret;
// Validate index
if ((UINT32)index >= paWasapi->deviceCount)
return paInvalidDevice;
return paWasapi->devInfo[ index ].loopBack;
}
// ------------------------------------------------------------------------------------------
const wchar_t *PaWasapi_GetInputDeviceID( PaStream* s )
{
PaWasapiStream *stream = (PaWasapiStream *)s;
if (stream == NULL)
return NULL;
if (stream->in.params.device_info)
return stream->in.params.device_info->szDeviceID;
return NULL;
}
// ------------------------------------------------------------------------------------------
const wchar_t *PaWasapi_GetOutputDeviceID( PaStream* s )
{
PaWasapiStream *stream = (PaWasapiStream *)s;
if (stream == NULL)
return NULL;
if (stream->out.params.device_info)
return stream->out.params.device_info->szDeviceID;
return NULL;
}
// ------------------------------------------------------------------------------------------
PaError PaWasapi_GetFramesPerHostBuffer( PaStream *pStream, unsigned int *nInput, unsigned int *nOutput )
{
@ -2127,7 +2155,7 @@ static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi,
shareMode = AUDCLNT_SHAREMODE_EXCLUSIVE;
hr = IMMDevice_Activate(paWasapi->devInfo[inputParameters->device].device,
&pa_IID_IAudioClient, CLSCTX_INPROC_SERVER, NULL, (void **)&tmpClient);
GetAudioClientIID(), CLSCTX_INPROC_SERVER, NULL, (void **)&tmpClient);
if (hr != S_OK)
{
LogHostError(hr);
@ -2153,7 +2181,7 @@ static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi,
shareMode = AUDCLNT_SHAREMODE_EXCLUSIVE;
hr = IMMDevice_Activate(paWasapi->devInfo[outputParameters->device].device,
&pa_IID_IAudioClient, CLSCTX_INPROC_SERVER, NULL, (void **)&tmpClient);
GetAudioClientIID(), CLSCTX_INPROC_SERVER, NULL, (void **)&tmpClient);
if (hr != S_OK)
{
LogHostError(hr);
@ -2253,7 +2281,7 @@ static HRESULT CreateAudioClient(PaWasapiStream *pStream, PaWasapiSubStream *pSu
}
// Get the audio client
hr = IMMDevice_Activate(pInfo->device, &pa_IID_IAudioClient, CLSCTX_ALL, NULL, (void **)&audioClient);
hr = IMMDevice_Activate(pInfo->device, GetAudioClientIID(), CLSCTX_ALL, NULL, (void **)&audioClient);
if (hr != S_OK)
{
(*pa_error) = paInsufficientMemory;
@ -2279,7 +2307,7 @@ static HRESULT CreateAudioClient(PaWasapiStream *pStream, PaWasapiSubStream *pSu
}*/
// select mixer
pSub->monoMixer = _GetMonoToStereoMixer(WaveToPaFormat(&pSub->wavex), (output ? MIX_DIR__1TO2 : MIX_DIR__2TO1_L));
pSub->monoMixer = _GetMonoToStereoMixer(WaveToPaFormat(&pSub->wavex), (pInfo->flow == eRender ? MIX_DIR__1TO2 : MIX_DIR__2TO1_L));
if (pSub->monoMixer == NULL)
{
(*pa_error) = paInvalidChannelCount;
@ -2407,6 +2435,38 @@ static HRESULT CreateAudioClient(PaWasapiStream *pStream, PaWasapiSubStream *pSu
}
}
// Set Raw mode (applicable only to IAudioClient2)
#ifdef __IAudioClient2_INTERFACE_DEFINED__
if (GetAudioClientVersion() >= 2)
{
pa_AudioClientProperties audioProps = { 0 };
audioProps.cbSize = sizeof(pa_AudioClientProperties);
audioProps.bIsOffload = FALSE;
audioProps.eCategory = (AUDIO_STREAM_CATEGORY)pSub->params.wasapi_params.streamCategory;
switch (pSub->params.wasapi_params.streamOption)
{
case eStreamOptionRaw:
if (GetWindowsVersion() >= WINDOWS_8_1_SERVER2012R2)
audioProps.Options = pa_AUDCLNT_STREAMOPTIONS_RAW;
break;
case eStreamOptionMatchFormat:
if (GetWindowsVersion() >= WINDOWS_10_SERVER2016)
audioProps.Options = pa_AUDCLNT_STREAMOPTIONS_MATCH_FORMAT;
break;
}
hr = IAudioClient2_SetClientProperties((IAudioClient2 *)audioClient, (AudioClientProperties *)&audioProps);
if (hr != S_OK)
{
PRINT(("WASAPI: IAudioClient2_SetClientProperties(Category = %d, Options = %d) failed with error = %08X\n", audioProps.eCategory, audioProps.Options, (UINT32)hr));
}
else
{
PRINT(("WASAPI: IAudioClient2 set properties: IsOffload = %d, Category = %d, Options = %d\n", audioProps.bIsOffload, audioProps.eCategory, audioProps.Options));
}
}
#endif
// Open the stream and associate it with an audio session
hr = IAudioClient_Initialize(audioClient,
pSub->shareMode,
@ -2435,7 +2495,7 @@ static HRESULT CreateAudioClient(PaWasapiStream *pStream, PaWasapiSubStream *pSu
SAFE_RELEASE(audioClient);
// Create a new audio client
hr = IMMDevice_Activate(pInfo->device, &pa_IID_IAudioClient, CLSCTX_ALL, NULL, (void**)&audioClient);
hr = IMMDevice_Activate(pInfo->device, GetAudioClientIID(), CLSCTX_ALL, NULL, (void**)&audioClient);
if (hr != S_OK)
{
(*pa_error) = paInsufficientMemory;
@ -2466,7 +2526,7 @@ static HRESULT CreateAudioClient(PaWasapiStream *pStream, PaWasapiSubStream *pSu
SAFE_RELEASE(audioClient);
// Create a new audio client
hr = IMMDevice_Activate(pInfo->device, &pa_IID_IAudioClient, CLSCTX_ALL, NULL, (void**)&audioClient);
hr = IMMDevice_Activate(pInfo->device, GetAudioClientIID(), CLSCTX_ALL, NULL, (void**)&audioClient);
if (hr != S_OK)
{
(*pa_error) = paInsufficientMemory;
@ -2506,7 +2566,7 @@ static HRESULT CreateAudioClient(PaWasapiStream *pStream, PaWasapiSubStream *pSu
SAFE_RELEASE(audioClient);
// Create a new audio client
hr = IMMDevice_Activate(pInfo->device, &pa_IID_IAudioClient, CLSCTX_ALL, NULL, (void**)&audioClient);
hr = IMMDevice_Activate(pInfo->device, GetAudioClientIID(), CLSCTX_ALL, NULL, (void**)&audioClient);
if (hr != S_OK)
{
(*pa_error) = paInsufficientMemory;
@ -2532,7 +2592,7 @@ static HRESULT CreateAudioClient(PaWasapiStream *pStream, PaWasapiSubStream *pSu
}*/
// Select mixer
pSub->monoMixer = _GetMonoToStereoMixer(WaveToPaFormat(&pSub->wavex), (output ? MIX_DIR__1TO2 : MIX_DIR__2TO1_L));
pSub->monoMixer = _GetMonoToStereoMixer(WaveToPaFormat(&pSub->wavex), (pInfo->flow == eRender ? MIX_DIR__1TO2 : MIX_DIR__2TO1_L));
if (pSub->monoMixer == NULL)
{
(*pa_error) = paInvalidChannelCount;
@ -2796,34 +2856,43 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
if (framesPerBuffer == 0)
framesPerBuffer = ((UINT32)sampleRate / 100) * 2;
stream->stopped = TRUE;
stream->running = FALSE;
// Try create device: Input
if (inputParameters != NULL)
{
inputChannelCount = inputParameters->channelCount;
inputSampleFormat = inputParameters->sampleFormat;
inputStreamInfo = (PaWasapiStreamInfo *)inputParameters->hostApiSpecificStreamInfo;
info = &paWasapi->devInfo[inputParameters->device];
stream->in.flags = (inputStreamInfo ? inputStreamInfo->flags : 0);
// Select Exclusive/Shared mode
// default Shared Mode
stream->in.shareMode = AUDCLNT_SHAREMODE_SHARED;
if ((inputStreamInfo != NULL) && (inputStreamInfo->flags & paWinWasapiExclusive))
{
// Boost thread priority
stream->nThreadPriority = eThreadPriorityProAudio;
// Make Exclusive
stream->in.shareMode = AUDCLNT_SHAREMODE_EXCLUSIVE;
}
// If user provided explicit thread priority level, use it
if ((inputStreamInfo != NULL) && (inputStreamInfo->flags & paWinWasapiThreadPriority))
// PaWasapiStreamInfo
if (inputParameters->hostApiSpecificStreamInfo != NULL)
{
if ((inputStreamInfo->threadPriority > eThreadPriorityNone) &&
(inputStreamInfo->threadPriority <= eThreadPriorityWindowManager))
stream->nThreadPriority = inputStreamInfo->threadPriority;
memcpy(&stream->in.params.wasapi_params, inputParameters->hostApiSpecificStreamInfo, min(sizeof(stream->in.params.wasapi_params), ((PaWasapiStreamInfo *)inputParameters->hostApiSpecificStreamInfo)->size));
stream->in.params.wasapi_params.size = sizeof(stream->in.params.wasapi_params);
stream->in.params.stream_params.hostApiSpecificStreamInfo = &stream->in.params.wasapi_params;
inputStreamInfo = &stream->in.params.wasapi_params;
stream->in.flags = inputStreamInfo->flags;
// Exclusive Mode
if (inputStreamInfo->flags & paWinWasapiExclusive)
{
// Boost thread priority
stream->nThreadPriority = eThreadPriorityProAudio;
// Make Exclusive
stream->in.shareMode = AUDCLNT_SHAREMODE_EXCLUSIVE;
}
// explicit thread priority level
if (inputStreamInfo->flags & paWinWasapiThreadPriority)
{
if ((inputStreamInfo->threadPriority > eThreadPriorityNone) &&
(inputStreamInfo->threadPriority <= eThreadPriorityWindowManager))
stream->nThreadPriority = inputStreamInfo->threadPriority;
}
}
// Choose processing mode
@ -2840,17 +2909,9 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
if (fullDuplex)
stream->in.streamFlags = 0; // polling interface is implemented for full-duplex mode also
if (info->flow == eRender)
stream->in.streamFlags |= AUDCLNT_STREAMFLAGS_LOOPBACK;
// Fill parameters for Audio Client creation
stream->in.params.device_info = info;
stream->in.params.stream_params = (*inputParameters);
if (inputStreamInfo != NULL)
{
stream->in.params.wasapi_params = (*inputStreamInfo);
stream->in.params.stream_params.hostApiSpecificStreamInfo = &stream->in.params.wasapi_params;
}
stream->in.params.frames_per_buffer = framesPerBuffer;
stream->in.params.sample_rate = sampleRate;
stream->in.params.blocking = (streamCallback == NULL);
@ -2927,26 +2988,38 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
{
outputChannelCount = outputParameters->channelCount;
outputSampleFormat = outputParameters->sampleFormat;
outputStreamInfo = (PaWasapiStreamInfo *)outputParameters->hostApiSpecificStreamInfo;
info = &paWasapi->devInfo[outputParameters->device];
stream->out.flags = (outputStreamInfo ? outputStreamInfo->flags : 0);
// Select Exclusive/Shared mode
// default Shared Mode
stream->out.shareMode = AUDCLNT_SHAREMODE_SHARED;
if ((outputStreamInfo != NULL) && (outputStreamInfo->flags & paWinWasapiExclusive))
{
// Boost thread priority
stream->nThreadPriority = eThreadPriorityProAudio;
// Make Exclusive
stream->out.shareMode = AUDCLNT_SHAREMODE_EXCLUSIVE;
}
// If user provided explicit thread priority level, use it
if ((outputStreamInfo != NULL) && (outputStreamInfo->flags & paWinWasapiThreadPriority))
// set PaWasapiStreamInfo
if (outputParameters->hostApiSpecificStreamInfo != NULL)
{
if ((outputStreamInfo->threadPriority > eThreadPriorityNone) &&
(outputStreamInfo->threadPriority <= eThreadPriorityWindowManager))
stream->nThreadPriority = outputStreamInfo->threadPriority;
memcpy(&stream->out.params.wasapi_params, outputParameters->hostApiSpecificStreamInfo, min(sizeof(stream->out.params.wasapi_params), ((PaWasapiStreamInfo *)outputParameters->hostApiSpecificStreamInfo)->size));
stream->out.params.wasapi_params.size = sizeof(stream->out.params.wasapi_params);
stream->out.params.stream_params.hostApiSpecificStreamInfo = &stream->out.params.wasapi_params;
outputStreamInfo = &stream->out.params.wasapi_params;
stream->out.flags = outputStreamInfo->flags;
// Exclusive Mode
if (outputStreamInfo->flags & paWinWasapiExclusive)
{
// Boost thread priority
stream->nThreadPriority = eThreadPriorityProAudio;
// Make Exclusive
stream->out.shareMode = AUDCLNT_SHAREMODE_EXCLUSIVE;
}
// explicit thread priority level
if (outputStreamInfo->flags & paWinWasapiThreadPriority)
{
if ((outputStreamInfo->threadPriority > eThreadPriorityNone) &&
(outputStreamInfo->threadPriority <= eThreadPriorityWindowManager))
stream->nThreadPriority = outputStreamInfo->threadPriority;
}
}
// Choose processing mode
@ -2966,11 +3039,6 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
// Fill parameters for Audio Client creation
stream->out.params.device_info = info;
stream->out.params.stream_params = (*outputParameters);
if (inputStreamInfo != NULL)
{
stream->out.params.wasapi_params = (*outputStreamInfo);
stream->out.params.stream_params.hostApiSpecificStreamInfo = &stream->out.params.wasapi_params;
}
stream->out.params.frames_per_buffer = framesPerBuffer;
stream->out.params.sample_rate = sampleRate;
stream->out.params.blocking = (streamCallback == NULL);
@ -3186,7 +3254,7 @@ HRESULT UnmarshalSubStreamComPointers(PaWasapiSubStream *substream)
substream->clientProc = NULL;
// IAudioClient
hResult = CoGetInterfaceAndReleaseStream(substream->clientStream, &pa_IID_IAudioClient, (LPVOID*)&substream->clientProc);
hResult = CoGetInterfaceAndReleaseStream(substream->clientStream, GetAudioClientIID(), (LPVOID*)&substream->clientProc);
substream->clientStream = NULL;
if (hResult != S_OK)
{
@ -3270,7 +3338,7 @@ HRESULT MarshalSubStreamComPointers(PaWasapiSubStream *substream)
substream->clientStream = NULL;
// IAudioClient
hResult = CoMarshalInterThreadInterfaceInStream(&pa_IID_IAudioClient, (LPUNKNOWN)substream->clientParent, &substream->clientStream);
hResult = CoMarshalInterThreadInterfaceInStream(GetAudioClientIID(), (LPUNKNOWN)substream->clientParent, &substream->clientStream);
if (hResult != S_OK)
goto marshal_sub_error;
@ -3452,7 +3520,6 @@ static PaError StartStream( PaStream *s )
// Signal: stream running.
stream->running = TRUE;
}
stream->stopped = FALSE;
return result;
@ -3494,7 +3561,6 @@ void _StreamFinish(PaWasapiStream *stream)
_StreamCleanup(stream);
stream->running = FALSE;
stream->stopped = TRUE;
}
// ------------------------------------------------------------------------------------------
@ -3528,7 +3594,7 @@ static PaError AbortStream( PaStream *s )
// ------------------------------------------------------------------------------------------
static PaError IsStreamStopped( PaStream *s )
{
return ((PaWasapiStream *)s)->stopped;
return !((PaWasapiStream *)s)->running;
}
// ------------------------------------------------------------------------------------------

View File

@ -1,25 +1,22 @@
**************
* WASAPI API *
**************
----------------------------------------
Microsoft Visual Studio 2005SP1/2008/10
----------------------------------------
No specific actions are needed to compile WASAPI API under Visual Studio.
You are only required to install min. Windows Vista SDK (v6.0A) prior
compilation.
----------------------------------------
MinGW (GCC 32-bit)/ MinGW64 (GCC 64-bit)
----------------------------------------
To compile under MinGW you are required to include 'mingw-include' directory
which contains necessary files with WASAPI API. These files are modified
in order to be compiled by MinGW compiler. These files are taken from
Windows Vista SDK (v6.0A). MinGW compilation is tested and proved to be
fully working under 32-bit and 64-bit modes.
MinGW (32-bit) tested: gcc version 4.4.0 (GCC)
MinGW64 (64-bit) tested: gcc version 4.4.4 20100226 (prerelease) (GCC)
PortAudio
/Dmitry Kostjuchenko/
04.03.2010
**************
* WASAPI API *
**************
-------------------------------------------
Microsoft Visual Studio 2005 SP1 and higher
-------------------------------------------
No specific action is required to compile WASAPI API under Visual Studio.
You are only required to install min. Windows Vista SDK (v6.0A) prior
the compilation. To compile with WASAPI specific functionality for Windows 8
and higher the min. Windows 8 SDK is required.
----------------------------------------
MinGW (GCC 32/64-bit)
----------------------------------------
To compile with MinGW you are required to include 'mingw-include' directory
which contains necessary files with WASAPI API. These files are modified
for the compatibility with MinGW compiler. These files are taken from
the Windows Vista SDK (v6.0A). MinGW compilation is tested and proved to be
fully working.
MinGW (32-bit) tested min. version: gcc version 4.4.0 (GCC)
MinGW64 (64-bit) tested min. version: gcc version 4.4.4 20100226 (prerelease) (GCC)

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/*
* $Id: pa_win_wmme.c 1874 2012-10-31 06:20:59Z rbencina $
* $Id: pa_win_wmme.c 1948 2015-01-21 06:52:11Z rbencina $
* pa_win_wmme.c
* Implementation of PortAudio for Windows MultiMedia Extensions (WMME)
*
@ -62,7 +62,7 @@
*/
/** @file
@ingroup hostapi_src
@ingroup hostapi_src
@brief Win32 host API implementation for the Windows MultiMedia Extensions (WMME) audio API.
*/
@ -86,6 +86,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
#include <windows.h>
#include <mmsystem.h>
@ -201,31 +202,52 @@
static const char constInputMapperSuffix_[] = " - Input";
static const char constOutputMapperSuffix_[] = " - Output";
/*
copies TCHAR string to explicit char string
*/
char *StrTCpyToC(char *to, const TCHAR *from)
/********************************************************************/
/* Copy null-terminated TCHAR string to explicit char string using UTF8 encoding */
static char *CopyTCharStringToUtf8CString(char *destination, size_t destLengthBytes, const TCHAR *source)
{
#if !defined(_UNICODE) && !defined(UNICODE)
return strcpy(to, from);
return strcpy(destination, source);
#else
int count = wcslen(from);
if (count != 0)
if (WideCharToMultiByte(CP_ACP, 0, from, count, to, count, NULL, NULL) == 0)
return NULL;
return to;
/* The cbMultiByte parameter ["destLengthBytes" below] is:
"""
Size, in bytes, of the buffer indicated by lpMultiByteStr ["destination" below].
If this parameter is set to 0, the function returns the required buffer
size for lpMultiByteStr and makes no use of the output parameter itself.
"""
Source: WideCharToMultiByte at MSDN:
http://msdn.microsoft.com/en-us/library/windows/desktop/dd374130(v=vs.85).aspx
*/
int intDestLengthBytes; /* cbMultiByte */
/* intDestLengthBytes is an int, destLengthBytes is a size_t. Ensure that we don't overflow
intDestLengthBytes by only using at most INT_MAX bytes of destination buffer.
*/
if (destLengthBytes < INT_MAX)
{
#pragma warning (disable : 4267) /* "conversion from 'size_t' to 'int', possible loss of data" */
intDestLengthBytes = (int)destLengthBytes; /* destLengthBytes is guaranteed < INT_MAX here */
#pragma warning (default : 4267)
}
else
{
intDestLengthBytes = INT_MAX;
}
if (WideCharToMultiByte(CP_UTF8, 0, source, -1, destination, /*cbMultiByte=*/intDestLengthBytes, NULL, NULL) == 0)
return NULL;
return destination;
#endif
}
/*
returns length of TCHAR string
*/
size_t StrTLen(const TCHAR *str)
/* returns required length (in bytes) of destination buffer when
converting TCHAR string to UTF8 bytes, not including the terminating null. */
static size_t TCharStringLen(const TCHAR *str)
{
#if !defined(_UNICODE) && !defined(UNICODE)
return strlen(str);
return strlen(str);
#else
return wcslen(str);
return WideCharToMultiByte(CP_UTF8, 0, str, -1, NULL, 0, NULL, NULL);
#endif
}
@ -491,7 +513,7 @@ static UINT LocalDeviceIndexToWinMmeDeviceId( PaWinMmeHostApiRepresentation *hos
{
assert( device >= 0 && device < hostApi->inputDeviceCount + hostApi->outputDeviceCount );
return hostApi->winMmeDeviceIds[ device ];
return hostApi->winMmeDeviceIds[ device ];
}
@ -686,6 +708,7 @@ static PaError InitializeInputDeviceInfo( PaWinMmeHostApiRepresentation *winMmeH
MMRESULT mmresult;
WAVEINCAPS wic;
PaDeviceInfo *deviceInfo = &winMmeDeviceInfo->inheritedDeviceInfo;
size_t len;
*success = 0;
@ -705,31 +728,35 @@ static PaError InitializeInputDeviceInfo( PaWinMmeHostApiRepresentation *winMmeH
return paNoError;
}
/* NOTE: the WAVEOUTCAPS.szPname is a null-terminated array of 32 characters,
so we are limited to displaying only the first 31 characters of the device name. */
if( winMmeInputDeviceId == WAVE_MAPPER )
{
len = TCharStringLen( wic.szPname ) + 1 + sizeof(constInputMapperSuffix_);
/* Append I/O suffix to WAVE_MAPPER device. */
deviceName = (char *)PaUtil_GroupAllocateMemory(
deviceName = (char*)PaUtil_GroupAllocateMemory(
winMmeHostApi->allocations,
(long) (StrTLen( wic.szPname ) + 1 + sizeof(constInputMapperSuffix_)) );
(long)len );
if( !deviceName )
{
result = paInsufficientMemory;
goto error;
}
StrTCpyToC( deviceName, wic.szPname );
CopyTCharStringToUtf8CString( deviceName, len, wic.szPname );
strcat( deviceName, constInputMapperSuffix_ );
}
else
{
len = TCharStringLen( wic.szPname ) + 1;
deviceName = (char*)PaUtil_GroupAllocateMemory(
winMmeHostApi->allocations,
(long) (StrTLen( wic.szPname ) + 1) );
winMmeHostApi->allocations,
(long)len );
if( !deviceName )
{
result = paInsufficientMemory;
goto error;
}
StrTCpyToC( deviceName, wic.szPname );
CopyTCharStringToUtf8CString( deviceName, len, wic.szPname );
}
deviceInfo->name = deviceName;
@ -811,6 +838,7 @@ static PaError InitializeOutputDeviceInfo( PaWinMmeHostApiRepresentation *winMme
MMRESULT mmresult;
WAVEOUTCAPS woc;
PaDeviceInfo *deviceInfo = &winMmeDeviceInfo->inheritedDeviceInfo;
size_t len;
#ifdef PAWIN_USE_WDMKS_DEVICE_INFO
int wdmksDeviceOutputChannelCountIsKnown;
#endif
@ -833,31 +861,35 @@ static PaError InitializeOutputDeviceInfo( PaWinMmeHostApiRepresentation *winMme
return paNoError;
}
/* NOTE: the WAVEOUTCAPS.szPname is a null-terminated array of 32 characters,
so we are limited to displaying only the first 31 characters of the device name. */
if( winMmeOutputDeviceId == WAVE_MAPPER )
{
/* Append I/O suffix to WAVE_MAPPER device. */
deviceName = (char *)PaUtil_GroupAllocateMemory(
len = TCharStringLen( woc.szPname ) + 1 + sizeof(constOutputMapperSuffix_);
deviceName = (char*)PaUtil_GroupAllocateMemory(
winMmeHostApi->allocations,
(long) (StrTLen( woc.szPname ) + 1 + sizeof(constOutputMapperSuffix_)) );
(long)len );
if( !deviceName )
{
result = paInsufficientMemory;
goto error;
}
StrTCpyToC( deviceName, woc.szPname );
CopyTCharStringToUtf8CString( deviceName, len, woc.szPname );
strcat( deviceName, constOutputMapperSuffix_ );
}
else
{
len = TCharStringLen( woc.szPname ) + 1;
deviceName = (char*)PaUtil_GroupAllocateMemory(
winMmeHostApi->allocations,
(long) (StrTLen( woc.szPname ) + 1) );
(long)len );
if( !deviceName )
{
result = paInsufficientMemory;
goto error;
}
StrTCpyToC( deviceName, woc.szPname );
CopyTCharStringToUtf8CString( deviceName, len, woc.szPname );
}
deviceInfo->name = deviceName;
@ -882,7 +914,7 @@ static PaError InitializeOutputDeviceInfo( PaWinMmeHostApiRepresentation *winMme
#ifdef PAWIN_USE_WDMKS_DEVICE_INFO
wdmksDeviceOutputChannelCountIsKnown = QueryWaveOutKSFilterMaxChannels(
winMmeOutputDeviceId, &deviceInfo->maxOutputChannels );
winMmeOutputDeviceId, &deviceInfo->maxOutputChannels );
if( wdmksDeviceOutputChannelCountIsKnown && !winMmeDeviceInfo->deviceOutputChannelCountIsKnown )
winMmeDeviceInfo->deviceOutputChannelCountIsKnown = 1;
#endif /* PAWIN_USE_WDMKS_DEVICE_INFO */
@ -901,9 +933,19 @@ error:
static void GetDefaultLatencies( PaTime *defaultLowLatency, PaTime *defaultHighLatency )
{
/*
NOTE: GetVersionEx() is deprecated as of Windows 8.1 and can not be used to reliably detect
versions of Windows higher than Windows 8 (due to manifest requirements for reporting higher versions).
Microsoft recommends switching to VerifyVersionInfo (available on Win 2k and later), however GetVersionEx
is is faster, for now we just disable the deprecation warning.
See: https://msdn.microsoft.com/en-us/library/windows/desktop/ms724451(v=vs.85).aspx
See: http://www.codeproject.com/Articles/678606/Part-Overcoming-Windows-s-deprecation-of-GetVe
*/
#pragma warning (disable : 4996) /* use of GetVersionEx */
OSVERSIONINFO osvi;
osvi.dwOSVersionInfoSize = sizeof( osvi );
GetVersionEx( &osvi );
GetVersionEx( &osvi );
/* Check for NT */
if( (osvi.dwMajorVersion == 4) && (osvi.dwPlatformId == 2) )
@ -920,6 +962,8 @@ static void GetDefaultLatencies( PaTime *defaultLowLatency, PaTime *defaultHighL
}
*defaultHighLatency = *defaultLowLatency * 2;
#pragma warning (default : 4996)
}
@ -983,11 +1027,11 @@ PaError PaWinMme_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiInd
inputDeviceCount = waveInGetNumDevs();
if( inputDeviceCount > 0 )
maximumPossibleDeviceCount += inputDeviceCount + 1; /* assume there is a WAVE_MAPPER */
maximumPossibleDeviceCount += inputDeviceCount + 1; /* assume there is a WAVE_MAPPER */
outputDeviceCount = waveOutGetNumDevs();
if( outputDeviceCount > 0 )
maximumPossibleDeviceCount += outputDeviceCount + 1; /* assume there is a WAVE_MAPPER */
maximumPossibleDeviceCount += outputDeviceCount + 1; /* assume there is a WAVE_MAPPER */
if( maximumPossibleDeviceCount > 0 ){
@ -2157,29 +2201,29 @@ static PaError ValidateWinMmeSpecificStreamInfo(
char *throttleProcessingThreadOnOverload,
unsigned long *deviceCount )
{
if( streamInfo )
{
if( streamInfo->size != sizeof( PaWinMmeStreamInfo )
|| streamInfo->version != 1 )
{
return paIncompatibleHostApiSpecificStreamInfo;
}
if( streamInfo )
{
if( streamInfo->size != sizeof( PaWinMmeStreamInfo )
|| streamInfo->version != 1 )
{
return paIncompatibleHostApiSpecificStreamInfo;
}
*winMmeSpecificFlags = streamInfo->flags;
if( streamInfo->flags & paWinMmeDontThrottleOverloadedProcessingThread )
*throttleProcessingThreadOnOverload = 0;
if( streamInfo->flags & paWinMmeDontThrottleOverloadedProcessingThread )
*throttleProcessingThreadOnOverload = 0;
if( streamInfo->flags & paWinMmeUseMultipleDevices )
{
if( streamParameters->device != paUseHostApiSpecificDeviceSpecification )
return paInvalidDevice;
*deviceCount = streamInfo->deviceCount;
}
}
if( streamInfo->flags & paWinMmeUseMultipleDevices )
{
if( streamParameters->device != paUseHostApiSpecificDeviceSpecification )
return paInvalidDevice;
*deviceCount = streamInfo->deviceCount;
}
}
return paNoError;
return paNoError;
}
static PaError RetrieveDevicesFromStreamParameters(
@ -2194,34 +2238,34 @@ static PaError RetrieveDevicesFromStreamParameters(
int totalChannelCount;
PaDeviceIndex hostApiDevice;
if( streamInfo && streamInfo->flags & paWinMmeUseMultipleDevices )
{
totalChannelCount = 0;
for( i=0; i < deviceCount; ++i )
{
/* validate that the device number is within range */
result = PaUtil_DeviceIndexToHostApiDeviceIndex( &hostApiDevice,
streamInfo->devices[i].device, hostApi );
if( result != paNoError )
return result;
devices[i].device = hostApiDevice;
devices[i].channelCount = streamInfo->devices[i].channelCount;
totalChannelCount += devices[i].channelCount;
}
if( totalChannelCount != streamParameters->channelCount )
{
/* channelCount must match total channels specified by multiple devices */
return paInvalidChannelCount; /* REVIEW use of this error code */
}
}
else
{
devices[0].device = streamParameters->device;
devices[0].channelCount = streamParameters->channelCount;
}
if( streamInfo && streamInfo->flags & paWinMmeUseMultipleDevices )
{
totalChannelCount = 0;
for( i=0; i < deviceCount; ++i )
{
/* validate that the device number is within range */
result = PaUtil_DeviceIndexToHostApiDeviceIndex( &hostApiDevice,
streamInfo->devices[i].device, hostApi );
if( result != paNoError )
return result;
devices[i].device = hostApiDevice;
devices[i].channelCount = streamInfo->devices[i].channelCount;
totalChannelCount += devices[i].channelCount;
}
if( totalChannelCount != streamParameters->channelCount )
{
/* channelCount must match total channels specified by multiple devices */
return paInvalidChannelCount; /* REVIEW use of this error code */
}
}
else
{
devices[0].device = streamParameters->device;
devices[0].channelCount = streamParameters->channelCount;
}
return result;
}
@ -2235,10 +2279,10 @@ static PaError ValidateInputChannelCounts(
PaWinMmeDeviceInfo *inputDeviceInfo;
PaError paerror;
for( i=0; i < deviceCount; ++i )
{
for( i=0; i < deviceCount; ++i )
{
if( devices[i].channelCount < 1 )
return paInvalidChannelCount;
return paInvalidChannelCount;
inputDeviceInfo =
(PaWinMmeDeviceInfo*)hostApi->deviceInfos[ devices[i].device ];
@ -2246,7 +2290,7 @@ static PaError ValidateInputChannelCounts(
paerror = IsInputChannelCountSupported( inputDeviceInfo, devices[i].channelCount );
if( paerror != paNoError )
return paerror;
}
}
return paNoError;
}
@ -2260,10 +2304,10 @@ static PaError ValidateOutputChannelCounts(
PaWinMmeDeviceInfo *outputDeviceInfo;
PaError paerror;
for( i=0; i < deviceCount; ++i )
{
for( i=0; i < deviceCount; ++i )
{
if( devices[i].channelCount < 1 )
return paInvalidChannelCount;
return paInvalidChannelCount;
outputDeviceInfo =
(PaWinMmeDeviceInfo*)hostApi->deviceInfos[ devices[i].device ];
@ -2271,7 +2315,7 @@ static PaError ValidateOutputChannelCounts(
paerror = IsOutputChannelCountSupported( outputDeviceInfo, devices[i].channelCount );
if( paerror != paNoError )
return paerror;
}
}
return paNoError;
}
@ -2320,28 +2364,28 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
if( inputParameters )
{
inputChannelCount = inputParameters->channelCount;
inputChannelCount = inputParameters->channelCount;
inputSampleFormat = inputParameters->sampleFormat;
suggestedInputLatency = inputParameters->suggestedLatency;
inputDeviceCount = 1;
inputDeviceCount = 1;
/* validate input hostApiSpecificStreamInfo */
/* validate input hostApiSpecificStreamInfo */
inputStreamInfo = (PaWinMmeStreamInfo*)inputParameters->hostApiSpecificStreamInfo;
result = ValidateWinMmeSpecificStreamInfo( inputParameters, inputStreamInfo,
result = ValidateWinMmeSpecificStreamInfo( inputParameters, inputStreamInfo,
&winMmeSpecificInputFlags,
&throttleProcessingThreadOnOverload,
&inputDeviceCount );
if( result != paNoError ) return result;
&throttleProcessingThreadOnOverload,
&inputDeviceCount );
if( result != paNoError ) return result;
inputDevices = (PaWinMmeDeviceAndChannelCount*)alloca( sizeof(PaWinMmeDeviceAndChannelCount) * inputDeviceCount );
inputDevices = (PaWinMmeDeviceAndChannelCount*)alloca( sizeof(PaWinMmeDeviceAndChannelCount) * inputDeviceCount );
if( !inputDevices ) return paInsufficientMemory;
result = RetrieveDevicesFromStreamParameters( hostApi, inputParameters, inputStreamInfo, inputDevices, inputDeviceCount );
if( result != paNoError ) return result;
result = RetrieveDevicesFromStreamParameters( hostApi, inputParameters, inputStreamInfo, inputDevices, inputDeviceCount );
if( result != paNoError ) return result;
result = ValidateInputChannelCounts( hostApi, inputDevices, inputDeviceCount );
if( result != paNoError ) return result;
result = ValidateInputChannelCounts( hostApi, inputDevices, inputDeviceCount );
if( result != paNoError ) return result;
hostInputSampleFormat =
PaUtil_SelectClosestAvailableFormat( paInt16 /* native formats */, inputSampleFormat );
@ -2357,7 +2401,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
else
inputChannelMask = PaWin_DefaultChannelMask( inputDevices[0].channelCount );
}
}
}
else
{
inputChannelCount = 0;
@ -2376,22 +2420,22 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
outputDeviceCount = 1;
/* validate output hostApiSpecificStreamInfo */
/* validate output hostApiSpecificStreamInfo */
outputStreamInfo = (PaWinMmeStreamInfo*)outputParameters->hostApiSpecificStreamInfo;
result = ValidateWinMmeSpecificStreamInfo( outputParameters, outputStreamInfo,
result = ValidateWinMmeSpecificStreamInfo( outputParameters, outputStreamInfo,
&winMmeSpecificOutputFlags,
&throttleProcessingThreadOnOverload,
&outputDeviceCount );
if( result != paNoError ) return result;
&throttleProcessingThreadOnOverload,
&outputDeviceCount );
if( result != paNoError ) return result;
outputDevices = (PaWinMmeDeviceAndChannelCount*)alloca( sizeof(PaWinMmeDeviceAndChannelCount) * outputDeviceCount );
outputDevices = (PaWinMmeDeviceAndChannelCount*)alloca( sizeof(PaWinMmeDeviceAndChannelCount) * outputDeviceCount );
if( !outputDevices ) return paInsufficientMemory;
result = RetrieveDevicesFromStreamParameters( hostApi, outputParameters, outputStreamInfo, outputDevices, outputDeviceCount );
if( result != paNoError ) return result;
result = RetrieveDevicesFromStreamParameters( hostApi, outputParameters, outputStreamInfo, outputDevices, outputDeviceCount );
if( result != paNoError ) return result;
result = ValidateOutputChannelCounts( hostApi, outputDevices, outputDeviceCount );
if( result != paNoError ) return result;
result = ValidateOutputChannelCounts( hostApi, outputDevices, outputDeviceCount );
if( result != paNoError ) return result;
hostOutputSampleFormat =
PaUtil_SelectClosestAvailableFormat( paInt16 /* native formats */, outputSampleFormat );
@ -3219,9 +3263,9 @@ static PaError StartStream( PaStream *s )
MMRESULT mmresult;
unsigned int i, j;
int callbackResult;
unsigned int channel;
unsigned long framesProcessed;
PaStreamCallbackTimeInfo timeInfo = {0,0,0}; /** @todo implement this for stream priming */
unsigned int channel;
unsigned long framesProcessed;
PaStreamCallbackTimeInfo timeInfo = {0,0,0}; /** @todo implement this for stream priming */
PaUtil_ResetBufferProcessor( &stream->bufferProcessor );

View File

@ -63,7 +63,6 @@ PaError PaWinDs_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiInde
PaError PaAsio_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index );
PaError PaWinWdm_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index );
PaError PaWasapi_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index );
PaError PaJack_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index );
#ifdef __cplusplus
}
@ -93,10 +92,6 @@ PaUtilHostApiInitializer *paHostApiInitializers[] =
PaWinWdm_Initialize,
#endif
#if PA_USE_JACK
PaJack_Initialize,
#endif
#if PA_USE_SKELETON
PaSkeleton_Initialize, /* just for testing. last in list so it isn't marked as default. */
#endif

View File

@ -66,33 +66,34 @@
#include "pa_util.h"
#include "pa_win_wdmks_utils.h"
#if !defined(PA_WDMKS_NO_KSGUID_LIB) && !defined(PAWIN_WDMKS_NO_KSGUID_LIB) && !defined(__GNUC__)
#if (defined(WIN32) && (defined(_MSC_VER) && (_MSC_VER >= 1200))) /* MSC version 6 and above */
#pragma comment( lib, "ksguid.lib" )
#endif
#define pa_KSDATAFORMAT_TYPE_AUDIO KSDATAFORMAT_TYPE_AUDIO
#define pa_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT KSDATAFORMAT_SUBTYPE_IEEE_FLOAT
#define pa_KSDATAFORMAT_SUBTYPE_PCM KSDATAFORMAT_SUBTYPE_PCM
#define pa_KSDATAFORMAT_SUBTYPE_WAVEFORMATEX KSDATAFORMAT_SUBTYPE_WAVEFORMATEX
#define pa_KSMEDIUMSETID_Standard KSMEDIUMSETID_Standard
#define pa_KSINTERFACESETID_Standard KSINTERFACESETID_Standard
#define pa_KSPROPSETID_Pin KSPROPSETID_Pin
#else
static const GUID pa_KSDATAFORMAT_TYPE_AUDIO = { STATIC_KSDATAFORMAT_TYPE_AUDIO };
static const GUID pa_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT = { STATIC_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT };
static const GUID pa_KSDATAFORMAT_SUBTYPE_PCM = { STATIC_KSDATAFORMAT_SUBTYPE_PCM };
static const GUID pa_KSDATAFORMAT_SUBTYPE_WAVEFORMATEX = { STATIC_KSDATAFORMAT_SUBTYPE_WAVEFORMATEX };
static const GUID pa_KSMEDIUMSETID_Standard = { STATIC_KSMEDIUMSETID_Standard };
static const GUID pa_KSINTERFACESETID_Standard = { STATIC_KSINTERFACESETID_Standard };
static const GUID pa_KSPROPSETID_Pin = { STATIC_KSPROPSETID_Pin };
#endif
/* PortAudio-local instances of GUIDs previously sourced from ksguid.lib */
/* GUID KSDATAFORMAT_TYPE_AUDIO */
static const GUID pa_KSDATAFORMAT_TYPE_AUDIO = { STATIC_KSDATAFORMAT_TYPE_AUDIO };
/* GUID KSDATAFORMAT_SUBTYPE_IEEE_FLOAT */
static const GUID pa_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT = { STATIC_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT };
/* GUID KSDATAFORMAT_SUBTYPE_PCM */
static const GUID pa_KSDATAFORMAT_SUBTYPE_PCM = { STATIC_KSDATAFORMAT_SUBTYPE_PCM };
/* GUID KSDATAFORMAT_SUBTYPE_WAVEFORMATEX */
static const GUID pa_KSDATAFORMAT_SUBTYPE_WAVEFORMATEX = { STATIC_KSDATAFORMAT_SUBTYPE_WAVEFORMATEX };
/* GUID KSMEDIUMSETID_Standard */
static const GUID pa_KSMEDIUMSETID_Standard = { STATIC_KSMEDIUMSETID_Standard };
/* GUID KSINTERFACESETID_Standard */
static const GUID pa_KSINTERFACESETID_Standard = { STATIC_KSINTERFACESETID_Standard };
/* GUID KSPROPSETID_Pin */
static const GUID pa_KSPROPSETID_Pin = { STATIC_KSPROPSETID_Pin };
#define pa_IS_VALID_WAVEFORMATEX_GUID(Guid)\
(!memcmp(((PUSHORT)&pa_KSDATAFORMAT_SUBTYPE_WAVEFORMATEX) + 1, ((PUSHORT)(Guid)) + 1, sizeof(GUID) - sizeof(USHORT)))
static PaError WdmGetPinPropertySimple(
HANDLE handle,
unsigned long pinId,

View File

@ -4,6 +4,10 @@
MACRO(ADD_TEST appl_name)
ADD_EXECUTABLE(${appl_name} "${appl_name}.c")
TARGET_LINK_LIBRARIES(${appl_name} portaudio_static)
SET_TARGET_PROPERTIES(${appl_name}
PROPERTIES
FOLDER "Test"
)
ENDMACRO(ADD_TEST)
ADD_TEST(patest_longsine)

View File

@ -4,7 +4,7 @@
@author Phil Burk http://www.softsynth.com
*/
/*
* $Id: patest_mono.c 1097 2006-08-26 08:27:53Z rossb $
* $Id: patest_mono.c 1915 2014-01-16 17:51:26Z philburk $
*
* Authors:
* Ross Bencina <rossb@audiomulch.com>
@ -152,4 +152,5 @@ error:
fprintf( stderr, "Error number: %d\n", err );
fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
return err;
}
}

View File

@ -0,0 +1,9 @@
This is used to test the SVN versioning system.
$Revision: 1951 $
$Author: philburk $
$Date: 2015-03-12 11:21:04 -0500 (Thu, 12 Mar 2015) $
$Id: file1.txt 1951 2015-03-12 16:21:04Z philburk $
After propset svn:keywords

View File

@ -0,0 +1,9 @@
This is used to test the SVN versioning system.
$Revision: 1952 $
$Author: philburk $
$Date: 2015-03-12 11:23:11 -0500 (Thu, 12 Mar 2015) $
$Id: file2.txt 1952 2015-03-12 16:23:11Z philburk $
After propset svn:keywords

View File

@ -0,0 +1,17 @@
#!/bin/bash
#
# Write the SVN revision to an include file.
# This should be run before compiling code on Linux or Macintosh.
#
revision_filename=src/common/pa_svnrevision.h
# Run svnversion first to make sure it is installed before corrupting the
# include file.
svnversion .
# Update the include file with the current SVN revision.
echo -n "#define PA_SVN_REVISION " > ${revision_filename}
svnversion . >> ${revision_filename}
echo ${revision_filename} now contains
cat ${revision_filename}