portaudio: Updated codebase from svn 1748 to svn 1802.

Notable changes:
 - Changes to buffer size calculations and latency calculations.

Not a big update, just wanted to commit something before the year ended!


git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5023 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gigaherz 2011-12-27 17:42:18 +00:00
parent 4f6796916a
commit 5483473da0
40 changed files with 37437 additions and 32926 deletions

View File

@ -43,7 +43,7 @@ SUBGROUPING = YES
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Build related configuration options # Build related configuration options
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
EXTRACT_ALL = YES EXTRACT_ALL = NO
EXTRACT_PRIVATE = NO EXTRACT_PRIVATE = NO
EXTRACT_STATIC = NO EXTRACT_STATIC = NO
EXTRACT_LOCAL_CLASSES = YES EXTRACT_LOCAL_CLASSES = YES
@ -60,14 +60,14 @@ INLINE_INFO = YES
SORT_MEMBER_DOCS = YES SORT_MEMBER_DOCS = YES
SORT_BRIEF_DOCS = NO SORT_BRIEF_DOCS = NO
SORT_BY_SCOPE_NAME = NO SORT_BY_SCOPE_NAME = NO
GENERATE_TODOLIST = YES GENERATE_TODOLIST = NO
GENERATE_TESTLIST = YES GENERATE_TESTLIST = NO
GENERATE_BUGLIST = YES GENERATE_BUGLIST = NO
GENERATE_DEPRECATEDLIST= YES GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS = ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30 MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES SHOW_USED_FILES = YES
SHOW_DIRECTORIES = NO SHOW_DIRECTORIES = YES
FILE_VERSION_FILTER = FILE_VERSION_FILTER =
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# configuration options related to warning and progress messages # configuration options related to warning and progress messages
@ -83,15 +83,14 @@ WARN_LOGFILE =
# configuration options related to the input files # configuration options related to the input files
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
INPUT = doc/src \ INPUT = doc/src \
src \
include \ include \
test examples
FILE_PATTERNS = *.h \ FILE_PATTERNS = *.h \
*.c \ *.c \
*.cpp \ *.cpp \
*.dox *.dox
RECURSIVE = YES RECURSIVE = YES
EXCLUDE = EXCLUDE = src/hostapi/wasapi/mingw-include
EXCLUDE_SYMLINKS = NO EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS = EXCLUDE_PATTERNS =
EXAMPLE_PATH = EXAMPLE_PATH =
@ -104,7 +103,7 @@ FILTER_SOURCE_FILES = NO
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# configuration options related to source browsing # configuration options related to source browsing
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
SOURCE_BROWSER = NO SOURCE_BROWSER = YES
INLINE_SOURCES = NO INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = YES REFERENCED_BY_RELATION = YES

241
3rdparty/portaudio/Doxyfile.developer vendored Normal file
View File

@ -0,0 +1,241 @@
# Doxyfile 1.4.6
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = PortAudio
PROJECT_NUMBER = 2.0
OUTPUT_DIRECTORY = ./doc/
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
USE_WINDOWS_ENCODING = NO
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ABBREVIATE_BRIEF = "The $name class" \
"The $name widget" \
"The $name file" \
is \
provides \
specifies \
contains \
represents \
a \
an \
the
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = NO
STRIP_FROM_PATH =
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
DETAILS_AT_TOP = NO
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 8
ALIASES =
OPTIMIZE_OUTPUT_FOR_C = YES
OPTIMIZE_OUTPUT_JAVA = NO
BUILTIN_STL_SUPPORT = NO
DISTRIBUTE_GROUP_DOC = NO
SUBGROUPING = YES
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL = YES
EXTRACT_PRIVATE = NO
EXTRACT_STATIC = NO
EXTRACT_LOCAL_CLASSES = YES
EXTRACT_LOCAL_METHODS = NO
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
HIDE_FRIEND_COMPOUNDS = NO
HIDE_IN_BODY_DOCS = NO
INTERNAL_DOCS = YES
CASE_SENSE_NAMES = YES
HIDE_SCOPE_NAMES = NO
SHOW_INCLUDE_FILES = YES
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
SORT_BRIEF_DOCS = NO
SORT_BY_SCOPE_NAME = NO
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS = INTERNAL
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
SHOW_DIRECTORIES = YES
FILE_VERSION_FILTER =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = NO
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = doc/src \
include \
examples \
src \
test \
qa
FILE_PATTERNS = *.h \
*.c \
*.cpp \
*.dox
RECURSIVE = YES
EXCLUDE = src/hostapi/wasapi/mingw-include
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS =
EXAMPLE_RECURSIVE = NO
IMAGE_PATH = doc/src/images
INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = NO
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES
USE_HTAGS = NO
VERBATIM_HEADERS = YES
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = NO
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = html
HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
BINARY_TOC = NO
TOC_EXPAND = NO
DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 4
GENERATE_TREEVIEW = NO
TREEVIEW_WIDTH = 250
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = NO
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4wide
EXTRA_PACKAGES =
LATEX_HEADER =
PDF_HYPERLINKS = NO
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = NO
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
XML_OUTPUT = xml
XML_SCHEMA =
XML_DTD =
XML_PROGRAMLISTING = YES
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED =
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::additions related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = NO
HIDE_UNDOC_RELATIONS = NO
HAVE_DOT = NO
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
GROUP_GRAPHS = YES
UML_LOOK = NO
TEMPLATE_RELATIONS = YES
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
CALL_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
DOT_IMAGE_FORMAT = png
DOT_PATH =
DOTFILE_DIRS =
MAX_DOT_GRAPH_WIDTH = 1024
MAX_DOT_GRAPH_HEIGHT = 1024
MAX_DOT_GRAPH_DEPTH = 1000
DOT_TRANSPARENT = NO
DOT_MULTI_TARGETS = NO
GENERATE_LEGEND = YES
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
# Configuration::additions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = NO

View File

@ -18,7 +18,7 @@ libdir = @libdir@
includedir = @includedir@ includedir = @includedir@
CC = @CC@ CC = @CC@
CXX = @CXX@ CXX = @CXX@
CFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/src/common -I$(top_srcdir)/src/os/unix @CFLAGS@ @DEFS@ CFLAGS = @CFLAGS@ @DEFS@
LIBS = @LIBS@ LIBS = @LIBS@
AR = @AR@ AR = @AR@
RANLIB = @RANLIB@ RANLIB = @RANLIB@
@ -67,9 +67,23 @@ LOOPBACK_OBJS = \
qa/loopback/src/write_wav.o \ qa/loopback/src/write_wav.o \
qa/loopback/src/paqa.o qa/loopback/src/paqa.o
TESTS = \ EXAMPLES = \
bin/pa_devs \
bin/pa_fuzz \
bin/paex_pink \
bin/paex_read_write_wire \
bin/paex_record \
bin/paex_saw \
bin/paex_sine \
bin/paex_write_sine \
bin/paex_write_sine_nonint
SELFTESTS = \
bin/paqa_devs \ bin/paqa_devs \
bin/paqa_errs \ bin/paqa_errs \
bin/paqa_latency
TESTS = \
bin/patest1 \ bin/patest1 \
bin/patest_buffer \ bin/patest_buffer \
bin/patest_callbackstop \ bin/patest_callbackstop \
@ -85,15 +99,9 @@ TESTS = \
bin/patest_mono \ bin/patest_mono \
bin/patest_multi_sine \ bin/patest_multi_sine \
bin/patest_out_underflow \ bin/patest_out_underflow \
bin/patest_pink \
bin/patest_prime \ bin/patest_prime \
bin/patest_read_record \
bin/patest_read_write_wire \
bin/patest_record \
bin/patest_ringmix \ bin/patest_ringmix \
bin/patest_saw \
bin/patest_sine8 \ bin/patest_sine8 \
bin/patest_sine \
bin/patest_sine_channelmaps \ bin/patest_sine_channelmaps \
bin/patest_sine_formats \ bin/patest_sine_formats \
bin/patest_sine_time \ bin/patest_sine_time \
@ -105,10 +113,6 @@ TESTS = \
bin/patest_two_rates \ bin/patest_two_rates \
bin/patest_underflow \ bin/patest_underflow \
bin/patest_wire \ bin/patest_wire \
bin/patest_write_sine \
bin/patest_write_sine_nonint \
bin/pa_devs \
bin/pa_fuzz \
bin/pa_minlat bin/pa_minlat
# Most of these don't compile yet. Put them in TESTS, above, if # Most of these don't compile yet. Put them in TESTS, above, if
@ -151,10 +155,14 @@ SRC_DIRS = \
SUBDIRS = SUBDIRS =
@ENABLE_CXX_TRUE@SUBDIRS += bindings/cpp @ENABLE_CXX_TRUE@SUBDIRS += bindings/cpp
all: lib/$(PALIB) all-recursive tests all: lib/$(PALIB) all-recursive tests examples selftests
tests: bin-stamp $(TESTS) tests: bin-stamp $(TESTS)
examples: bin-stamp $(EXAMPLES)
selftests: bin-stamp $(SELFTESTS)
loopback: bin-stamp bin/paloopback loopback: bin-stamp bin/paloopback
# With ASIO enabled we must link libportaudio and all test programs with CXX # With ASIO enabled we must link libportaudio and all test programs with CXX
@ -166,6 +174,14 @@ $(ALL_TESTS): bin/%: lib/$(PALIB) $(MAKEFILE) $(PAINC) test/%.c
@WITH_ASIO_FALSE@ $(LIBTOOL) --mode=link $(CC) -o $@ $(CFLAGS) $(top_srcdir)/test/$*.c lib/$(PALIB) $(LIBS) @WITH_ASIO_FALSE@ $(LIBTOOL) --mode=link $(CC) -o $@ $(CFLAGS) $(top_srcdir)/test/$*.c lib/$(PALIB) $(LIBS)
@WITH_ASIO_TRUE@ $(LIBTOOL) --mode=link --tag=CXX $(CXX) -o $@ $(CXXFLAGS) $(top_srcdir)/test/$*.c lib/$(PALIB) $(LIBS) @WITH_ASIO_TRUE@ $(LIBTOOL) --mode=link --tag=CXX $(CXX) -o $@ $(CXXFLAGS) $(top_srcdir)/test/$*.c lib/$(PALIB) $(LIBS)
$(EXAMPLES): bin/%: lib/$(PALIB) $(MAKEFILE) $(PAINC) examples/%.c
@WITH_ASIO_FALSE@ $(LIBTOOL) --mode=link $(CC) -o $@ $(CFLAGS) $(top_srcdir)/examples/$*.c lib/$(PALIB) $(LIBS)
@WITH_ASIO_TRUE@ $(LIBTOOL) --mode=link --tag=CXX $(CXX) -o $@ $(CXXFLAGS) $(top_srcdir)/examples/$*.c lib/$(PALIB) $(LIBS)
$(SELFTESTS): bin/%: lib/$(PALIB) $(MAKEFILE) $(PAINC) qa/%.c
@WITH_ASIO_FALSE@ $(LIBTOOL) --mode=link $(CC) -o $@ $(CFLAGS) $(top_srcdir)/qa/$*.c lib/$(PALIB) $(LIBS)
@WITH_ASIO_TRUE@ $(LIBTOOL) --mode=link --tag=CXX $(CXX) -o $@ $(CXXFLAGS) $(top_srcdir)/qa/$*.c lib/$(PALIB) $(LIBS)
bin/paloopback: lib/$(PALIB) $(MAKEFILE) $(PAINC) $(LOOPBACK_OBJS) bin/paloopback: lib/$(PALIB) $(MAKEFILE) $(PAINC) $(LOOPBACK_OBJS)
@WITH_ASIO_FALSE@ $(LIBTOOL) --mode=link $(CC) -o $@ $(CFLAGS) $(LOOPBACK_OBJS) lib/$(PALIB) $(LIBS) @WITH_ASIO_FALSE@ $(LIBTOOL) --mode=link $(CC) -o $@ $(CFLAGS) $(LOOPBACK_OBJS) lib/$(PALIB) $(LIBS)
@WITH_ASIO_TRUE@ $(LIBTOOL) --mode=link --tag=CXX $(CXX) -o $@ $(CXXFLAGS) $(LOOPBACK_OBJS) lib/$(PALIB) $(LIBS) @WITH_ASIO_TRUE@ $(LIBTOOL) --mode=link --tag=CXX $(CXX) -o $@ $(CXXFLAGS) $(LOOPBACK_OBJS) lib/$(PALIB) $(LIBS)

File diff suppressed because it is too large Load Diff

View File

@ -1,78 +0,0 @@
# Project: portaudio-dll
# Makefile created by Dev-C++ 4.9.8.2
CPP = g++.exe
CC = gcc.exe
WINDRES = windres.exe
RES =
OBJ = ./pa_hostapi_skeleton.o ./pa_stream.o ./pa_trace.o ./pa_allocation.o ./pa_converters.o ./pa_cpuload.o ./pa_dither.o ./pa_front.o ./pa_process.o ./pa_asio.o ./pa_win_util.o ./pa_win_hostapis.o ./pa_win_ds.o ./dsound_wrapper.o ./pa_win_wmme.o ./iasiothiscallresolver.o $(RES)
LINKOBJ = ./pa_hostapi_skeleton.o ./pa_stream.o ./pa_trace.o ./pa_allocation.o ./pa_converters.o ./pa_cpuload.o ./pa_dither.o ./pa_front.o ./pa_process.o ./pa_asio.o ./pa_win_util.o ./pa_win_hostapis.o ./pa_win_ds.o ./dsound_wrapper.o ./pa_win_wmme.o ./iasiothiscallresolver.o $(RES)
LIBS = -L"C:/Dev-CPP/lib" -fmessage-length=0 --no-export-all-symbols --add-stdcall-alias ../../../asiosdk2/asiosdk2.a -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32 -lwinmm -O3 -s
INCS = -I"C:/Dev-CPP/include" -I"../../../asiosdk2" -I"../../../asiosdk2/common" -I"../../../asiosdk2/host" -I"../../../asiosdk2/host/pc" -I"../../common"
CXXINCS = -I"C:/Dev-CPP/include/c++" -I"C:/Dev-CPP/include/c++/mingw32" -I"C:/Dev-CPP/include/c++/backward" -I"C:/Dev-CPP/include" -I"../../../asiosdk2" -I"../../../asiosdk2/common" -I"../../../asiosdk2/host" -I"../../../asiosdk2/host/pc" -I"../../common"
BIN = portaudio-dll.dll
CXXFLAGS = $(CXXINCS)-O3 -fmessage-length=0 -Wall
CFLAGS = $(INCS)-DBUILDING_DLL=1 -O3 -fmessage-length=0 -Wall
.PHONY: all all-before all-after clean clean-custom
all: all-before portaudio-dll.dll all-after
clean: clean-custom
rm -f $(OBJ) $(BIN)
DLLWRAP=dllwrap.exe
DEFFILE=libportaudio-dll.def
STATICLIB=libportaudio-dll.a
$(BIN): $(LINKOBJ)
$(DLLWRAP) --output-def $(DEFFILE) --driver-name c++ --implib $(STATICLIB) $(LINKOBJ) $(LIBS) -o $(BIN)
./pa_hostapi_skeleton.o: ../../hostapi/skeleton/pa_hostapi_skeleton.c
$(CPP) -c ../../hostapi/skeleton/pa_hostapi_skeleton.c -o ./pa_hostapi_skeleton.o $(CXXFLAGS)
./pa_stream.o: ../../common/pa_stream.c
$(CPP) -c ../../common/pa_stream.c -o ./pa_stream.o $(CXXFLAGS)
./pa_trace.o: ../../common/pa_trace.c
$(CPP) -c ../../common/pa_trace.c -o ./pa_trace.o $(CXXFLAGS)
./pa_allocation.o: ../../common/pa_allocation.c
$(CPP) -c ../../common/pa_allocation.c -o ./pa_allocation.o $(CXXFLAGS)
./pa_converters.o: ../../common/pa_converters.c
$(CPP) -c ../../common/pa_converters.c -o ./pa_converters.o $(CXXFLAGS)
./pa_cpuload.o: ../../common/pa_cpuload.c
$(CPP) -c ../../common/pa_cpuload.c -o ./pa_cpuload.o $(CXXFLAGS)
./pa_dither.o: ../../common/pa_dither.c
$(CPP) -c ../../common/pa_dither.c -o ./pa_dither.o $(CXXFLAGS)
./pa_front.o: ../../common/pa_front.c
$(CPP) -c ../../common/pa_front.c -o ./pa_front.o $(CXXFLAGS)
./pa_process.o: ../../common/pa_process.c
$(CPP) -c ../../common/pa_process.c -o ./pa_process.o $(CXXFLAGS)
./pa_asio.o: ../../pa_asio/pa_asio.cpp
$(CPP) -c ../../pa_asio/pa_asio.cpp -o ./pa_asio.o $(CXXFLAGS)
./pa_win_util.o: ../pa_win_util.c
$(CPP) -c ../pa_win_util.c -o ./pa_win_util.o $(CXXFLAGS)
./pa_win_hostapis.o: ../pa_win_hostapis.c
$(CPP) -c ../pa_win_hostapis.c -o ./pa_win_hostapis.o $(CXXFLAGS)
./pa_win_ds.o: ../../pa_win_ds/pa_win_ds.c
$(CPP) -c ../../pa_win_ds/pa_win_ds.c -o ./pa_win_ds.o $(CXXFLAGS)
./dsound_wrapper.o: ../../pa_win_ds/dsound_wrapper.c
$(CPP) -c ../../pa_win_ds/dsound_wrapper.c -o ./dsound_wrapper.o $(CXXFLAGS)
./pa_win_wmme.o: ../../pa_win_wmme/pa_win_wmme.c
$(CPP) -c ../../pa_win_wmme/pa_win_wmme.c -o ./pa_win_wmme.o $(CXXFLAGS)
./iasiothiscallresolver.o: ../../pa_asio/iasiothiscallresolver.cpp
$(CPP) -c ../../pa_asio/iasiothiscallresolver.cpp -o ./iasiothiscallresolver.o $(CXXFLAGS)

View File

@ -1,75 +0,0 @@
# Project: portaudio-static
# Makefile created by Dev-C++ 4.9.8.2
CPP = g++.exe
CC = gcc.exe
WINDRES = windres.exe
RES =
OBJ = ./pa_hostapi_skeleton.o ./pa_stream.o ./pa_trace.o ./pa_allocation.o ./pa_converters.o ./pa_cpuload.o ./pa_dither.o ./pa_front.o ./pa_process.o ./pa_asio.o ./pa_win_util.o ./pa_win_hostapis.o ./pa_win_ds.o ./dsound_wrapper.o ./pa_win_wmme.o ./iasiothiscallresolver.o $(RES)
LINKOBJ = ./pa_hostapi_skeleton.o ./pa_stream.o ./pa_trace.o ./pa_allocation.o ./pa_converters.o ./pa_cpuload.o ./pa_dither.o ./pa_front.o ./pa_process.o ./pa_asio.o ./pa_win_util.o ./pa_win_hostapis.o ./pa_win_ds.o ./dsound_wrapper.o ./pa_win_wmme.o ./iasiothiscallresolver.o $(RES)
LIBS = -L"C:/Dev-CPP/lib" -fmessage-length=0 -O3 -s
INCS = -I"C:/Dev-CPP/include" -I"../../../asiosdk2" -I"../../../asiosdk2/common" -I"../../../asiosdk2/host" -I"../../../asiosdk2/host/pc" -I"../../common"
CXXINCS = -I"C:/Dev-CPP/include/c++" -I"C:/Dev-CPP/include/c++/mingw32" -I"C:/Dev-CPP/include/c++/backward" -I"C:/Dev-CPP/include" -I"../../../asiosdk2" -I"../../../asiosdk2/common" -I"../../../asiosdk2/host" -I"../../../asiosdk2/host/pc" -I"../../common"
BIN = portaudio-static.a
CXXFLAGS = $(CXXINCS)-O3 -fmessage-length=0 -Wall
CFLAGS = $(INCS)-O3 -fmessage-length=0 -Wall
.PHONY: all all-before all-after clean clean-custom
all: all-before portaudio-static.a all-after
clean: clean-custom
rm -f $(OBJ) $(BIN)
$(BIN): $(LINKOBJ)
ar r $(BIN) $(LINKOBJ)
ranlib $(BIN)
./pa_hostapi_skeleton.o: ../../hostapi/skeleton/pa_hostapi_skeleton.c
$(CPP) -c ../../hostapi/skeleton/pa_hostapi_skeleton.c -o ./pa_hostapi_skeleton.o $(CXXFLAGS)
./pa_stream.o: ../../common/pa_stream.c
$(CPP) -c ../../common/pa_stream.c -o ./pa_stream.o $(CXXFLAGS)
./pa_trace.o: ../../common/pa_trace.c
$(CPP) -c ../../common/pa_trace.c -o ./pa_trace.o $(CXXFLAGS)
./pa_allocation.o: ../../common/pa_allocation.c
$(CPP) -c ../../common/pa_allocation.c -o ./pa_allocation.o $(CXXFLAGS)
./pa_converters.o: ../../common/pa_converters.c
$(CPP) -c ../../common/pa_converters.c -o ./pa_converters.o $(CXXFLAGS)
./pa_cpuload.o: ../../common/pa_cpuload.c
$(CPP) -c ../../common/pa_cpuload.c -o ./pa_cpuload.o $(CXXFLAGS)
./pa_dither.o: ../../common/pa_dither.c
$(CPP) -c ../../common/pa_dither.c -o ./pa_dither.o $(CXXFLAGS)
./pa_front.o: ../../common/pa_front.c
$(CPP) -c ../../common/pa_front.c -o ./pa_front.o $(CXXFLAGS)
./pa_process.o: ../../common/pa_process.c
$(CPP) -c ../../common/pa_process.c -o ./pa_process.o $(CXXFLAGS)
./pa_asio.o: ../../pa_asio/pa_asio.cpp
$(CPP) -c ../../pa_asio/pa_asio.cpp -o ./pa_asio.o $(CXXFLAGS)
./pa_win_util.o: ../pa_win_util.c
$(CPP) -c ../pa_win_util.c -o ./pa_win_util.o $(CXXFLAGS)
./pa_win_hostapis.o: ../pa_win_hostapis.c
$(CPP) -c ../pa_win_hostapis.c -o ./pa_win_hostapis.o $(CXXFLAGS)
./pa_win_ds.o: ../../pa_win_ds/pa_win_ds.c
$(CPP) -c ../../pa_win_ds/pa_win_ds.c -o ./pa_win_ds.o $(CXXFLAGS)
./dsound_wrapper.o: ../../pa_win_ds/dsound_wrapper.c
$(CPP) -c ../../pa_win_ds/dsound_wrapper.c -o ./dsound_wrapper.o $(CXXFLAGS)
./pa_win_wmme.o: ../../pa_win_wmme/pa_win_wmme.c
$(CPP) -c ../../pa_win_wmme/pa_win_wmme.c -o ./pa_win_wmme.o $(CXXFLAGS)
./iasiothiscallresolver.o: ../../pa_asio/iasiothiscallresolver.cpp
$(CPP) -c ../../pa_asio/iasiothiscallresolver.cpp -o ./iasiothiscallresolver.o $(CXXFLAGS)

View File

@ -1,209 +0,0 @@
[Project]
FileName=portaudio-dll.dev
Name=portaudio-dll
UnitCount=16
Type=3
Ver=1
ObjFiles=
Includes=..\..\..\asiosdk2;..\..\..\asiosdk2\common;..\..\..\asiosdk2\host;..\..\..\asiosdk2\host\pc;..\..\common
Libs=
PrivateResource=
ResourceIncludes=
MakeIncludes=
Compiler=-DBUILDING_DLL=1_@@_-O3_@@_
CppCompiler=-O3_@@_
Linker=--no-export-all-symbols --add-stdcall-alias_@@_../../../asiosdk2/asiosdk2.a_@@_-lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32 -lwinmm_@@_-O3 -s_@@_
IsCpp=1
Icon=
ExeOutput=.
ObjectOutput=.
OverrideOutput=0
OverrideOutputName=portaudio.a
HostApplication=
Folders=
CommandLine=
IncludeVersionInfo=0
SupportXPThemes=0
CompilerSet=0
CompilerSettings=0000000000000000000
UseCustomMakefile=0
CustomMakefile=
[Unit1]
FileName=..\..\hostapi\skeleton\pa_hostapi_skeleton.c
CompileCpp=1
Folder=portaudio
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=$(CC) -c pa_hostapi_skeleton.c -o ./pa_hostapi_skeleton.o $(CFLAGS)
[Unit2]
FileName=..\..\common\pa_stream.c
CompileCpp=1
Folder=portaudio
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=$(CC) -c pa_stream.c -o ./pa_stream.o $(CFLAGS)
[Unit3]
FileName=..\..\common\pa_trace.c
CompileCpp=1
Folder=portaudio
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=$(CC) -c pa_trace.c -o ./pa_trace.o $(CFLAGS)
[Unit4]
FileName=..\..\common\pa_allocation.c
CompileCpp=1
Folder=portaudio
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=$(CC) -c pa_allocation.c -o ./pa_allocation.o $(CFLAGS)
[Unit5]
FileName=..\..\common\pa_converters.c
CompileCpp=1
Folder=portaudio
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=$(CC) -c pa_converters.c -o ./pa_converters.o $(CFLAGS)
[Unit6]
FileName=..\..\common\pa_cpuload.c
CompileCpp=1
Folder=portaudio
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=$(CC) -c pa_cpuload.c -o ./pa_cpuload.o $(CFLAGS)
[Unit7]
FileName=..\..\common\pa_dither.c
CompileCpp=1
Folder=portaudio
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=$(CC) -c pa_dither.c -o ./pa_dither.o $(CFLAGS)
[Unit8]
FileName=..\..\common\pa_front.c
CompileCpp=1
Folder=portaudio
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=$(CC) -c pa_front.c -o ./pa_front.o $(CFLAGS)
[Unit9]
FileName=..\..\common\pa_process.c
CompileCpp=1
Folder=portaudio
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=$(CC) -c pa_process.c -o ./pa_process.o $(CFLAGS)
[VersionInfo]
Major=0
Minor=1
Release=1
Build=1
LanguageID=1033
CharsetID=1252
CompanyName=
FileVersion=
FileDescription=Developed using the Dev-C++ IDE
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=
AutoIncBuildNr=0
[Unit10]
FileName=..\..\pa_asio\pa_asio.cpp
CompileCpp=1
Folder=portaudio
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=$(CPP) -c pa_asio.cpp -o ./pa_asio.o $(CXXFLAGS)
[Unit11]
FileName=..\pa_win_util.c
CompileCpp=1
Folder=portaudio
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=$(CC) -c pa_win_util.c -o ./pa_win_util.o $(CFLAGS)
[Unit12]
FileName=..\pa_win_hostapis.c
CompileCpp=1
Folder=portaudio
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=$(CC) -c pa_win_hostapis.c -o ./pa_win_hostapis.o $(CFLAGS)
[Unit13]
FileName=..\..\pa_win_ds\pa_win_ds.c
CompileCpp=1
Folder=portaudio
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=$(CC) -c pa_win_ds.c -o ./pa_win_ds.o $(CFLAGS)
[Unit14]
FileName=..\..\pa_win_ds\dsound_wrapper.c
CompileCpp=1
Folder=portaudio
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=$(CC) -c dsound_wrapper.c -o ./dsound_wrapper.o $(CFLAGS)
[Unit15]
FileName=..\..\pa_win_wmme\pa_win_wmme.c
CompileCpp=1
Folder=portaudio
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=$(CC) -c pa_win_wmme.c -o ./pa_win_wmme.o $(CFLAGS)
[Unit16]
FileName=..\..\pa_asio\iasiothiscallresolver.cpp
CompileCpp=1
Folder=portaudio
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=

View File

@ -1,209 +0,0 @@
[Project]
FileName=portaudio-static.dev
Name=portaudio-static
UnitCount=16
Type=2
Ver=1
ObjFiles=
Includes=..\..\..\asiosdk2;..\..\..\asiosdk2\common;..\..\..\asiosdk2\host;..\..\..\asiosdk2\host\pc;..\..\common
Libs=
PrivateResource=
ResourceIncludes=
MakeIncludes=
Compiler=-O3_@@_
CppCompiler=-O3_@@_
Linker=-O3 -s_@@_
IsCpp=1
Icon=
ExeOutput=.
ObjectOutput=.
OverrideOutput=0
OverrideOutputName=portaudio.a
HostApplication=
Folders=
CommandLine=
IncludeVersionInfo=0
SupportXPThemes=0
CompilerSet=0
CompilerSettings=0000000000000000000
UseCustomMakefile=0
CustomMakefile=
[Unit1]
FileName=..\..\hostapi\skeleton\pa_hostapi_skeleton.c
CompileCpp=1
Folder=portaudio
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=$(CC) -c pa_hostapi_skeleton.c -o ./pa_hostapi_skeleton.o $(CFLAGS)
[Unit2]
FileName=..\..\common\pa_stream.c
CompileCpp=1
Folder=portaudio
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=$(CC) -c pa_stream.c -o ./pa_stream.o $(CFLAGS)
[Unit3]
FileName=..\..\common\pa_trace.c
CompileCpp=1
Folder=portaudio
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=$(CC) -c pa_trace.c -o ./pa_trace.o $(CFLAGS)
[Unit4]
FileName=..\..\common\pa_allocation.c
CompileCpp=1
Folder=portaudio
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=$(CC) -c pa_allocation.c -o ./pa_allocation.o $(CFLAGS)
[Unit5]
FileName=..\..\common\pa_converters.c
CompileCpp=1
Folder=portaudio
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=$(CC) -c pa_converters.c -o ./pa_converters.o $(CFLAGS)
[Unit6]
FileName=..\..\common\pa_cpuload.c
CompileCpp=1
Folder=portaudio
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=$(CC) -c pa_cpuload.c -o ./pa_cpuload.o $(CFLAGS)
[Unit7]
FileName=..\..\common\pa_dither.c
CompileCpp=1
Folder=portaudio
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=$(CC) -c pa_dither.c -o ./pa_dither.o $(CFLAGS)
[Unit8]
FileName=..\..\common\pa_front.c
CompileCpp=1
Folder=portaudio
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=$(CC) -c pa_front.c -o ./pa_front.o $(CFLAGS)
[Unit9]
FileName=..\..\common\pa_process.c
CompileCpp=1
Folder=portaudio
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=$(CC) -c pa_process.c -o ./pa_process.o $(CFLAGS)
[VersionInfo]
Major=0
Minor=1
Release=1
Build=1
LanguageID=1033
CharsetID=1252
CompanyName=
FileVersion=
FileDescription=Developed using the Dev-C++ IDE
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=
AutoIncBuildNr=0
[Unit10]
FileName=..\..\pa_asio\pa_asio.cpp
CompileCpp=1
Folder=portaudio
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=$(CPP) -c pa_asio.cpp -o ./pa_asio.o $(CXXFLAGS)
[Unit11]
FileName=..\..\pa_win\pa_win_util.c
CompileCpp=1
Folder=portaudio
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=$(CC) -c pa_win_util.c -o ./pa_win_util.o $(CFLAGS)
[Unit12]
FileName=..\..\pa_win\pa_win_hostapis.c
CompileCpp=1
Folder=portaudio
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=$(CC) -c pa_win_hostapis.c -o ./pa_win_hostapis.o $(CFLAGS)
[Unit13]
FileName=..\..\pa_win_ds\pa_win_ds.c
CompileCpp=1
Folder=portaudio
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=$(CC) -c pa_win_ds.c -o ./pa_win_ds.o $(CFLAGS)
[Unit14]
FileName=..\..\pa_win_ds\dsound_wrapper.c
CompileCpp=1
Folder=portaudio
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=$(CC) -c dsound_wrapper.c -o ./dsound_wrapper.o $(CFLAGS)
[Unit15]
FileName=..\..\pa_win_wmme\pa_win_wmme.c
CompileCpp=1
Folder=portaudio
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=$(CC) -c pa_win_wmme.c -o ./pa_win_wmme.o $(CFLAGS)
[Unit16]
FileName=..\..\pa_asio\iasiothiscallresolver.cpp
CompileCpp=1
Folder=portaudio
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=

View File

@ -1,23 +0,0 @@
From: "Peter L Jones"
Sent: Wednesday, September 17, 2003 5:18 AM
Subject: Dev-C++ project files
I attach two project files intended for portaudio/pa_win/dev-cpp (i.e. in
parallel with the msvc directory), if you want them. One is for a static
library build and one for a DLL. I've used the static library (in building
a single monolithic DLL) but I can't guarantee the DLL version will build a
working library (I think it's mostly there, though!).
I also attach the resulting makefiles, which may be of use to other MinGW
users.
They're rooted in the directory given above and drop their object and
library files in the same place. They assume the asiosdk2 files are in the
same directory as portaudio/ in a sub-directory called asiosdk2/. Oh! The
DLL is built against a static asiosdk2.a library... maybe not the best way
to do it... I ought to figure out how to link against a "home made" dll in
Dev-C++, I guess ;-)
Cheers,
-- Peter

View File

@ -1,10 +1,10 @@
#! /bin/sh #! /bin/sh
# Attempt to guess a canonical system name. # Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# Free Software Foundation, Inc. # 2011 Free Software Foundation, Inc.
timestamp='2009-12-30' timestamp='2011-05-11'
# This file is free software; you can redistribute it and/or modify it # 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 # under the terms of the GNU General Public License as published by
@ -57,7 +57,7 @@ GNU config.guess ($timestamp)
Originally written by Per Bothner. Originally written by Per Bothner.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free
Software Foundation, Inc. Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO This is free software; see the source for copying conditions. There is NO
@ -270,7 +270,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# A Xn.n version is an unreleased experimental baselevel. # A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r. # 1.2 uses "1.2" for uname -r.
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
exit ;; # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
exitcode=$?
trap '' 0
exit $exitcode ;;
Alpha\ *:Windows_NT*:*) Alpha\ *:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem? # How do we know it's Interix rather than the generic POSIX subsystem?
# Should we change UNAME_MACHINE based on the output of uname instead # Should we change UNAME_MACHINE based on the output of uname instead
@ -552,7 +555,7 @@ EOF
echo rs6000-ibm-aix3.2 echo rs6000-ibm-aix3.2
fi fi
exit ;; exit ;;
*:AIX:*:[456]) *:AIX:*:[4567])
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
IBM_ARCH=rs6000 IBM_ARCH=rs6000
@ -879,7 +882,13 @@ EOF
then then
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-gnu
else 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-gnueabi
else
echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
fi
fi fi
exit ;; exit ;;
avr32*:Linux:*:*) avr32*:Linux:*:*)
@ -968,6 +977,9 @@ EOF
sparc:Linux:*:* | sparc64:Linux:*:*) sparc:Linux:*:* | sparc64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;; exit ;;
tile*:Linux:*:*)
echo ${UNAME_MACHINE}-tilera-linux-gnu
exit ;;
vax:Linux:*:*) vax:Linux:*:*)
echo ${UNAME_MACHINE}-dec-linux-gnu echo ${UNAME_MACHINE}-dec-linux-gnu
exit ;; exit ;;
@ -1231,6 +1243,9 @@ EOF
*:QNX:*:4*) *:QNX:*:4*)
echo i386-pc-qnx echo i386-pc-qnx
exit ;; exit ;;
NEO-?:NONSTOP_KERNEL:*:*)
echo neo-tandem-nsk${UNAME_RELEASE}
exit ;;
NSE-?:NONSTOP_KERNEL:*:*) NSE-?:NONSTOP_KERNEL:*:*)
echo nse-tandem-nsk${UNAME_RELEASE} echo nse-tandem-nsk${UNAME_RELEASE}
exit ;; exit ;;

View File

@ -1,10 +1,10 @@
#! /bin/sh #! /bin/sh
# Configuration validation subroutine script. # Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# Free Software Foundation, Inc. # 2011 Free Software Foundation, Inc.
timestamp='2010-01-22' timestamp='2011-03-23'
# This file is (in principle) common to ALL GNU software. # This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software # The presence of a machine in this file suggests that SOME GNU software
@ -76,7 +76,7 @@ version="\
GNU config.sub ($timestamp) GNU config.sub ($timestamp)
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free
Software Foundation, Inc. Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO This is free software; see the source for copying conditions. There is NO
@ -124,8 +124,9 @@ esac
# Here we must recognize all the valid KERNEL-OS combinations. # Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in case $maybe_os in
nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
knetbsd*-gnu* | netbsd*-gnu* | \
kopensolaris*-gnu* | \ kopensolaris*-gnu* | \
storm-chaos* | os2-emx* | rtmk-nova*) storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os os=-$maybe_os
@ -282,11 +283,13 @@ case $basic_machine in
| moxie \ | moxie \
| mt \ | mt \
| msp430 \ | msp430 \
| nds32 | nds32le | nds32be \
| nios | nios2 \ | nios | nios2 \
| ns16k | ns32k \ | ns16k | ns32k \
| open8 \
| or32 \ | or32 \
| pdp10 | pdp11 | pj | pjl \ | pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | powerpc | powerpc64 | powerpc64le | powerpcle \
| pyramid \ | pyramid \
| rx \ | rx \
| score \ | score \
@ -294,15 +297,24 @@ case $basic_machine in
| sh64 | sh64le \ | sh64 | sh64le \
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
| spu | strongarm \ | spu \
| tahoe | thumb | tic4x | tic80 | tron \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
| ubicom32 \ | ubicom32 \
| v850 | v850e \ | v850 | v850e \
| we32k \ | we32k \
| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | x86 | xc16x | xstormy16 | xtensa \
| z8k | z80) | z8k | z80)
basic_machine=$basic_machine-unknown basic_machine=$basic_machine-unknown
;; ;;
c54x)
basic_machine=tic54x-unknown
;;
c55x)
basic_machine=tic55x-unknown
;;
c6x)
basic_machine=tic6x-unknown
;;
m6811 | m68hc11 | m6812 | m68hc12 | picochip) m6811 | m68hc11 | m6812 | m68hc12 | picochip)
# Motorola 68HC11/12. # Motorola 68HC11/12.
basic_machine=$basic_machine-unknown basic_machine=$basic_machine-unknown
@ -314,6 +326,18 @@ case $basic_machine in
basic_machine=mt-unknown basic_machine=mt-unknown
;; ;;
strongarm | thumb | xscale)
basic_machine=arm-unknown
;;
xscaleeb)
basic_machine=armeb-unknown
;;
xscaleel)
basic_machine=armel-unknown
;;
# We use `pc' rather than `unknown' # We use `pc' rather than `unknown'
# because (1) that's what they normally are, and # because (1) that's what they normally are, and
# (2) the word "unknown" tends to confuse beginning users. # (2) the word "unknown" tends to confuse beginning users.
@ -334,7 +358,7 @@ case $basic_machine in
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* | avr32-* \ | avr-* | avr32-* \
| bfin-* | bs2000-* \ | bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \
| clipper-* | craynv-* | cydra-* \ | clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \ | d10v-* | d30v-* | dlx-* \
| elxsi-* \ | elxsi-* \
@ -368,26 +392,28 @@ case $basic_machine in
| mmix-* \ | mmix-* \
| mt-* \ | mt-* \
| msp430-* \ | msp430-* \
| nds32-* | nds32le-* | nds32be-* \
| nios-* | nios2-* \ | nios-* | nios2-* \
| none-* | np1-* | ns16k-* | ns32k-* \ | none-* | np1-* | ns16k-* | ns32k-* \
| open8-* \
| orion-* \ | orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
| pyramid-* \ | pyramid-* \
| romp-* | rs6000-* | rx-* \ | romp-* | rs6000-* | rx-* \
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
| sparclite-* \ | sparclite-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
| tahoe-* | thumb-* \ | tahoe-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tile-* | tilegx-* \ | tile-* | tilegx-* \
| tron-* \ | tron-* \
| ubicom32-* \ | ubicom32-* \
| v850-* | v850e-* | vax-* \ | v850-* | v850e-* | vax-* \
| we32k-* \ | we32k-* \
| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \
| xstormy16-* | xtensa*-* \ | xstormy16-* | xtensa*-* \
| ymp-* \ | ymp-* \
| z8k-* | z80-*) | z8k-* | z80-*)
@ -482,6 +508,15 @@ case $basic_machine in
basic_machine=powerpc-ibm basic_machine=powerpc-ibm
os=-cnk os=-cnk
;; ;;
c54x-*)
basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
c55x-*)
basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
c6x-*)
basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
c90) c90)
basic_machine=c90-cray basic_machine=c90-cray
os=-unicos os=-unicos
@ -518,7 +553,7 @@ case $basic_machine in
basic_machine=craynv-cray basic_machine=craynv-cray
os=-unicosmp os=-unicosmp
;; ;;
cr16) cr16 | cr16-*)
basic_machine=cr16-unknown basic_machine=cr16-unknown
os=-elf os=-elf
;; ;;
@ -841,6 +876,12 @@ case $basic_machine in
np1) np1)
basic_machine=np1-gould basic_machine=np1-gould
;; ;;
neo-tandem)
basic_machine=neo-tandem
;;
nse-tandem)
basic_machine=nse-tandem
;;
nsr-tandem) nsr-tandem)
basic_machine=nsr-tandem basic_machine=nsr-tandem
;; ;;
@ -923,9 +964,10 @@ case $basic_machine in
;; ;;
power) basic_machine=power-ibm power) basic_machine=power-ibm
;; ;;
ppc) basic_machine=powerpc-unknown ppc | ppcbe) basic_machine=powerpc-unknown
;; ;;
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ppc-* | ppcbe-*)
basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
;; ;;
ppcle | powerpclittle | ppc-le | powerpc-little) ppcle | powerpclittle | ppc-le | powerpc-little)
basic_machine=powerpcle-unknown basic_machine=powerpcle-unknown
@ -1019,6 +1061,9 @@ case $basic_machine in
basic_machine=i860-stratus basic_machine=i860-stratus
os=-sysv4 os=-sysv4
;; ;;
strongarm-* | thumb-*)
basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
sun2) sun2)
basic_machine=m68000-sun basic_machine=m68000-sun
;; ;;
@ -1075,18 +1120,6 @@ case $basic_machine in
basic_machine=t90-cray basic_machine=t90-cray
os=-unicos os=-unicos
;; ;;
tic54x | c54x*)
basic_machine=tic54x-unknown
os=-coff
;;
tic55x | c55x*)
basic_machine=tic55x-unknown
os=-coff
;;
tic6x | c6x*)
basic_machine=tic6x-unknown
os=-coff
;;
# This must be matched before tile*. # This must be matched before tile*.
tilegx*) tilegx*)
basic_machine=tilegx-unknown basic_machine=tilegx-unknown
@ -1163,6 +1196,9 @@ case $basic_machine in
xps | xps100) xps | xps100)
basic_machine=xps100-honeywell basic_machine=xps100-honeywell
;; ;;
xscale-* | xscalee[bl]-*)
basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
;;
ymp) ymp)
basic_machine=ymp-cray basic_machine=ymp-cray
os=-unicos os=-unicos
@ -1301,7 +1337,8 @@ case $os in
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* | -cegcc* \ | -chorusos* | -chorusrdb* | -cegcc* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -mingw32* | -linux-gnu* | -linux-android* \
| -linux-newlib* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* \ | -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
@ -1484,6 +1521,15 @@ case $basic_machine in
c4x-* | tic4x-*) c4x-* | tic4x-*)
os=-coff os=-coff
;; ;;
tic54x-*)
os=-coff
;;
tic55x-*)
os=-coff
;;
tic6x-*)
os=-coff
;;
# This must come before the *-dec entry. # This must come before the *-dec entry.
pdp10-*) pdp10-*)
os=-tops20 os=-tops20

File diff suppressed because it is too large Load Diff

View File

@ -97,6 +97,10 @@ AC_ARG_WITH(host_os, [], host_os=$withval)
dnl Checks for programs. dnl Checks for programs.
AC_PROG_CC AC_PROG_CC
dnl ASIO and CXX bindings need a C++ compiler
if [[ "$with_asio" = "yes" ] || [ "$enable_cxx" = "yes" ]] ; then
AC_PROG_CXX
fi
AC_LIBTOOL_WIN32_DLL AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL AC_PROG_LIBTOOL
AC_PROG_INSTALL AC_PROG_INSTALL
@ -191,13 +195,16 @@ add_objects()
INCLUDES=portaudio.h INCLUDES=portaudio.h
dnl Include directories needed by all implementations
CFLAGS="$CFLAGS -I\$(top_srcdir)/include -I\$(top_srcdir)/src/common"
case "${host_os}" in case "${host_os}" in
darwin* ) darwin* )
dnl Mac OS X configuration dnl Mac OS X configuration
AC_DEFINE(PA_USE_COREAUDIO) AC_DEFINE(PA_USE_COREAUDIO,1)
CFLAGS="$CFLAGS -Werror" CFLAGS="$CFLAGS -I\$(top_srcdir)/src/os/unix -Werror"
LIBS="-framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework Carbon" LIBS="-framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework Carbon"
if test "x$enable_mac_universal" = "xyes" ; then if test "x$enable_mac_universal" = "xyes" ; then
@ -235,7 +242,7 @@ case "${host_os}" in
PADLL="portaudio.dll" PADLL="portaudio.dll"
THREAD_CFLAGS="-mthreads" THREAD_CFLAGS="-mthreads"
SHARED_FLAGS="-shared" SHARED_FLAGS="-shared"
CFLAGS="$CFLAGS -I\$(top_srcdir)/include -DPA_USE_WMME=0 -DPA_USE_ASIO=0 -DPA_USE_WDMKS=0 -DPA_USE_DS=0 -DPA_USE_WASAPI=0" CFLAGS="$CFLAGS -I\$(top_srcdir)/src/os/win -DPA_USE_WMME=0 -DPA_USE_ASIO=0 -DPA_USE_WDMKS=0 -DPA_USE_DS=0 -DPA_USE_WASAPI=0"
if [[ "x$with_directx" = "xyes" ]]; then if [[ "x$with_directx" = "xyes" ]]; then
DXDIR="$with_dxdir" DXDIR="$with_dxdir"
@ -244,7 +251,7 @@ case "${host_os}" in
DLL_LIBS="${DLL_LIBS} -lwinmm -lm -L$DXDIR/lib -ldsound -lole32" DLL_LIBS="${DLL_LIBS} -lwinmm -lm -L$DXDIR/lib -ldsound -lole32"
#VC98="\"/c/Program Files/Microsoft Visual Studio/VC98/Include\"" #VC98="\"/c/Program Files/Microsoft Visual Studio/VC98/Include\""
#CFLAGS="$CFLAGS -I$VC98 -DPA_NO_WMME -DPA_NO_ASIO" #CFLAGS="$CFLAGS -I$VC98 -DPA_NO_WMME -DPA_NO_ASIO"
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/os/win -I$DXDIR/include -UPA_USE_DS -DPA_USE_DS=1" CFLAGS="$CFLAGS -I$DXDIR/include -UPA_USE_DS -DPA_USE_DS=1"
fi fi
if [[ "x$with_asio" = "xyes" ]]; then if [[ "x$with_asio" = "xyes" ]]; then
@ -252,7 +259,14 @@ case "${host_os}" in
add_objects src/hostapi/asio/pa_asio.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_coinitialize.o src/hostapi/asio/iasiothiscallresolver.o $ASIODIR/common/asio.o $ASIODIR/host/asiodrivers.o $ASIODIR/host/pc/asiolist.o add_objects src/hostapi/asio/pa_asio.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_coinitialize.o src/hostapi/asio/iasiothiscallresolver.o $ASIODIR/common/asio.o $ASIODIR/host/asiodrivers.o $ASIODIR/host/pc/asiolist.o
LIBS="-lwinmm -lm -lole32 -luuid" LIBS="-lwinmm -lm -lole32 -luuid"
DLL_LIBS="${DLL_LIBS} -lwinmm -lm -lole32 -luuid" DLL_LIBS="${DLL_LIBS} -lwinmm -lm -lole32 -luuid"
CFLAGS="$CFLAGS -ffast-math -fomit-frame-pointer -I\$(top_srcdir)/src/common -I\$(top_srcdir)/src/hostapi/asio -I$ASIODIR/host/pc -I$ASIODIR/common -I$ASIODIR/host -UPA_USE_ASIO -DPA_USE_ASIO=1 -DWINDOWS" CFLAGS="$CFLAGS -ffast-math -fomit-frame-pointer -I\$(top_srcdir)/src/hostapi/asio -I$ASIODIR/host/pc -I$ASIODIR/common -I$ASIODIR/host -UPA_USE_ASIO -DPA_USE_ASIO=1 -DWINDOWS"
dnl Setting the windows version flags below resolves a conflict between Interlocked*
dnl definitions in mingw winbase.h and Interlocked* hacks in ASIO SDK combase.h
dnl combase.h is included by asiodrvr.h
dnl PortAudio does not actually require Win XP (winver 501) APIs
CFLAGS="$CFLAGS -D_WIN32_WINNT=0x0501 -DWINVER=0x0501"
CXXFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS"
fi fi
@ -263,21 +277,21 @@ case "${host_os}" in
DLL_LIBS="${DLL_LIBS} -lwinmm -lm -L$DXDIR/lib -luuid -lsetupapi -lole32" DLL_LIBS="${DLL_LIBS} -lwinmm -lm -L$DXDIR/lib -luuid -lsetupapi -lole32"
#VC98="\"/c/Program Files/Microsoft Visual Studio/VC98/Include\"" #VC98="\"/c/Program Files/Microsoft Visual Studio/VC98/Include\""
#CFLAGS="$CFLAGS -I$VC98 -DPA_NO_WMME -DPA_NO_ASIO" #CFLAGS="$CFLAGS -I$VC98 -DPA_NO_WMME -DPA_NO_ASIO"
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/common -I$DXDIR/include -UPA_USE_WDMKS -DPA_USE_WDMKS=1" CFLAGS="$CFLAGS -I$DXDIR/include -UPA_USE_WDMKS -DPA_USE_WDMKS=1"
fi fi
if [[ "x$with_wmme" = "xyes" ]]; then if [[ "x$with_wmme" = "xyes" ]]; then
add_objects src/hostapi/wmme/pa_win_wmme.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o src/os/win/pa_win_waveformat.o add_objects src/hostapi/wmme/pa_win_wmme.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o src/os/win/pa_win_waveformat.o
LIBS="-lwinmm -lm -lole32 -luuid" LIBS="-lwinmm -lm -lole32 -luuid"
DLL_LIBS="${DLL_LIBS} -lwinmm" DLL_LIBS="${DLL_LIBS} -lwinmm"
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/common -UPA_USE_WMME -DPA_USE_WMME=1" CFLAGS="$CFLAGS -UPA_USE_WMME -DPA_USE_WMME=1"
fi fi
if [[ "x$with_wasapi" = "xyes" ]]; then if [[ "x$with_wasapi" = "xyes" ]]; then
add_objects src/hostapi/wasapi/pa_win_wasapi.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_coinitialize.o src/os/win/pa_win_waveformat.o add_objects src/hostapi/wasapi/pa_win_wasapi.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_coinitialize.o src/os/win/pa_win_waveformat.o
LIBS="-lwinmm -lm -lole32 -luuid" LIBS="-lwinmm -lm -lole32 -luuid"
DLL_LIBS="${DLL_LIBS} -lwinmm -lole32" DLL_LIBS="${DLL_LIBS} -lwinmm -lole32"
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/common -I\$(top_srcdir)/src/hostapi/wasapi/mingw-include -UPA_USE_WASAPI -DPA_USE_WASAPI=1" CFLAGS="$CFLAGS -I\$(top_srcdir)/src/hostapi/wasapi/mingw-include -UPA_USE_WASAPI -DPA_USE_WASAPI=1"
fi fi
;; ;;
@ -285,7 +299,7 @@ case "${host_os}" in
dnl Cygwin configuration dnl Cygwin configuration
OTHER_OBJS="src/hostapi/wmme/pa_win_wmme.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o src/os/win/pa_win_waveformat.o" OTHER_OBJS="src/hostapi/wmme/pa_win_wmme.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o src/os/win/pa_win_waveformat.o"
CFLAGS="$CFLAGS -DPA_USE_DS=0 -DPA_USE_WDMKS=0 -DPA_USE_ASIO=0 -DPA_USE_WASAPI=0 -DPA_USE_WMME=1" CFLAGS="$CFLAGS -I\$(top_srcdir)/src/os/win -DPA_USE_DS=0 -DPA_USE_WDMKS=0 -DPA_USE_ASIO=0 -DPA_USE_WASAPI=0 -DPA_USE_WMME=1"
LIBS="-lwinmm -lm" LIBS="-lwinmm -lm"
PADLL="portaudio.dll" PADLL="portaudio.dll"
THREAD_CFLAGS="-mthreads" THREAD_CFLAGS="-mthreads"
@ -304,7 +318,9 @@ case "${host_os}" in
dnl See the '#ifdef PA_USE_SGI' in file pa_unix/pa_unix_hostapis.c dnl See the '#ifdef PA_USE_SGI' in file pa_unix/pa_unix_hostapis.c
dnl which selects the appropriate PaXXX_Initialize() function. dnl which selects the appropriate PaXXX_Initialize() function.
dnl dnl
AC_DEFINE(PA_USE_SGI) AC_DEFINE(PA_USE_SGI,1)
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/os/unix"
dnl The _REENTRANT option for pthread safety. Perhaps not necessary but it 'll do no harm. dnl The _REENTRANT option for pthread safety. Perhaps not necessary but it 'll do no harm.
dnl dnl
@ -322,6 +338,8 @@ case "${host_os}" in
*) *)
dnl Unix configuration dnl Unix configuration
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/os/unix"
AC_CHECK_LIB(pthread, pthread_create,[have_pthread="yes"], AC_CHECK_LIB(pthread, pthread_create,[have_pthread="yes"],
AC_MSG_ERROR([libpthread not found!])) AC_MSG_ERROR([libpthread not found!]))
@ -330,7 +348,7 @@ case "${host_os}" in
LIBS="$LIBS -lasound" LIBS="$LIBS -lasound"
OTHER_OBJS="$OTHER_OBJS src/hostapi/alsa/pa_linux_alsa.o" OTHER_OBJS="$OTHER_OBJS src/hostapi/alsa/pa_linux_alsa.o"
INCLUDES="$INCLUDES pa_linux_alsa.h" INCLUDES="$INCLUDES pa_linux_alsa.h"
AC_DEFINE(PA_USE_ALSA) AC_DEFINE(PA_USE_ALSA,1)
fi fi
if [[ "$have_jack" = "yes" ] && [ "$with_jack" != "no" ]] ; then if [[ "$have_jack" = "yes" ] && [ "$with_jack" != "no" ]] ; then
@ -338,7 +356,7 @@ case "${host_os}" in
CFLAGS="$CFLAGS $JACK_CFLAGS" CFLAGS="$CFLAGS $JACK_CFLAGS"
OTHER_OBJS="$OTHER_OBJS src/hostapi/jack/pa_jack.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" INCLUDES="$INCLUDES pa_jack.h"
AC_DEFINE(PA_USE_JACK) AC_DEFINE(PA_USE_JACK,1)
fi fi
if [[ "$with_oss" != "no" ]] ; then if [[ "$with_oss" != "no" ]] ; then
@ -347,14 +365,14 @@ case "${host_os}" in
DLL_LIBS="$DLL_LIBS -lossaudio" DLL_LIBS="$DLL_LIBS -lossaudio"
LIBS="$LIBS -lossaudio" LIBS="$LIBS -lossaudio"
fi fi
AC_DEFINE(PA_USE_OSS) AC_DEFINE(PA_USE_OSS,1)
fi fi
if [[ "$have_asihpi" = "yes" ] && [ "$with_asihpi" != "no" ]] ; then if [[ "$have_asihpi" = "yes" ] && [ "$with_asihpi" != "no" ]] ; then
LIBS="$LIBS -lhpi" LIBS="$LIBS -lhpi"
DLL_LIBS="$DLL_LIBS -lhpi" DLL_LIBS="$DLL_LIBS -lhpi"
OTHER_OBJS="$OTHER_OBJS src/hostapi/asihpi/pa_linux_asihpi.o" OTHER_OBJS="$OTHER_OBJS src/hostapi/asihpi/pa_linux_asihpi.o"
AC_DEFINE(PA_USE_ASIHPI) AC_DEFINE(PA_USE_ASIHPI,1)
fi fi
DLL_LIBS="$DLL_LIBS -lm -lpthread" DLL_LIBS="$DLL_LIBS -lm -lpthread"
@ -368,7 +386,7 @@ case "${host_os}" in
THREAD_CFLAGS="-mt" THREAD_CFLAGS="-mt"
;; ;;
*) *)
SHARED_FLAGS="-shared -fPIC" SHARED_FLAGS="-fPIC"
THREAD_CFLAGS="-pthread" THREAD_CFLAGS="-pthread"
;; ;;
esac esac

View File

@ -1,7 +1,7 @@
/** @page License PortAudio License /** @page License PortAudio License
PortAudio Portable Real-Time Audio Library <br> PortAudio Portable Real-Time Audio Library <br>
Copyright (c) 1999-2006 Ross Bencina, Phil Burk Copyright (c) 1999-2011 Ross Bencina, Phil Burk

View File

@ -1,35 +1,60 @@
/* doxygen index page */ /* doxygen index page */
/** @mainpage /** @mainpage
@section overview Overview
PortAudio is a cross-platform, open-source C language library for real-time audio input and output. The library provides functions that allow your software to acquire and output real-time audio streams from your computer's hardware audio interfaces. It is designed to simplify writing cross-platform audio applications, and also to simplify the development of audio software in general by hiding the complexities of dealing directly with each native audio API. PortAudio is used to implement sound recording, editing and mixing applications, software synthesizers, effects processors, music players, internet telephony applications, software defined radios and more. Supported platforms include MS Windows, Mac OS X and Linux. Third-party language bindings make it possible to call PortAudio from other programming languages including C++, C#, Python, PureBasic, FreePascal and Lazarus. PortAudio is a cross-platform, open-source C language library for real-time audio input and output. The library provides functions that allow your software to acquire and output real-time audio streams from your computer's hardware audio interfaces. It is designed to simplify writing cross-platform audio applications, and also to simplify the development of audio software in general by hiding the complexities of dealing directly with each native audio API. PortAudio is used to implement sound recording, editing and mixing applications, software synthesizers, effects processors, music players, internet telephony applications, software defined radios and more. Supported platforms include MS Windows, Mac OS X and Linux. Third-party language bindings make it possible to call PortAudio from other programming languages including C++, C#, Python, PureBasic, FreePascal and Lazarus.
See the PortAudio website for further information http://www.portaudio.com
Read the @ref api_overview for a top-down view of the PortAudio API, its capabilities, functions and data structures. The documentation for PortAudio's main header file portaudio.h details the individual data types and functions that make up the API. @section start_here Start here
To get started writing code check out the tutorials on the PortAudio Wiki: - @ref api_overview<br>
http://www.portaudio.com/trac/wiki/TutorialDir/TutorialStart A top-down view of the PortAudio API, its capabilities, functions and data structures
- <a href="http://www.portaudio.com/trac/wiki/TutorialDir/TutorialStart">PortAudio Tutorials</a><br>
Get started writing code with PortAudio tutorials
- @ref examples_src "Examples"<br>
Simple example programs demonstrating PortAudio usage
- @ref License<br>
PortAudio is licenced under the MIT Expat open source licence. We make a non-binding request for you to contribute your changes back to the project.
@section reference API Reference
- portaudio.h Portable API<br>
Detailed documentation for each portable API function and data type
- @ref public_header "Host API Specific Extensions"<br>
Documentation for non-portable platform-specific host API extensions
@section resources Resources
- <a href="http://www.portaudio.com">The PortAudio website</a>
- <a href="http://music.columbia.edu/mailman/listinfo/portaudio/">Our mailing list for users and developers</a><br>
- <a href="http://www.portaudio.com/trac">The PortAudio wiki</a>
@section developer_resources Developer Resources
@if INTERNAL
- @ref srcguide
@endif
- <a href="http://www.portaudio.com/trac">Our Trac wiki and issue tracking system</a>
- <a href="http://www.portaudio.com/docs/proposals/014-StyleGuide.html">Coding 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.portaudio.com/trac/report/3">check out the starter tickets in Trac</a>.
@section older_api_versions Older API Versions
This documentation covers the current API version: PortAudio V19, API version 2.0. API 2.0 differs in a number of ways from previous versions (most often encountered in PortAudio V18), please consult the enhancement proposals for details of what was added/changed for V19: This documentation covers the current API version: PortAudio V19, API version 2.0. API 2.0 differs in a number of ways from previous versions (most often encountered in PortAudio V18), please consult the enhancement proposals for details of what was added/changed for V19:
http://www.portaudio.com/docs/proposals/index.html http://www.portaudio.com/docs/proposals/index.html
You might also be interested in:
- @ref srcguide
- The @ref License
- Our mailing list for users and developers:
http://music.columbia.edu/mailman/listinfo/portaudio/
- Our issue tracking system:
http://www.portaudio.com/trac
- Coding guidelines:
http://www.portaudio.com/docs/proposals/014-StyleGuide.html
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.
*/ */

View File

@ -7,33 +7,45 @@
*/ */
/** /**
@internal
@defgroup common_src Source code common to all implementations @defgroup common_src Source code common to all implementations
*/ */
/** /**
@internal
@defgroup win_src Source code common to all Windows implementations @defgroup win_src Source code common to all Windows implementations
*/ */
/** /**
@internal
@defgroup unix_src Source code common to all Unix implementations @defgroup unix_src Source code common to all Unix implementations
*/ */
/** /**
@internal
@defgroup macosx_src Source code common to all Macintosh implementations @defgroup macosx_src Source code common to all Macintosh implementations
*/ */
/** /**
@internal
@defgroup hostapi_src Source code for specific Host APIs @defgroup hostapi_src Source code for specific Host APIs
*/ */
/** /**
@defgroup test_src Test and example programs @internal
@defgroup test_src Test programs
*/ */
/** /**
@page srcguide A guide to the PortAudio sources. @defgroup examples_src Example programs demonstrating PortAudio usage
*/
/**
@internal
@page srcguide A guide to the PortAudio sources
- \ref public_header - \ref public_header
- \ref examples_src
- \ref common_src - \ref common_src
- \ref win_src - \ref win_src
- \ref unix_src - \ref unix_src

View File

@ -61,24 +61,21 @@ typedef struct PaWinDirectSoundStreamInfo{
PaHostApiTypeId hostApiType; /**< paDirectSound */ PaHostApiTypeId hostApiType; /**< paDirectSound */
unsigned long version; /**< 2 */ unsigned long version; /**< 2 */
unsigned long flags; unsigned long flags; /**< enable other features of this struct */
/* low-level latency setting support /**
Control the size of host buffers in order to set latency. They will low-level latency setting support
be used instead of the generic parameters to Pa_OpenStream() if Sets the size of the DirectSound host buffer.
flags contains the paWinDirectSoundUseLowLevelLatencyParameters When flags contains the paWinDirectSoundUseLowLevelLatencyParameters
flag. this size will be used instead of interpreting the generic latency
parameters to Pa_OpenStream(). If the flag is not set this value is ignored.
If PaWinDirectSoundStreamInfo structures with paWinDirectSoundUseLowLevelLatencyParameters If the stream is a full duplex stream the implementation requires that
are supplied for both input and output in a full duplex stream, then the the values of framesPerBuffer for input and output match (if both are specified).
input and output framesPerBuffer must be the same, or the larger of the
two must be a multiple of the smaller, otherwise a
paIncompatibleHostApiSpecificStreamInfo error will be returned from
Pa_OpenStream().
*/ */
unsigned long framesPerBuffer; /* NOT IMPLEMENTED see http://www.portaudio.com/trac/ticket/129 */ unsigned long framesPerBuffer;
/* /**
support for WAVEFORMATEXTENSIBLE channel masks. If flags contains support for WAVEFORMATEXTENSIBLE channel masks. If flags contains
paWinDirectSoundUseChannelMask this allows you to specify which speakers paWinDirectSoundUseChannelMask this allows you to specify which speakers
to address in a multichannel stream. Constants for channelMask to address in a multichannel stream. Constants for channelMask

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/* /*
* $Id: pa_linux_alsa.c 1691 2011-05-26 20:19:19Z aknudsen $ * $Id: pa_linux_alsa.c 1798 2011-12-08 19:43:29Z alan_horstmann $
* PortAudio Portable Real-Time Audio Library * PortAudio Portable Real-Time Audio Library
* Latest Version at: http://www.portaudio.com * Latest Version at: http://www.portaudio.com
* ALSA implementation by Joshua Haberman and Arve Knudsen * ALSA implementation by Joshua Haberman and Arve Knudsen
@ -957,10 +957,10 @@ typedef struct
HwDevInfo predefinedNames[] = { HwDevInfo predefinedNames[] = {
{ "center_lfe", NULL, 0, 1, 0 }, { "center_lfe", NULL, 0, 1, 0 },
/* { "default", NULL, 0, 1, 0 }, */ /* { "default", NULL, 0, 1, 1 }, */
/* { "dmix", NULL, 0, 1, 0 }, */ { "dmix", NULL, 0, 1, 0 },
/* { "dpl", NULL, 0, 1, 0 }, */ /* { "dpl", NULL, 0, 1, 0 }, */
/* { "dsnoop", NULL, 0, 1, 0 }, */ /* { "dsnoop", NULL, 0, 0, 1 }, */
{ "front", NULL, 0, 1, 0 }, { "front", NULL, 0, 1, 0 },
{ "iec958", NULL, 0, 1, 0 }, { "iec958", NULL, 0, 1, 0 },
/* { "modem", NULL, 0, 1, 0 }, */ /* { "modem", NULL, 0, 1, 0 }, */

View File

@ -1,12 +1,16 @@
/* /*
* $Id:$
* PortAudio Portable Real-Time Audio Library * PortAudio Portable Real-Time Audio Library
* Latest Version at: http://www.portaudio.com * Latest Version at: http://www.portaudio.com
* AudioScience HPI implementation by Fred Gleason, Ludwig Schwardt and
* Eliot Blennerhassett
* *
* PortAudio v18 version of AudioScience HPI driver by Fred Gleason <fredg@salemradiolabs.com> * Copyright (c) 2003 Fred Gleason <fredg@salemradiolabs.com>
* PortAudio v19 version of AudioScience HPI driver by Ludwig Schwardt <schwardt@sun.ac.za> * Copyright (c) 2005,2006 Ludwig Schwardt <schwardt@sun.ac.za>
* Copyright (c) 2011 Eliot Blennerhassett <eblennerhassett@audioscience.com>
* *
* Copyright (c) 2003 Fred Gleason * Based on the Open Source API proposed by Ross Bencina
* Copyright (c) 2005,2006 Ludwig Schwardt * Copyright (c) 1999-2008 Ross Bencina, Phil Burk
* *
* Permission is hereby granted, free of charge, to any person obtaining * Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files * a copy of this software and associated documentation files
@ -61,7 +65,7 @@
Documentation for the HPI API can be found at: Documentation for the HPI API can be found at:
http://www.audioscience.com/internet/download/sdk/spchpi.pdf http://www.audioscience.com/internet/download/sdk/hpi_usermanual_html/html/index.html
The Linux HPI driver itself (a kernel module + library) can be downloaded from: The Linux HPI driver itself (a kernel module + library) can be downloaded from:
@ -134,8 +138,6 @@
Output buffer priming via the user callback (i.e. paPrimeOutputBuffersUsingStreamCallback Output buffer priming via the user callback (i.e. paPrimeOutputBuffersUsingStreamCallback
and friends) is not implemented yet. All output is primed with silence. and friends) is not implemented yet. All output is primed with silence.
Please send bug reports etc. to Ludwig Schwardt <schwardt@sun.ac.za>
*/ */
#include <unistd.h> #include <unistd.h>
@ -193,7 +195,7 @@
/** Check return value of HPI function, and map it to PaError */ /** Check return value of HPI function, and map it to PaError */
#define PA_ASIHPI_UNLESS_(expr, paError) \ #define PA_ASIHPI_UNLESS_(expr, paError) \
do { \ do { \
HW16 hpiError = (expr); \ hpi_err_t hpiError = (expr); \
/* If HPI error occurred */ \ /* If HPI error occurred */ \
if( UNLIKELY( hpiError ) ) \ if( UNLIKELY( hpiError ) ) \
{ \ { \
@ -265,8 +267,6 @@ typedef struct PaAsiHpiHostApiRepresentation
/* implementation specific data goes here */ /* implementation specific data goes here */
PaHostApiIndex hostApiIndex; PaHostApiIndex hostApiIndex;
/** HPI subsystem pointer */
HPI_HSUBSYS *subSys;
} }
PaAsiHpiHostApiRepresentation; PaAsiHpiHostApiRepresentation;
@ -280,20 +280,18 @@ typedef struct PaAsiHpiDeviceInfo
/* implementation specific data goes here */ /* implementation specific data goes here */
/** HPI subsystem (required for most HPI calls) */
HPI_HSUBSYS *subSys;
/** Adapter index */ /** Adapter index */
HW16 adapterIndex; uint16_t adapterIndex;
/** Adapter model number (hex) */ /** Adapter model number (hex) */
HW16 adapterType; uint16_t adapterType;
/** Adapter HW/SW version */ /** Adapter HW/SW version */
HW16 adapterVersion; uint16_t adapterVersion;
/** Adapter serial number */ /** Adapter serial number */
HW32 adapterSerialNumber; uint32_t adapterSerialNumber;
/** Stream number */ /** Stream number */
HW16 streamIndex; uint16_t streamIndex;
/** 0=Input, 1=Output (HPI streams are either input or output but not both) */ /** 0=Input, 1=Output (HPI streams are either input or output but not both) */
HW16 streamIsOutput; uint16_t streamIsOutput;
} }
PaAsiHpiDeviceInfo; PaAsiHpiDeviceInfo;
@ -328,27 +326,25 @@ typedef struct PaAsiHpiStreamComponent
{ {
/** Device information (HPI handles, etc) */ /** Device information (HPI handles, etc) */
PaAsiHpiDeviceInfo *hpiDevice; PaAsiHpiDeviceInfo *hpiDevice;
/** Stream handle, as passed to HPI interface. /** Stream handle, as passed to HPI interface. */
HACK: we assume types HPI_HISTREAM and HPI_HOSTREAM are the same... hpi_handle_t hpiStream;
(both are HW32 up to version 3.00 of ASIHPI, and hopefully they stay that way) */
HPI_HISTREAM hpiStream;
/** Stream format, as passed to HPI interface */ /** Stream format, as passed to HPI interface */
HPI_FORMAT hpiFormat; struct hpi_format hpiFormat;
/** Number of bytes per frame, derived from hpiFormat and saved for convenience */ /** Number of bytes per frame, derived from hpiFormat and saved for convenience */
HW32 bytesPerFrame; uint32_t bytesPerFrame;
/** Size of hardware (on-card) buffer of stream in bytes */ /** Size of hardware (on-card) buffer of stream in bytes */
HW32 hardwareBufferSize; uint32_t hardwareBufferSize;
/** Size of host (BBM) buffer of stream in bytes (if used) */ /** Size of host (BBM) buffer of stream in bytes (if used) */
HW32 hostBufferSize; uint32_t hostBufferSize;
/** Upper limit on the utilization of output stream buffer (both hardware and host). /** Upper limit on the utilization of output stream buffer (both hardware and host).
This prevents large latencies in an output-only stream with a potentially huge buffer This prevents large latencies in an output-only stream with a potentially huge buffer
and a fast data generator, which would otherwise keep the hardware buffer filled to and a fast data generator, which would otherwise keep the hardware buffer filled to
capacity. See also the "Hardware Buffering=off" option in the AudioScience WAV driver. */ capacity. See also the "Hardware Buffering=off" option in the AudioScience WAV driver. */
HW32 outputBufferCap; uint32_t outputBufferCap;
/** Sample buffer (halfway station between HPI and buffer processor) */ /** Sample buffer (halfway station between HPI and buffer processor) */
HW8 *tempBuffer; uint8_t *tempBuffer;
/** Sample buffer size, in bytes */ /** Sample buffer size, in bytes */
HW32 tempBufferSize; uint32_t tempBufferSize;
} }
PaAsiHpiStreamComponent; PaAsiHpiStreamComponent;
@ -369,7 +365,7 @@ typedef struct PaAsiHpiStream
PaAsiHpiStreamComponent *input, *output; PaAsiHpiStreamComponent *input, *output;
/** Polling interval (in milliseconds) */ /** Polling interval (in milliseconds) */
HW32 pollingInterval; uint32_t pollingInterval;
/** Are we running in callback mode? */ /** Are we running in callback mode? */
int callbackMode; int callbackMode;
/** Number of frames to transfer at a time to/from HPI */ /** Number of frames to transfer at a time to/from HPI */
@ -401,23 +397,23 @@ PaAsiHpiStream;
typedef struct PaAsiHpiStreamInfo typedef struct PaAsiHpiStreamInfo
{ {
/** HPI stream state (HPI_STATE_STOPPED, HPI_STATE_PLAYING, etc.) */ /** HPI stream state (HPI_STATE_STOPPED, HPI_STATE_PLAYING, etc.) */
HW16 state; uint16_t state;
/** Size (in bytes) of recording/playback data buffer in HPI driver */ /** Size (in bytes) of recording/playback data buffer in HPI driver */
HW32 bufferSize; uint32_t bufferSize;
/** Amount of data (in bytes) available in the buffer */ /** Amount of data (in bytes) available in the buffer */
HW32 dataSize; uint32_t dataSize;
/** Number of frames played/recorded since last stream reset */ /** Number of frames played/recorded since last stream reset */
HW32 frameCounter; uint32_t frameCounter;
/** Amount of data (in bytes) in hardware (on-card) buffer. /** Amount of data (in bytes) in hardware (on-card) buffer.
This differs from dataSize if bus mastering (BBM) is used, which introduces another This differs from dataSize if bus mastering (BBM) is used, which introduces another
driver-level buffer to which dataSize/bufferSize then refers. */ driver-level buffer to which dataSize/bufferSize then refers. */
HW32 auxDataSize; uint32_t auxDataSize;
/** Total number of data frames currently buffered by HPI driver (host + hw buffers) */ /** Total number of data frames currently buffered by HPI driver (host + hw buffers) */
HW32 totalBufferedData; uint32_t totalBufferedData;
/** Size of immediately available data (for input) or space (for output) in frames. /** Size of immediately available data (for input) or space (for output) in frames.
This only checks the first-level buffer (typically host buffer). This amount can be This only checks the first-level buffer (typically host buffer). This amount can be
transferred immediately. */ transferred immediately. */
HW32 availableFrames; uint32_t availableFrames;
/** Indicates that hardware buffer is getting too full */ /** Indicates that hardware buffer is getting too full */
int overflow; int overflow;
/** Indicates that hardware buffer is getting too empty */ /** Indicates that hardware buffer is getting too empty */
@ -479,21 +475,21 @@ static void *CallbackThreadFunc( void *userData );
/* Functions specific to this API */ /* Functions specific to this API */
static PaError PaAsiHpi_BuildDeviceList( PaAsiHpiHostApiRepresentation *hpiHostApi ); static PaError PaAsiHpi_BuildDeviceList( PaAsiHpiHostApiRepresentation *hpiHostApi );
static HW16 PaAsiHpi_PaToHpiFormat( PaSampleFormat paFormat ); static uint16_t PaAsiHpi_PaToHpiFormat( PaSampleFormat paFormat );
static PaSampleFormat PaAsiHpi_HpiToPaFormat( HW16 hpiFormat ); static PaSampleFormat PaAsiHpi_HpiToPaFormat( uint16_t hpiFormat );
static PaError PaAsiHpi_CreateFormat( struct PaUtilHostApiRepresentation *hostApi, static PaError PaAsiHpi_CreateFormat( struct PaUtilHostApiRepresentation *hostApi,
const PaStreamParameters *parameters, double sampleRate, const PaStreamParameters *parameters, double sampleRate,
PaAsiHpiDeviceInfo **hpiDevice, HPI_FORMAT *hpiFormat ); PaAsiHpiDeviceInfo **hpiDevice, struct hpi_format *hpiFormat );
static PaError PaAsiHpi_OpenInput( struct PaUtilHostApiRepresentation *hostApi, static PaError PaAsiHpi_OpenInput( struct PaUtilHostApiRepresentation *hostApi,
const PaAsiHpiDeviceInfo *hpiDevice, const HPI_FORMAT *hpiFormat, const PaAsiHpiDeviceInfo *hpiDevice, const struct hpi_format *hpiFormat,
HPI_HISTREAM *hpiStream ); hpi_handle_t *hpiStream );
static PaError PaAsiHpi_OpenOutput( struct PaUtilHostApiRepresentation *hostApi, static PaError PaAsiHpi_OpenOutput( struct PaUtilHostApiRepresentation *hostApi,
const PaAsiHpiDeviceInfo *hpiDevice, const HPI_FORMAT *hpiFormat, const PaAsiHpiDeviceInfo *hpiDevice, const struct hpi_format *hpiFormat,
HPI_HOSTREAM *hpiStream ); hpi_handle_t *hpiStream );
static PaError PaAsiHpi_GetStreamInfo( PaAsiHpiStreamComponent *streamComp, PaAsiHpiStreamInfo *info ); static PaError PaAsiHpi_GetStreamInfo( PaAsiHpiStreamComponent *streamComp, PaAsiHpiStreamInfo *info );
static void PaAsiHpi_StreamComponentDump( PaAsiHpiStreamComponent *streamComp, PaAsiHpiStream *stream ); static void PaAsiHpi_StreamComponentDump( PaAsiHpiStreamComponent *streamComp, PaAsiHpiStream *stream );
static void PaAsiHpi_StreamDump( PaAsiHpiStream *stream ); static void PaAsiHpi_StreamDump( PaAsiHpiStream *stream );
static PaError PaAsiHpi_SetupBuffers( PaAsiHpiStreamComponent *streamComp, HW32 pollingInterval, static PaError PaAsiHpi_SetupBuffers( PaAsiHpiStreamComponent *streamComp, uint32_t pollingInterval,
unsigned long framesPerPaHostBuffer, PaTime suggestedLatency ); unsigned long framesPerPaHostBuffer, PaTime suggestedLatency );
static PaError PaAsiHpi_PrimeOutputWithSilence( PaAsiHpiStream *stream ); static PaError PaAsiHpi_PrimeOutputWithSilence( PaAsiHpiStream *stream );
static PaError PaAsiHpi_StartStream( PaAsiHpiStream *stream, int outputPrimed ); static PaError PaAsiHpi_StartStream( PaAsiHpiStream *stream, int outputPrimed );
@ -529,43 +525,38 @@ static PaError PaAsiHpi_BuildDeviceList( PaAsiHpiHostApiRepresentation *hpiHostA
PaUtilHostApiRepresentation *hostApi = &hpiHostApi->baseHostApiRep; PaUtilHostApiRepresentation *hostApi = &hpiHostApi->baseHostApiRep;
PaHostApiInfo *baseApiInfo = &hostApi->info; PaHostApiInfo *baseApiInfo = &hostApi->info;
PaAsiHpiDeviceInfo *hpiDeviceList; PaAsiHpiDeviceInfo *hpiDeviceList;
HW16 adapterList[ HPI_MAX_ADAPTERS ]; int numAdapters;
HW16 numAdapters; hpi_err_t hpiError = 0;
HW16 hpiError = 0;
int i, j, deviceCount = 0, deviceIndex = 0; int i, j, deviceCount = 0, deviceIndex = 0;
assert( hpiHostApi ); assert( hpiHostApi );
assert( hpiHostApi->subSys );
/* Look for adapters (not strictly necessary, as AdapterOpen can do the same, but this */
/* way we have less errors since we do not try to open adapters we know aren't there) */
/* Errors not considered critical here (subsystem may report 0 devices), but report them */ /* Errors not considered critical here (subsystem may report 0 devices), but report them */
/* in debug mode. */ /* in debug mode. */
PA_ASIHPI_UNLESS_( HPI_SubSysFindAdapters( hpiHostApi->subSys, &numAdapters, PA_ASIHPI_UNLESS_( HPI_SubSysGetNumAdapters( NULL, &numAdapters), paNoError );
adapterList, HPI_MAX_ADAPTERS ), paNoError );
/* First open and count the number of devices (= number of streams), to ease memory allocation */ for( i=0; i < numAdapters; ++i )
for( i=0; i < HPI_MAX_ADAPTERS; ++i )
{ {
HW16 inStreams, outStreams; uint16_t inStreams, outStreams;
HW16 version; uint16_t version;
HW32 serial; uint32_t serial;
HW16 type; uint16_t type;
uint32_t idx;
/* If no adapter found at this index, skip it */ hpiError = HPI_SubSysGetAdapter(NULL, i, &idx, &type);
if( adapterList[i] == 0 ) if (hpiError)
continue; continue;
/* Try to open adapter */ /* Try to open adapter */
hpiError = HPI_AdapterOpen( hpiHostApi->subSys, i ); hpiError = HPI_AdapterOpen( NULL, idx );
/* Report error and skip to next device on failure */ /* Report error and skip to next device on failure */
if( hpiError ) if( hpiError )
{ {
PA_ASIHPI_REPORT_ERROR_( hpiError ); PA_ASIHPI_REPORT_ERROR_( hpiError );
continue; continue;
} }
hpiError = HPI_AdapterGetInfo( hpiHostApi->subSys, i, hpiError = HPI_AdapterGetInfo( NULL, idx, &outStreams, &inStreams,
&outStreams, &inStreams, &version, &serial, &type ); &version, &serial, &type );
/* Skip to next device on failure */ /* Skip to next device on failure */
if( hpiError ) if( hpiError )
{ {
@ -597,19 +588,20 @@ static PaError PaAsiHpi_BuildDeviceList( PaAsiHpiHostApiRepresentation *hpiHostA
paInsufficientMemory ); paInsufficientMemory );
/* Now query devices again for information */ /* Now query devices again for information */
for( i=0; i < HPI_MAX_ADAPTERS; ++i ) for( i=0; i < numAdapters; ++i )
{ {
HW16 inStreams, outStreams; uint16_t inStreams, outStreams;
HW16 version; uint16_t version;
HW32 serial; uint32_t serial;
HW16 type; uint16_t type;
uint32_t idx;
/* If no adapter found at this index, skip it */ hpiError = HPI_SubSysGetAdapter( NULL, i, &idx, &type );
if( adapterList[i] == 0 ) if (hpiError)
continue; continue;
/* Assume adapter is still open from previous round */ /* Assume adapter is still open from previous round */
hpiError = HPI_AdapterGetInfo( hpiHostApi->subSys, i, hpiError = HPI_AdapterGetInfo( NULL, idx,
&outStreams, &inStreams, &version, &serial, &type ); &outStreams, &inStreams, &version, &serial, &type );
/* Report error and skip to next device on failure */ /* Report error and skip to next device on failure */
if( hpiError ) if( hpiError )
@ -620,7 +612,7 @@ static PaError PaAsiHpi_BuildDeviceList( PaAsiHpiHostApiRepresentation *hpiHostA
else else
{ {
PA_DEBUG(( "Found HPI Adapter ID=%4X Idx=%d #In=%d #Out=%d S/N=%d HWver=%c%d DSPver=%03d\n", PA_DEBUG(( "Found HPI Adapter ID=%4X Idx=%d #In=%d #Out=%d S/N=%d HWver=%c%d DSPver=%03d\n",
type, i, inStreams, outStreams, serial, type, idx, inStreams, outStreams, serial,
((version>>3)&0xf)+'A', /* Hw version major */ ((version>>3)&0xf)+'A', /* Hw version major */
version&0x7, /* Hw version minor */ version&0x7, /* Hw version minor */
((version>>13)*100)+((version>>7)&0x3f) /* DSP code version */ ((version>>13)*100)+((version>>7)&0x3f) /* DSP code version */
@ -637,8 +629,7 @@ static PaError PaAsiHpi_BuildDeviceList( PaAsiHpiHostApiRepresentation *hpiHostA
memset( hpiDevice, 0, sizeof(PaAsiHpiDeviceInfo) ); memset( hpiDevice, 0, sizeof(PaAsiHpiDeviceInfo) );
/* Set implementation-specific device details */ /* Set implementation-specific device details */
hpiDevice->subSys = hpiHostApi->subSys; hpiDevice->adapterIndex = idx;
hpiDevice->adapterIndex = i;
hpiDevice->adapterType = type; hpiDevice->adapterType = type;
hpiDevice->adapterVersion = version; hpiDevice->adapterVersion = version;
hpiDevice->adapterSerialNumber = serial; hpiDevice->adapterSerialNumber = serial;
@ -680,8 +671,7 @@ static PaError PaAsiHpi_BuildDeviceList( PaAsiHpiHostApiRepresentation *hpiHostA
memset( hpiDevice, 0, sizeof(PaAsiHpiDeviceInfo) ); memset( hpiDevice, 0, sizeof(PaAsiHpiDeviceInfo) );
/* Set implementation-specific device details */ /* Set implementation-specific device details */
hpiDevice->subSys = hpiHostApi->subSys; hpiDevice->adapterIndex = idx;
hpiDevice->adapterIndex = i;
hpiDevice->adapterType = type; hpiDevice->adapterType = type;
hpiDevice->adapterVersion = version; hpiDevice->adapterVersion = version;
hpiDevice->adapterSerialNumber = serial; hpiDevice->adapterSerialNumber = serial;
@ -740,32 +730,31 @@ PaError PaAsiHpi_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiInd
PaAsiHpiHostApiRepresentation *hpiHostApi = NULL; PaAsiHpiHostApiRepresentation *hpiHostApi = NULL;
PaHostApiInfo *baseApiInfo; PaHostApiInfo *baseApiInfo;
/* Try to initialize HPI subsystem */
if (!HPI_SubSysCreate())
{
/* the V19 development docs say that if an implementation
* detects that it cannot be used, it should return a NULL
* interface and paNoError */
PA_DEBUG(( "Could not open HPI interface\n" ));
*hostApi = NULL;
return paNoError;
}
else
{
uint32_t hpiVersion;
PA_ASIHPI_UNLESS_( HPI_SubSysGetVersionEx( NULL, &hpiVersion ), paUnanticipatedHostError );
PA_DEBUG(( "HPI interface v%d.%02d.%02d\n",
hpiVersion >> 16, (hpiVersion >> 8) & 0x0F, (hpiVersion & 0x0F) ));
}
/* Allocate host API structure */ /* Allocate host API structure */
PA_UNLESS_( hpiHostApi = (PaAsiHpiHostApiRepresentation*) PaUtil_AllocateMemory( PA_UNLESS_( hpiHostApi = (PaAsiHpiHostApiRepresentation*) PaUtil_AllocateMemory(
sizeof(PaAsiHpiHostApiRepresentation) ), paInsufficientMemory ); sizeof(PaAsiHpiHostApiRepresentation) ), paInsufficientMemory );
PA_UNLESS_( hpiHostApi->allocations = PaUtil_CreateAllocationGroup(), paInsufficientMemory ); PA_UNLESS_( hpiHostApi->allocations = PaUtil_CreateAllocationGroup(), paInsufficientMemory );
hpiHostApi->hostApiIndex = hostApiIndex; hpiHostApi->hostApiIndex = hostApiIndex;
hpiHostApi->subSys = NULL;
/* Try to initialize HPI subsystem */
if( ( hpiHostApi->subSys = HPI_SubSysCreate() ) == NULL)
{
/* the V19 development docs say that if an implementation
* detects that it cannot be used, it should return a NULL
* interface and paNoError */
PA_DEBUG(( "Could not open HPI interface\n" ));
result = paNoError;
*hostApi = NULL;
goto error;
}
else
{
HW32 hpiVersion;
PA_ASIHPI_UNLESS_( HPI_SubSysGetVersion( hpiHostApi->subSys, &hpiVersion ), paUnanticipatedHostError );
PA_DEBUG(( "HPI interface v%d.%02d\n",
hpiVersion >> 8, 10*((hpiVersion & 0xF0) >> 4) + (hpiVersion & 0x0F) ));
}
*hostApi = &hpiHostApi->baseHostApiRep; *hostApi = &hpiHostApi->baseHostApiRep;
baseApiInfo = &((*hostApi)->info); baseApiInfo = &((*hostApi)->info);
@ -799,8 +788,8 @@ PaError PaAsiHpi_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiInd
return result; return result;
error: error:
/* Clean up memory */ if (hpiHostApi)
Terminate( (PaUtilHostApiRepresentation *)hpiHostApi ); PaUtil_FreeMemory( hpiHostApi );
return result; return result;
} }
@ -820,9 +809,7 @@ static void Terminate( struct PaUtilHostApiRepresentation *hostApi )
if( hpiHostApi ) if( hpiHostApi )
{ {
/* Get rid of HPI-specific structures */ /* Get rid of HPI-specific structures */
if( hpiHostApi->subSys ) uint16_t lastAdapterIndex = HPI_MAX_ADAPTERS;
{
HW16 lastAdapterIndex = HPI_MAX_ADAPTERS;
/* Iterate through device list and close adapters */ /* Iterate through device list and close adapters */
for( i=0; i < hostApi->info.deviceCount; ++i ) for( i=0; i < hostApi->info.deviceCount; ++i )
{ {
@ -831,14 +818,13 @@ static void Terminate( struct PaUtilHostApiRepresentation *hostApi )
if( hpiDevice->adapterIndex != lastAdapterIndex ) if( hpiDevice->adapterIndex != lastAdapterIndex )
{ {
/* Ignore errors (report only during debugging) */ /* Ignore errors (report only during debugging) */
PA_ASIHPI_UNLESS_( HPI_AdapterClose( hpiHostApi->subSys, PA_ASIHPI_UNLESS_( HPI_AdapterClose( NULL,
hpiDevice->adapterIndex ), paNoError ); hpiDevice->adapterIndex ), paNoError );
lastAdapterIndex = hpiDevice->adapterIndex; lastAdapterIndex = hpiDevice->adapterIndex;
} }
} }
/* Finally dismantle HPI subsystem */ /* Finally dismantle HPI subsystem */
HPI_SubSysFree( hpiHostApi->subSys ); HPI_SubSysFree( NULL );
}
if( hpiHostApi->allocations ) if( hpiHostApi->allocations )
{ {
@ -859,7 +845,7 @@ error:
@return HPI sample format @return HPI sample format
*/ */
static HW16 PaAsiHpi_PaToHpiFormat( PaSampleFormat paFormat ) static uint16_t PaAsiHpi_PaToHpiFormat( PaSampleFormat paFormat )
{ {
/* Ignore interleaving flag */ /* Ignore interleaving flag */
switch( paFormat & ~paNonInterleaved ) switch( paFormat & ~paNonInterleaved )
@ -893,7 +879,7 @@ static HW16 PaAsiHpi_PaToHpiFormat( PaSampleFormat paFormat )
@return PortAudio sample format @return PortAudio sample format
*/ */
static PaSampleFormat PaAsiHpi_HpiToPaFormat( HW16 hpiFormat ) static PaSampleFormat PaAsiHpi_HpiToPaFormat( uint16_t hpiFormat )
{ {
switch( hpiFormat ) switch( hpiFormat )
{ {
@ -938,11 +924,11 @@ static PaSampleFormat PaAsiHpi_HpiToPaFormat( HW16 hpiFormat )
*/ */
static PaError PaAsiHpi_CreateFormat( struct PaUtilHostApiRepresentation *hostApi, static PaError PaAsiHpi_CreateFormat( struct PaUtilHostApiRepresentation *hostApi,
const PaStreamParameters *parameters, double sampleRate, const PaStreamParameters *parameters, double sampleRate,
PaAsiHpiDeviceInfo **hpiDevice, HPI_FORMAT *hpiFormat ) PaAsiHpiDeviceInfo **hpiDevice, struct hpi_format *hpiFormat )
{ {
int maxChannelCount = 0; int maxChannelCount = 0;
PaSampleFormat hostSampleFormat = 0; PaSampleFormat hostSampleFormat = 0;
HW16 hpiError = 0; hpi_err_t hpiError = 0;
/* Unless alternate device specification is supported, reject the use of /* Unless alternate device specification is supported, reject the use of
paUseHostApiSpecificDeviceSpecification */ paUseHostApiSpecificDeviceSpecification */
@ -979,9 +965,9 @@ static PaError PaAsiHpi_CreateFormat( struct PaUtilHostApiRepresentation *hostAp
hostSampleFormat = PaUtil_SelectClosestAvailableFormat(PA_ASIHPI_AVAILABLE_FORMATS_, hostSampleFormat = PaUtil_SelectClosestAvailableFormat(PA_ASIHPI_AVAILABLE_FORMATS_,
parameters->sampleFormat ); parameters->sampleFormat );
/* Setup format + info objects */ /* Setup format + info objects */
hpiError = HPI_FormatCreate( hpiFormat, (HW16)parameters->channelCount, hpiError = HPI_FormatCreate( hpiFormat, (uint16_t)parameters->channelCount,
PaAsiHpi_PaToHpiFormat( hostSampleFormat ), PaAsiHpi_PaToHpiFormat( hostSampleFormat ),
(HW32)sampleRate, 0, 0 ); (uint32_t)sampleRate, 0, 0 );
if( hpiError ) if( hpiError )
{ {
PA_ASIHPI_REPORT_ERROR_( hpiError ); PA_ASIHPI_REPORT_ERROR_( hpiError );
@ -1016,25 +1002,25 @@ static PaError PaAsiHpi_CreateFormat( struct PaUtilHostApiRepresentation *hostAp
@return PortAudio error code (typically indicating a problem with stream format or device) @return PortAudio error code (typically indicating a problem with stream format or device)
*/ */
static PaError PaAsiHpi_OpenInput( struct PaUtilHostApiRepresentation *hostApi, static PaError PaAsiHpi_OpenInput( struct PaUtilHostApiRepresentation *hostApi,
const PaAsiHpiDeviceInfo *hpiDevice, const HPI_FORMAT *hpiFormat, const PaAsiHpiDeviceInfo *hpiDevice, const struct hpi_format *hpiFormat,
HPI_HISTREAM *hpiStream ) hpi_handle_t *hpiStream )
{ {
PaAsiHpiHostApiRepresentation *hpiHostApi = (PaAsiHpiHostApiRepresentation*)hostApi; PaAsiHpiHostApiRepresentation *hpiHostApi = (PaAsiHpiHostApiRepresentation*)hostApi;
PaError result = paNoError; PaError result = paNoError;
HW16 hpiError = 0; hpi_err_t hpiError = 0;
/* Catch misplaced output devices, as they typically have 0 input channels */ /* Catch misplaced output devices, as they typically have 0 input channels */
PA_UNLESS_( !hpiDevice->streamIsOutput, paInvalidChannelCount ); PA_UNLESS_( !hpiDevice->streamIsOutput, paInvalidChannelCount );
/* Try to open input stream */ /* Try to open input stream */
PA_ASIHPI_UNLESS_( HPI_InStreamOpen( hpiHostApi->subSys, hpiDevice->adapterIndex, PA_ASIHPI_UNLESS_( HPI_InStreamOpen( NULL, hpiDevice->adapterIndex,
hpiDevice->streamIndex, hpiStream ), paDeviceUnavailable ); hpiDevice->streamIndex, hpiStream ), paDeviceUnavailable );
/* Set input format (checking it in the process) */ /* Set input format (checking it in the process) */
/* Could also use HPI_InStreamQueryFormat, but this economizes the process */ /* Could also use HPI_InStreamQueryFormat, but this economizes the process */
hpiError = HPI_InStreamSetFormat( hpiHostApi->subSys, *hpiStream, (HPI_FORMAT*)hpiFormat ); hpiError = HPI_InStreamSetFormat( NULL, *hpiStream, (struct hpi_format*)hpiFormat );
if( hpiError ) if( hpiError )
{ {
PA_ASIHPI_REPORT_ERROR_( hpiError ); PA_ASIHPI_REPORT_ERROR_( hpiError );
PA_ASIHPI_UNLESS_( HPI_InStreamClose( hpiHostApi->subSys, *hpiStream ), paNoError ); PA_ASIHPI_UNLESS_( HPI_InStreamClose( NULL, *hpiStream ), paNoError );
switch( hpiError ) switch( hpiError )
{ {
case HPI_ERROR_INVALID_FORMAT: case HPI_ERROR_INVALID_FORMAT:
@ -1071,25 +1057,25 @@ error:
@return PortAudio error code (typically indicating a problem with stream format or device) @return PortAudio error code (typically indicating a problem with stream format or device)
*/ */
static PaError PaAsiHpi_OpenOutput( struct PaUtilHostApiRepresentation *hostApi, static PaError PaAsiHpi_OpenOutput( struct PaUtilHostApiRepresentation *hostApi,
const PaAsiHpiDeviceInfo *hpiDevice, const HPI_FORMAT *hpiFormat, const PaAsiHpiDeviceInfo *hpiDevice, const struct hpi_format *hpiFormat,
HPI_HOSTREAM *hpiStream ) hpi_handle_t *hpiStream )
{ {
PaAsiHpiHostApiRepresentation *hpiHostApi = (PaAsiHpiHostApiRepresentation*)hostApi; PaAsiHpiHostApiRepresentation *hpiHostApi = (PaAsiHpiHostApiRepresentation*)hostApi;
PaError result = paNoError; PaError result = paNoError;
HW16 hpiError = 0; hpi_err_t hpiError = 0;
/* Catch misplaced input devices, as they typically have 0 output channels */ /* Catch misplaced input devices, as they typically have 0 output channels */
PA_UNLESS_( hpiDevice->streamIsOutput, paInvalidChannelCount ); PA_UNLESS_( hpiDevice->streamIsOutput, paInvalidChannelCount );
/* Try to open output stream */ /* Try to open output stream */
PA_ASIHPI_UNLESS_( HPI_OutStreamOpen( hpiHostApi->subSys, hpiDevice->adapterIndex, PA_ASIHPI_UNLESS_( HPI_OutStreamOpen( NULL, hpiDevice->adapterIndex,
hpiDevice->streamIndex, hpiStream ), paDeviceUnavailable ); hpiDevice->streamIndex, hpiStream ), paDeviceUnavailable );
/* Check output format (format is set on first write to output stream) */ /* Check output format (format is set on first write to output stream) */
hpiError = HPI_OutStreamQueryFormat( hpiHostApi->subSys, *hpiStream, (HPI_FORMAT*)hpiFormat ); hpiError = HPI_OutStreamQueryFormat( NULL, *hpiStream, (struct hpi_format*)hpiFormat );
if( hpiError ) if( hpiError )
{ {
PA_ASIHPI_REPORT_ERROR_( hpiError ); PA_ASIHPI_REPORT_ERROR_( hpiError );
PA_ASIHPI_UNLESS_( HPI_OutStreamClose( hpiHostApi->subSys, *hpiStream ), paNoError ); PA_ASIHPI_UNLESS_( HPI_OutStreamClose( NULL, *hpiStream ), paNoError );
switch( hpiError ) switch( hpiError )
{ {
case HPI_ERROR_INVALID_FORMAT: case HPI_ERROR_INVALID_FORMAT:
@ -1135,12 +1121,12 @@ static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi,
PaError result = paFormatIsSupported; PaError result = paFormatIsSupported;
PaAsiHpiHostApiRepresentation *hpiHostApi = (PaAsiHpiHostApiRepresentation*)hostApi; PaAsiHpiHostApiRepresentation *hpiHostApi = (PaAsiHpiHostApiRepresentation*)hostApi;
PaAsiHpiDeviceInfo *hpiDevice = NULL; PaAsiHpiDeviceInfo *hpiDevice = NULL;
HPI_FORMAT hpiFormat; struct hpi_format hpiFormat;
/* Input stream */ /* Input stream */
if( inputParameters ) if( inputParameters )
{ {
HPI_HISTREAM hpiStream; hpi_handle_t hpiStream;
PA_DEBUG(( "%s: Checking input params: dev=%d, sr=%d, chans=%d, fmt=%d\n", PA_DEBUG(( "%s: Checking input params: dev=%d, sr=%d, chans=%d, fmt=%d\n",
__FUNCTION__, inputParameters->device, (int)sampleRate, __FUNCTION__, inputParameters->device, (int)sampleRate,
inputParameters->channelCount, inputParameters->sampleFormat )); inputParameters->channelCount, inputParameters->sampleFormat ));
@ -1150,13 +1136,13 @@ static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi,
/* Open stream to further check format */ /* Open stream to further check format */
PA_ENSURE_( PaAsiHpi_OpenInput( hostApi, hpiDevice, &hpiFormat, &hpiStream ) ); PA_ENSURE_( PaAsiHpi_OpenInput( hostApi, hpiDevice, &hpiFormat, &hpiStream ) );
/* Close stream again */ /* Close stream again */
PA_ASIHPI_UNLESS_( HPI_InStreamClose( hpiHostApi->subSys, hpiStream ), paNoError ); PA_ASIHPI_UNLESS_( HPI_InStreamClose( NULL, hpiStream ), paNoError );
} }
/* Output stream */ /* Output stream */
if( outputParameters ) if( outputParameters )
{ {
HPI_HOSTREAM hpiStream; hpi_handle_t hpiStream;
PA_DEBUG(( "%s: Checking output params: dev=%d, sr=%d, chans=%d, fmt=%d\n", PA_DEBUG(( "%s: Checking output params: dev=%d, sr=%d, chans=%d, fmt=%d\n",
__FUNCTION__, outputParameters->device, (int)sampleRate, __FUNCTION__, outputParameters->device, (int)sampleRate,
outputParameters->channelCount, outputParameters->sampleFormat )); outputParameters->channelCount, outputParameters->sampleFormat ));
@ -1166,7 +1152,7 @@ static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi,
/* Open stream to further check format */ /* Open stream to further check format */
PA_ENSURE_( PaAsiHpi_OpenOutput( hostApi, hpiDevice, &hpiFormat, &hpiStream ) ); PA_ENSURE_( PaAsiHpi_OpenOutput( hostApi, hpiDevice, &hpiFormat, &hpiStream ) );
/* Close stream again */ /* Close stream again */
PA_ASIHPI_UNLESS_( HPI_OutStreamClose( hpiHostApi->subSys, hpiStream ), paNoError ); PA_ASIHPI_UNLESS_( HPI_OutStreamClose( NULL, hpiStream ), paNoError );
} }
error: error:
@ -1188,9 +1174,9 @@ error:
static PaError PaAsiHpi_GetStreamInfo( PaAsiHpiStreamComponent *streamComp, PaAsiHpiStreamInfo *info ) static PaError PaAsiHpi_GetStreamInfo( PaAsiHpiStreamComponent *streamComp, PaAsiHpiStreamInfo *info )
{ {
PaError result = paDeviceUnavailable; PaError result = paDeviceUnavailable;
HW16 state; uint16_t state;
HW32 bufferSize, dataSize, frameCounter, auxDataSize, threshold; uint32_t bufferSize, dataSize, frameCounter, auxDataSize, threshold;
HW32 hwBufferSize, hwDataSize; uint32_t hwBufferSize, hwDataSize;
assert( streamComp ); assert( streamComp );
assert( info ); assert( info );
@ -1212,14 +1198,14 @@ static PaError PaAsiHpi_GetStreamInfo( PaAsiHpiStreamComponent *streamComp, PaAs
/* Obtain detailed stream info (either input or output) */ /* Obtain detailed stream info (either input or output) */
if( streamComp->hpiDevice->streamIsOutput ) if( streamComp->hpiDevice->streamIsOutput )
{ {
PA_ASIHPI_UNLESS_( HPI_OutStreamGetInfoEx( streamComp->hpiDevice->subSys, PA_ASIHPI_UNLESS_( HPI_OutStreamGetInfoEx( NULL,
streamComp->hpiStream, streamComp->hpiStream,
&state, &bufferSize, &dataSize, &frameCounter, &state, &bufferSize, &dataSize, &frameCounter,
&auxDataSize ), paUnanticipatedHostError ); &auxDataSize ), paUnanticipatedHostError );
} }
else else
{ {
PA_ASIHPI_UNLESS_( HPI_InStreamGetInfoEx( streamComp->hpiDevice->subSys, PA_ASIHPI_UNLESS_( HPI_InStreamGetInfoEx( NULL,
streamComp->hpiStream, streamComp->hpiStream,
&state, &bufferSize, &dataSize, &frameCounter, &state, &bufferSize, &dataSize, &frameCounter,
&auxDataSize ), paUnanticipatedHostError ); &auxDataSize ), paUnanticipatedHostError );
@ -1479,7 +1465,7 @@ static void PaAsiHpi_StreamDump( PaAsiHpiStream *stream )
@return PortAudio error code (possibly paBufferTooBig or paInsufficientMemory) @return PortAudio error code (possibly paBufferTooBig or paInsufficientMemory)
*/ */
static PaError PaAsiHpi_SetupBuffers( PaAsiHpiStreamComponent *streamComp, HW32 pollingInterval, static PaError PaAsiHpi_SetupBuffers( PaAsiHpiStreamComponent *streamComp, uint32_t pollingInterval,
unsigned long framesPerPaHostBuffer, PaTime suggestedLatency ) unsigned long framesPerPaHostBuffer, PaTime suggestedLatency )
{ {
PaError result = paNoError; PaError result = paNoError;
@ -1499,8 +1485,8 @@ static PaError PaAsiHpi_SetupBuffers( PaAsiHpiStreamComponent *streamComp, HW32
/* Check if BBM (background bus mastering) is to be enabled */ /* Check if BBM (background bus mastering) is to be enabled */
if( PA_ASIHPI_USE_BBM_ ) if( PA_ASIHPI_USE_BBM_ )
{ {
HW32 bbmBufferSize = 0, preLatencyBufferSize = 0; uint32_t bbmBufferSize = 0, preLatencyBufferSize = 0;
HW16 hpiError = 0; hpi_err_t hpiError = 0;
PaTime pollingOverhead; PaTime pollingOverhead;
/* Check overhead of Pa_Sleep() call (minimum sleep duration in ms -> OS dependent) */ /* Check overhead of Pa_Sleep() call (minimum sleep duration in ms -> OS dependent) */
@ -1510,7 +1496,7 @@ static PaError PaAsiHpi_SetupBuffers( PaAsiHpiStreamComponent *streamComp, HW32
PA_DEBUG(( "polling overhead = %f ms (length of 0-second sleep)\n", pollingOverhead )); PA_DEBUG(( "polling overhead = %f ms (length of 0-second sleep)\n", pollingOverhead ));
/* Obtain minimum recommended size for host buffer (in bytes) */ /* Obtain minimum recommended size for host buffer (in bytes) */
PA_ASIHPI_UNLESS_( HPI_StreamEstimateBufferSize( &streamComp->hpiFormat, PA_ASIHPI_UNLESS_( HPI_StreamEstimateBufferSize( &streamComp->hpiFormat,
pollingInterval + (HW32)ceil( pollingOverhead ), pollingInterval + (uint32_t)ceil( pollingOverhead ),
&bbmBufferSize ), paUnanticipatedHostError ); &bbmBufferSize ), paUnanticipatedHostError );
/* BBM places more stringent requirements on buffer size (see description */ /* BBM places more stringent requirements on buffer size (see description */
/* of HPI_StreamEstimateBufferSize in HPI API document) */ /* of HPI_StreamEstimateBufferSize in HPI API document) */
@ -1528,27 +1514,26 @@ static PaError PaAsiHpi_SetupBuffers( PaAsiHpiStreamComponent *streamComp, HW32
{ {
/* Save old buffer size, to be retried if new size proves too big */ /* Save old buffer size, to be retried if new size proves too big */
preLatencyBufferSize = bbmBufferSize; preLatencyBufferSize = bbmBufferSize;
bbmBufferSize = (HW32)ceil( suggestedLatency * streamComp->bytesPerFrame bbmBufferSize = (uint32_t)ceil( suggestedLatency * streamComp->bytesPerFrame
* streamComp->hpiFormat.dwSampleRate ); * streamComp->hpiFormat.dwSampleRate );
} }
} }
/* Choose closest memory block boundary (HPI API document states that /* Choose closest memory block boundary (HPI API document states that
"a buffer size of Nx4096 - 20 makes the best use of memory" "a buffer size of Nx4096 - 20 makes the best use of memory"
(under the entry for HPI_StreamEstimateBufferSize)) */ (under the entry for HPI_StreamEstimateBufferSize)) */
bbmBufferSize = ((HW32)ceil((bbmBufferSize + 20)/4096.0))*4096 - 20; bbmBufferSize = ((uint32_t)ceil((bbmBufferSize + 20)/4096.0))*4096 - 20;
streamComp->hostBufferSize = bbmBufferSize; streamComp->hostBufferSize = bbmBufferSize;
/* Allocate BBM host buffer (this enables bus mastering transfers in background) */ /* Allocate BBM host buffer (this enables bus mastering transfers in background) */
if( streamComp->hpiDevice->streamIsOutput ) if( streamComp->hpiDevice->streamIsOutput )
hpiError = HPI_OutStreamHostBufferAllocate( streamComp->hpiDevice->subSys, hpiError = HPI_OutStreamHostBufferAllocate( NULL,
streamComp->hpiStream, streamComp->hpiStream,
bbmBufferSize ); bbmBufferSize );
else else
hpiError = HPI_InStreamHostBufferAllocate( streamComp->hpiDevice->subSys, hpiError = HPI_InStreamHostBufferAllocate( NULL,
streamComp->hpiStream, streamComp->hpiStream,
bbmBufferSize ); bbmBufferSize );
if( hpiError ) if( hpiError )
{ {
PA_ASIHPI_REPORT_ERROR_( hpiError );
/* Indicate that BBM is disabled */ /* Indicate that BBM is disabled */
streamComp->hostBufferSize = 0; streamComp->hostBufferSize = 0;
/* Retry with smaller buffer size (transfers will still work, but not via BBM) */ /* Retry with smaller buffer size (transfers will still work, but not via BBM) */
@ -1561,11 +1546,11 @@ static PaError PaAsiHpi_SetupBuffers( PaAsiHpiStreamComponent *streamComp, HW32
preLatencyBufferSize, bbmBufferSize )); preLatencyBufferSize, bbmBufferSize ));
bbmBufferSize = preLatencyBufferSize; bbmBufferSize = preLatencyBufferSize;
if( streamComp->hpiDevice->streamIsOutput ) if( streamComp->hpiDevice->streamIsOutput )
hpiError = HPI_OutStreamHostBufferAllocate( streamComp->hpiDevice->subSys, hpiError = HPI_OutStreamHostBufferAllocate( NULL,
streamComp->hpiStream, streamComp->hpiStream,
bbmBufferSize ); bbmBufferSize );
else else
hpiError = HPI_InStreamHostBufferAllocate( streamComp->hpiDevice->subSys, hpiError = HPI_InStreamHostBufferAllocate( NULL,
streamComp->hpiStream, streamComp->hpiStream,
bbmBufferSize ); bbmBufferSize );
/* Another round of error checking */ /* Another round of error checking */
@ -1598,8 +1583,10 @@ static PaError PaAsiHpi_SetupBuffers( PaAsiHpiStreamComponent *streamComp, HW32
} }
/* If BBM not supported, foreground transfers will be used, but not a show-stopper */ /* If BBM not supported, foreground transfers will be used, but not a show-stopper */
/* Anything else is an error */ /* Anything else is an error */
else if( hpiError != HPI_ERROR_INVALID_OPERATION ) else if (( hpiError != HPI_ERROR_INVALID_OPERATION ) &&
( hpiError != HPI_ERROR_INVALID_FUNC ))
{ {
PA_ASIHPI_REPORT_ERROR_( hpiError );
result = paUnanticipatedHostError; result = paUnanticipatedHostError;
goto error; goto error;
} }
@ -1623,7 +1610,7 @@ static PaError PaAsiHpi_SetupBuffers( PaAsiHpiStreamComponent *streamComp, HW32
PaTime latency = suggestedLatency > 0.0 ? suggestedLatency : PaTime latency = suggestedLatency > 0.0 ? suggestedLatency :
streamComp->hpiDevice->baseDeviceInfo.defaultHighOutputLatency; streamComp->hpiDevice->baseDeviceInfo.defaultHighOutputLatency;
streamComp->outputBufferCap = streamComp->outputBufferCap =
(HW32)ceil( latency * streamComp->bytesPerFrame * streamComp->hpiFormat.dwSampleRate ); (uint32_t)ceil( latency * streamComp->bytesPerFrame * streamComp->hpiFormat.dwSampleRate );
/* The cap should not be too small, to prevent underflow */ /* The cap should not be too small, to prevent underflow */
if( streamComp->outputBufferCap < 4*paHostBufferSize ) if( streamComp->outputBufferCap < 4*paHostBufferSize )
streamComp->outputBufferCap = 4*paHostBufferSize; streamComp->outputBufferCap = 4*paHostBufferSize;
@ -1635,7 +1622,7 @@ static PaError PaAsiHpi_SetupBuffers( PaAsiHpiStreamComponent *streamComp, HW32
/* Temp buffer size should be multiple of PA host buffer size (or 1x, if using fixed blocks) */ /* Temp buffer size should be multiple of PA host buffer size (or 1x, if using fixed blocks) */
streamComp->tempBufferSize = paHostBufferSize; streamComp->tempBufferSize = paHostBufferSize;
/* Allocate temp buffer */ /* Allocate temp buffer */
PA_UNLESS_( streamComp->tempBuffer = (HW8 *)PaUtil_AllocateMemory( streamComp->tempBufferSize ), PA_UNLESS_( streamComp->tempBuffer = (uint8_t *)PaUtil_AllocateMemory( streamComp->tempBufferSize ),
paInsufficientMemory ); paInsufficientMemory );
error: error:
return result; return result;
@ -1725,7 +1712,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
By keeping the frames a multiple of 4, this is ensured even for 8-bit mono sound. */ By keeping the frames a multiple of 4, this is ensured even for 8-bit mono sound. */
framesPerHostBuffer = (framesPerHostBuffer / 4) * 4; framesPerHostBuffer = (framesPerHostBuffer / 4) * 4;
/* Polling is based on time length (in milliseconds) of user-requested block size */ /* Polling is based on time length (in milliseconds) of user-requested block size */
stream->pollingInterval = (HW32)ceil( 1000.0*framesPerHostBuffer/sampleRate ); stream->pollingInterval = (uint32_t)ceil( 1000.0*framesPerHostBuffer/sampleRate );
assert( framesPerHostBuffer > 0 ); assert( framesPerHostBuffer > 0 );
/* Open underlying streams, check formats and allocate buffers */ /* Open underlying streams, check formats and allocate buffers */
@ -1890,7 +1877,7 @@ static PaError CloseStream( PaStream *s )
/* Close HPI stream (freeing BBM host buffer in the process, if used) */ /* Close HPI stream (freeing BBM host buffer in the process, if used) */
if( stream->input->hpiStream ) if( stream->input->hpiStream )
{ {
PA_ASIHPI_UNLESS_( HPI_InStreamClose( stream->input->hpiDevice->subSys, PA_ASIHPI_UNLESS_( HPI_InStreamClose( NULL,
stream->input->hpiStream ), paUnanticipatedHostError ); stream->input->hpiStream ), paUnanticipatedHostError );
} }
/* Free temp buffer and stream component */ /* Free temp buffer and stream component */
@ -1902,7 +1889,7 @@ static PaError CloseStream( PaStream *s )
/* Close HPI stream (freeing BBM host buffer in the process, if used) */ /* Close HPI stream (freeing BBM host buffer in the process, if used) */
if( stream->output->hpiStream ) if( stream->output->hpiStream )
{ {
PA_ASIHPI_UNLESS_( HPI_OutStreamClose( stream->output->hpiDevice->subSys, PA_ASIHPI_UNLESS_( HPI_OutStreamClose( NULL,
stream->output->hpiStream ), paUnanticipatedHostError ); stream->output->hpiStream ), paUnanticipatedHostError );
} }
/* Free temp buffer and stream component */ /* Free temp buffer and stream component */
@ -1933,9 +1920,6 @@ static PaError PaAsiHpi_PrimeOutputWithSilence( PaAsiHpiStream *stream )
PaAsiHpiStreamComponent *out; PaAsiHpiStreamComponent *out;
PaUtilZeroer *zeroer; PaUtilZeroer *zeroer;
PaSampleFormat outputFormat; PaSampleFormat outputFormat;
#if (HPI_VER < HPI_VERSION_CONSTRUCTOR( 3, 5, 5 ))
HPI_DATA data;
#endif
assert( stream ); assert( stream );
out = stream->output; out = stream->output;
/* Only continue if stream has output channels */ /* Only continue if stream has output channels */
@ -1944,28 +1928,19 @@ static PaError PaAsiHpi_PrimeOutputWithSilence( PaAsiHpiStream *stream )
assert( out->tempBuffer ); assert( out->tempBuffer );
/* Clear all existing data in hardware playback buffer */ /* Clear all existing data in hardware playback buffer */
PA_ASIHPI_UNLESS_( HPI_OutStreamReset( out->hpiDevice->subSys, PA_ASIHPI_UNLESS_( HPI_OutStreamReset( NULL,
out->hpiStream ), paUnanticipatedHostError ); out->hpiStream ), paUnanticipatedHostError );
/* Fill temp buffer with silence */ /* Fill temp buffer with silence */
outputFormat = PaAsiHpi_HpiToPaFormat( out->hpiFormat.wFormat ); outputFormat = PaAsiHpi_HpiToPaFormat( out->hpiFormat.wFormat );
zeroer = PaUtil_SelectZeroer( outputFormat ); zeroer = PaUtil_SelectZeroer( outputFormat );
zeroer(out->tempBuffer, 1, out->tempBufferSize / Pa_GetSampleSize(outputFormat) ); zeroer(out->tempBuffer, 1, out->tempBufferSize / Pa_GetSampleSize(outputFormat) );
/* Write temp buffer to hardware fifo twice, to get started */ /* Write temp buffer to hardware fifo twice, to get started */
#if (HPI_VER >= HPI_VERSION_CONSTRUCTOR( 3, 5, 5 )) PA_ASIHPI_UNLESS_( HPI_OutStreamWriteBuf( NULL, out->hpiStream,
PA_ASIHPI_UNLESS_( HPI_OutStreamWriteBuf( out->hpiDevice->subSys, out->hpiStream,
out->tempBuffer, out->tempBufferSize, &out->hpiFormat), out->tempBuffer, out->tempBufferSize, &out->hpiFormat),
paUnanticipatedHostError ); paUnanticipatedHostError );
PA_ASIHPI_UNLESS_( HPI_OutStreamWriteBuf( out->hpiDevice->subSys, out->hpiStream, PA_ASIHPI_UNLESS_( HPI_OutStreamWriteBuf( NULL, out->hpiStream,
out->tempBuffer, out->tempBufferSize, &out->hpiFormat), out->tempBuffer, out->tempBufferSize, &out->hpiFormat),
paUnanticipatedHostError ); paUnanticipatedHostError );
#else
PA_ASIHPI_UNLESS_( HPI_DataCreate( &data, &out->hpiFormat, out->tempBuffer, out->tempBufferSize ),
paUnanticipatedHostError );
PA_ASIHPI_UNLESS_( HPI_OutStreamWrite( out->hpiDevice->subSys,
out->hpiStream, &data ), paUnanticipatedHostError );
PA_ASIHPI_UNLESS_( HPI_OutStreamWrite( out->hpiDevice->subSys,
out->hpiStream, &data ), paUnanticipatedHostError );
#endif
error: error:
return result; return result;
} }
@ -1989,7 +1964,7 @@ static PaError PaAsiHpi_StartStream( PaAsiHpiStream *stream, int outputPrimed )
if( stream->input ) if( stream->input )
{ {
PA_ASIHPI_UNLESS_( HPI_InStreamStart( stream->input->hpiDevice->subSys, PA_ASIHPI_UNLESS_( HPI_InStreamStart( NULL,
stream->input->hpiStream ), paUnanticipatedHostError ); stream->input->hpiStream ), paUnanticipatedHostError );
} }
if( stream->output ) if( stream->output )
@ -1999,7 +1974,7 @@ static PaError PaAsiHpi_StartStream( PaAsiHpiStream *stream, int outputPrimed )
/* Buffer isn't primed, so load stream with silence */ /* Buffer isn't primed, so load stream with silence */
PA_ENSURE_( PaAsiHpi_PrimeOutputWithSilence( stream ) ); PA_ENSURE_( PaAsiHpi_PrimeOutputWithSilence( stream ) );
} }
PA_ASIHPI_UNLESS_( HPI_OutStreamStart( stream->output->hpiDevice->subSys, PA_ASIHPI_UNLESS_( HPI_OutStreamStart( NULL,
stream->output->hpiStream ), paUnanticipatedHostError ); stream->output->hpiStream ), paUnanticipatedHostError );
} }
stream->state = paAsiHpiActiveState; stream->state = paAsiHpiActiveState;
@ -2071,7 +2046,7 @@ static PaError PaAsiHpi_StopStream( PaAsiHpiStream *stream, int abort )
/* Input channels */ /* Input channels */
if( stream->input ) if( stream->input )
{ {
PA_ASIHPI_UNLESS_( HPI_InStreamReset( stream->input->hpiDevice->subSys, PA_ASIHPI_UNLESS_( HPI_InStreamReset( NULL,
stream->input->hpiStream ), paUnanticipatedHostError ); stream->input->hpiStream ), paUnanticipatedHostError );
} }
/* Output channels */ /* Output channels */
@ -2097,7 +2072,7 @@ static PaError PaAsiHpi_StopStream( PaAsiHpiStream *stream, int abort )
Pa_Sleep( (long)ceil( timeLeft ) ); Pa_Sleep( (long)ceil( timeLeft ) );
} }
} }
PA_ASIHPI_UNLESS_( HPI_OutStreamReset( stream->output->hpiDevice->subSys, PA_ASIHPI_UNLESS_( HPI_OutStreamReset( NULL,
stream->output->hpiStream ), paUnanticipatedHostError ); stream->output->hpiStream ), paUnanticipatedHostError );
} }
@ -2315,7 +2290,7 @@ static PaError PaAsiHpi_WaitForFrames( PaAsiHpiStream *stream, unsigned long *fr
PaError result = paNoError; PaError result = paNoError;
double sampleRate; double sampleRate;
unsigned long framesTarget; unsigned long framesTarget;
HW32 outputData = 0, outputSpace = 0, inputData = 0, framesLeft = 0; uint32_t outputData = 0, outputSpace = 0, inputData = 0, framesLeft = 0;
assert( stream ); assert( stream );
assert( stream->input || stream->output ); assert( stream->input || stream->output );
@ -2485,10 +2460,7 @@ static PaError PaAsiHpi_BeginProcessing( PaAsiHpiStream *stream, unsigned long *
{ {
PaAsiHpiStreamInfo info; PaAsiHpiStreamInfo info;
#if (HPI_VER < HPI_VERSION_CONSTRUCTOR( 3, 5, 5 )) uint32_t framesToGet = *numFrames;
HPI_DATA data;
#endif
HW32 framesToGet = *numFrames;
/* Check for overflows and underflows yet again */ /* Check for overflows and underflows yet again */
PA_ENSURE_( PaAsiHpi_GetStreamInfo( stream->input, &info ) ); PA_ENSURE_( PaAsiHpi_GetStreamInfo( stream->input, &info ) );
@ -2513,22 +2485,12 @@ static PaError PaAsiHpi_BeginProcessing( PaAsiHpiStream *stream, unsigned long *
stream->input->tempBufferSize / Pa_GetSampleSize(inputFormat) ); stream->input->tempBufferSize / Pa_GetSampleSize(inputFormat) );
} }
#if (HPI_VER >= HPI_VERSION_CONSTRUCTOR( 3, 5, 5 ))
/* Read block of data into temp buffer */ /* Read block of data into temp buffer */
PA_ASIHPI_UNLESS_( HPI_InStreamReadBuf( stream->input->hpiDevice->subSys, PA_ASIHPI_UNLESS_( HPI_InStreamReadBuf( NULL,
stream->input->hpiStream, stream->input->hpiStream,
stream->input->tempBuffer, stream->input->tempBuffer,
framesToGet * stream->input->bytesPerFrame), framesToGet * stream->input->bytesPerFrame),
paUnanticipatedHostError ); paUnanticipatedHostError );
#else
/* Setup HPI data structure around temp buffer */
HPI_DataCreate( &data, &stream->input->hpiFormat, stream->input->tempBuffer,
framesToGet * stream->input->bytesPerFrame );
/* Read block of data into temp buffer */
PA_ASIHPI_UNLESS_( HPI_InStreamRead( stream->input->hpiDevice->subSys,
stream->input->hpiStream, &data ),
paUnanticipatedHostError );
#endif
/* Register temp buffer with buffer processor (always FULL buffer) */ /* Register temp buffer with buffer processor (always FULL buffer) */
PaUtil_SetInputFrameCount( &stream->bufferProcessor, *numFrames ); PaUtil_SetInputFrameCount( &stream->bufferProcessor, *numFrames );
/* HPI interface only allows interleaved channels */ /* HPI interface only allows interleaved channels */
@ -2572,9 +2534,6 @@ static PaError PaAsiHpi_EndProcessing( PaAsiHpiStream *stream, unsigned long num
if( stream->output ) if( stream->output )
{ {
PaAsiHpiStreamInfo info; PaAsiHpiStreamInfo info;
#if (HPI_VER < HPI_VERSION_CONSTRUCTOR( 3, 5, 5 ))
HPI_DATA data;
#endif
/* Check for underflows after the (potentially time-consuming) callback */ /* Check for underflows after the (potentially time-consuming) callback */
PA_ENSURE_( PaAsiHpi_GetStreamInfo( stream->output, &info ) ); PA_ENSURE_( PaAsiHpi_GetStreamInfo( stream->output, &info ) );
if( info.underflow ) if( info.underflow )
@ -2582,23 +2541,13 @@ static PaError PaAsiHpi_EndProcessing( PaAsiHpiStream *stream, unsigned long num
*cbFlags |= paOutputUnderflow; *cbFlags |= paOutputUnderflow;
} }
#if (HPI_VER >= HPI_VERSION_CONSTRUCTOR( 3, 5, 5 ))
/* Write temp buffer to HPI stream */ /* Write temp buffer to HPI stream */
PA_ASIHPI_UNLESS_( HPI_OutStreamWriteBuf( stream->output->hpiDevice->subSys, PA_ASIHPI_UNLESS_( HPI_OutStreamWriteBuf( NULL,
stream->output->hpiStream, stream->output->hpiStream,
stream->output->tempBuffer, stream->output->tempBuffer,
numFrames * stream->output->bytesPerFrame, numFrames * stream->output->bytesPerFrame,
&stream->output->hpiFormat), &stream->output->hpiFormat),
paUnanticipatedHostError ); paUnanticipatedHostError );
#else
/* Setup HPI data structure around temp buffer */
HPI_DataCreate( &data, &stream->output->hpiFormat, stream->output->tempBuffer,
numFrames * stream->output->bytesPerFrame );
/* Write temp buffer to HPI stream */
PA_ASIHPI_UNLESS_( HPI_OutStreamWrite( stream->output->hpiDevice->subSys,
stream->output->hpiStream, &data ),
paUnanticipatedHostError );
#endif
} }
error: error:

View File

@ -4,64 +4,56 @@ This document contains information to help you compile PortAudio with
ASIO support. If you find any omissions or errors in this document ASIO support. If you find any omissions or errors in this document
please notify us on the PortAudio mailing list. please notify us on the PortAudio mailing list.
NOTE: The Macintosh sections of this document are provided for historical
reference. They refer to pre-OS X Macintosh. PortAudio no longer
supports pre-OS X Macintosh. Steinberg does not support ASIO on Mac OS X.
Building PortAudio with ASIO support Building PortAudio with ASIO support
------------------------------------ ------------------------------------
To build PortAudio with ASIO support you need to compile and link with To build PortAudio with ASIO support you need to compile and link with
pa_asio.c, and files from the ASIO SDK (see below), along with the common pa_asio.c, and files from the ASIO SDK (see below), along with the common
files from src/common/ and platform specific files from src/os/win/ (for Win32) PortAudio files from src/common/ and platform specific files from
or src/os/mac/ (for Macintosh). src/os/win/ (for Win32).
If you are compiling with a non-Microsoft compiler on Windows, also If you are compiling with a non-Microsoft compiler on Windows, also
compile and link with iasiothiscallresolver.cpp (see below for compile and link with iasiothiscallresolver.cpp (see below for
an explanation). an explanation).
For some platforms (MingW, possibly Mac), you may simply For some platforms (MingW, Cygwin/MingW), you may simply
be able to type: be able to type:
./configure --with-host_os=mingw --with-winapi=asio [--with-asiodir=/usr/local/asiosdk2] ./configure --with-host_os=mingw --with-winapi=asio [--with-asiodir=/usr/local/asiosdk2]
make make
./configure --with-host_os=darwin --with-winapi=asio [--with-asiodir=/usr/local/asiosdk2] and life will be good. Make sure you update the above with the correct local
make path to the ASIO SDK.
For Microsoft Visual C++ there is an build tutorial here:
http://www.portaudio.com/trac/wiki/TutorialDir/Compile/WindowsASIOMSVC
and life will be good.
Obtaining the ASIO SDK Obtaining the ASIO SDK
---------------------- ----------------------
In order to build PortAudio with ASIO support, you need to download In order to build PortAudio with ASIO support, you need to download
the ASIO SDK (version 2.0) from Steinberg. Steinberg makes the ASIO the ASIO SDK (version 2.0 or later) from Steinberg. Steinberg makes the ASIO
SDK available to anyone free of charge, however they do not permit its SDK available to anyone free of charge, however they do not permit its
source code to be distributed. source code to be distributed.
NOTE: In some cases the ASIO SDK may require patching, see below NOTE: In some cases the ASIO SDK may require patching, see below
for further details. for further details.
http://www.steinberg.de/329+M52087573ab0.html http://www.steinberg.net/en/company/developer.html
If the above link is broken search Google for: If the above link is broken search Google for:
"download steinberg ASIO SDK" "download steinberg ASIO SDK"
Building the ASIO SDK on Macintosh
----------------------------------
To build the ASIO SDK on Macintosh you need to compile and link with the
following files from the ASIO SDK:
host/asiodrivers.cpp
host/mac/asioshlib.cpp
host/mac/codefragements.cpp
You may also need to adjust your include paths to support inclusion of
header files from the above directories.
Building the ASIO SDK on Windows Building the ASIO SDK on Windows
-------------------------------- --------------------------------
@ -103,12 +95,27 @@ If you use configure and make (see above), this should be handled
automatically for you. automatically for you.
For further information about the IASIO thiscall problem see this page: For further information about the IASIO thiscall problem see this page:
http://www.audiomulch.com/~rossb/code/calliasio http://www.rossbencina.com/code/iasio-thiscall-resolver
Macintosh ASIO SDK Bug Patch Building the ASIO SDK on (Pre-OS X) Macintosh
---------------------------- ---------------------------------------------
To build the ASIO SDK on Macintosh you need to compile and link with the
following files from the ASIO SDK:
host/asiodrivers.cpp
host/mac/asioshlib.cpp
host/mac/codefragements.cpp
You may also need to adjust your include paths to support inclusion of
header files from the above directories.
(Pre-OS X) Macintosh ASIO SDK Bug Patch
---------------------------------------
There is a bug in the ASIO SDK that causes the Macintosh version to There is a bug in the ASIO SDK that causes the Macintosh version to
often fail during initialization. Below is a patch that you can apply. often fail during initialization. Below is a patch that you can apply.
@ -137,4 +144,4 @@ bool CodeFragments::getFrontProcessDirectory(void *specs)
} }
--- ###

View File

@ -1,5 +1,5 @@
/* /*
* $Id: pa_asio.cpp 1681 2011-05-10 15:58:15Z rossb $ * $Id: pa_asio.cpp 1778 2011-11-10 13:59:53Z rossb $
* Portable Audio I/O Library for ASIO Drivers * Portable Audio I/O Library for ASIO Drivers
* *
* Author: Stephane Letz * Author: Stephane Letz
@ -1214,7 +1214,7 @@ PaError PaAsio_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex
if( foundDefaultSampleRate ){ if( foundDefaultSampleRate ){
/* calculate default latency values from bufferPreferredSize /* calculate default latency values from bufferPreferredSize
for default low latency, and bufferPreferredSize * 3 for default low latency, and bufferMaxSize
for default high latency. for default high latency.
use the default sample rate to convert from samples to use the default sample rate to convert from samples to
seconds. Without knowing what sample rate the user will seconds. Without knowing what sample rate the user will
@ -1227,14 +1227,8 @@ PaError PaAsio_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex
deviceInfo->defaultLowInputLatency = defaultLowLatency; deviceInfo->defaultLowInputLatency = defaultLowLatency;
deviceInfo->defaultLowOutputLatency = defaultLowLatency; deviceInfo->defaultLowOutputLatency = defaultLowLatency;
long defaultHighLatencyBufferSize =
paAsioDriverInfo.bufferPreferredSize * 3;
if( defaultHighLatencyBufferSize > paAsioDriverInfo.bufferMaxSize )
defaultHighLatencyBufferSize = paAsioDriverInfo.bufferMaxSize;
double defaultHighLatency = double defaultHighLatency =
defaultHighLatencyBufferSize / deviceInfo->defaultSampleRate; paAsioDriverInfo.bufferMaxSize / deviceInfo->defaultSampleRate;
if( defaultHighLatency < defaultLowLatency ) if( defaultHighLatency < defaultLowLatency )
defaultHighLatency = defaultLowLatency; /* just in case the driver returns something strange */ defaultHighLatency = defaultLowLatency; /* just in case the driver returns something strange */
@ -1629,33 +1623,60 @@ static void ZeroOutputBuffers( PaAsioStream *stream, long index )
} }
static unsigned long SelectHostBufferSize( unsigned long suggestedLatencyFrames, unsigned long userFramesPerBuffer, /* return the next power of two >= x.
PaAsioDriverInfo *driverInfo ) Returns the input parameter if it is already a power of two.
http://stackoverflow.com/questions/364985/algorithm-for-finding-the-smallest-power-of-two-thats-greater-or-equal-to-a-giv
*/
static unsigned long NextPowerOfTwo( unsigned long x )
{ {
--x;
x |= x >> 1;
x |= x >> 2;
x |= x >> 4;
x |= x >> 8;
x |= x >> 16;
/* If you needed to deal with numbers > 2^32 the following would be needed.
For latencies, we don't deal with values this large.
x |= x >> 16;
*/
return x + 1;
}
static unsigned long SelectHostBufferSizeForUnspecifiedUserFramesPerBuffer(
unsigned long targetBufferingLatencyFrames, PaAsioDriverInfo *driverInfo )
{
/* Choose a host buffer size based only on targetBufferingLatencyFrames and the
device's supported buffer sizes. Always returns a valid value.
*/
unsigned long result; unsigned long result;
if( suggestedLatencyFrames == 0 ) if( targetBufferingLatencyFrames <= (unsigned long)driverInfo->bufferMinSize )
{
result = driverInfo->bufferPreferredSize;
}
else{
if( suggestedLatencyFrames <= (unsigned long)driverInfo->bufferMinSize )
{ {
result = driverInfo->bufferMinSize; result = driverInfo->bufferMinSize;
} }
else if( suggestedLatencyFrames >= (unsigned long)driverInfo->bufferMaxSize ) else if( targetBufferingLatencyFrames >= (unsigned long)driverInfo->bufferMaxSize )
{ {
result = driverInfo->bufferMaxSize; result = driverInfo->bufferMaxSize;
} }
else else
{ {
if( driverInfo->bufferGranularity == -1 ) if( driverInfo->bufferGranularity == 0 ) /* single fixed host buffer size */
{ {
/* power-of-two */ /* The documentation states that bufferGranularity should be zero
result = 2; when bufferMinSize, bufferMaxSize and bufferPreferredSize are the
same. We assume that is the case.
*/
while( result < suggestedLatencyFrames ) result = driverInfo->bufferPreferredSize;
result *= 2; }
else if( driverInfo->bufferGranularity == -1 ) /* power-of-two */
{
/* We assume bufferMinSize and bufferMaxSize are powers of two. */
result = NextPowerOfTwo( targetBufferingLatencyFrames );
if( result < (unsigned long)driverInfo->bufferMinSize ) if( result < (unsigned long)driverInfo->bufferMinSize )
result = driverInfo->bufferMinSize; result = driverInfo->bufferMinSize;
@ -1663,36 +1684,150 @@ static unsigned long SelectHostBufferSize( unsigned long suggestedLatencyFrames,
if( result > (unsigned long)driverInfo->bufferMaxSize ) if( result > (unsigned long)driverInfo->bufferMaxSize )
result = driverInfo->bufferMaxSize; result = driverInfo->bufferMaxSize;
} }
else if( driverInfo->bufferGranularity == 0 ) else /* modulo bufferGranularity */
{ {
/* the documentation states that bufferGranularity should be /* round up to the next multiple of granularity */
zero when bufferMinSize, bufferMaxSize and unsigned long n = (targetBufferingLatencyFrames + driverInfo->bufferGranularity - 1)
bufferPreferredSize are the same. We assume that is the case. / driverInfo->bufferGranularity;
*/
result = driverInfo->bufferPreferredSize; result = n * driverInfo->bufferGranularity;
}
else
{
/* modulo granularity */
unsigned long remainder = if( result < (unsigned long)driverInfo->bufferMinSize )
suggestedLatencyFrames % driverInfo->bufferGranularity; result = driverInfo->bufferMinSize;
if( remainder == 0 )
{
result = suggestedLatencyFrames;
}
else
{
result = suggestedLatencyFrames
+ (driverInfo->bufferGranularity - remainder);
if( result > (unsigned long)driverInfo->bufferMaxSize ) if( result > (unsigned long)driverInfo->bufferMaxSize )
result = driverInfo->bufferMaxSize; result = driverInfo->bufferMaxSize;
} }
} }
return result;
} }
static unsigned long SelectHostBufferSizeForSpecifiedUserFramesPerBuffer(
unsigned long targetBufferingLatencyFrames, unsigned long userFramesPerBuffer,
PaAsioDriverInfo *driverInfo )
{
/* Select a host buffer size conforming to targetBufferingLatencyFrames
and the device's supported buffer sizes.
The return value will always be a multiple of userFramesPerBuffer.
If a valid buffer size can not be found the function returns 0.
The current implementation uses a simple iterative search for clarity.
Feel free to suggest a closed form solution.
*/
unsigned long result = 0;
assert( userFramesPerBuffer != 0 );
if( driverInfo->bufferGranularity == 0 ) /* single fixed host buffer size */
{
/* The documentation states that bufferGranularity should be zero
when bufferMinSize, bufferMaxSize and bufferPreferredSize are the
same. We assume that is the case.
*/
if( (driverInfo->bufferPreferredSize % userFramesPerBuffer) == 0 )
result = driverInfo->bufferPreferredSize;
}
else if( driverInfo->bufferGranularity == -1 ) /* power-of-two */
{
/* We assume bufferMinSize and bufferMaxSize are powers of two. */
/* Search all powers of two in the range [bufferMinSize,bufferMaxSize]
for multiples of userFramesPerBuffer. We prefer the first multiple
that is equal or greater than targetBufferingLatencyFrames, or
failing that, the largest multiple less than
targetBufferingLatencyFrames.
*/
unsigned long x = (unsigned long)driverInfo->bufferMinSize;
do {
if( (x % userFramesPerBuffer) == 0 )
{
/* any power-of-two multiple of userFramesPerBuffer is acceptable */
result = x;
if( result >= targetBufferingLatencyFrames )
break; /* stop. a value >= to targetBufferingLatencyFrames is ideal. */
}
x *= 2;
} while( x <= (unsigned long)driverInfo->bufferMaxSize );
}
else /* modulo granularity */
{
/* We assume bufferMinSize is a multiple of bufferGranularity. */
/* Search all multiples of bufferGranularity in the range
[bufferMinSize,bufferMaxSize] for multiples of userFramesPerBuffer.
We prefer the first multiple that is equal or greater than
targetBufferingLatencyFrames, or failing that, the largest multiple
less than targetBufferingLatencyFrames.
*/
unsigned long x = (unsigned long)driverInfo->bufferMinSize;
do {
if( (x % userFramesPerBuffer) == 0 )
{
/* any power-of-two multiple of userFramesPerBuffer is acceptable */
result = x;
if( result >= targetBufferingLatencyFrames )
break; /* stop. a value >= to targetBufferingLatencyFrames is ideal. */
}
x += driverInfo->bufferGranularity;
} while( x <= (unsigned long)driverInfo->bufferMaxSize );
}
return result;
}
static unsigned long SelectHostBufferSize(
unsigned long targetBufferingLatencyFrames,
unsigned long userFramesPerBuffer, PaAsioDriverInfo *driverInfo )
{
unsigned long result = 0;
/* We select a host buffer size based on the following requirements
(in priority order):
1. The host buffer size must be permissible according to the ASIO
driverInfo buffer size constraints (min, max, granularity or
powers-of-two).
2. If the user specifies a non-zero framesPerBuffer parameter
(userFramesPerBuffer here) the host buffer should be a multiple of
this (subject to the constraints in (1) above).
[NOTE: Where no permissible host buffer size is a multiple of
userFramesPerBuffer, we choose a value as if userFramesPerBuffer were
zero (i.e. we ignore it). This strategy is open for review ~ perhaps
there are still "more optimal" buffer sizes related to
userFramesPerBuffer that we could use.]
3. The host buffer size should be greater than or equal to
targetBufferingLatencyFrames, subject to (1) and (2) above. Where it
is not possible to select a host buffer size equal or greater than
targetBufferingLatencyFrames, the highest buffer size conforming to
(1) and (2) should be chosen.
*/
if( userFramesPerBuffer != 0 )
{
/* userFramesPerBuffer is specified, try to find a buffer size that's
a multiple of it */
result = SelectHostBufferSizeForSpecifiedUserFramesPerBuffer(
targetBufferingLatencyFrames, userFramesPerBuffer, driverInfo );
}
if( result == 0 )
{
/* either userFramesPerBuffer was not specified, or we couldn't find a
host buffer size that is a multiple of it. Select a host buffer size
according to targetBufferingLatencyFrames and the ASIO driverInfo
buffer size constraints.
*/
result = SelectHostBufferSizeForUnspecifiedUserFramesPerBuffer(
targetBufferingLatencyFrames, driverInfo );
} }
return result; return result;
@ -2101,10 +2236,29 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
} }
else /* Using callback interface... */ else /* Using callback interface... */
{ {
framesPerHostBuffer = SelectHostBufferSize( /* Select the host buffer size based on user framesPerBuffer and the
maximum of suggestedInputLatencyFrames and
suggestedOutputLatencyFrames.
We should subtract any fixed known driver latency from
suggestedLatencyFrames before computing the host buffer size.
However, the ASIO API doesn't provide a method for determining fixed
latencies independent of the host buffer size. ASIOGetLatencies()
only returns latencies after the buffer size has been configured, so
we can't reliably use it to determine fixed latencies here.
We could set the preferred buffer size and then subtract it from
the values returned from ASIOGetLatencies, but this would not be 100%
reliable, so we don't do it.
*/
unsigned long targetBufferingLatencyFrames =
(( suggestedInputLatencyFrames > suggestedOutputLatencyFrames ) (( suggestedInputLatencyFrames > suggestedOutputLatencyFrames )
? suggestedInputLatencyFrames : suggestedOutputLatencyFrames), framesPerBuffer, ? suggestedInputLatencyFrames
driverInfo ); : suggestedOutputLatencyFrames);
framesPerHostBuffer = SelectHostBufferSize( targetBufferingLatencyFrames,
framesPerBuffer, driverInfo );
} }
@ -2254,7 +2408,8 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
stream->outputBufferConverter = 0; stream->outputBufferConverter = 0;
} }
/* Values returned by ASIOGetLatencies() include the latency introduced by
the ASIO double buffer. */
ASIOGetLatencies( &stream->asioInputLatencyFrames, &stream->asioOutputLatencyFrames ); ASIOGetLatencies( &stream->asioInputLatencyFrames, &stream->asioOutputLatencyFrames );

View File

@ -990,18 +990,19 @@ static void UpdateTimeStampOffsets( PaMacCoreStream *stream )
} }
/* ================================================================================= */ /* ================================================================================= */
/* Query sample rate property. */
static OSStatus UpdateSampleRateFromDeviceProperty( PaMacCoreStream *stream, AudioDeviceID deviceID, Boolean isInput ) /* can be used to update from nominal or actual sample rate */
static OSStatus UpdateSampleRateFromDeviceProperty( PaMacCoreStream *stream, AudioDeviceID deviceID, Boolean isInput, AudioDevicePropertyID sampleRatePropertyID )
{ {
PaMacCoreDeviceProperties * deviceProperties = isInput ? &stream->inputProperties : &stream->outputProperties; PaMacCoreDeviceProperties * deviceProperties = isInput ? &stream->inputProperties : &stream->outputProperties;
/* FIXME: not sure if this should be the sample rate of the output device or the output unit */
Float64 actualSampleRate = deviceProperties->sampleRate; Float64 sampleRate = 0.0;
UInt32 propSize = sizeof(Float64); UInt32 propSize = sizeof(Float64);
OSStatus osErr = AudioDeviceGetProperty( deviceID, 0, isInput, kAudioDevicePropertyActualSampleRate, &propSize, &actualSampleRate); OSStatus osErr = AudioDeviceGetProperty( deviceID, 0, isInput, sampleRatePropertyID, &propSize, &sampleRate);
if( (osErr == noErr) && (actualSampleRate > 1000.0) ) // avoid divide by zero if there's an error if( (osErr == noErr) && (sampleRate > 1000.0) ) /* avoid divide by zero if there's an error */
{ {
deviceProperties->sampleRate = actualSampleRate; deviceProperties->sampleRate = sampleRate;
deviceProperties->samplePeriod = 1.0 / actualSampleRate; deviceProperties->samplePeriod = 1.0 / sampleRate;
} }
return osErr; return osErr;
} }
@ -1013,7 +1014,7 @@ static OSStatus AudioDevicePropertyActualSampleRateListenerProc( AudioDeviceID i
// Make sure the callback is operating on a stream that is still valid! // Make sure the callback is operating on a stream that is still valid!
assert( stream->streamRepresentation.magic == PA_STREAM_MAGIC ); assert( stream->streamRepresentation.magic == PA_STREAM_MAGIC );
OSStatus osErr = UpdateSampleRateFromDeviceProperty( stream, inDevice, isInput ); OSStatus osErr = UpdateSampleRateFromDeviceProperty( stream, inDevice, isInput, kAudioDevicePropertyActualSampleRate );
if( osErr == noErr ) if( osErr == noErr )
{ {
UpdateTimeStampOffsets( stream ); UpdateTimeStampOffsets( stream );
@ -1077,9 +1078,6 @@ static OSStatus SetupDevicePropertyListeners( PaMacCoreStream *stream, AudioDevi
OSStatus osErr = noErr; OSStatus osErr = noErr;
PaMacCoreDeviceProperties *deviceProperties = isInput ? &stream->inputProperties : &stream->outputProperties; PaMacCoreDeviceProperties *deviceProperties = isInput ? &stream->inputProperties : &stream->outputProperties;
// Start with the current values for the device properties.
UpdateSampleRateFromDeviceProperty( stream, deviceID, isInput );
if( (osErr = QueryUInt32DeviceProperty( deviceID, isInput, if( (osErr = QueryUInt32DeviceProperty( deviceID, isInput,
kAudioDevicePropertyLatency, &deviceProperties->deviceLatency )) != noErr ) return osErr; kAudioDevicePropertyLatency, &deviceProperties->deviceLatency )) != noErr ) return osErr;
if( (osErr = QueryUInt32DeviceProperty( deviceID, isInput, if( (osErr = QueryUInt32DeviceProperty( deviceID, isInput,
@ -1579,7 +1577,7 @@ static UInt32 CalculateOptimalBufferSize( PaMacAUHAL *auhalHostApi,
double sampleRate, double sampleRate,
UInt32 requestedFramesPerBuffer ) UInt32 requestedFramesPerBuffer )
{ {
UInt32 suggested = 0; UInt32 resultBufferSizeFrames = 0;
// Use maximum of suggested input and output latencies. // Use maximum of suggested input and output latencies.
if( inputParameters ) if( inputParameters )
{ {
@ -1588,28 +1586,25 @@ static UInt32 CalculateOptimalBufferSize( PaMacAUHAL *auhalHostApi,
SInt32 variableLatencyFrames = suggestedLatencyFrames - fixedInputLatency; SInt32 variableLatencyFrames = suggestedLatencyFrames - fixedInputLatency;
// Prevent negative latency. // Prevent negative latency.
variableLatencyFrames = MAX( variableLatencyFrames, 0 ); variableLatencyFrames = MAX( variableLatencyFrames, 0 );
suggested = MAX( suggested, (UInt32) variableLatencyFrames ); resultBufferSizeFrames = MAX( resultBufferSizeFrames, (UInt32) variableLatencyFrames );
} }
if( outputParameters ) if( outputParameters )
{ {
UInt32 suggestedLatencyFrames = outputParameters->suggestedLatency * sampleRate; UInt32 suggestedLatencyFrames = outputParameters->suggestedLatency * sampleRate;
SInt32 variableLatencyFrames = suggestedLatencyFrames - fixedOutputLatency; SInt32 variableLatencyFrames = suggestedLatencyFrames - fixedOutputLatency;
variableLatencyFrames = MAX( variableLatencyFrames, 0 ); variableLatencyFrames = MAX( variableLatencyFrames, 0 );
suggested = MAX( suggested, (UInt32) variableLatencyFrames ); resultBufferSizeFrames = MAX( resultBufferSizeFrames, (UInt32) variableLatencyFrames );
} }
VDBUG( ("Block Size unspecified. Based on Latency, the user wants a Block Size near: %ld.\n",
suggested ) );
if( requestedFramesPerBuffer != paFramesPerBufferUnspecified ) if( requestedFramesPerBuffer != paFramesPerBufferUnspecified )
{ {
if( suggested > (requestedFramesPerBuffer + 1) ) // make host buffer the next highest integer multiple of user frames per buffer
{ UInt32 n = (resultBufferSizeFrames + requestedFramesPerBuffer - 1) / requestedFramesPerBuffer;
// If the user asks for higher latency than the requested buffer size would provide resultBufferSizeFrames = n * requestedFramesPerBuffer;
// then put multiple user buffers in one host buffer.
UInt32 userBuffersPerHostBuffer = (suggested + (requestedFramesPerBuffer - 1)) / requestedFramesPerBuffer; }else{
suggested = userBuffersPerHostBuffer * requestedFramesPerBuffer; VDBUG( ("Block Size unspecified. Based on Latency, the user wants a Block Size near: %ld.\n",
} resultBufferSizeFrames ) );
} }
// Clip to the capabilities of the device. // Clip to the capabilities of the device.
@ -1617,16 +1612,16 @@ static UInt32 CalculateOptimalBufferSize( PaMacAUHAL *auhalHostApi,
{ {
ClipToDeviceBufferSize( auhalHostApi->devIds[inputParameters->device], ClipToDeviceBufferSize( auhalHostApi->devIds[inputParameters->device],
true, // In the old code isInput was false! true, // In the old code isInput was false!
suggested, &suggested ); resultBufferSizeFrames, &resultBufferSizeFrames );
} }
if( outputParameters ) if( outputParameters )
{ {
ClipToDeviceBufferSize( auhalHostApi->devIds[outputParameters->device], ClipToDeviceBufferSize( auhalHostApi->devIds[outputParameters->device],
false, suggested, &suggested ); false, resultBufferSizeFrames, &resultBufferSizeFrames );
} }
VDBUG(("After querying hardware, setting block size to %ld.\n", suggested)); VDBUG(("After querying hardware, setting block size to %ld.\n", resultBufferSizeFrames));
return suggested; return resultBufferSizeFrames;
} }
/* =================================================================================================== */ /* =================================================================================================== */
@ -1997,52 +1992,47 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
stream->streamRepresentation.streamInfo.sampleRate = sampleRate; stream->streamRepresentation.streamInfo.sampleRate = sampleRate;
stream->sampleRate = sampleRate; stream->sampleRate = sampleRate;
stream->outDeviceSampleRate = 0;
if( stream->outputUnit ) {
Float64 rate;
UInt32 size = sizeof( rate );
result = ERR( AudioDeviceGetProperty( stream->outputDevice,
0,
FALSE,
kAudioDevicePropertyNominalSampleRate,
&size, &rate ) );
if( result )
goto error;
stream->outDeviceSampleRate = rate;
}
stream->inDeviceSampleRate = 0;
if( stream->inputUnit ) {
Float64 rate;
UInt32 size = sizeof( rate );
result = ERR( AudioDeviceGetProperty( stream->inputDevice,
0,
TRUE,
kAudioDevicePropertyNominalSampleRate,
&size, &rate ) );
if( result )
goto error;
stream->inDeviceSampleRate = rate;
}
stream->userInChan = inputChannelCount; stream->userInChan = inputChannelCount;
stream->userOutChan = outputChannelCount; stream->userOutChan = outputChannelCount;
// Setup property listeners for timestamp and latency calculations. // Setup property listeners for timestamp and latency calculations.
pthread_mutex_init( &stream->timingInformationMutex, NULL ); pthread_mutex_init( &stream->timingInformationMutex, NULL );
stream->timingInformationMutexIsInitialized = 1; stream->timingInformationMutexIsInitialized = 1;
InitializeDeviceProperties( &stream->inputProperties ); InitializeDeviceProperties( &stream->inputProperties ); // zeros the struct. doesn't actually init it to useful values
InitializeDeviceProperties( &stream->outputProperties ); InitializeDeviceProperties( &stream->outputProperties ); // zeros the struct. doesn't actually init it to useful values
if( stream->outputUnit ) if( stream->outputUnit )
{ {
Boolean isInput = FALSE; Boolean isInput = FALSE;
// Start with the current values for the device properties.
// Init with nominal sample rate. Use actual sample rate where available
result = ERR( UpdateSampleRateFromDeviceProperty(
stream, stream->outputDevice, isInput, kAudioDevicePropertyNominalSampleRate ) );
if( result )
goto error; /* fail if we can't even get a nominal device sample rate */
UpdateSampleRateFromDeviceProperty( stream, stream->outputDevice, isInput, kAudioDevicePropertyActualSampleRate );
SetupDevicePropertyListeners( stream, stream->outputDevice, isInput ); SetupDevicePropertyListeners( stream, stream->outputDevice, isInput );
} }
if( stream->inputUnit ) if( stream->inputUnit )
{ {
Boolean isInput = TRUE; Boolean isInput = TRUE;
// as above
result = ERR( UpdateSampleRateFromDeviceProperty(
stream, stream->inputDevice, isInput, kAudioDevicePropertyNominalSampleRate ) );
if( result )
goto error;
UpdateSampleRateFromDeviceProperty( stream, stream->inputDevice, isInput, kAudioDevicePropertyActualSampleRate );
SetupDevicePropertyListeners( stream, stream->inputDevice, isInput ); SetupDevicePropertyListeners( stream, stream->inputDevice, isInput );
} }
UpdateTimeStampOffsets( stream ); UpdateTimeStampOffsets( stream );
// Setup copies to be used by audio callback. // Setup timestamp copies to be used by audio callback.
stream->timestampOffsetCombined_ioProcCopy = stream->timestampOffsetCombined; stream->timestampOffsetCombined_ioProcCopy = stream->timestampOffsetCombined;
stream->timestampOffsetInputDevice_ioProcCopy = stream->timestampOffsetInputDevice; stream->timestampOffsetInputDevice_ioProcCopy = stream->timestampOffsetInputDevice;
stream->timestampOffsetOutputDevice_ioProcCopy = stream->timestampOffsetOutputDevice; stream->timestampOffsetOutputDevice_ioProcCopy = stream->timestampOffsetOutputDevice;

View File

@ -120,7 +120,11 @@ typedef struct PaMacCoreDeviceProperties
UInt32 bufferFrameSize; UInt32 bufferFrameSize;
// UInt32 streamLatency; // Seems to be the same as deviceLatency!? // UInt32 streamLatency; // Seems to be the same as deviceLatency!?
UInt32 deviceLatency; UInt32 deviceLatency;
/* Current device sample rate. May change! */ /* Current device sample rate. May change!
These are initialized to the nominal device sample rate,
and updated with the actual sample rate, when/where available.
Note that these are the *device* sample rates, prior to any required
SR conversion. */
Float64 sampleRate; Float64 sampleRate;
Float64 samplePeriod; // reciprocal Float64 samplePeriod; // reciprocal
} }
@ -166,10 +170,6 @@ typedef struct PaMacCoreStream
ACTIVE = 3 /* The stream is active and running. */ ACTIVE = 3 /* The stream is active and running. */
} state; } state;
double sampleRate; double sampleRate;
//these may be different from the stream sample rate due to SR conversion:
double outDeviceSampleRate;
double inDeviceSampleRate;
PaMacCoreDeviceProperties inputProperties; PaMacCoreDeviceProperties inputProperties;
PaMacCoreDeviceProperties outputProperties; PaMacCoreDeviceProperties outputProperties;

View File

@ -1,5 +1,5 @@
/* /*
* $Id: pa_win_ds.c 1744 2011-08-25 15:59:32Z rossb $ * $Id: pa_win_ds.c 1794 2011-11-24 18:11:33Z rossb $
* Portable Audio I/O Library DirectSound implementation * Portable Audio I/O Library DirectSound implementation
* *
* Authors: Phil Burk, Robert Marsanyi & Ross Bencina * Authors: Phil Burk, Robert Marsanyi & Ross Bencina
@ -152,6 +152,13 @@ PA_THREAD_FUNC ProcessingThreadProc( void *pArg );
#define PA_DS_WIN_WDM_DEFAULT_LATENCY_ (.120) #define PA_DS_WIN_WDM_DEFAULT_LATENCY_ (.120)
/* we allow the polling period to range between 1 and 100ms.
prior to August 2011 we limited the minimum polling period to 10ms.
*/
#define PA_DS_MINIMUM_POLLING_PERIOD_SECONDS (0.001) /* 1ms */
#define PA_DS_MAXIMUM_POLLING_PERIOD_SECONDS (0.100) /* 100ms */
#define PA_DS_POLLING_JITTER_SECONDS (0.001) /* 1ms */
#define SECONDS_PER_MSEC (0.001) #define SECONDS_PER_MSEC (0.001)
#define MSECS_PER_SECOND (1000) #define MSECS_PER_SECOND (1000)
@ -1336,6 +1343,13 @@ static PaError ValidateWinDirectSoundSpecificStreamInfo(
{ {
return paIncompatibleHostApiSpecificStreamInfo; return paIncompatibleHostApiSpecificStreamInfo;
} }
if( streamInfo->flags & paWinDirectSoundUseLowLevelLatencyParameters )
{
if( streamInfo->framesPerBuffer <= 0 )
return paIncompatibleHostApiSpecificStreamInfo;
}
} }
return paNoError; return paNoError;
@ -1541,7 +1555,13 @@ static HRESULT InitFullDuplexInputOutputBuffers( PaWinDsStream *stream,
#endif /* PAWIN_USE_DIRECTSOUNDFULLDUPLEXCREATE */ #endif /* PAWIN_USE_DIRECTSOUNDFULLDUPLEXCREATE */
static HRESULT InitInputBuffer( PaWinDsStream *stream, PaWinDsDeviceInfo *device, PaSampleFormat sampleFormat, unsigned long nFrameRate, WORD nChannels, int bytesPerBuffer, PaWinWaveFormatChannelMask channelMask ) static HRESULT InitInputBuffer( PaWinDsStream *stream,
PaWinDsDeviceInfo *device,
PaSampleFormat sampleFormat,
unsigned long nFrameRate,
WORD nChannels,
int bytesPerBuffer,
PaWinWaveFormatChannelMask channelMask )
{ {
DSCBUFFERDESC captureDesc; DSCBUFFERDESC captureDesc;
PaWinWaveFormat waveFormat; PaWinWaveFormat waveFormat;
@ -1582,7 +1602,10 @@ static HRESULT InitInputBuffer( PaWinDsStream *stream, PaWinDsDeviceInfo *device
} }
static HRESULT InitOutputBuffer( PaWinDsStream *stream, PaWinDsDeviceInfo *device, PaSampleFormat sampleFormat, unsigned long nFrameRate, WORD nChannels, int bytesPerBuffer, PaWinWaveFormatChannelMask channelMask ) static HRESULT InitOutputBuffer( PaWinDsStream *stream, PaWinDsDeviceInfo *device,
PaSampleFormat sampleFormat, unsigned long nFrameRate,
WORD nChannels, int bytesPerBuffer,
PaWinWaveFormatChannelMask channelMask )
{ {
HRESULT result; HRESULT result;
HWND hWnd; HWND hWnd;
@ -1680,18 +1703,15 @@ static void CalculateBufferSettings( unsigned long *hostBufferSizeFrames,
unsigned long suggestedOutputLatencyFrames, unsigned long suggestedOutputLatencyFrames,
double sampleRate, unsigned long userFramesPerBuffer ) double sampleRate, unsigned long userFramesPerBuffer )
{ {
/* we allow the polling period to range between 1 and 100ms. unsigned long minimumPollingPeriodFrames = sampleRate * PA_DS_MINIMUM_POLLING_PERIOD_SECONDS;
prior to August 2011 we limited the minimum polling period to 10ms. unsigned long maximumPollingPeriodFrames = sampleRate * PA_DS_MAXIMUM_POLLING_PERIOD_SECONDS;
*/ unsigned long pollingJitterFrames = sampleRate * PA_DS_POLLING_JITTER_SECONDS;
unsigned long minimumPollingPeriodFrames = sampleRate / 1000; /* 1ms */
unsigned long maximumPollingPeriodFrames = sampleRate / 10; /* 100ms */
unsigned long pollingJitterFrames = sampleRate / 1000; /* 1ms */
if( userFramesPerBuffer == paFramesPerBufferUnspecified ) if( userFramesPerBuffer == paFramesPerBufferUnspecified )
{ {
unsigned long suggestedLatencyFrames = max( suggestedInputLatencyFrames, suggestedOutputLatencyFrames ); unsigned long targetBufferingLatencyFrames = max( suggestedInputLatencyFrames, suggestedOutputLatencyFrames );
*pollingPeriodFrames = suggestedLatencyFrames / 4; *pollingPeriodFrames = targetBufferingLatencyFrames / 4;
if( *pollingPeriodFrames < minimumPollingPeriodFrames ) if( *pollingPeriodFrames < minimumPollingPeriodFrames )
{ {
*pollingPeriodFrames = minimumPollingPeriodFrames; *pollingPeriodFrames = minimumPollingPeriodFrames;
@ -1702,14 +1722,14 @@ static void CalculateBufferSettings( unsigned long *hostBufferSizeFrames,
} }
*hostBufferSizeFrames = *pollingPeriodFrames *hostBufferSizeFrames = *pollingPeriodFrames
+ max( *pollingPeriodFrames + pollingJitterFrames, suggestedLatencyFrames); + max( *pollingPeriodFrames + pollingJitterFrames, targetBufferingLatencyFrames);
} }
else else
{ {
unsigned long suggestedLatencyFrames = suggestedInputLatencyFrames; unsigned long targetBufferingLatencyFrames = suggestedInputLatencyFrames;
if( isFullDuplex ) if( isFullDuplex )
{ {
/* in full duplex streams we know that the buffer adapter adds userFramesPerBuffer /* In full duplex streams we know that the buffer adapter adds userFramesPerBuffer
extra fixed latency. so we subtract it here as a fixed latency before computing extra fixed latency. so we subtract it here as a fixed latency before computing
the buffer size. being careful not to produce an unrepresentable negative result. the buffer size. being careful not to produce an unrepresentable negative result.
@ -1723,21 +1743,21 @@ static void CalculateBufferSettings( unsigned long *hostBufferSizeFrames,
suggestedOutputLatencyFrames - userFramesPerBuffer; suggestedOutputLatencyFrames - userFramesPerBuffer;
/* maximum of input and adjusted output suggested latency */ /* maximum of input and adjusted output suggested latency */
if( adjustedSuggestedOutputLatencyFrames > suggestedInputLatencyFrames ) if( adjustedSuggestedOutputLatencyFrames > targetBufferingLatencyFrames )
suggestedLatencyFrames = adjustedSuggestedOutputLatencyFrames; targetBufferingLatencyFrames = adjustedSuggestedOutputLatencyFrames;
} }
} }
else else
{ {
/* maximum of input and output suggested latency */ /* maximum of input and output suggested latency */
if( suggestedOutputLatencyFrames > suggestedInputLatencyFrames ) if( suggestedOutputLatencyFrames > suggestedInputLatencyFrames )
suggestedLatencyFrames = suggestedOutputLatencyFrames; targetBufferingLatencyFrames = suggestedOutputLatencyFrames;
} }
*hostBufferSizeFrames = userFramesPerBuffer *hostBufferSizeFrames = userFramesPerBuffer
+ max( userFramesPerBuffer + pollingJitterFrames, suggestedLatencyFrames); + max( userFramesPerBuffer + pollingJitterFrames, targetBufferingLatencyFrames);
*pollingPeriodFrames = max( max(1, userFramesPerBuffer / 4), suggestedLatencyFrames / 16 ); *pollingPeriodFrames = max( max(1, userFramesPerBuffer / 4), targetBufferingLatencyFrames / 16 );
if( *pollingPeriodFrames > maximumPollingPeriodFrames ) if( *pollingPeriodFrames > maximumPollingPeriodFrames )
{ {
@ -1747,6 +1767,23 @@ static void CalculateBufferSettings( unsigned long *hostBufferSizeFrames,
} }
static void CalculatePollingPeriodFrames( unsigned long hostBufferSizeFrames,
unsigned long *pollingPeriodFrames,
double sampleRate, unsigned long userFramesPerBuffer )
{
unsigned long minimumPollingPeriodFrames = sampleRate * PA_DS_MINIMUM_POLLING_PERIOD_SECONDS;
unsigned long maximumPollingPeriodFrames = sampleRate * PA_DS_MAXIMUM_POLLING_PERIOD_SECONDS;
unsigned long pollingJitterFrames = sampleRate * PA_DS_POLLING_JITTER_SECONDS;
*pollingPeriodFrames = max( max(1, userFramesPerBuffer / 4), hostBufferSizeFrames / 16 );
if( *pollingPeriodFrames > maximumPollingPeriodFrames )
{
*pollingPeriodFrames = maximumPollingPeriodFrames;
}
}
static void SetStreamInfoLatencies( PaWinDsStream *stream, static void SetStreamInfoLatencies( PaWinDsStream *stream,
unsigned long userFramesPerBuffer, unsigned long userFramesPerBuffer,
unsigned long pollingPeriodFrames, unsigned long pollingPeriodFrames,
@ -1808,6 +1845,8 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
int inputChannelCount, outputChannelCount; int inputChannelCount, outputChannelCount;
PaSampleFormat inputSampleFormat, outputSampleFormat; PaSampleFormat inputSampleFormat, outputSampleFormat;
PaSampleFormat hostInputSampleFormat, hostOutputSampleFormat; PaSampleFormat hostInputSampleFormat, hostOutputSampleFormat;
int userRequestedHostInputBufferSizeFrames = 0;
int userRequestedHostOutputBufferSizeFrames = 0;
unsigned long suggestedInputLatencyFrames, suggestedOutputLatencyFrames; unsigned long suggestedInputLatencyFrames, suggestedOutputLatencyFrames;
PaWinDirectSoundStreamInfo *inputStreamInfo, *outputStreamInfo; PaWinDirectSoundStreamInfo *inputStreamInfo, *outputStreamInfo;
PaWinWaveFormatChannelMask inputChannelMask, outputChannelMask; PaWinWaveFormatChannelMask inputChannelMask, outputChannelMask;
@ -1840,6 +1879,9 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
result = ValidateWinDirectSoundSpecificStreamInfo( inputParameters, inputStreamInfo ); result = ValidateWinDirectSoundSpecificStreamInfo( inputParameters, inputStreamInfo );
if( result != paNoError ) return result; if( result != paNoError ) return result;
if( inputStreamInfo && inputStreamInfo->flags & paWinDirectSoundUseLowLevelLatencyParameters )
userRequestedHostInputBufferSizeFrames = inputStreamInfo->framesPerBuffer;
if( inputStreamInfo && inputStreamInfo->flags & paWinDirectSoundUseChannelMask ) if( inputStreamInfo && inputStreamInfo->flags & paWinDirectSoundUseChannelMask )
inputChannelMask = inputStreamInfo->channelMask; inputChannelMask = inputStreamInfo->channelMask;
else else
@ -1877,6 +1919,9 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
result = ValidateWinDirectSoundSpecificStreamInfo( outputParameters, outputStreamInfo ); result = ValidateWinDirectSoundSpecificStreamInfo( outputParameters, outputStreamInfo );
if( result != paNoError ) return result; if( result != paNoError ) return result;
if( outputStreamInfo && outputStreamInfo->flags & paWinDirectSoundUseLowLevelLatencyParameters )
userRequestedHostOutputBufferSizeFrames = outputStreamInfo->framesPerBuffer;
if( outputStreamInfo && outputStreamInfo->flags & paWinDirectSoundUseChannelMask ) if( outputStreamInfo && outputStreamInfo->flags & paWinDirectSoundUseChannelMask )
outputChannelMask = outputStreamInfo->channelMask; outputChannelMask = outputStreamInfo->channelMask;
else else
@ -1889,6 +1934,16 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
suggestedOutputLatencyFrames = 0; suggestedOutputLatencyFrames = 0;
} }
/*
If low level host buffer size is specified for both input and output
the current code requires the sizes to match.
*/
if( (userRequestedHostInputBufferSizeFrames > 0 && userRequestedHostOutputBufferSizeFrames > 0)
&& userRequestedHostInputBufferSizeFrames != userRequestedHostOutputBufferSizeFrames )
return paIncompatibleHostApiSpecificStreamInfo;
/* /*
IMPLEMENT ME: IMPLEMENT ME:
@ -2027,14 +2082,34 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
/* set up i/o parameters */ /* set up i/o parameters */
if( userRequestedHostInputBufferSizeFrames > 0 || userRequestedHostOutputBufferSizeFrames > 0 )
{
/* use low level parameters */
/* since we use the same host buffer size for input and output
we choose the highest user specified value.
*/
stream->hostBufferSizeFrames = max( userRequestedHostInputBufferSizeFrames, userRequestedHostOutputBufferSizeFrames );
CalculatePollingPeriodFrames(
stream->hostBufferSizeFrames, &pollingPeriodFrames,
sampleRate, framesPerBuffer );
}
else
{
CalculateBufferSettings( &stream->hostBufferSizeFrames, &pollingPeriodFrames, CalculateBufferSettings( &stream->hostBufferSizeFrames, &pollingPeriodFrames,
/* isFullDuplex = */ (inputParameters && outputParameters), /* isFullDuplex = */ (inputParameters && outputParameters),
suggestedInputLatencyFrames, suggestedInputLatencyFrames,
suggestedOutputLatencyFrames, suggestedOutputLatencyFrames,
sampleRate, framesPerBuffer ); sampleRate, framesPerBuffer );
}
stream->pollingPeriodSeconds = pollingPeriodFrames / sampleRate; stream->pollingPeriodSeconds = pollingPeriodFrames / sampleRate;
DBUG(("DirectSound host buffer size frames: %d, polling period seconds: %f, @ sr: %f\n",
stream->hostBufferSizeFrames, stream->pollingPeriodSeconds, sampleRate ));
/* ------------------ OUTPUT */ /* ------------------ OUTPUT */
if( outputParameters ) if( outputParameters )
{ {
@ -2348,7 +2423,8 @@ static int TimeSlice( PaWinDsStream *stream )
long bytesProcessed; long bytesProcessed;
HRESULT hresult; HRESULT hresult;
double outputLatency = 0; double outputLatency = 0;
PaStreamCallbackTimeInfo timeInfo = {0,0,0}; /** @todo implement inputBufferAdcTime */ double inputLatency = 0;
PaStreamCallbackTimeInfo timeInfo = {0,0,0};
/* Input */ /* Input */
LPBYTE lpInBuf1 = NULL; LPBYTE lpInBuf1 = NULL;
@ -2377,11 +2453,12 @@ static int TimeSlice( PaWinDsStream *stream )
filled = readPos - stream->readOffset; filled = readPos - stream->readOffset;
if( filled < 0 ) filled += stream->inputBufferSizeBytes; // unwrap offset if( filled < 0 ) filled += stream->inputBufferSizeBytes; // unwrap offset
bytesFilled = filled; bytesFilled = filled;
inputLatency = ((double)bytesFilled) * stream->secondsPerHostByte;
} }
// FIXME: what happens if IDirectSoundCaptureBuffer_GetCurrentPosition fails? // FIXME: what happens if IDirectSoundCaptureBuffer_GetCurrentPosition fails?
framesToXfer = numInFramesReady = bytesFilled / stream->inputFrameSizeBytes; framesToXfer = numInFramesReady = bytesFilled / stream->inputFrameSizeBytes;
outputLatency = ((double)bytesFilled) * stream->secondsPerHostByte; // FIXME: this doesn't look right. we're calculating output latency in input branch. also secondsPerHostByte is only initialized for the output stream
/** @todo Check for overflow */ /** @todo Check for overflow */
} }
@ -2396,6 +2473,14 @@ static int TimeSlice( PaWinDsStream *stream )
/* Check for underflow */ /* Check for underflow */
if( stream->outputUnderflowCount != previousUnderflowCount ) if( stream->outputUnderflowCount != previousUnderflowCount )
stream->callbackFlags |= paOutputUnderflow; stream->callbackFlags |= paOutputUnderflow;
/* We are about to compute audio into the first byte of empty space in the output buffer.
This audio will reach the DAC after all of the current (non-empty) audio
in the buffer has played. Therefore the output time is the current time
plus the time it takes to play the non-empty bytes in the buffer,
computed here:
*/
outputLatency = ((double)(stream->outputBufferSizeBytes - bytesEmpty)) * stream->secondsPerHostByte;
} }
/* if it's a full duplex stream, set framesToXfer to the minimum of input and output frames ready */ /* if it's a full duplex stream, set framesToXfer to the minimum of input and output frames ready */
@ -2411,8 +2496,6 @@ static int TimeSlice( PaWinDsStream *stream )
/* The outputBufferDacTime parameter should indicates the time at which /* The outputBufferDacTime parameter should indicates the time at which
the first sample of the output buffer is heard at the DACs. */ the first sample of the output buffer is heard at the DACs. */
timeInfo.currentTime = PaUtil_GetTime(); timeInfo.currentTime = PaUtil_GetTime();
timeInfo.outputBufferDacTime = timeInfo.currentTime + outputLatency; // FIXME: QueryOutputSpace gets the playback position, we could use that (?)
PaUtil_BeginBufferProcessing( &stream->bufferProcessor, &timeInfo, stream->callbackFlags ); PaUtil_BeginBufferProcessing( &stream->bufferProcessor, &timeInfo, stream->callbackFlags );
stream->callbackFlags = 0; stream->callbackFlags = 0;
@ -2420,6 +2503,8 @@ static int TimeSlice( PaWinDsStream *stream )
/* Input */ /* Input */
if( stream->bufferProcessor.inputChannelCount > 0 ) if( stream->bufferProcessor.inputChannelCount > 0 )
{ {
timeInfo.inputBufferAdcTime = timeInfo.currentTime - inputLatency;
bytesToXfer = framesToXfer * stream->inputFrameSizeBytes; bytesToXfer = framesToXfer * stream->inputFrameSizeBytes;
hresult = IDirectSoundCaptureBuffer_Lock ( stream->pDirectSoundInputBuffer, hresult = IDirectSoundCaptureBuffer_Lock ( stream->pDirectSoundInputBuffer,
stream->readOffset, bytesToXfer, stream->readOffset, bytesToXfer,
@ -2449,6 +2534,13 @@ static int TimeSlice( PaWinDsStream *stream )
/* Output */ /* Output */
if( stream->bufferProcessor.outputChannelCount > 0 ) if( stream->bufferProcessor.outputChannelCount > 0 )
{ {
/*
We don't currently add outputLatency here because it appears to produce worse
results than non adding it. Need to do more testing to verify this.
*/
/* timeInfo.outputBufferDacTime = timeInfo.currentTime + outputLatency; */
timeInfo.outputBufferDacTime = timeInfo.currentTime;
bytesToXfer = framesToXfer * stream->outputFrameSizeBytes; bytesToXfer = framesToXfer * stream->outputFrameSizeBytes;
hresult = IDirectSoundBuffer_Lock ( stream->pDirectSoundOutputBuffer, hresult = IDirectSoundBuffer_Lock ( stream->pDirectSoundOutputBuffer,
stream->outputBufferWriteOffsetBytes, bytesToXfer, stream->outputBufferWriteOffsetBytes, bytesToXfer,

View File

@ -125,13 +125,13 @@
#endif #endif
#ifdef _MSC_VER #ifdef _MSC_VER
#define NOMMIDS //#define NOMMIDS
#define DYNAMIC_GUID(data) {data} #define DYNAMIC_GUID(data) {data}
#define _NTRTL_ /* Turn off default definition of DEFINE_GUIDEX */ //#define _NTRTL_ /* Turn off default definition of DEFINE_GUIDEX */
#undef DEFINE_GUID //#undef DEFINE_GUID
#define DEFINE_GUID(n,data) EXTERN_C const GUID n = {data} //#define DEFINE_GUID(n,data) EXTERN_C const GUID n = {data}
#define DEFINE_GUID_THUNK(n,data) DEFINE_GUID(n,data) //#define DEFINE_GUID_THUNK(n,data) DEFINE_GUID(n,data)
#define DEFINE_GUIDEX(n) DEFINE_GUID_THUNK(n, STATIC_##n) //#define DEFINE_GUIDEX(n) DEFINE_GUID_THUNK(n, STATIC_##n)
#endif #endif
#include <mmreg.h> #include <mmreg.h>