- Reestructuración de ficheros y directorios general
- merge v0.01 --> Añadido fileselector - Añadidas fuentes de Gem y Pure Data - pix2jpg incluído en Gem. Archivos de construcción de Gem modificados. - Añadido fichero ompiling.txt con instrucciones de compilación
This commit is contained in:
parent
c9adfd020b
commit
e85d191b46
3100 changed files with 775434 additions and 3073 deletions
81
pd-0.44-2/portaudio/LICENSE.txt
Normal file
81
pd-0.44-2/portaudio/LICENSE.txt
Normal file
|
@ -0,0 +1,81 @@
|
|||
Portable header file to contain:
|
||||
>>>>>
|
||||
/*
|
||||
* PortAudio Portable Real-Time Audio Library
|
||||
* PortAudio API Header File
|
||||
* Latest version available at: http://www.portaudio.com
|
||||
*
|
||||
* Copyright (c) 1999-2006 Ross Bencina and Phil Burk
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
<<<<<
|
||||
|
||||
|
||||
Implementation files to contain:
|
||||
>>>>>
|
||||
/*
|
||||
* PortAudio Portable Real-Time Audio Library
|
||||
* Latest version at: http://www.portaudio.com
|
||||
* <platform> Implementation
|
||||
* Copyright (c) 1999-2000 <author(s)>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
<<<<<
|
118
pd-0.44-2/portaudio/Makefile.dist
Normal file
118
pd-0.44-2/portaudio/Makefile.dist
Normal file
|
@ -0,0 +1,118 @@
|
|||
## distdir target by IOhannes m zmölnig
|
||||
## portaudio's original build-system lacks a "distdir" target
|
||||
## which prevents us from easily creating a distribution tarball
|
||||
## for Pd!
|
||||
## so we provide a simplified target here, to satisfy autotools needs
|
||||
|
||||
# list of all files to be installed
|
||||
## generated with `make distclean; find . -type f`
|
||||
DISTFILES=\
|
||||
LICENSE.txt \
|
||||
include/pa_asio.h \
|
||||
include/pa_jack.h \
|
||||
include/pa_linux_alsa.h \
|
||||
include/pa_mac_core.h \
|
||||
include/pa_win_waveformat.h \
|
||||
include/pa_win_wmme.h \
|
||||
include/portaudio.h \
|
||||
src/common/pa_allocation.c \
|
||||
src/common/pa_allocation.h \
|
||||
src/common/pa_converters.c \
|
||||
src/common/pa_converters.h \
|
||||
src/common/pa_cpuload.c \
|
||||
src/common/pa_cpuload.h \
|
||||
src/common/pa_debugprint.c \
|
||||
src/common/pa_debugprint.h \
|
||||
src/common/pa_dither.c \
|
||||
src/common/pa_dither.h \
|
||||
src/common/pa_endianness.h \
|
||||
src/common/pa_front.c \
|
||||
src/common/pa_hostapi.h \
|
||||
src/common/pa_memorybarrier.h \
|
||||
src/common/pa_process.c \
|
||||
src/common/pa_process.h \
|
||||
src/common/pa_ringbuffer.c \
|
||||
src/common/pa_ringbuffer.h \
|
||||
src/common/pa_stream.c \
|
||||
src/common/pa_stream.h \
|
||||
src/common/pa_trace.c \
|
||||
src/common/pa_trace.h \
|
||||
src/common/pa_types.h \
|
||||
src/common/pa_util.h \
|
||||
src/hostapi/alsa/pa_linux_alsa.c \
|
||||
src/hostapi/asio/iasiothiscallresolver.cpp \
|
||||
src/hostapi/asio/iasiothiscallresolver.h \
|
||||
src/hostapi/asio/pa_asio.cpp \
|
||||
src/hostapi/coreaudio/notes.txt \
|
||||
src/hostapi/coreaudio/pa_mac_core.c \
|
||||
src/hostapi/coreaudio/pa_mac_core_blocking.c \
|
||||
src/hostapi/coreaudio/pa_mac_core_blocking.h \
|
||||
src/hostapi/coreaudio/pa_mac_core_internal.h \
|
||||
src/hostapi/coreaudio/pa_mac_core_old.c \
|
||||
src/hostapi/coreaudio/pa_mac_core_utilities.c \
|
||||
src/hostapi/coreaudio/pa_mac_core_utilities.h \
|
||||
src/hostapi/jack/pa_jack.c \
|
||||
src/hostapi/oss/low_latency_tip.txt \
|
||||
src/hostapi/oss/pa_unix_oss.c \
|
||||
src/hostapi/oss/recplay.c \
|
||||
src/hostapi/wmme/pa_win_wmme.c \
|
||||
src/os/mac_osx/pa_mac_hostapis.c \
|
||||
src/os/unix/pa_unix_hostapis.c \
|
||||
src/os/unix/pa_unix_util.c \
|
||||
src/os/unix/pa_unix_util.h \
|
||||
src/os/win/pa_win_coinitialize.c \
|
||||
src/os/win/pa_win_coinitialize.h \
|
||||
src/os/win/pa_win_hostapis.c \
|
||||
src/os/win/pa_win_util.c \
|
||||
src/os/win/pa_win_waveformat.c \
|
||||
src/os/win/pa_win_wdmks_utils.c \
|
||||
src/os/win/pa_win_wdmks_utils.h \
|
||||
src/os/win/pa_x86_plain_converters.c \
|
||||
src/os/win/pa_x86_plain_converters.h \
|
||||
aclocal.m4 \
|
||||
configure.in \
|
||||
configure \
|
||||
Makefile.in \
|
||||
Makefile.dist \
|
||||
Makefile \
|
||||
config.guess \
|
||||
config.sub \
|
||||
config.status \
|
||||
install-sh \
|
||||
ltmain.sh
|
||||
|
||||
## this is the actual target, stolen from an automake generated Makefile
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
## some dummy targets,
|
||||
## that are needed by autotools but are not provided by portaudio
|
||||
dvi check installcheck distuninstallcheck:
|
261
pd-0.44-2/portaudio/Makefile.in
Normal file
261
pd-0.44-2/portaudio/Makefile.in
Normal file
|
@ -0,0 +1,261 @@
|
|||
#
|
||||
# PortAudio V19 Makefile.in
|
||||
#
|
||||
# Dominic Mazzoni
|
||||
# Modifications by Mikael Magnusson
|
||||
# Modifications by Stelios Bounanos
|
||||
#
|
||||
|
||||
top_srcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
top_builddir = .
|
||||
PREFIX = @prefix@
|
||||
prefix = $(PREFIX)
|
||||
exec_prefix = @exec_prefix@
|
||||
bindir = @bindir@
|
||||
libdir = @libdir@
|
||||
includedir = @includedir@
|
||||
CC = @CC@
|
||||
CXX = @CXX@
|
||||
CFLAGS = @CFLAGS@ @DEFS@
|
||||
LIBS = @LIBS@
|
||||
AR = @AR@
|
||||
RANLIB = @RANLIB@
|
||||
SHELL = @SHELL@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
SHARED_FLAGS = @SHARED_FLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
DLL_LIBS = @DLL_LIBS@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
NASM = @NASM@
|
||||
NASMOPT = @NASMOPT@
|
||||
LN_S = @LN_S@
|
||||
LT_CURRENT=@LT_CURRENT@
|
||||
LT_REVISION=@LT_REVISION@
|
||||
LT_AGE=@LT_AGE@
|
||||
MKDIR_P=@MKDIR_P@
|
||||
|
||||
OTHER_OBJS = @OTHER_OBJS@
|
||||
INCLUDES = @INCLUDES@
|
||||
|
||||
PALIB = libportaudio.la
|
||||
PAINC = include/portaudio.h
|
||||
|
||||
PA_LDFLAGS = $(LDFLAGS) $(SHARED_FLAGS) -rpath $(libdir) -no-undefined \
|
||||
-export-symbols-regex "(Pa|PaMacCore|PaJack|PaAlsa|PaAsio|PaOSS)_.*" \
|
||||
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
|
||||
|
||||
COMMON_OBJS = \
|
||||
src/common/pa_allocation.o \
|
||||
src/common/pa_converters.o \
|
||||
src/common/pa_cpuload.o \
|
||||
src/common/pa_dither.o \
|
||||
src/common/pa_debugprint.o \
|
||||
src/common/pa_front.o \
|
||||
src/common/pa_process.o \
|
||||
src/common/pa_stream.o \
|
||||
src/common/pa_trace.o
|
||||
|
||||
LOOPBACK_OBJS = \
|
||||
qa/loopback/src/audio_analyzer.o \
|
||||
qa/loopback/src/biquad_filter.o \
|
||||
qa/loopback/src/paqa_tools.o \
|
||||
qa/loopback/src/test_audio_analyzer.o \
|
||||
qa/loopback/src/write_wav.o \
|
||||
qa/loopback/src/paqa.o
|
||||
|
||||
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_errs \
|
||||
bin/paqa_latency
|
||||
|
||||
TESTS = \
|
||||
bin/patest1 \
|
||||
bin/patest_buffer \
|
||||
bin/patest_callbackstop \
|
||||
bin/patest_clip \
|
||||
bin/patest_dither \
|
||||
bin/patest_hang \
|
||||
bin/patest_in_overflow \
|
||||
bin/patest_latency \
|
||||
bin/patest_leftright \
|
||||
bin/patest_longsine \
|
||||
bin/patest_many \
|
||||
bin/patest_maxsines \
|
||||
bin/patest_mono \
|
||||
bin/patest_multi_sine \
|
||||
bin/patest_out_underflow \
|
||||
bin/patest_prime \
|
||||
bin/patest_ringmix \
|
||||
bin/patest_sine8 \
|
||||
bin/patest_sine_channelmaps \
|
||||
bin/patest_sine_formats \
|
||||
bin/patest_sine_time \
|
||||
bin/patest_sine_srate \
|
||||
bin/patest_start_stop \
|
||||
bin/patest_stop \
|
||||
bin/patest_stop_playout \
|
||||
bin/patest_toomanysines \
|
||||
bin/patest_two_rates \
|
||||
bin/patest_underflow \
|
||||
bin/patest_wire \
|
||||
bin/pa_minlat
|
||||
|
||||
# Most of these don't compile yet. Put them in TESTS, above, if
|
||||
# you want to try to compile them...
|
||||
ALL_TESTS = \
|
||||
$(TESTS) \
|
||||
bin/patest_sync \
|
||||
bin/debug_convert \
|
||||
bin/debug_dither_calc \
|
||||
bin/debug_dual \
|
||||
bin/debug_multi_in \
|
||||
bin/debug_multi_out \
|
||||
bin/debug_record \
|
||||
bin/debug_record_reuse \
|
||||
bin/debug_sine_amp \
|
||||
bin/debug_sine \
|
||||
bin/debug_sine_formats \
|
||||
bin/debug_srate \
|
||||
bin/debug_test1
|
||||
|
||||
OBJS := $(COMMON_OBJS) $(OTHER_OBJS)
|
||||
|
||||
LTOBJS := $(OBJS:.o=.lo)
|
||||
|
||||
SRC_DIRS = \
|
||||
src/common \
|
||||
src/hostapi/alsa \
|
||||
src/hostapi/asihpi \
|
||||
src/hostapi/asio \
|
||||
src/hostapi/coreaudio \
|
||||
src/hostapi/dsound \
|
||||
src/hostapi/jack \
|
||||
src/hostapi/oss \
|
||||
src/hostapi/wasapi \
|
||||
src/hostapi/wdmks \
|
||||
src/hostapi/wmme \
|
||||
src/os/unix \
|
||||
src/os/win
|
||||
|
||||
SUBDIRS =
|
||||
@ENABLE_CXX_TRUE@SUBDIRS += bindings/cpp
|
||||
|
||||
all: lib/$(PALIB) all-recursive
|
||||
|
||||
tests: bin-stamp $(TESTS)
|
||||
|
||||
examples: bin-stamp $(EXAMPLES)
|
||||
|
||||
selftests: bin-stamp $(SELFTESTS)
|
||||
|
||||
loopback: bin-stamp bin/paloopback
|
||||
|
||||
# With ASIO enabled we must link libportaudio and all test programs with CXX
|
||||
lib/$(PALIB): lib-stamp $(LTOBJS) $(MAKEFILE) $(PAINC)
|
||||
@WITH_ASIO_FALSE@ $(LIBTOOL) --mode=link $(CC) $(PA_LDFLAGS) -o lib/$(PALIB) $(LTOBJS) $(DLL_LIBS)
|
||||
@WITH_ASIO_TRUE@ $(LIBTOOL) --mode=link --tag=CXX $(CXX) $(PA_LDFLAGS) -o lib/$(PALIB) $(LTOBJS) $(DLL_LIBS)
|
||||
|
||||
$(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_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)
|
||||
@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)
|
||||
|
||||
install: lib/$(PALIB)
|
||||
$(INSTALL) -d $(DESTDIR)$(libdir)
|
||||
$(LIBTOOL) --mode=install $(INSTALL) lib/$(PALIB) $(DESTDIR)$(libdir)
|
||||
$(INSTALL) -d $(DESTDIR)$(includedir)
|
||||
for include in $(INCLUDES); do \
|
||||
$(INSTALL_DATA) -m 644 $(top_srcdir)/include/$$include $(DESTDIR)$(includedir)/$$include; \
|
||||
done
|
||||
@echo ""
|
||||
@echo "------------------------------------------------------------"
|
||||
@echo "PortAudio was successfully installed."
|
||||
@echo ""
|
||||
@echo "On some systems (e.g. Linux) you should run 'ldconfig' now"
|
||||
@echo "to make the shared object available. You may also need to"
|
||||
@echo "modify your LD_LIBRARY_PATH environment variable to include"
|
||||
@echo "the directory $(libdir)"
|
||||
@echo "------------------------------------------------------------"
|
||||
@echo ""
|
||||
$(MAKE) install-recursive
|
||||
|
||||
uninstall:
|
||||
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$(PALIB)
|
||||
for include in $(INCLUDES); do \
|
||||
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(includedir)/$$include; \
|
||||
done
|
||||
$(MAKE) uninstall-recursive
|
||||
|
||||
clean:
|
||||
$(LIBTOOL) --mode=clean rm -f $(LTOBJS) $(LOOPBACK_OBJS) $(ALL_TESTS) lib/$(PALIB)
|
||||
$(RM) bin-stamp lib-stamp
|
||||
-$(RM) -r bin lib
|
||||
|
||||
distclean: clean
|
||||
$(RM) config.log config.status Makefile libtool
|
||||
|
||||
%.o: %.c $(MAKEFILE) $(PAINC)
|
||||
$(CC) -c $(CFLAGS) $< -o $@
|
||||
|
||||
%.lo: %.c $(MAKEFILE) $(PAINC)
|
||||
$(LIBTOOL) --mode=compile $(CC) -c $(CFLAGS) $< -o $@
|
||||
|
||||
%.lo: %.cpp $(MAKEFILE) $(PAINC)
|
||||
$(LIBTOOL) --mode=compile --tag=CXX $(CXX) -c $(CXXFLAGS) $< -o $@
|
||||
|
||||
%.o: %.cpp $(MAKEFILE) $(PAINC)
|
||||
$(CXX) -c $(CXXFLAGS) $< -o $@
|
||||
|
||||
%.o: %.asm
|
||||
$(NASM) $(NASMOPT) -o $@ $<
|
||||
|
||||
bin-stamp:
|
||||
-mkdir bin
|
||||
touch $@
|
||||
|
||||
lib-stamp:
|
||||
-mkdir lib
|
||||
-mkdir -p $(SRC_DIRS)
|
||||
touch $@
|
||||
|
||||
Makefile: Makefile.in config.status
|
||||
$(SHELL) config.status
|
||||
|
||||
all-recursive:
|
||||
if test -n "$(SUBDIRS)" ; then for dir in "$(SUBDIRS)"; do $(MAKE) -C $$dir all; done ; fi
|
||||
|
||||
install-recursive:
|
||||
if test -n "$(SUBDIRS)" ; then for dir in "$(SUBDIRS)"; do $(MAKE) -C $$dir install; done ; fi
|
||||
|
||||
uninstall-recursive:
|
||||
if test -n "$(SUBDIRS)" ; then for dir in "$(SUBDIRS)"; do $(MAKE) -C $$dir uninstall; done ; fi
|
||||
|
||||
|
||||
## dist/distdir targets by IOhannes m zmölnig
|
||||
include $(srcdir)/Makefile.dist
|
8762
pd-0.44-2/portaudio/aclocal.m4
vendored
Normal file
8762
pd-0.44-2/portaudio/aclocal.m4
vendored
Normal file
File diff suppressed because it is too large
Load diff
18852
pd-0.44-2/portaudio/autom4te.cache/output.0
Normal file
18852
pd-0.44-2/portaudio/autom4te.cache/output.0
Normal file
File diff suppressed because it is too large
Load diff
18848
pd-0.44-2/portaudio/autom4te.cache/output.1
Normal file
18848
pd-0.44-2/portaudio/autom4te.cache/output.1
Normal file
File diff suppressed because it is too large
Load diff
255
pd-0.44-2/portaudio/autom4te.cache/requests
Normal file
255
pd-0.44-2/portaudio/autom4te.cache/requests
Normal file
|
@ -0,0 +1,255 @@
|
|||
# This file was generated by Autom4te Sun Apr 29 21:48:16 UTC 2012.
|
||||
# It contains the lists of macros which have been traced.
|
||||
# It can be safely removed.
|
||||
|
||||
@request = (
|
||||
bless( [
|
||||
'0',
|
||||
1,
|
||||
[
|
||||
'/usr/share/autoconf'
|
||||
],
|
||||
[
|
||||
'/usr/share/autoconf/autoconf/autoconf.m4f',
|
||||
'/usr/share/aclocal/argz.m4',
|
||||
'/usr/share/aclocal/libtool.m4',
|
||||
'/usr/share/aclocal/ltdl.m4',
|
||||
'/usr/share/aclocal/ltoptions.m4',
|
||||
'/usr/share/aclocal/ltsugar.m4',
|
||||
'/usr/share/aclocal/ltversion.m4',
|
||||
'/usr/share/aclocal/lt~obsolete.m4',
|
||||
'/usr/share/aclocal/pkg.m4',
|
||||
'/usr/share/aclocal-1.11/cond.m4',
|
||||
'/usr/share/aclocal-1.11/substnot.m4',
|
||||
'configure.in'
|
||||
],
|
||||
{
|
||||
'AM_ENABLE_STATIC' => 1,
|
||||
'AC_LIBTOOL_LANG_RC_CONFIG' => 1,
|
||||
'_LT_AC_SHELL_INIT' => 1,
|
||||
'AC_DEFUN' => 1,
|
||||
'_LT_AC_LANG_CXX_CONFIG' => 1,
|
||||
'AC_PROG_LIBTOOL' => 1,
|
||||
'AM_SUBST_NOTMAKE' => 1,
|
||||
'AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH' => 1,
|
||||
'_LT_AC_LANG_C_CONFIG' => 1,
|
||||
'_m4_warn' => 1,
|
||||
'AC_LIBTOOL_OBJDIR' => 1,
|
||||
'gl_FUNC_ARGZ' => 1,
|
||||
'LTOBSOLETE_VERSION' => 1,
|
||||
'AC_LIBTOOL_LANG_GCJ_CONFIG' => 1,
|
||||
'AC_LIBTOOL_PROG_COMPILER_PIC' => 1,
|
||||
'LT_LIB_M' => 1,
|
||||
'_LT_AC_CHECK_DLFCN' => 1,
|
||||
'AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE' => 1,
|
||||
'LTSUGAR_VERSION' => 1,
|
||||
'_LT_PROG_LTMAIN' => 1,
|
||||
'LT_SYS_SYMBOL_USCORE' => 1,
|
||||
'AC_LIBTOOL_GCJ' => 1,
|
||||
'_LT_WITH_SYSROOT' => 1,
|
||||
'LT_FUNC_DLSYM_USCORE' => 1,
|
||||
'LT_SYS_DLOPEN_DEPLIBS' => 1,
|
||||
'AC_LIBTOOL_CONFIG' => 1,
|
||||
'_LT_AC_LANG_F77' => 1,
|
||||
'AC_LTDL_DLLIB' => 1,
|
||||
'_AM_SUBST_NOTMAKE' => 1,
|
||||
'_AM_AUTOCONF_VERSION' => 1,
|
||||
'AM_DISABLE_SHARED' => 1,
|
||||
'_LT_PROG_ECHO_BACKSLASH' => 1,
|
||||
'_LTDL_SETUP' => 1,
|
||||
'_LT_AC_LANG_CXX' => 1,
|
||||
'AM_PROG_LIBTOOL' => 1,
|
||||
'AC_LIB_LTDL' => 1,
|
||||
'_LT_AC_FILE_LTDLL_C' => 1,
|
||||
'AM_PROG_LD' => 1,
|
||||
'AU_DEFUN' => 1,
|
||||
'AC_PROG_NM' => 1,
|
||||
'AC_LIBTOOL_DLOPEN' => 1,
|
||||
'AC_PROG_LD' => 1,
|
||||
'AC_ENABLE_FAST_INSTALL' => 1,
|
||||
'AC_PROG_LD_GNU' => 1,
|
||||
'AC_LIBTOOL_FC' => 1,
|
||||
'LTDL_CONVENIENCE' => 1,
|
||||
'AC_LTDL_PREOPEN' => 1,
|
||||
'_LT_LINKER_BOILERPLATE' => 1,
|
||||
'_LT_PREPARE_SED_QUOTE_VARS' => 1,
|
||||
'AC_LIBTOOL_LANG_CXX_CONFIG' => 1,
|
||||
'AC_LIBTOOL_PROG_CC_C_O' => 1,
|
||||
'gl_PREREQ_ARGZ' => 1,
|
||||
'LT_SUPPORTED_TAG' => 1,
|
||||
'LT_PROG_RC' => 1,
|
||||
'LT_SYS_MODULE_EXT' => 1,
|
||||
'AC_DEFUN_ONCE' => 1,
|
||||
'_LT_AC_LANG_GCJ' => 1,
|
||||
'AC_LTDL_OBJDIR' => 1,
|
||||
'_LT_PATH_TOOL_PREFIX' => 1,
|
||||
'AC_LIBTOOL_RC' => 1,
|
||||
'AC_DISABLE_FAST_INSTALL' => 1,
|
||||
'_LT_AC_PROG_ECHO_BACKSLASH' => 1,
|
||||
'include' => 1,
|
||||
'_LT_AC_SYS_LIBPATH_AIX' => 1,
|
||||
'_LT_AC_TRY_DLOPEN_SELF' => 1,
|
||||
'LT_AC_PROG_SED' => 1,
|
||||
'AM_ENABLE_SHARED' => 1,
|
||||
'LTDL_INSTALLABLE' => 1,
|
||||
'_LT_AC_LANG_GCJ_CONFIG' => 1,
|
||||
'AC_ENABLE_SHARED' => 1,
|
||||
'AC_LIBTOOL_SYS_HARD_LINK_LOCKS' => 1,
|
||||
'_LT_REQUIRED_DARWIN_CHECKS' => 1,
|
||||
'AC_ENABLE_STATIC' => 1,
|
||||
'_LT_AC_TAGVAR' => 1,
|
||||
'AC_LIBTOOL_LANG_F77_CONFIG' => 1,
|
||||
'AM_CONDITIONAL' => 1,
|
||||
'LT_LIB_DLLOAD' => 1,
|
||||
'LTVERSION_VERSION' => 1,
|
||||
'LTDL_INIT' => 1,
|
||||
'_LT_PROG_F77' => 1,
|
||||
'_LT_PROG_CXX' => 1,
|
||||
'm4_include' => 1,
|
||||
'AC_PROG_EGREP' => 1,
|
||||
'AC_PATH_MAGIC' => 1,
|
||||
'AC_LTDL_SYSSEARCHPATH' => 1,
|
||||
'_LT_AC_TAGCONFIG' => 1,
|
||||
'LT_CMD_MAX_LEN' => 1,
|
||||
'm4_pattern_forbid' => 1,
|
||||
'_LT_LINKER_OPTION' => 1,
|
||||
'AC_LIBTOOL_COMPILER_OPTION' => 1,
|
||||
'AC_DISABLE_SHARED' => 1,
|
||||
'_LT_COMPILER_BOILERPLATE' => 1,
|
||||
'AC_LIBTOOL_WIN32_DLL' => 1,
|
||||
'AC_LIBTOOL_SETUP' => 1,
|
||||
'AC_PROG_LD_RELOAD_FLAG' => 1,
|
||||
'AC_LTDL_DLSYM_USCORE' => 1,
|
||||
'LT_LANG' => 1,
|
||||
'LT_SYS_DLSEARCH_PATH' => 1,
|
||||
'LT_CONFIG_LTDL_DIR' => 1,
|
||||
'LT_OUTPUT' => 1,
|
||||
'AC_LIBTOOL_DLOPEN_SELF' => 1,
|
||||
'AC_LIBTOOL_PROG_LD_SHLIBS' => 1,
|
||||
'_PKG_SHORT_ERRORS_SUPPORTED' => 1,
|
||||
'AC_WITH_LTDL' => 1,
|
||||
'AC_LIBTOOL_LINKER_OPTION' => 1,
|
||||
'PKG_CHECK_EXISTS' => 1,
|
||||
'LT_AC_PROG_RC' => 1,
|
||||
'AC_LIBTOOL_CXX' => 1,
|
||||
'LT_INIT' => 1,
|
||||
'LT_SYS_DLOPEN_SELF' => 1,
|
||||
'LT_AC_PROG_GCJ' => 1,
|
||||
'AM_DISABLE_STATIC' => 1,
|
||||
'_LT_AC_PROG_CXXCPP' => 1,
|
||||
'_AC_PROG_LIBTOOL' => 1,
|
||||
'AC_PATH_TOOL_PREFIX' => 1,
|
||||
'm4_pattern_allow' => 1,
|
||||
'AC_LIBTOOL_F77' => 1,
|
||||
'LT_AC_PROG_EGREP' => 1,
|
||||
'_LT_PROG_FC' => 1,
|
||||
'AC_LIBTOOL_LANG_C_CONFIG' => 1,
|
||||
'LTOPTIONS_VERSION' => 1,
|
||||
'_LT_AC_SYS_COMPILER' => 1,
|
||||
'AM_PROG_NM' => 1,
|
||||
'PKG_CHECK_MODULES' => 1,
|
||||
'AC_LIBLTDL_CONVENIENCE' => 1,
|
||||
'AC_DEPLIBS_CHECK_METHOD' => 1,
|
||||
'AC_LIBLTDL_INSTALLABLE' => 1,
|
||||
'AC_LTDL_ENABLE_INSTALL' => 1,
|
||||
'LT_PROG_GCJ' => 1,
|
||||
'AC_LIBTOOL_SYS_DYNAMIC_LINKER' => 1,
|
||||
'AC_DISABLE_STATIC' => 1,
|
||||
'LT_PATH_NM' => 1,
|
||||
'AC_LTDL_SHLIBEXT' => 1,
|
||||
'_LT_AC_LOCK' => 1,
|
||||
'_LT_AC_LANG_RC_CONFIG' => 1,
|
||||
'LT_PROG_GO' => 1,
|
||||
'LT_SYS_MODULE_PATH' => 1,
|
||||
'AC_LIBTOOL_POSTDEP_PREDEP' => 1,
|
||||
'LT_WITH_LTDL' => 1,
|
||||
'AC_LTDL_SHLIBPATH' => 1,
|
||||
'_LT_AC_LANG_F77_CONFIG' => 1,
|
||||
'AC_LIBTOOL_PROG_COMPILER_NO_RTTI' => 1,
|
||||
'_LT_COMPILER_OPTION' => 1,
|
||||
'AC_LTDL_SYS_DLOPEN_DEPLIBS' => 1,
|
||||
'AC_LIBTOOL_SYS_OLD_ARCHIVE' => 1,
|
||||
'AC_LIBTOOL_PICMODE' => 1,
|
||||
'AC_CHECK_LIBM' => 1,
|
||||
'LT_PATH_LD' => 1,
|
||||
'AC_LIBTOOL_SYS_LIB_STRIP' => 1,
|
||||
'AC_LIBTOOL_SYS_MAX_CMD_LEN' => 1,
|
||||
'AC_LTDL_SYMBOL_USCORE' => 1,
|
||||
'_LT_CC_BASENAME' => 1,
|
||||
'PKG_PROG_PKG_CONFIG' => 1,
|
||||
'_LT_LIBOBJ' => 1
|
||||
}
|
||||
], 'Autom4te::Request' ),
|
||||
bless( [
|
||||
'1',
|
||||
1,
|
||||
[
|
||||
'/usr/share/autoconf'
|
||||
],
|
||||
[
|
||||
'/usr/share/autoconf/autoconf/autoconf.m4f',
|
||||
'aclocal.m4',
|
||||
'configure.in'
|
||||
],
|
||||
{
|
||||
'_LT_AC_TAGCONFIG' => 1,
|
||||
'AM_PROG_F77_C_O' => 1,
|
||||
'm4_pattern_forbid' => 1,
|
||||
'AC_INIT' => 1,
|
||||
'_AM_COND_IF' => 1,
|
||||
'AC_CANONICAL_TARGET' => 1,
|
||||
'AC_SUBST' => 1,
|
||||
'AC_CONFIG_LIBOBJ_DIR' => 1,
|
||||
'AC_FC_SRCEXT' => 1,
|
||||
'AC_CANONICAL_HOST' => 1,
|
||||
'AC_PROG_LIBTOOL' => 1,
|
||||
'AM_INIT_AUTOMAKE' => 1,
|
||||
'AM_PATH_GUILE' => 1,
|
||||
'AC_CONFIG_SUBDIRS' => 1,
|
||||
'AM_AUTOMAKE_VERSION' => 1,
|
||||
'LT_CONFIG_LTDL_DIR' => 1,
|
||||
'AC_REQUIRE_AUX_FILE' => 1,
|
||||
'AC_CONFIG_LINKS' => 1,
|
||||
'm4_sinclude' => 1,
|
||||
'LT_SUPPORTED_TAG' => 1,
|
||||
'AM_MAINTAINER_MODE' => 1,
|
||||
'AM_NLS' => 1,
|
||||
'AC_FC_PP_DEFINE' => 1,
|
||||
'AM_GNU_GETTEXT_INTL_SUBDIR' => 1,
|
||||
'AM_MAKEFILE_INCLUDE' => 1,
|
||||
'_m4_warn' => 1,
|
||||
'AM_PROG_CXX_C_O' => 1,
|
||||
'_AM_COND_ENDIF' => 1,
|
||||
'_AM_MAKEFILE_INCLUDE' => 1,
|
||||
'AM_ENABLE_MULTILIB' => 1,
|
||||
'AM_SILENT_RULES' => 1,
|
||||
'AM_PROG_MOC' => 1,
|
||||
'AC_CONFIG_FILES' => 1,
|
||||
'LT_INIT' => 1,
|
||||
'include' => 1,
|
||||
'AM_PROG_AR' => 1,
|
||||
'AM_GNU_GETTEXT' => 1,
|
||||
'AC_LIBSOURCE' => 1,
|
||||
'AM_PROG_FC_C_O' => 1,
|
||||
'AC_CANONICAL_BUILD' => 1,
|
||||
'AC_FC_FREEFORM' => 1,
|
||||
'AH_OUTPUT' => 1,
|
||||
'AC_FC_PP_SRCEXT' => 1,
|
||||
'_AM_SUBST_NOTMAKE' => 1,
|
||||
'AC_CONFIG_AUX_DIR' => 1,
|
||||
'sinclude' => 1,
|
||||
'AM_PROG_CC_C_O' => 1,
|
||||
'm4_pattern_allow' => 1,
|
||||
'AM_XGETTEXT_OPTION' => 1,
|
||||
'AC_CANONICAL_SYSTEM' => 1,
|
||||
'AM_CONDITIONAL' => 1,
|
||||
'AC_CONFIG_HEADERS' => 1,
|
||||
'AC_DEFINE_TRACE_LITERAL' => 1,
|
||||
'AM_POT_TOOLS' => 1,
|
||||
'm4_include' => 1,
|
||||
'_AM_COND_ELSE' => 1,
|
||||
'AC_SUBST_TRACE' => 1
|
||||
}
|
||||
], 'Autom4te::Request' )
|
||||
);
|
||||
|
1924
pd-0.44-2/portaudio/autom4te.cache/traces.0
Normal file
1924
pd-0.44-2/portaudio/autom4te.cache/traces.0
Normal file
File diff suppressed because it is too large
Load diff
591
pd-0.44-2/portaudio/autom4te.cache/traces.1
Normal file
591
pd-0.44-2/portaudio/autom4te.cache/traces.1
Normal file
|
@ -0,0 +1,591 @@
|
|||
m4trace:configure.in:12: -1- AC_INIT([include/portaudio.h])
|
||||
m4trace:configure.in:12: -1- m4_pattern_forbid([^_?A[CHUM]_])
|
||||
m4trace:configure.in:12: -1- m4_pattern_forbid([_AC_])
|
||||
m4trace:configure.in:12: -1- m4_pattern_forbid([^LIBOBJS$], [do not use LIBOBJS directly, use AC_LIBOBJ (see section `AC_LIBOBJ vs LIBOBJS'])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^AS_FLAGS$])
|
||||
m4trace:configure.in:12: -1- m4_pattern_forbid([^_?m4_])
|
||||
m4trace:configure.in:12: -1- m4_pattern_forbid([^dnl$])
|
||||
m4trace:configure.in:12: -1- m4_pattern_forbid([^_?AS_])
|
||||
m4trace:configure.in:12: -1- AC_SUBST([SHELL])
|
||||
m4trace:configure.in:12: -1- AC_SUBST_TRACE([SHELL])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^SHELL$])
|
||||
m4trace:configure.in:12: -1- AC_SUBST([PATH_SEPARATOR])
|
||||
m4trace:configure.in:12: -1- AC_SUBST_TRACE([PATH_SEPARATOR])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^PATH_SEPARATOR$])
|
||||
m4trace:configure.in:12: -1- AC_SUBST([PACKAGE_NAME], [m4_ifdef([AC_PACKAGE_NAME], ['AC_PACKAGE_NAME'])])
|
||||
m4trace:configure.in:12: -1- AC_SUBST_TRACE([PACKAGE_NAME])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^PACKAGE_NAME$])
|
||||
m4trace:configure.in:12: -1- AC_SUBST([PACKAGE_TARNAME], [m4_ifdef([AC_PACKAGE_TARNAME], ['AC_PACKAGE_TARNAME'])])
|
||||
m4trace:configure.in:12: -1- AC_SUBST_TRACE([PACKAGE_TARNAME])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^PACKAGE_TARNAME$])
|
||||
m4trace:configure.in:12: -1- AC_SUBST([PACKAGE_VERSION], [m4_ifdef([AC_PACKAGE_VERSION], ['AC_PACKAGE_VERSION'])])
|
||||
m4trace:configure.in:12: -1- AC_SUBST_TRACE([PACKAGE_VERSION])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^PACKAGE_VERSION$])
|
||||
m4trace:configure.in:12: -1- AC_SUBST([PACKAGE_STRING], [m4_ifdef([AC_PACKAGE_STRING], ['AC_PACKAGE_STRING'])])
|
||||
m4trace:configure.in:12: -1- AC_SUBST_TRACE([PACKAGE_STRING])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^PACKAGE_STRING$])
|
||||
m4trace:configure.in:12: -1- AC_SUBST([PACKAGE_BUGREPORT], [m4_ifdef([AC_PACKAGE_BUGREPORT], ['AC_PACKAGE_BUGREPORT'])])
|
||||
m4trace:configure.in:12: -1- AC_SUBST_TRACE([PACKAGE_BUGREPORT])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^PACKAGE_BUGREPORT$])
|
||||
m4trace:configure.in:12: -1- AC_SUBST([PACKAGE_URL], [m4_ifdef([AC_PACKAGE_URL], ['AC_PACKAGE_URL'])])
|
||||
m4trace:configure.in:12: -1- AC_SUBST_TRACE([PACKAGE_URL])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^PACKAGE_URL$])
|
||||
m4trace:configure.in:12: -1- AC_SUBST([exec_prefix], [NONE])
|
||||
m4trace:configure.in:12: -1- AC_SUBST_TRACE([exec_prefix])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^exec_prefix$])
|
||||
m4trace:configure.in:12: -1- AC_SUBST([prefix], [NONE])
|
||||
m4trace:configure.in:12: -1- AC_SUBST_TRACE([prefix])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^prefix$])
|
||||
m4trace:configure.in:12: -1- AC_SUBST([program_transform_name], [s,x,x,])
|
||||
m4trace:configure.in:12: -1- AC_SUBST_TRACE([program_transform_name])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^program_transform_name$])
|
||||
m4trace:configure.in:12: -1- AC_SUBST([bindir], ['${exec_prefix}/bin'])
|
||||
m4trace:configure.in:12: -1- AC_SUBST_TRACE([bindir])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^bindir$])
|
||||
m4trace:configure.in:12: -1- AC_SUBST([sbindir], ['${exec_prefix}/sbin'])
|
||||
m4trace:configure.in:12: -1- AC_SUBST_TRACE([sbindir])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^sbindir$])
|
||||
m4trace:configure.in:12: -1- AC_SUBST([libexecdir], ['${exec_prefix}/libexec'])
|
||||
m4trace:configure.in:12: -1- AC_SUBST_TRACE([libexecdir])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^libexecdir$])
|
||||
m4trace:configure.in:12: -1- AC_SUBST([datarootdir], ['${prefix}/share'])
|
||||
m4trace:configure.in:12: -1- AC_SUBST_TRACE([datarootdir])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^datarootdir$])
|
||||
m4trace:configure.in:12: -1- AC_SUBST([datadir], ['${datarootdir}'])
|
||||
m4trace:configure.in:12: -1- AC_SUBST_TRACE([datadir])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^datadir$])
|
||||
m4trace:configure.in:12: -1- AC_SUBST([sysconfdir], ['${prefix}/etc'])
|
||||
m4trace:configure.in:12: -1- AC_SUBST_TRACE([sysconfdir])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^sysconfdir$])
|
||||
m4trace:configure.in:12: -1- AC_SUBST([sharedstatedir], ['${prefix}/com'])
|
||||
m4trace:configure.in:12: -1- AC_SUBST_TRACE([sharedstatedir])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^sharedstatedir$])
|
||||
m4trace:configure.in:12: -1- AC_SUBST([localstatedir], ['${prefix}/var'])
|
||||
m4trace:configure.in:12: -1- AC_SUBST_TRACE([localstatedir])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^localstatedir$])
|
||||
m4trace:configure.in:12: -1- AC_SUBST([includedir], ['${prefix}/include'])
|
||||
m4trace:configure.in:12: -1- AC_SUBST_TRACE([includedir])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^includedir$])
|
||||
m4trace:configure.in:12: -1- AC_SUBST([oldincludedir], ['/usr/include'])
|
||||
m4trace:configure.in:12: -1- AC_SUBST_TRACE([oldincludedir])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^oldincludedir$])
|
||||
m4trace:configure.in:12: -1- AC_SUBST([docdir], [m4_ifset([AC_PACKAGE_TARNAME],
|
||||
['${datarootdir}/doc/${PACKAGE_TARNAME}'],
|
||||
['${datarootdir}/doc/${PACKAGE}'])])
|
||||
m4trace:configure.in:12: -1- AC_SUBST_TRACE([docdir])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^docdir$])
|
||||
m4trace:configure.in:12: -1- AC_SUBST([infodir], ['${datarootdir}/info'])
|
||||
m4trace:configure.in:12: -1- AC_SUBST_TRACE([infodir])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^infodir$])
|
||||
m4trace:configure.in:12: -1- AC_SUBST([htmldir], ['${docdir}'])
|
||||
m4trace:configure.in:12: -1- AC_SUBST_TRACE([htmldir])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^htmldir$])
|
||||
m4trace:configure.in:12: -1- AC_SUBST([dvidir], ['${docdir}'])
|
||||
m4trace:configure.in:12: -1- AC_SUBST_TRACE([dvidir])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^dvidir$])
|
||||
m4trace:configure.in:12: -1- AC_SUBST([pdfdir], ['${docdir}'])
|
||||
m4trace:configure.in:12: -1- AC_SUBST_TRACE([pdfdir])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^pdfdir$])
|
||||
m4trace:configure.in:12: -1- AC_SUBST([psdir], ['${docdir}'])
|
||||
m4trace:configure.in:12: -1- AC_SUBST_TRACE([psdir])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^psdir$])
|
||||
m4trace:configure.in:12: -1- AC_SUBST([libdir], ['${exec_prefix}/lib'])
|
||||
m4trace:configure.in:12: -1- AC_SUBST_TRACE([libdir])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^libdir$])
|
||||
m4trace:configure.in:12: -1- AC_SUBST([localedir], ['${datarootdir}/locale'])
|
||||
m4trace:configure.in:12: -1- AC_SUBST_TRACE([localedir])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^localedir$])
|
||||
m4trace:configure.in:12: -1- AC_SUBST([mandir], ['${datarootdir}/man'])
|
||||
m4trace:configure.in:12: -1- AC_SUBST_TRACE([mandir])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^mandir$])
|
||||
m4trace:configure.in:12: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_NAME])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^PACKAGE_NAME$])
|
||||
m4trace:configure.in:12: -1- AH_OUTPUT([PACKAGE_NAME], [/* Define to the full name of this package. */
|
||||
@%:@undef PACKAGE_NAME])
|
||||
m4trace:configure.in:12: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_TARNAME])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^PACKAGE_TARNAME$])
|
||||
m4trace:configure.in:12: -1- AH_OUTPUT([PACKAGE_TARNAME], [/* Define to the one symbol short name of this package. */
|
||||
@%:@undef PACKAGE_TARNAME])
|
||||
m4trace:configure.in:12: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_VERSION])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^PACKAGE_VERSION$])
|
||||
m4trace:configure.in:12: -1- AH_OUTPUT([PACKAGE_VERSION], [/* Define to the version of this package. */
|
||||
@%:@undef PACKAGE_VERSION])
|
||||
m4trace:configure.in:12: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_STRING])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^PACKAGE_STRING$])
|
||||
m4trace:configure.in:12: -1- AH_OUTPUT([PACKAGE_STRING], [/* Define to the full name and version of this package. */
|
||||
@%:@undef PACKAGE_STRING])
|
||||
m4trace:configure.in:12: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_BUGREPORT])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^PACKAGE_BUGREPORT$])
|
||||
m4trace:configure.in:12: -1- AH_OUTPUT([PACKAGE_BUGREPORT], [/* Define to the address where bug reports for this package should be sent. */
|
||||
@%:@undef PACKAGE_BUGREPORT])
|
||||
m4trace:configure.in:12: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_URL])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^PACKAGE_URL$])
|
||||
m4trace:configure.in:12: -1- AH_OUTPUT([PACKAGE_URL], [/* Define to the home page for this package. */
|
||||
@%:@undef PACKAGE_URL])
|
||||
m4trace:configure.in:12: -1- AC_SUBST([DEFS])
|
||||
m4trace:configure.in:12: -1- AC_SUBST_TRACE([DEFS])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^DEFS$])
|
||||
m4trace:configure.in:12: -1- AC_SUBST([ECHO_C])
|
||||
m4trace:configure.in:12: -1- AC_SUBST_TRACE([ECHO_C])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^ECHO_C$])
|
||||
m4trace:configure.in:12: -1- AC_SUBST([ECHO_N])
|
||||
m4trace:configure.in:12: -1- AC_SUBST_TRACE([ECHO_N])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^ECHO_N$])
|
||||
m4trace:configure.in:12: -1- AC_SUBST([ECHO_T])
|
||||
m4trace:configure.in:12: -1- AC_SUBST_TRACE([ECHO_T])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^ECHO_T$])
|
||||
m4trace:configure.in:12: -1- AC_SUBST([LIBS])
|
||||
m4trace:configure.in:12: -1- AC_SUBST_TRACE([LIBS])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^LIBS$])
|
||||
m4trace:configure.in:12: -1- AC_SUBST([build_alias])
|
||||
m4trace:configure.in:12: -1- AC_SUBST_TRACE([build_alias])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^build_alias$])
|
||||
m4trace:configure.in:12: -1- AC_SUBST([host_alias])
|
||||
m4trace:configure.in:12: -1- AC_SUBST_TRACE([host_alias])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^host_alias$])
|
||||
m4trace:configure.in:12: -1- AC_SUBST([target_alias])
|
||||
m4trace:configure.in:12: -1- AC_SUBST_TRACE([target_alias])
|
||||
m4trace:configure.in:12: -1- m4_pattern_allow([^target_alias$])
|
||||
m4trace:configure.in:14: -1- AC_REQUIRE_AUX_FILE([install-sh])
|
||||
m4trace:configure.in:14: -1- AC_SUBST([MKDIR_P])
|
||||
m4trace:configure.in:14: -1- AC_SUBST_TRACE([MKDIR_P])
|
||||
m4trace:configure.in:14: -1- m4_pattern_allow([^MKDIR_P$])
|
||||
m4trace:configure.in:17: -1- AC_CANONICAL_BUILD
|
||||
m4trace:configure.in:17: -1- AC_REQUIRE_AUX_FILE([config.sub])
|
||||
m4trace:configure.in:17: -1- AC_REQUIRE_AUX_FILE([config.guess])
|
||||
m4trace:configure.in:17: -1- AC_SUBST([build], [$ac_cv_build])
|
||||
m4trace:configure.in:17: -1- AC_SUBST_TRACE([build])
|
||||
m4trace:configure.in:17: -1- m4_pattern_allow([^build$])
|
||||
m4trace:configure.in:17: -1- AC_SUBST([build_cpu], [$[1]])
|
||||
m4trace:configure.in:17: -1- AC_SUBST_TRACE([build_cpu])
|
||||
m4trace:configure.in:17: -1- m4_pattern_allow([^build_cpu$])
|
||||
m4trace:configure.in:17: -1- AC_SUBST([build_vendor], [$[2]])
|
||||
m4trace:configure.in:17: -1- AC_SUBST_TRACE([build_vendor])
|
||||
m4trace:configure.in:17: -1- m4_pattern_allow([^build_vendor$])
|
||||
m4trace:configure.in:17: -1- AC_SUBST([build_os])
|
||||
m4trace:configure.in:17: -1- AC_SUBST_TRACE([build_os])
|
||||
m4trace:configure.in:17: -1- m4_pattern_allow([^build_os$])
|
||||
m4trace:configure.in:19: -1- AC_CANONICAL_HOST
|
||||
m4trace:configure.in:19: -1- AC_SUBST([host], [$ac_cv_host])
|
||||
m4trace:configure.in:19: -1- AC_SUBST_TRACE([host])
|
||||
m4trace:configure.in:19: -1- m4_pattern_allow([^host$])
|
||||
m4trace:configure.in:19: -1- AC_SUBST([host_cpu], [$[1]])
|
||||
m4trace:configure.in:19: -1- AC_SUBST_TRACE([host_cpu])
|
||||
m4trace:configure.in:19: -1- m4_pattern_allow([^host_cpu$])
|
||||
m4trace:configure.in:19: -1- AC_SUBST([host_vendor], [$[2]])
|
||||
m4trace:configure.in:19: -1- AC_SUBST_TRACE([host_vendor])
|
||||
m4trace:configure.in:19: -1- m4_pattern_allow([^host_vendor$])
|
||||
m4trace:configure.in:19: -1- AC_SUBST([host_os])
|
||||
m4trace:configure.in:19: -1- AC_SUBST_TRACE([host_os])
|
||||
m4trace:configure.in:19: -1- m4_pattern_allow([^host_os$])
|
||||
m4trace:configure.in:21: -1- AC_CANONICAL_TARGET
|
||||
m4trace:configure.in:21: -1- AC_SUBST([target], [$ac_cv_target])
|
||||
m4trace:configure.in:21: -1- AC_SUBST_TRACE([target])
|
||||
m4trace:configure.in:21: -1- m4_pattern_allow([^target$])
|
||||
m4trace:configure.in:21: -1- AC_SUBST([target_cpu], [$[1]])
|
||||
m4trace:configure.in:21: -1- AC_SUBST_TRACE([target_cpu])
|
||||
m4trace:configure.in:21: -1- m4_pattern_allow([^target_cpu$])
|
||||
m4trace:configure.in:21: -1- AC_SUBST([target_vendor], [$[2]])
|
||||
m4trace:configure.in:21: -1- AC_SUBST_TRACE([target_vendor])
|
||||
m4trace:configure.in:21: -1- m4_pattern_allow([^target_vendor$])
|
||||
m4trace:configure.in:21: -1- AC_SUBST([target_os])
|
||||
m4trace:configure.in:21: -1- AC_SUBST_TRACE([target_os])
|
||||
m4trace:configure.in:21: -1- m4_pattern_allow([^target_os$])
|
||||
m4trace:configure.in:57: -1- _m4_warn([obsolete], [back quotes and double quotes must not be escaped in: unknown Windows API \"$api\" (do you need --help?)], [])
|
||||
m4trace:configure.in:73: -1- AC_DEFINE_TRACE_LITERAL([PA_ENABLE_DEBUG_OUTPUT])
|
||||
m4trace:configure.in:73: -1- m4_pattern_allow([^PA_ENABLE_DEBUG_OUTPUT$])
|
||||
m4trace:configure.in:73: -1- AH_OUTPUT([PA_ENABLE_DEBUG_OUTPUT], [/* Enable debugging messages */
|
||||
@%:@undef PA_ENABLE_DEBUG_OUTPUT])
|
||||
m4trace:configure.in:101: -1- AC_SUBST([CC])
|
||||
m4trace:configure.in:101: -1- AC_SUBST_TRACE([CC])
|
||||
m4trace:configure.in:101: -1- m4_pattern_allow([^CC$])
|
||||
m4trace:configure.in:101: -1- AC_SUBST([CFLAGS])
|
||||
m4trace:configure.in:101: -1- AC_SUBST_TRACE([CFLAGS])
|
||||
m4trace:configure.in:101: -1- m4_pattern_allow([^CFLAGS$])
|
||||
m4trace:configure.in:101: -1- AC_SUBST([LDFLAGS])
|
||||
m4trace:configure.in:101: -1- AC_SUBST_TRACE([LDFLAGS])
|
||||
m4trace:configure.in:101: -1- m4_pattern_allow([^LDFLAGS$])
|
||||
m4trace:configure.in:101: -1- AC_SUBST([LIBS])
|
||||
m4trace:configure.in:101: -1- AC_SUBST_TRACE([LIBS])
|
||||
m4trace:configure.in:101: -1- m4_pattern_allow([^LIBS$])
|
||||
m4trace:configure.in:101: -1- AC_SUBST([CPPFLAGS])
|
||||
m4trace:configure.in:101: -1- AC_SUBST_TRACE([CPPFLAGS])
|
||||
m4trace:configure.in:101: -1- m4_pattern_allow([^CPPFLAGS$])
|
||||
m4trace:configure.in:101: -1- AC_SUBST([CC])
|
||||
m4trace:configure.in:101: -1- AC_SUBST_TRACE([CC])
|
||||
m4trace:configure.in:101: -1- m4_pattern_allow([^CC$])
|
||||
m4trace:configure.in:101: -1- AC_SUBST([CC])
|
||||
m4trace:configure.in:101: -1- AC_SUBST_TRACE([CC])
|
||||
m4trace:configure.in:101: -1- m4_pattern_allow([^CC$])
|
||||
m4trace:configure.in:101: -1- AC_SUBST([CC])
|
||||
m4trace:configure.in:101: -1- AC_SUBST_TRACE([CC])
|
||||
m4trace:configure.in:101: -1- m4_pattern_allow([^CC$])
|
||||
m4trace:configure.in:101: -1- AC_SUBST([CC])
|
||||
m4trace:configure.in:101: -1- AC_SUBST_TRACE([CC])
|
||||
m4trace:configure.in:101: -1- m4_pattern_allow([^CC$])
|
||||
m4trace:configure.in:101: -1- AC_SUBST([ac_ct_CC])
|
||||
m4trace:configure.in:101: -1- AC_SUBST_TRACE([ac_ct_CC])
|
||||
m4trace:configure.in:101: -1- m4_pattern_allow([^ac_ct_CC$])
|
||||
m4trace:configure.in:101: -1- AC_SUBST([EXEEXT], [$ac_cv_exeext])
|
||||
m4trace:configure.in:101: -1- AC_SUBST_TRACE([EXEEXT])
|
||||
m4trace:configure.in:101: -1- m4_pattern_allow([^EXEEXT$])
|
||||
m4trace:configure.in:101: -1- AC_SUBST([OBJEXT], [$ac_cv_objext])
|
||||
m4trace:configure.in:101: -1- AC_SUBST_TRACE([OBJEXT])
|
||||
m4trace:configure.in:101: -1- m4_pattern_allow([^OBJEXT$])
|
||||
m4trace:configure.in:104: -1- AC_SUBST([CXX])
|
||||
m4trace:configure.in:104: -1- AC_SUBST_TRACE([CXX])
|
||||
m4trace:configure.in:104: -1- m4_pattern_allow([^CXX$])
|
||||
m4trace:configure.in:104: -1- AC_SUBST([CXXFLAGS])
|
||||
m4trace:configure.in:104: -1- AC_SUBST_TRACE([CXXFLAGS])
|
||||
m4trace:configure.in:104: -1- m4_pattern_allow([^CXXFLAGS$])
|
||||
m4trace:configure.in:104: -1- AC_SUBST([LDFLAGS])
|
||||
m4trace:configure.in:104: -1- AC_SUBST_TRACE([LDFLAGS])
|
||||
m4trace:configure.in:104: -1- m4_pattern_allow([^LDFLAGS$])
|
||||
m4trace:configure.in:104: -1- AC_SUBST([LIBS])
|
||||
m4trace:configure.in:104: -1- AC_SUBST_TRACE([LIBS])
|
||||
m4trace:configure.in:104: -1- m4_pattern_allow([^LIBS$])
|
||||
m4trace:configure.in:104: -1- AC_SUBST([CPPFLAGS])
|
||||
m4trace:configure.in:104: -1- AC_SUBST_TRACE([CPPFLAGS])
|
||||
m4trace:configure.in:104: -1- m4_pattern_allow([^CPPFLAGS$])
|
||||
m4trace:configure.in:104: -1- AC_SUBST([CXX])
|
||||
m4trace:configure.in:104: -1- AC_SUBST_TRACE([CXX])
|
||||
m4trace:configure.in:104: -1- m4_pattern_allow([^CXX$])
|
||||
m4trace:configure.in:104: -1- AC_SUBST([ac_ct_CXX])
|
||||
m4trace:configure.in:104: -1- AC_SUBST_TRACE([ac_ct_CXX])
|
||||
m4trace:configure.in:104: -1- m4_pattern_allow([^ac_ct_CXX$])
|
||||
m4trace:configure.in:106: -1- _m4_warn([obsolete], [The macro `AC_LIBTOOL_WIN32_DLL' is obsolete.
|
||||
You should run autoupdate.], [aclocal.m4:8119: AC_LIBTOOL_WIN32_DLL is expanded from...
|
||||
configure.in:106: the top level])
|
||||
m4trace:configure.in:106: -1- AC_SUBST([AS])
|
||||
m4trace:configure.in:106: -1- AC_SUBST_TRACE([AS])
|
||||
m4trace:configure.in:106: -1- m4_pattern_allow([^AS$])
|
||||
m4trace:configure.in:106: -1- AC_SUBST([DLLTOOL])
|
||||
m4trace:configure.in:106: -1- AC_SUBST_TRACE([DLLTOOL])
|
||||
m4trace:configure.in:106: -1- m4_pattern_allow([^DLLTOOL$])
|
||||
m4trace:configure.in:106: -1- AC_SUBST([OBJDUMP])
|
||||
m4trace:configure.in:106: -1- AC_SUBST_TRACE([OBJDUMP])
|
||||
m4trace:configure.in:106: -1- m4_pattern_allow([^OBJDUMP$])
|
||||
m4trace:configure.in:106: -1- _m4_warn([obsolete], [AC_LIBTOOL_WIN32_DLL: Remove this warning and the call to _LT_SET_OPTION when you
|
||||
put the `win32-dll' option into LT_INIT's first parameter.], [aclocal.m4:8119: AC_LIBTOOL_WIN32_DLL is expanded from...
|
||||
configure.in:106: the top level])
|
||||
m4trace:configure.in:107: -1- AC_PROG_LIBTOOL
|
||||
m4trace:configure.in:107: -1- _m4_warn([obsolete], [The macro `AC_PROG_LIBTOOL' is obsolete.
|
||||
You should run autoupdate.], [aclocal.m4:121: AC_PROG_LIBTOOL is expanded from...
|
||||
configure.in:107: the top level])
|
||||
m4trace:configure.in:107: -1- LT_INIT
|
||||
m4trace:configure.in:107: -1- m4_pattern_forbid([^_?LT_[A-Z_]+$])
|
||||
m4trace:configure.in:107: -1- m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])
|
||||
m4trace:configure.in:107: -1- AC_REQUIRE_AUX_FILE([ltmain.sh])
|
||||
m4trace:configure.in:107: -1- AC_SUBST([LIBTOOL])
|
||||
m4trace:configure.in:107: -1- AC_SUBST_TRACE([LIBTOOL])
|
||||
m4trace:configure.in:107: -1- m4_pattern_allow([^LIBTOOL$])
|
||||
m4trace:configure.in:107: -1- AC_SUBST([SED])
|
||||
m4trace:configure.in:107: -1- AC_SUBST_TRACE([SED])
|
||||
m4trace:configure.in:107: -1- m4_pattern_allow([^SED$])
|
||||
m4trace:configure.in:107: -1- AC_SUBST([GREP])
|
||||
m4trace:configure.in:107: -1- AC_SUBST_TRACE([GREP])
|
||||
m4trace:configure.in:107: -1- m4_pattern_allow([^GREP$])
|
||||
m4trace:configure.in:107: -1- AC_SUBST([EGREP])
|
||||
m4trace:configure.in:107: -1- AC_SUBST_TRACE([EGREP])
|
||||
m4trace:configure.in:107: -1- m4_pattern_allow([^EGREP$])
|
||||
m4trace:configure.in:107: -1- AC_SUBST([FGREP])
|
||||
m4trace:configure.in:107: -1- AC_SUBST_TRACE([FGREP])
|
||||
m4trace:configure.in:107: -1- m4_pattern_allow([^FGREP$])
|
||||
m4trace:configure.in:107: -1- AC_SUBST([GREP])
|
||||
m4trace:configure.in:107: -1- AC_SUBST_TRACE([GREP])
|
||||
m4trace:configure.in:107: -1- m4_pattern_allow([^GREP$])
|
||||
m4trace:configure.in:107: -1- AC_SUBST([LD])
|
||||
m4trace:configure.in:107: -1- AC_SUBST_TRACE([LD])
|
||||
m4trace:configure.in:107: -1- m4_pattern_allow([^LD$])
|
||||
m4trace:configure.in:107: -1- AC_SUBST([DUMPBIN])
|
||||
m4trace:configure.in:107: -1- AC_SUBST_TRACE([DUMPBIN])
|
||||
m4trace:configure.in:107: -1- m4_pattern_allow([^DUMPBIN$])
|
||||
m4trace:configure.in:107: -1- AC_SUBST([ac_ct_DUMPBIN])
|
||||
m4trace:configure.in:107: -1- AC_SUBST_TRACE([ac_ct_DUMPBIN])
|
||||
m4trace:configure.in:107: -1- m4_pattern_allow([^ac_ct_DUMPBIN$])
|
||||
m4trace:configure.in:107: -1- AC_SUBST([DUMPBIN])
|
||||
m4trace:configure.in:107: -1- AC_SUBST_TRACE([DUMPBIN])
|
||||
m4trace:configure.in:107: -1- m4_pattern_allow([^DUMPBIN$])
|
||||
m4trace:configure.in:107: -1- AC_SUBST([NM])
|
||||
m4trace:configure.in:107: -1- AC_SUBST_TRACE([NM])
|
||||
m4trace:configure.in:107: -1- m4_pattern_allow([^NM$])
|
||||
m4trace:configure.in:107: -1- AC_SUBST([LN_S], [$as_ln_s])
|
||||
m4trace:configure.in:107: -1- AC_SUBST_TRACE([LN_S])
|
||||
m4trace:configure.in:107: -1- m4_pattern_allow([^LN_S$])
|
||||
m4trace:configure.in:107: -1- AC_SUBST([OBJDUMP])
|
||||
m4trace:configure.in:107: -1- AC_SUBST_TRACE([OBJDUMP])
|
||||
m4trace:configure.in:107: -1- m4_pattern_allow([^OBJDUMP$])
|
||||
m4trace:configure.in:107: -1- AC_SUBST([OBJDUMP])
|
||||
m4trace:configure.in:107: -1- AC_SUBST_TRACE([OBJDUMP])
|
||||
m4trace:configure.in:107: -1- m4_pattern_allow([^OBJDUMP$])
|
||||
m4trace:configure.in:107: -1- AC_SUBST([DLLTOOL])
|
||||
m4trace:configure.in:107: -1- AC_SUBST_TRACE([DLLTOOL])
|
||||
m4trace:configure.in:107: -1- m4_pattern_allow([^DLLTOOL$])
|
||||
m4trace:configure.in:107: -1- AC_SUBST([DLLTOOL])
|
||||
m4trace:configure.in:107: -1- AC_SUBST_TRACE([DLLTOOL])
|
||||
m4trace:configure.in:107: -1- m4_pattern_allow([^DLLTOOL$])
|
||||
m4trace:configure.in:107: -1- AC_SUBST([AR])
|
||||
m4trace:configure.in:107: -1- AC_SUBST_TRACE([AR])
|
||||
m4trace:configure.in:107: -1- m4_pattern_allow([^AR$])
|
||||
m4trace:configure.in:107: -1- AC_SUBST([ac_ct_AR])
|
||||
m4trace:configure.in:107: -1- AC_SUBST_TRACE([ac_ct_AR])
|
||||
m4trace:configure.in:107: -1- m4_pattern_allow([^ac_ct_AR$])
|
||||
m4trace:configure.in:107: -1- AC_SUBST([STRIP])
|
||||
m4trace:configure.in:107: -1- AC_SUBST_TRACE([STRIP])
|
||||
m4trace:configure.in:107: -1- m4_pattern_allow([^STRIP$])
|
||||
m4trace:configure.in:107: -1- AC_SUBST([RANLIB])
|
||||
m4trace:configure.in:107: -1- AC_SUBST_TRACE([RANLIB])
|
||||
m4trace:configure.in:107: -1- m4_pattern_allow([^RANLIB$])
|
||||
m4trace:configure.in:107: -1- AC_SUBST([AWK])
|
||||
m4trace:configure.in:107: -1- AC_SUBST_TRACE([AWK])
|
||||
m4trace:configure.in:107: -1- m4_pattern_allow([^AWK$])
|
||||
m4trace:configure.in:107: -1- m4_pattern_allow([LT_OBJDIR])
|
||||
m4trace:configure.in:107: -1- AC_DEFINE_TRACE_LITERAL([LT_OBJDIR])
|
||||
m4trace:configure.in:107: -1- m4_pattern_allow([^LT_OBJDIR$])
|
||||
m4trace:configure.in:107: -1- AH_OUTPUT([LT_OBJDIR], [/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
||||
*/
|
||||
@%:@undef LT_OBJDIR])
|
||||
m4trace:configure.in:107: -1- LT_SUPPORTED_TAG([CC])
|
||||
m4trace:configure.in:107: -1- AC_SUBST([MANIFEST_TOOL])
|
||||
m4trace:configure.in:107: -1- AC_SUBST_TRACE([MANIFEST_TOOL])
|
||||
m4trace:configure.in:107: -1- m4_pattern_allow([^MANIFEST_TOOL$])
|
||||
m4trace:configure.in:107: -1- AC_SUBST([DSYMUTIL])
|
||||
m4trace:configure.in:107: -1- AC_SUBST_TRACE([DSYMUTIL])
|
||||
m4trace:configure.in:107: -1- m4_pattern_allow([^DSYMUTIL$])
|
||||
m4trace:configure.in:107: -1- AC_SUBST([NMEDIT])
|
||||
m4trace:configure.in:107: -1- AC_SUBST_TRACE([NMEDIT])
|
||||
m4trace:configure.in:107: -1- m4_pattern_allow([^NMEDIT$])
|
||||
m4trace:configure.in:107: -1- AC_SUBST([LIPO])
|
||||
m4trace:configure.in:107: -1- AC_SUBST_TRACE([LIPO])
|
||||
m4trace:configure.in:107: -1- m4_pattern_allow([^LIPO$])
|
||||
m4trace:configure.in:107: -1- AC_SUBST([OTOOL])
|
||||
m4trace:configure.in:107: -1- AC_SUBST_TRACE([OTOOL])
|
||||
m4trace:configure.in:107: -1- m4_pattern_allow([^OTOOL$])
|
||||
m4trace:configure.in:107: -1- AC_SUBST([OTOOL64])
|
||||
m4trace:configure.in:107: -1- AC_SUBST_TRACE([OTOOL64])
|
||||
m4trace:configure.in:107: -1- m4_pattern_allow([^OTOOL64$])
|
||||
m4trace:configure.in:107: -1- AH_OUTPUT([HAVE_DLFCN_H], [/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
@%:@undef HAVE_DLFCN_H])
|
||||
m4trace:configure.in:107: -1- AC_SUBST([CPP])
|
||||
m4trace:configure.in:107: -1- AC_SUBST_TRACE([CPP])
|
||||
m4trace:configure.in:107: -1- m4_pattern_allow([^CPP$])
|
||||
m4trace:configure.in:107: -1- AC_SUBST([CPPFLAGS])
|
||||
m4trace:configure.in:107: -1- AC_SUBST_TRACE([CPPFLAGS])
|
||||
m4trace:configure.in:107: -1- m4_pattern_allow([^CPPFLAGS$])
|
||||
m4trace:configure.in:107: -1- AC_SUBST([CPP])
|
||||
m4trace:configure.in:107: -1- AC_SUBST_TRACE([CPP])
|
||||
m4trace:configure.in:107: -1- m4_pattern_allow([^CPP$])
|
||||
m4trace:configure.in:107: -1- AC_DEFINE_TRACE_LITERAL([STDC_HEADERS])
|
||||
m4trace:configure.in:107: -1- m4_pattern_allow([^STDC_HEADERS$])
|
||||
m4trace:configure.in:107: -1- AH_OUTPUT([STDC_HEADERS], [/* Define to 1 if you have the ANSI C header files. */
|
||||
@%:@undef STDC_HEADERS])
|
||||
m4trace:configure.in:107: -1- AH_OUTPUT([HAVE_SYS_TYPES_H], [/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
@%:@undef HAVE_SYS_TYPES_H])
|
||||
m4trace:configure.in:107: -1- AH_OUTPUT([HAVE_SYS_STAT_H], [/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
@%:@undef HAVE_SYS_STAT_H])
|
||||
m4trace:configure.in:107: -1- AH_OUTPUT([HAVE_STDLIB_H], [/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
@%:@undef HAVE_STDLIB_H])
|
||||
m4trace:configure.in:107: -1- AH_OUTPUT([HAVE_STRING_H], [/* Define to 1 if you have the <string.h> header file. */
|
||||
@%:@undef HAVE_STRING_H])
|
||||
m4trace:configure.in:107: -1- AH_OUTPUT([HAVE_MEMORY_H], [/* Define to 1 if you have the <memory.h> header file. */
|
||||
@%:@undef HAVE_MEMORY_H])
|
||||
m4trace:configure.in:107: -1- AH_OUTPUT([HAVE_STRINGS_H], [/* Define to 1 if you have the <strings.h> header file. */
|
||||
@%:@undef HAVE_STRINGS_H])
|
||||
m4trace:configure.in:107: -1- AH_OUTPUT([HAVE_INTTYPES_H], [/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
@%:@undef HAVE_INTTYPES_H])
|
||||
m4trace:configure.in:107: -1- AH_OUTPUT([HAVE_STDINT_H], [/* Define to 1 if you have the <stdint.h> header file. */
|
||||
@%:@undef HAVE_STDINT_H])
|
||||
m4trace:configure.in:107: -1- AH_OUTPUT([HAVE_UNISTD_H], [/* Define to 1 if you have the <unistd.h> header file. */
|
||||
@%:@undef HAVE_UNISTD_H])
|
||||
m4trace:configure.in:107: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DLFCN_H])
|
||||
m4trace:configure.in:107: -1- m4_pattern_allow([^HAVE_DLFCN_H$])
|
||||
m4trace:configure.in:107: -1- LT_SUPPORTED_TAG([CXX])
|
||||
m4trace:configure.in:107: -1- AC_SUBST([CXXCPP])
|
||||
m4trace:configure.in:107: -1- AC_SUBST_TRACE([CXXCPP])
|
||||
m4trace:configure.in:107: -1- m4_pattern_allow([^CXXCPP$])
|
||||
m4trace:configure.in:107: -1- AC_SUBST([CPPFLAGS])
|
||||
m4trace:configure.in:107: -1- AC_SUBST_TRACE([CPPFLAGS])
|
||||
m4trace:configure.in:107: -1- m4_pattern_allow([^CPPFLAGS$])
|
||||
m4trace:configure.in:107: -1- AC_SUBST([CXXCPP])
|
||||
m4trace:configure.in:107: -1- AC_SUBST_TRACE([CXXCPP])
|
||||
m4trace:configure.in:107: -1- m4_pattern_allow([^CXXCPP$])
|
||||
m4trace:configure.in:107: -1- AC_SUBST([LD])
|
||||
m4trace:configure.in:107: -1- AC_SUBST_TRACE([LD])
|
||||
m4trace:configure.in:107: -1- m4_pattern_allow([^LD$])
|
||||
m4trace:configure.in:108: -1- AC_REQUIRE_AUX_FILE([install-sh])
|
||||
m4trace:configure.in:108: -1- AC_SUBST([INSTALL_PROGRAM])
|
||||
m4trace:configure.in:108: -1- AC_SUBST_TRACE([INSTALL_PROGRAM])
|
||||
m4trace:configure.in:108: -1- m4_pattern_allow([^INSTALL_PROGRAM$])
|
||||
m4trace:configure.in:108: -1- AC_SUBST([INSTALL_SCRIPT])
|
||||
m4trace:configure.in:108: -1- AC_SUBST_TRACE([INSTALL_SCRIPT])
|
||||
m4trace:configure.in:108: -1- m4_pattern_allow([^INSTALL_SCRIPT$])
|
||||
m4trace:configure.in:108: -1- AC_SUBST([INSTALL_DATA])
|
||||
m4trace:configure.in:108: -1- AC_SUBST_TRACE([INSTALL_DATA])
|
||||
m4trace:configure.in:108: -1- m4_pattern_allow([^INSTALL_DATA$])
|
||||
m4trace:configure.in:109: -1- AC_SUBST([LN_S], [$as_ln_s])
|
||||
m4trace:configure.in:109: -1- AC_SUBST_TRACE([LN_S])
|
||||
m4trace:configure.in:109: -1- m4_pattern_allow([^LN_S$])
|
||||
m4trace:configure.in:110: -1- AC_SUBST([AR])
|
||||
m4trace:configure.in:110: -1- AC_SUBST_TRACE([AR])
|
||||
m4trace:configure.in:110: -1- m4_pattern_allow([^AR$])
|
||||
m4trace:configure.in:116: -1- AH_OUTPUT([WORDS_BIGENDIAN], [/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
|
||||
significant byte first (like Motorola and SPARC, unlike Intel). */
|
||||
#if defined AC_APPLE_UNIVERSAL_BUILD
|
||||
# if defined __BIG_ENDIAN__
|
||||
# define WORDS_BIGENDIAN 1
|
||||
# endif
|
||||
#else
|
||||
# ifndef WORDS_BIGENDIAN
|
||||
# undef WORDS_BIGENDIAN
|
||||
# endif
|
||||
#endif])
|
||||
m4trace:configure.in:116: -1- AC_DEFINE_TRACE_LITERAL([WORDS_BIGENDIAN])
|
||||
m4trace:configure.in:116: -1- m4_pattern_allow([^WORDS_BIGENDIAN$])
|
||||
m4trace:configure.in:116: -1- AC_DEFINE_TRACE_LITERAL([AC_APPLE_UNIVERSAL_BUILD])
|
||||
m4trace:configure.in:116: -1- m4_pattern_allow([^AC_APPLE_UNIVERSAL_BUILD$])
|
||||
m4trace:configure.in:116: -1- AH_OUTPUT([AC_APPLE_UNIVERSAL_BUILD], [/* Define if building universal (internal helper macro) */
|
||||
@%:@undef AC_APPLE_UNIVERSAL_BUILD])
|
||||
m4trace:configure.in:132: -1- AH_OUTPUT([HAVE_SYS_SOUNDCARD_H], [/* Define to 1 if you have the <sys/soundcard.h> header file. */
|
||||
@%:@undef HAVE_SYS_SOUNDCARD_H])
|
||||
m4trace:configure.in:132: -1- AH_OUTPUT([HAVE_LINUX_SOUNDCARD_H], [/* Define to 1 if you have the <linux/soundcard.h> header file. */
|
||||
@%:@undef HAVE_LINUX_SOUNDCARD_H])
|
||||
m4trace:configure.in:132: -1- AH_OUTPUT([HAVE_MACHINE_SOUNDCARD_H], [/* Define to 1 if you have the <machine/soundcard.h> header file. */
|
||||
@%:@undef HAVE_MACHINE_SOUNDCARD_H])
|
||||
m4trace:configure.in:139: -1- m4_pattern_forbid([^_?PKG_[A-Z_]+$])
|
||||
m4trace:configure.in:139: -1- m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
|
||||
m4trace:configure.in:139: -1- m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
|
||||
m4trace:configure.in:139: -1- AC_SUBST([PKG_CONFIG])
|
||||
m4trace:configure.in:139: -1- AC_SUBST_TRACE([PKG_CONFIG])
|
||||
m4trace:configure.in:139: -1- m4_pattern_allow([^PKG_CONFIG$])
|
||||
m4trace:configure.in:139: -1- AC_SUBST([PKG_CONFIG_PATH])
|
||||
m4trace:configure.in:139: -1- AC_SUBST_TRACE([PKG_CONFIG_PATH])
|
||||
m4trace:configure.in:139: -1- m4_pattern_allow([^PKG_CONFIG_PATH$])
|
||||
m4trace:configure.in:139: -1- AC_SUBST([PKG_CONFIG_LIBDIR])
|
||||
m4trace:configure.in:139: -1- AC_SUBST_TRACE([PKG_CONFIG_LIBDIR])
|
||||
m4trace:configure.in:139: -1- m4_pattern_allow([^PKG_CONFIG_LIBDIR$])
|
||||
m4trace:configure.in:139: -1- AC_SUBST([PKG_CONFIG])
|
||||
m4trace:configure.in:139: -1- AC_SUBST_TRACE([PKG_CONFIG])
|
||||
m4trace:configure.in:139: -1- m4_pattern_allow([^PKG_CONFIG$])
|
||||
m4trace:configure.in:139: -1- AC_SUBST([JACK_CFLAGS])
|
||||
m4trace:configure.in:139: -1- AC_SUBST_TRACE([JACK_CFLAGS])
|
||||
m4trace:configure.in:139: -1- m4_pattern_allow([^JACK_CFLAGS$])
|
||||
m4trace:configure.in:139: -1- AC_SUBST([JACK_LIBS])
|
||||
m4trace:configure.in:139: -1- AC_SUBST_TRACE([JACK_LIBS])
|
||||
m4trace:configure.in:139: -1- m4_pattern_allow([^JACK_LIBS$])
|
||||
m4trace:configure.in:145: -1- AC_DEFINE_TRACE_LITERAL([SIZEOF_SHORT])
|
||||
m4trace:configure.in:145: -1- m4_pattern_allow([^SIZEOF_SHORT$])
|
||||
m4trace:configure.in:145: -1- AH_OUTPUT([SIZEOF_SHORT], [/* The size of `short\', as computed by sizeof. */
|
||||
@%:@undef SIZEOF_SHORT])
|
||||
m4trace:configure.in:146: -1- AC_DEFINE_TRACE_LITERAL([SIZEOF_INT])
|
||||
m4trace:configure.in:146: -1- m4_pattern_allow([^SIZEOF_INT$])
|
||||
m4trace:configure.in:146: -1- AH_OUTPUT([SIZEOF_INT], [/* The size of `int\', as computed by sizeof. */
|
||||
@%:@undef SIZEOF_INT])
|
||||
m4trace:configure.in:147: -1- AC_DEFINE_TRACE_LITERAL([SIZEOF_LONG])
|
||||
m4trace:configure.in:147: -1- m4_pattern_allow([^SIZEOF_LONG$])
|
||||
m4trace:configure.in:147: -1- AH_OUTPUT([SIZEOF_LONG], [/* The size of `long\', as computed by sizeof. */
|
||||
@%:@undef SIZEOF_LONG])
|
||||
m4trace:configure.in:153: -1- AH_OUTPUT([HAVE_CLOCK_GETTIME], [/* Define to 1 if you have the `clock_gettime\' function. */
|
||||
@%:@undef HAVE_CLOCK_GETTIME])
|
||||
m4trace:configure.in:153: -1- AH_OUTPUT([HAVE_NANOSLEEP], [/* Define to 1 if you have the `nanosleep\' function. */
|
||||
@%:@undef HAVE_NANOSLEEP])
|
||||
m4trace:configure.in:161: -1- AC_SUBST([LT_CURRENT])
|
||||
m4trace:configure.in:161: -1- AC_SUBST_TRACE([LT_CURRENT])
|
||||
m4trace:configure.in:161: -1- m4_pattern_allow([^LT_CURRENT$])
|
||||
m4trace:configure.in:162: -1- AC_SUBST([LT_REVISION])
|
||||
m4trace:configure.in:162: -1- AC_SUBST_TRACE([LT_REVISION])
|
||||
m4trace:configure.in:162: -1- m4_pattern_allow([^LT_REVISION$])
|
||||
m4trace:configure.in:163: -1- AC_SUBST([LT_AGE])
|
||||
m4trace:configure.in:163: -1- AC_SUBST_TRACE([LT_AGE])
|
||||
m4trace:configure.in:163: -1- m4_pattern_allow([^LT_AGE$])
|
||||
m4trace:configure.in:166: -1- AC_SUBST([OTHER_OBJS])
|
||||
m4trace:configure.in:166: -1- AC_SUBST_TRACE([OTHER_OBJS])
|
||||
m4trace:configure.in:166: -1- m4_pattern_allow([^OTHER_OBJS$])
|
||||
m4trace:configure.in:167: -1- AC_SUBST([PADLL])
|
||||
m4trace:configure.in:167: -1- AC_SUBST_TRACE([PADLL])
|
||||
m4trace:configure.in:167: -1- m4_pattern_allow([^PADLL$])
|
||||
m4trace:configure.in:168: -1- AC_SUBST([SHARED_FLAGS])
|
||||
m4trace:configure.in:168: -1- AC_SUBST_TRACE([SHARED_FLAGS])
|
||||
m4trace:configure.in:168: -1- m4_pattern_allow([^SHARED_FLAGS$])
|
||||
m4trace:configure.in:169: -1- AC_SUBST([THREAD_CFLAGS])
|
||||
m4trace:configure.in:169: -1- AC_SUBST_TRACE([THREAD_CFLAGS])
|
||||
m4trace:configure.in:169: -1- m4_pattern_allow([^THREAD_CFLAGS$])
|
||||
m4trace:configure.in:170: -1- AC_SUBST([DLL_LIBS])
|
||||
m4trace:configure.in:170: -1- AC_SUBST_TRACE([DLL_LIBS])
|
||||
m4trace:configure.in:170: -1- m4_pattern_allow([^DLL_LIBS$])
|
||||
m4trace:configure.in:171: -1- AC_SUBST([CXXFLAGS])
|
||||
m4trace:configure.in:171: -1- AC_SUBST_TRACE([CXXFLAGS])
|
||||
m4trace:configure.in:171: -1- m4_pattern_allow([^CXXFLAGS$])
|
||||
m4trace:configure.in:172: -1- AC_SUBST([NASM])
|
||||
m4trace:configure.in:172: -1- AC_SUBST_TRACE([NASM])
|
||||
m4trace:configure.in:172: -1- m4_pattern_allow([^NASM$])
|
||||
m4trace:configure.in:173: -1- AC_SUBST([NASMOPT])
|
||||
m4trace:configure.in:173: -1- AC_SUBST_TRACE([NASMOPT])
|
||||
m4trace:configure.in:173: -1- m4_pattern_allow([^NASMOPT$])
|
||||
m4trace:configure.in:174: -1- AC_SUBST([INCLUDES])
|
||||
m4trace:configure.in:174: -1- AC_SUBST_TRACE([INCLUDES])
|
||||
m4trace:configure.in:174: -1- m4_pattern_allow([^INCLUDES$])
|
||||
m4trace:configure.in:207: -1- AC_DEFINE_TRACE_LITERAL([PA_USE_COREAUDIO])
|
||||
m4trace:configure.in:207: -1- m4_pattern_allow([^PA_USE_COREAUDIO$])
|
||||
m4trace:configure.in:260: -1- _m4_warn([obsolete], [The macro `AC_TRY_COMPILE' is obsolete.
|
||||
You should run autoupdate.], [../../lib/autoconf/general.m4:2614: AC_TRY_COMPILE is expanded from...
|
||||
configure.in:260: the top level])
|
||||
m4trace:configure.in:356: -1- AH_OUTPUT([HAVE_LIBPTHREAD], [/* Define to 1 if you have the `pthread\' library (-lpthread). */
|
||||
@%:@undef HAVE_LIBPTHREAD])
|
||||
m4trace:configure.in:356: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LIBPTHREAD])
|
||||
m4trace:configure.in:356: -1- m4_pattern_allow([^HAVE_LIBPTHREAD$])
|
||||
m4trace:configure.in:357: -1- AH_OUTPUT([HAVE_LIBAUDIO], [/* Define to 1 if you have the `audio\' library (-laudio). */
|
||||
@%:@undef HAVE_LIBAUDIO])
|
||||
m4trace:configure.in:357: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LIBAUDIO])
|
||||
m4trace:configure.in:357: -1- m4_pattern_allow([^HAVE_LIBAUDIO$])
|
||||
m4trace:configure.in:358: -1- AH_OUTPUT([HAVE_LIBDMEDIA], [/* Define to 1 if you have the `dmedia\' library (-ldmedia). */
|
||||
@%:@undef HAVE_LIBDMEDIA])
|
||||
m4trace:configure.in:358: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LIBDMEDIA])
|
||||
m4trace:configure.in:358: -1- m4_pattern_allow([^HAVE_LIBDMEDIA$])
|
||||
m4trace:configure.in:363: -1- AC_DEFINE_TRACE_LITERAL([PA_USE_SGI])
|
||||
m4trace:configure.in:363: -1- m4_pattern_allow([^PA_USE_SGI$])
|
||||
m4trace:configure.in:393: -1- AC_DEFINE_TRACE_LITERAL([PA_USE_ALSA])
|
||||
m4trace:configure.in:393: -1- m4_pattern_allow([^PA_USE_ALSA$])
|
||||
m4trace:configure.in:401: -1- AC_DEFINE_TRACE_LITERAL([PA_USE_JACK])
|
||||
m4trace:configure.in:401: -1- m4_pattern_allow([^PA_USE_JACK$])
|
||||
m4trace:configure.in:410: -1- AC_DEFINE_TRACE_LITERAL([PA_USE_OSS])
|
||||
m4trace:configure.in:410: -1- m4_pattern_allow([^PA_USE_OSS$])
|
||||
m4trace:configure.in:417: -1- AC_DEFINE_TRACE_LITERAL([PA_USE_ASIHPI])
|
||||
m4trace:configure.in:417: -1- m4_pattern_allow([^PA_USE_ASIHPI$])
|
||||
m4trace:configure.in:443: -1- AC_CONFIG_SUBDIRS([bindings/cpp])
|
||||
m4trace:configure.in:443: -1- AC_SUBST([subdirs], ["$subdirs m4_normalize([bindings/cpp])"])
|
||||
m4trace:configure.in:443: -1- AC_SUBST_TRACE([subdirs])
|
||||
m4trace:configure.in:443: -1- m4_pattern_allow([^subdirs$])
|
||||
m4trace:configure.in:450: -1- AC_SUBST([ENABLE_CXX_TRUE])
|
||||
m4trace:configure.in:450: -1- AC_SUBST_TRACE([ENABLE_CXX_TRUE])
|
||||
m4trace:configure.in:450: -1- m4_pattern_allow([^ENABLE_CXX_TRUE$])
|
||||
m4trace:configure.in:451: -1- AC_SUBST([ENABLE_CXX_FALSE])
|
||||
m4trace:configure.in:451: -1- AC_SUBST_TRACE([ENABLE_CXX_FALSE])
|
||||
m4trace:configure.in:451: -1- m4_pattern_allow([^ENABLE_CXX_FALSE$])
|
||||
m4trace:configure.in:460: -1- AC_SUBST([WITH_ASIO_TRUE])
|
||||
m4trace:configure.in:460: -1- AC_SUBST_TRACE([WITH_ASIO_TRUE])
|
||||
m4trace:configure.in:460: -1- m4_pattern_allow([^WITH_ASIO_TRUE$])
|
||||
m4trace:configure.in:461: -1- AC_SUBST([WITH_ASIO_FALSE])
|
||||
m4trace:configure.in:461: -1- AC_SUBST_TRACE([WITH_ASIO_FALSE])
|
||||
m4trace:configure.in:461: -1- m4_pattern_allow([^WITH_ASIO_FALSE$])
|
||||
m4trace:configure.in:463: -1- AC_CONFIG_FILES([Makefile])
|
||||
m4trace:configure.in:463: -1- _m4_warn([obsolete], [AC_OUTPUT should be used without arguments.
|
||||
You should run autoupdate.], [])
|
||||
m4trace:configure.in:463: -1- AC_SUBST([LIB@&t@OBJS], [$ac_libobjs])
|
||||
m4trace:configure.in:463: -1- AC_SUBST_TRACE([LIB@&t@OBJS])
|
||||
m4trace:configure.in:463: -1- m4_pattern_allow([^LIB@&t@OBJS$])
|
||||
m4trace:configure.in:463: -1- AC_SUBST([LTLIBOBJS], [$ac_ltlibobjs])
|
||||
m4trace:configure.in:463: -1- AC_SUBST_TRACE([LTLIBOBJS])
|
||||
m4trace:configure.in:463: -1- m4_pattern_allow([^LTLIBOBJS$])
|
||||
m4trace:configure.in:463: -1- _m4_warn([obsolete], [AC_C_BIGENDIAN should be used with AC_CONFIG_HEADERS], [])
|
||||
m4trace:configure.in:463: -1- AC_SUBST_TRACE([top_builddir])
|
||||
m4trace:configure.in:463: -1- AC_SUBST_TRACE([top_build_prefix])
|
||||
m4trace:configure.in:463: -1- AC_SUBST_TRACE([srcdir])
|
||||
m4trace:configure.in:463: -1- AC_SUBST_TRACE([abs_srcdir])
|
||||
m4trace:configure.in:463: -1- AC_SUBST_TRACE([top_srcdir])
|
||||
m4trace:configure.in:463: -1- AC_SUBST_TRACE([abs_top_srcdir])
|
||||
m4trace:configure.in:463: -1- AC_SUBST_TRACE([builddir])
|
||||
m4trace:configure.in:463: -1- AC_SUBST_TRACE([abs_builddir])
|
||||
m4trace:configure.in:463: -1- AC_SUBST_TRACE([abs_top_builddir])
|
||||
m4trace:configure.in:463: -1- AC_SUBST_TRACE([INSTALL])
|
||||
m4trace:configure.in:463: -1- AC_SUBST_TRACE([MKDIR_P])
|
||||
m4trace:configure.in:463: -1- AC_REQUIRE_AUX_FILE([ltmain.sh])
|
1530
pd-0.44-2/portaudio/config.guess
vendored
Executable file
1530
pd-0.44-2/portaudio/config.guess
vendored
Executable file
File diff suppressed because it is too large
Load diff
1782
pd-0.44-2/portaudio/config.sub
vendored
Executable file
1782
pd-0.44-2/portaudio/config.sub
vendored
Executable file
File diff suppressed because it is too large
Load diff
18848
pd-0.44-2/portaudio/configure
vendored
Executable file
18848
pd-0.44-2/portaudio/configure
vendored
Executable file
File diff suppressed because it is too large
Load diff
503
pd-0.44-2/portaudio/configure.in
Normal file
503
pd-0.44-2/portaudio/configure.in
Normal file
|
@ -0,0 +1,503 @@
|
|||
dnl
|
||||
dnl portaudio V19 configure.in script
|
||||
dnl
|
||||
dnl Dominic Mazzoni, Arve Knudsen, Stelios Bounanos
|
||||
dnl
|
||||
|
||||
dnl Require autoconf >= 2.13
|
||||
AC_PREREQ(2.13)
|
||||
|
||||
dnl Init autoconf and make sure configure is being called
|
||||
dnl from the right directory
|
||||
AC_INIT([include/portaudio.h])
|
||||
|
||||
AC_PROG_MKDIR_P
|
||||
|
||||
dnl Define build, build_cpu, build_vendor, build_os
|
||||
AC_CANONICAL_BUILD
|
||||
dnl Define host, host_cpu, host_vendor, host_os
|
||||
AC_CANONICAL_HOST
|
||||
dnl Define target, target_cpu, target_vendor, target_os
|
||||
AC_CANONICAL_TARGET
|
||||
|
||||
dnl Specify options
|
||||
|
||||
AC_ARG_WITH(alsa,
|
||||
AS_HELP_STRING([--with-alsa], [Enable support for ALSA @<:@autodetect@:>@]),
|
||||
[with_alsa=$withval])
|
||||
|
||||
AC_ARG_WITH(jack,
|
||||
AS_HELP_STRING([--with-jack], [Enable support for JACK @<:@autodetect@:>@]),
|
||||
[with_jack=$withval])
|
||||
|
||||
AC_ARG_WITH(oss,
|
||||
AS_HELP_STRING([--with-oss], [Enable support for OSS @<:@autodetect@:>@]),
|
||||
[with_oss=$withval])
|
||||
|
||||
AC_ARG_WITH(asihpi,
|
||||
AS_HELP_STRING([--with-asihpi], [Enable support for ASIHPI @<:@autodetect@:>@]),
|
||||
[with_asihpi=$withval])
|
||||
|
||||
AC_ARG_WITH(winapi,
|
||||
AS_HELP_STRING([--with-winapi],
|
||||
[Select Windows API support (@<:@wmme|directx|asio|wasapi|wdmks@:>@@<:@,...@:>@) @<:@wmme@:>@]),
|
||||
[with_winapi=$withval], [with_winapi="wmme"])
|
||||
case "$target_os" in *mingw* | *cygwin*)
|
||||
with_wmme=no
|
||||
with_directx=no
|
||||
with_asio=no
|
||||
with_wasapi=no
|
||||
with_wdmks=no
|
||||
for api in $(echo $with_winapi | sed 's/,/ /g'); do
|
||||
case "$api" in
|
||||
wmme|directx|asio|wasapi|wdmks)
|
||||
eval with_$api=yes
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([unknown Windows API \"$api\" (do you need --help?)])
|
||||
;;
|
||||
esac
|
||||
done
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_ARG_WITH(asiodir,
|
||||
AS_HELP_STRING([--with-asiodir], [ASIO directory @<:@/usr/local/asiosdk2@:>@]),
|
||||
with_asiodir=$withval, with_asiodir="/usr/local/asiosdk2")
|
||||
|
||||
AC_ARG_WITH(dxdir,
|
||||
AS_HELP_STRING([--with-dxdir], [DirectX directory @<:@/usr/local/dx7sdk@:>@]),
|
||||
with_dxdir=$withval, with_dxdir="/usr/local/dx7sdk")
|
||||
|
||||
debug_output=no
|
||||
AC_ARG_ENABLE(debug-output,
|
||||
AS_HELP_STRING([--enable-debug-output], [Enable debug output @<:@no@:>@]),
|
||||
[if test "x$enableval" != "xno" ; then
|
||||
AC_DEFINE(PA_ENABLE_DEBUG_OUTPUT,,[Enable debugging messages])
|
||||
debug_output=yes
|
||||
fi
|
||||
])
|
||||
|
||||
AC_ARG_ENABLE(cxx,
|
||||
AS_HELP_STRING([--enable-cxx], [Enable C++ bindings @<:@no@:>@]),
|
||||
enable_cxx=$enableval, enable_cxx="no")
|
||||
|
||||
AC_ARG_ENABLE(mac-debug,
|
||||
AS_HELP_STRING([--enable-mac-debug], [Enable Mac debug @<:@no@:>@]),
|
||||
enable_mac_debug=$enableval, enable_mac_debug="no")
|
||||
|
||||
AC_ARG_ENABLE(mac-universal,
|
||||
AS_HELP_STRING([--enable-mac-universal], [Build Mac universal binaries @<:@yes@:>@]),
|
||||
enable_mac_universal=$enableval, enable_mac_universal="yes")
|
||||
|
||||
dnl Continue to accept --host_os for compatibility but do not document
|
||||
dnl it (the correct way to change host_os is with --host=...). Moved
|
||||
dnl here because the empty help string generates a blank line which we
|
||||
dnl can use to separate PA options from libtool options.
|
||||
AC_ARG_WITH(host_os, [], host_os=$withval)
|
||||
|
||||
dnl Checks for programs.
|
||||
|
||||
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_PROG_LIBTOOL
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_LN_S
|
||||
AC_PATH_PROG(AR, ar, no)
|
||||
if [[ $AR = "no" ]] ; then
|
||||
AC_MSG_ERROR("Could not find ar - needed to create a library")
|
||||
fi
|
||||
|
||||
dnl This must be one of the first tests we do or it will fail...
|
||||
AC_C_BIGENDIAN
|
||||
|
||||
dnl checks for various host APIs and arguments to configure that
|
||||
dnl turn them on or off
|
||||
|
||||
have_alsa=no
|
||||
if test "x$with_alsa" != "xno"; then
|
||||
AC_CHECK_LIB(asound, snd_pcm_open, have_alsa=yes, have_alsa=no)
|
||||
fi
|
||||
have_asihpi=no
|
||||
if test "x$with_asihpi" != "xno"; then
|
||||
AC_CHECK_LIB(hpi, HPI_SubSysCreate, have_asihpi=yes, have_asihpi=no, -lm)
|
||||
fi
|
||||
have_libossaudio=no
|
||||
have_oss=no
|
||||
if test "x$with_oss" != "xno"; then
|
||||
AC_CHECK_HEADERS([sys/soundcard.h linux/soundcard.h machine/soundcard.h], [have_oss=yes])
|
||||
if test "x$have_oss" = "xyes"; then
|
||||
AC_CHECK_LIB(ossaudio, _oss_ioctl, have_libossaudio=yes, have_libossaudio=no)
|
||||
fi
|
||||
fi
|
||||
have_jack=no
|
||||
if test "x$with_jack" != "xno"; then
|
||||
PKG_CHECK_MODULES(JACK, jack, have_jack=yes, have_jack=no)
|
||||
fi
|
||||
|
||||
|
||||
dnl sizeof checks: we will need a 16-bit and a 32-bit type
|
||||
|
||||
AC_CHECK_SIZEOF(short)
|
||||
AC_CHECK_SIZEOF(int)
|
||||
AC_CHECK_SIZEOF(long)
|
||||
|
||||
save_LIBS="${LIBS}"
|
||||
AC_CHECK_LIB(rt, clock_gettime, [rt_libs=" -lrt"])
|
||||
LIBS="${LIBS}${rt_libs}"
|
||||
DLL_LIBS="${DLL_LIBS}${rt_libs}"
|
||||
AC_CHECK_FUNCS([clock_gettime nanosleep])
|
||||
LIBS="${save_LIBS}"
|
||||
|
||||
dnl LT_RELEASE=19
|
||||
LT_CURRENT=2
|
||||
LT_REVISION=0
|
||||
LT_AGE=0
|
||||
|
||||
AC_SUBST(LT_CURRENT)
|
||||
AC_SUBST(LT_REVISION)
|
||||
AC_SUBST(LT_AGE)
|
||||
|
||||
dnl extra variables
|
||||
AC_SUBST(OTHER_OBJS)
|
||||
AC_SUBST(PADLL)
|
||||
AC_SUBST(SHARED_FLAGS)
|
||||
AC_SUBST(THREAD_CFLAGS)
|
||||
AC_SUBST(DLL_LIBS)
|
||||
AC_SUBST(CXXFLAGS)
|
||||
AC_SUBST(NASM)
|
||||
AC_SUBST(NASMOPT)
|
||||
AC_SUBST(INCLUDES)
|
||||
|
||||
dnl -g is optional on darwin
|
||||
if ( echo "${host_os}" | grep ^darwin >> /dev/null ) &&
|
||||
[[ "$enable_mac_universal" = "yes" ] &&
|
||||
[ "$enable_mac_debug" != "yes" ]] ; then
|
||||
CFLAGS="-O2 -Wall -pedantic -pipe -fPIC -DNDEBUG"
|
||||
else
|
||||
CFLAGS=${CFLAGS:-"-g -O2 -Wall -pedantic -pipe -fPIC"}
|
||||
fi
|
||||
|
||||
if [[ $ac_cv_c_bigendian = "yes" ]] ; then
|
||||
CFLAGS="$CFLAGS -DPA_BIG_ENDIAN"
|
||||
else
|
||||
CFLAGS="$CFLAGS -DPA_LITTLE_ENDIAN"
|
||||
fi
|
||||
|
||||
add_objects()
|
||||
{
|
||||
for o in $@; do
|
||||
test "${OTHER_OBJS#*${o}*}" = "${OTHER_OBJS}" && OTHER_OBJS="$OTHER_OBJS $o"
|
||||
done
|
||||
}
|
||||
|
||||
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
|
||||
darwin* )
|
||||
dnl Mac OS X configuration
|
||||
|
||||
AC_DEFINE(PA_USE_COREAUDIO,1)
|
||||
|
||||
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/os/unix -Werror"
|
||||
LIBS="-framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework Carbon"
|
||||
|
||||
if test "x$enable_mac_universal" = "xyes" ; then
|
||||
case "xcodebuild -version | sed -n 's/Xcode \(.*\)/\1/p'" in
|
||||
|
||||
[12]*|3.0|3.1)
|
||||
dnl In pre-3.2 versions of Xcode, xcodebuild doesn't
|
||||
dnl support -sdk, so we can't use that to look for
|
||||
dnl SDKs. However, in those versions of Xcode, the
|
||||
dnl SDKs are under /Developer/SDKs, so we can just look
|
||||
dnl there. Also, we assume they had no SDKs later
|
||||
dnl than 10.5, as 3.2 was the version that came with
|
||||
dnl 10.6, at least if the Wikipedia page for Xcode
|
||||
dnl is to be believed.
|
||||
if [[ -d /Developer/SDKs/MacOSX10.5.sdk ]] ; then
|
||||
mac_version_min="-mmacosx-version-min=10.3"
|
||||
mac_sysroot="-isysroot /Developer/SDKs/MacOSX10.5.sdk"
|
||||
else
|
||||
mac_version_min="-mmacosx-version-min=10.3"
|
||||
mac_sysroot="-isysroot /Developer/SDKs/MacOSX10.4u.sdk"
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
dnl In 3.2 and later, xcodebuild supports -sdk, and, in
|
||||
dnl 4.3 and later, the SDKs aren't under /Developer/SDKs
|
||||
dnl as there *is* no /Developer, so we use -sdk to check
|
||||
dnl what SDKs are available and to get the full path of
|
||||
dnl the SDKs.
|
||||
if xcodebuild -version -sdk macosx10.5 Path >/dev/null 2>&1 ; then
|
||||
mac_version_min="-mmacosx-version-min=10.3"
|
||||
mac_sysroot="-isysroot `xcodebuild -version -sdk macosx10.5 Path`"
|
||||
elif xcodebuild -version -sdk macosx10.6 Path >/dev/null 2>&1 ; then
|
||||
mac_version_min="-mmacosx-version-min=10.4"
|
||||
mac_sysroot="-isysroot `xcodebuild -version -sdk macosx10.6 Path`"
|
||||
elif xcodebuild -version -sdk macosx10.7 Path >/dev/null 2>&1 ; then
|
||||
mac_version_min="-mmacosx-version-min=10.4"
|
||||
mac_sysroot="-isysroot `xcodebuild -version -sdk macosx10.7 Path`"
|
||||
else
|
||||
AC_MSG_ERROR([Couldn't find 10.5, 10.6, or 10.7 SDK])
|
||||
fi
|
||||
esac
|
||||
|
||||
dnl Pick which architectures to build for based on what
|
||||
dnl the compiler supports.
|
||||
mac_arches=""
|
||||
for arch in i386 x86_64 ppc ppc64
|
||||
do
|
||||
save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -arch $arch"
|
||||
AC_TRY_COMPILE([], [return 0;],
|
||||
[
|
||||
if [[ -z "$mac_arches" ]] ; then
|
||||
mac_arches="-arch $arch"
|
||||
else
|
||||
mac_arches="$mac_arches -arch $arch"
|
||||
fi
|
||||
])
|
||||
CFLAGS="$save_CFLAGS"
|
||||
done
|
||||
else
|
||||
mac_arches=""
|
||||
mac_sysroot=""
|
||||
mac_version=""
|
||||
fi
|
||||
SHARED_FLAGS="$LIBS -dynamiclib $mac_arches $mac_sysroot $mac_version_min"
|
||||
CFLAGS="-std=c99 $CFLAGS $mac_arches $mac_sysroot $mac_version_min"
|
||||
OTHER_OBJS="src/os/unix/pa_unix_hostapis.o src/os/unix/pa_unix_util.o src/hostapi/coreaudio/pa_mac_core.o src/hostapi/coreaudio/pa_mac_core_utilities.o src/hostapi/coreaudio/pa_mac_core_blocking.o src/common/pa_ringbuffer.o"
|
||||
PADLL="libportaudio.dylib"
|
||||
;;
|
||||
|
||||
mingw* )
|
||||
dnl MingW configuration
|
||||
|
||||
PADLL="portaudio.dll"
|
||||
THREAD_CFLAGS="-mthreads"
|
||||
SHARED_FLAGS="-shared"
|
||||
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
|
||||
DXDIR="$with_dxdir"
|
||||
add_objects src/hostapi/dsound/pa_win_ds.o src/hostapi/dsound/pa_win_ds_dynlink.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="${LIBS} -lwinmm -lm -ldsound -lole32"
|
||||
DLL_LIBS="${DLL_LIBS} -lwinmm -lm -L$DXDIR/lib -ldsound -lole32"
|
||||
#VC98="\"/c/Program Files/Microsoft Visual Studio/VC98/Include\""
|
||||
#CFLAGS="$CFLAGS -I$VC98 -DPA_NO_WMME -DPA_NO_ASIO"
|
||||
CFLAGS="$CFLAGS -I$DXDIR/include -UPA_USE_DS -DPA_USE_DS=1"
|
||||
fi
|
||||
|
||||
if [[ "x$with_asio" = "xyes" ]]; then
|
||||
ASIODIR="$with_asiodir"
|
||||
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="${LIBS} -lwinmm -lm -lole32 -luuid"
|
||||
DLL_LIBS="${DLL_LIBS} -lwinmm -lm -lole32 -luuid"
|
||||
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"
|
||||
fi
|
||||
|
||||
if [[ "x$with_wdmks" = "xyes" ]]; then
|
||||
DXDIR="$with_dxdir"
|
||||
add_objects src/hostapi/wdmks/pa_win_wdmks.o src/common/pa_ringbuffer.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o src/os/win/pa_win_wdmks_util.o src/os/win/pa_win_waveformat.o
|
||||
LIBS="${LIBS} -lwinmm -lm -luuid -lsetupapi -lole32"
|
||||
DLL_LIBS="${DLL_LIBS} -lwinmm -lm -L$DXDIR/lib -luuid -lsetupapi -lole32"
|
||||
#VC98="\"/c/Program Files/Microsoft Visual Studio/VC98/Include\""
|
||||
#CFLAGS="$CFLAGS -I$VC98 -DPA_NO_WMME -DPA_NO_ASIO"
|
||||
CFLAGS="$CFLAGS -I$DXDIR/include -UPA_USE_WDMKS -DPA_USE_WDMKS=1"
|
||||
fi
|
||||
|
||||
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
|
||||
LIBS="${LIBS} -lwinmm -lm -lole32 -luuid"
|
||||
DLL_LIBS="${DLL_LIBS} -lwinmm"
|
||||
CFLAGS="$CFLAGS -UPA_USE_WMME -DPA_USE_WMME=1"
|
||||
fi
|
||||
|
||||
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
|
||||
LIBS="${LIBS} -lwinmm -lm -lole32 -luuid"
|
||||
DLL_LIBS="${DLL_LIBS} -lwinmm -lole32"
|
||||
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/hostapi/wasapi/mingw-include -UPA_USE_WASAPI -DPA_USE_WASAPI=1"
|
||||
fi
|
||||
;;
|
||||
|
||||
cygwin* )
|
||||
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"
|
||||
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"
|
||||
PADLL="portaudio.dll"
|
||||
THREAD_CFLAGS="-mthreads"
|
||||
SHARED_FLAGS="-shared"
|
||||
DLL_LIBS="${DLL_LIBS} -lwinmm"
|
||||
;;
|
||||
|
||||
irix* )
|
||||
dnl SGI IRIX audio library (AL) configuration (Pieter, oct 2-13, 2003).
|
||||
dnl The 'dmedia' library is needed to read the Unadjusted System Time (UST).
|
||||
dnl
|
||||
AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR([IRIX posix thread library not found!]))
|
||||
AC_CHECK_LIB(audio, alOpenPort, , AC_MSG_ERROR([IRIX audio library not found!]))
|
||||
AC_CHECK_LIB(dmedia, dmGetUST, , AC_MSG_ERROR([IRIX digital media library not found!]))
|
||||
|
||||
dnl See the '#ifdef PA_USE_SGI' in file pa_unix/pa_unix_hostapis.c
|
||||
dnl which selects the appropriate PaXXX_Initialize() function.
|
||||
dnl
|
||||
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
|
||||
THREAD_CFLAGS="-D_REENTRANT"
|
||||
|
||||
OTHER_OBJS="pa_sgi/pa_sgi.o src/os/unix/pa_unix_hostapis.o src/os/unix/pa_unix_util.o"
|
||||
|
||||
dnl SGI books say -lpthread should be the last of the libs mentioned.
|
||||
dnl
|
||||
LIBS="-lm -ldmedia -laudio -lpthread"
|
||||
PADLL="libportaudio.so"
|
||||
SHARED_FLAGS=""
|
||||
;;
|
||||
|
||||
*)
|
||||
dnl Unix configuration
|
||||
|
||||
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/os/unix"
|
||||
|
||||
AC_CHECK_LIB(pthread, pthread_create,[have_pthread="yes"],
|
||||
AC_MSG_ERROR([libpthread not found!]))
|
||||
|
||||
if [[ "$have_alsa" = "yes" ] && [ "$with_alsa" != "no" ]] ; then
|
||||
DLL_LIBS="$DLL_LIBS -lasound"
|
||||
LIBS="$LIBS -lasound"
|
||||
OTHER_OBJS="$OTHER_OBJS src/hostapi/alsa/pa_linux_alsa.o"
|
||||
INCLUDES="$INCLUDES pa_linux_alsa.h"
|
||||
AC_DEFINE(PA_USE_ALSA,1)
|
||||
fi
|
||||
|
||||
if [[ "$have_jack" = "yes" ] && [ "$with_jack" != "no" ]] ; then
|
||||
DLL_LIBS="$DLL_LIBS $JACK_LIBS"
|
||||
CFLAGS="$CFLAGS $JACK_CFLAGS"
|
||||
OTHER_OBJS="$OTHER_OBJS src/hostapi/jack/pa_jack.o src/common/pa_ringbuffer.o"
|
||||
INCLUDES="$INCLUDES pa_jack.h"
|
||||
AC_DEFINE(PA_USE_JACK,1)
|
||||
fi
|
||||
|
||||
if [[ "$with_oss" != "no" ]] ; then
|
||||
OTHER_OBJS="$OTHER_OBJS src/hostapi/oss/pa_unix_oss.o"
|
||||
if [[ "$have_libossaudio" = "yes" ]] ; then
|
||||
DLL_LIBS="$DLL_LIBS -lossaudio"
|
||||
LIBS="$LIBS -lossaudio"
|
||||
fi
|
||||
AC_DEFINE(PA_USE_OSS,1)
|
||||
fi
|
||||
|
||||
if [[ "$have_asihpi" = "yes" ] && [ "$with_asihpi" != "no" ]] ; then
|
||||
LIBS="$LIBS -lhpi"
|
||||
DLL_LIBS="$DLL_LIBS -lhpi"
|
||||
OTHER_OBJS="$OTHER_OBJS src/hostapi/asihpi/pa_linux_asihpi.o"
|
||||
AC_DEFINE(PA_USE_ASIHPI,1)
|
||||
fi
|
||||
|
||||
DLL_LIBS="$DLL_LIBS -lm -lpthread"
|
||||
LIBS="$LIBS -lm -lpthread"
|
||||
PADLL="libportaudio.so"
|
||||
|
||||
## support sun cc compiler flags
|
||||
case "${host_os}" in
|
||||
solaris*)
|
||||
SHARED_FLAGS="-G"
|
||||
THREAD_CFLAGS="-mt"
|
||||
;;
|
||||
*)
|
||||
SHARED_FLAGS="-fPIC"
|
||||
THREAD_CFLAGS="-pthread"
|
||||
;;
|
||||
esac
|
||||
|
||||
OTHER_OBJS="$OTHER_OBJS src/os/unix/pa_unix_hostapis.o src/os/unix/pa_unix_util.o"
|
||||
esac
|
||||
CFLAGS="$CFLAGS $THREAD_CFLAGS"
|
||||
|
||||
test "$enable_shared" != "yes" && SHARED_FLAGS=""
|
||||
|
||||
if test "$enable_cxx" = "yes"; then
|
||||
AC_CONFIG_SUBDIRS([bindings/cpp])
|
||||
ENABLE_CXX_TRUE=""
|
||||
ENABLE_CXX_FALSE="#"
|
||||
else
|
||||
ENABLE_CXX_TRUE="#"
|
||||
ENABLE_CXX_FALSE=""
|
||||
fi
|
||||
AC_SUBST(ENABLE_CXX_TRUE)
|
||||
AC_SUBST(ENABLE_CXX_FALSE)
|
||||
|
||||
if test "x$with_asio" = "xyes"; then
|
||||
WITH_ASIO_TRUE=""
|
||||
WITH_ASIO_FALSE="@ #"
|
||||
else
|
||||
WITH_ASIO_TRUE="@ #"
|
||||
WITH_ASIO_FALSE=""
|
||||
fi
|
||||
AC_SUBST(WITH_ASIO_TRUE)
|
||||
AC_SUBST(WITH_ASIO_FALSE)
|
||||
|
||||
AC_OUTPUT([Makefile])
|
||||
|
||||
AC_MSG_RESULT([
|
||||
Configuration summary:
|
||||
|
||||
Target ...................... $target
|
||||
C++ bindings ................ $enable_cxx
|
||||
Debug output ................ $debug_output])
|
||||
|
||||
case "$target_os" in *linux*)
|
||||
AC_MSG_RESULT([
|
||||
ALSA ........................ $have_alsa
|
||||
ASIHPI ...................... $have_asihpi])
|
||||
;;
|
||||
esac
|
||||
case "$target_os" in
|
||||
*mingw* | *cygwin*)
|
||||
test "x$with_directx" = "xyes" && with_directx="$with_directx (${with_dxdir})"
|
||||
test "x$with_wdmks" = "xyes" && with_wdmks="$with_wdmks (${with_dxdir})"
|
||||
test "x$with_asio" = "xyes" && with_asio="$with_asio (${with_asiodir})"
|
||||
test "x$with_wasapi" = "xyes"
|
||||
AC_MSG_RESULT([
|
||||
WMME ........................ $with_wmme
|
||||
DSound ...................... $with_directx
|
||||
ASIO ........................ $with_asio
|
||||
WASAPI ...................... $with_wasapi
|
||||
WDMKS ....................... $with_wdmks
|
||||
])
|
||||
;;
|
||||
*darwin*)
|
||||
AC_MSG_RESULT([
|
||||
Mac debug flags ............. $enable_mac_debug
|
||||
])
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT([
|
||||
OSS ......................... $have_oss
|
||||
JACK ........................ $have_jack
|
||||
])
|
||||
;;
|
||||
esac
|
150
pd-0.44-2/portaudio/include/pa_asio.h
Normal file
150
pd-0.44-2/portaudio/include/pa_asio.h
Normal file
|
@ -0,0 +1,150 @@
|
|||
#ifndef PA_ASIO_H
|
||||
#define PA_ASIO_H
|
||||
/*
|
||||
* $Id: pa_asio.h 1667 2011-05-02 15:49:20Z rossb $
|
||||
* PortAudio Portable Real-Time Audio Library
|
||||
* ASIO specific extensions
|
||||
*
|
||||
* Copyright (c) 1999-2000 Ross Bencina and Phil Burk
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
|
||||
/** @file
|
||||
@ingroup public_header
|
||||
@brief ASIO-specific PortAudio API extension header file.
|
||||
*/
|
||||
|
||||
#include "portaudio.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/** Retrieve legal native buffer sizes for the specificed device, in sample frames.
|
||||
|
||||
@param device The global index of the device about which the query is being made.
|
||||
@param minBufferSizeFrames A pointer to the location which will receive the minimum buffer size value.
|
||||
@param maxBufferSizeFrames A pointer to the location which will receive the maximum buffer size value.
|
||||
@param preferredBufferSizeFrames A pointer to the location which will receive the preferred buffer size value.
|
||||
@param granularity A pointer to the location which will receive the "granularity". This value determines
|
||||
the step size used to compute the legal values between minBufferSizeFrames and maxBufferSizeFrames.
|
||||
If granularity is -1 then available buffer size values are powers of two.
|
||||
|
||||
@see ASIOGetBufferSize in the ASIO SDK.
|
||||
|
||||
@note: this function used to be called PaAsio_GetAvailableLatencyValues. There is a
|
||||
#define that maps PaAsio_GetAvailableLatencyValues to this function for backwards compatibility.
|
||||
*/
|
||||
PaError PaAsio_GetAvailableBufferSizes( PaDeviceIndex device,
|
||||
long *minBufferSizeFrames, long *maxBufferSizeFrames, long *preferredBufferSizeFrames, long *granularity );
|
||||
|
||||
|
||||
/** Backwards compatibility alias for PaAsio_GetAvailableBufferSizes
|
||||
|
||||
@see PaAsio_GetAvailableBufferSizes
|
||||
*/
|
||||
#define PaAsio_GetAvailableLatencyValues PaAsio_GetAvailableBufferSizes
|
||||
|
||||
|
||||
/** Display the ASIO control panel for the specified device.
|
||||
|
||||
@param device The global index of the device whose control panel is to be displayed.
|
||||
@param systemSpecific On Windows, the calling application's main window handle,
|
||||
on Macintosh this value should be zero.
|
||||
*/
|
||||
PaError PaAsio_ShowControlPanel( PaDeviceIndex device, void* systemSpecific );
|
||||
|
||||
|
||||
|
||||
|
||||
/** Retrieve a pointer to a string containing the name of the specified
|
||||
input channel. The string is valid until Pa_Terminate is called.
|
||||
|
||||
The string will be no longer than 32 characters including the null terminator.
|
||||
*/
|
||||
PaError PaAsio_GetInputChannelName( PaDeviceIndex device, int channelIndex,
|
||||
const char** channelName );
|
||||
|
||||
|
||||
/** Retrieve a pointer to a string containing the name of the specified
|
||||
input channel. The string is valid until Pa_Terminate is called.
|
||||
|
||||
The string will be no longer than 32 characters including the null terminator.
|
||||
*/
|
||||
PaError PaAsio_GetOutputChannelName( PaDeviceIndex device, int channelIndex,
|
||||
const char** channelName );
|
||||
|
||||
|
||||
/** Set the sample rate of an open paASIO stream.
|
||||
|
||||
@param stream The stream to operate on.
|
||||
@param sampleRate The new sample rate.
|
||||
|
||||
Note that this function may fail if the stream is alredy running and the
|
||||
ASIO driver does not support switching the sample rate of a running stream.
|
||||
|
||||
Returns paIncompatibleStreamHostApi if stream is not a paASIO stream.
|
||||
*/
|
||||
PaError PaAsio_SetStreamSampleRate( PaStream* stream, double sampleRate );
|
||||
|
||||
|
||||
#define paAsioUseChannelSelectors (0x01)
|
||||
|
||||
typedef struct PaAsioStreamInfo{
|
||||
unsigned long size; /**< sizeof(PaAsioStreamInfo) */
|
||||
PaHostApiTypeId hostApiType; /**< paASIO */
|
||||
unsigned long version; /**< 1 */
|
||||
|
||||
unsigned long flags;
|
||||
|
||||
/* Support for opening only specific channels of an ASIO device.
|
||||
If the paAsioUseChannelSelectors flag is set, channelSelectors is a
|
||||
pointer to an array of integers specifying the device channels to use.
|
||||
When used, the length of the channelSelectors array must match the
|
||||
corresponding channelCount parameter to Pa_OpenStream() otherwise a
|
||||
crash may result.
|
||||
The values in the selectors array must specify channels within the
|
||||
range of supported channels for the device or paInvalidChannelCount will
|
||||
result.
|
||||
*/
|
||||
int *channelSelectors;
|
||||
}PaAsioStreamInfo;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* PA_ASIO_H */
|
77
pd-0.44-2/portaudio/include/pa_jack.h
Normal file
77
pd-0.44-2/portaudio/include/pa_jack.h
Normal file
|
@ -0,0 +1,77 @@
|
|||
#ifndef PA_JACK_H
|
||||
#define PA_JACK_H
|
||||
|
||||
/*
|
||||
* $Id:
|
||||
* PortAudio Portable Real-Time Audio Library
|
||||
* JACK-specific extensions
|
||||
*
|
||||
* Copyright (c) 1999-2000 Ross Bencina and Phil Burk
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
* @ingroup public_header
|
||||
* @brief JACK-specific PortAudio API extension header file.
|
||||
*/
|
||||
|
||||
#include "portaudio.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Set the JACK client name.
|
||||
*
|
||||
* During Pa_Initialize, When PA JACK connects as a client of the JACK server, it requests a certain
|
||||
* name, which is for instance prepended to port names. By default this name is "PortAudio". The
|
||||
* JACK server may append a suffix to the client name, in order to avoid clashes among clients that
|
||||
* try to connect with the same name (e.g., different PA JACK clients).
|
||||
*
|
||||
* This function must be called before Pa_Initialize, otherwise it won't have any effect. Note that
|
||||
* the string is not copied, but instead referenced directly, so it must not be freed for as long as
|
||||
* PA might need it.
|
||||
* @sa PaJack_GetClientName
|
||||
*/
|
||||
PaError PaJack_SetClientName( const char* name );
|
||||
|
||||
/** Get the JACK client name used by PA JACK.
|
||||
*
|
||||
* The caller is responsible for freeing the returned pointer.
|
||||
*/
|
||||
PaError PaJack_GetClientName(const char** clientName);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
107
pd-0.44-2/portaudio/include/pa_linux_alsa.h
Normal file
107
pd-0.44-2/portaudio/include/pa_linux_alsa.h
Normal file
|
@ -0,0 +1,107 @@
|
|||
#ifndef PA_LINUX_ALSA_H
|
||||
#define PA_LINUX_ALSA_H
|
||||
|
||||
/*
|
||||
* $Id: pa_linux_alsa.h 1597 2011-02-11 00:15:51Z dmitrykos $
|
||||
* PortAudio Portable Real-Time Audio Library
|
||||
* ALSA-specific extensions
|
||||
*
|
||||
* Copyright (c) 1999-2000 Ross Bencina and Phil Burk
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
* @ingroup public_header
|
||||
* @brief ALSA-specific PortAudio API extension header file.
|
||||
*/
|
||||
|
||||
#include "portaudio.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct PaAlsaStreamInfo
|
||||
{
|
||||
unsigned long size;
|
||||
PaHostApiTypeId hostApiType;
|
||||
unsigned long version;
|
||||
|
||||
const char *deviceString;
|
||||
}
|
||||
PaAlsaStreamInfo;
|
||||
|
||||
/** Initialize host API specific structure, call this before setting relevant attributes. */
|
||||
void PaAlsa_InitializeStreamInfo( PaAlsaStreamInfo *info );
|
||||
|
||||
/** Instruct whether to enable real-time priority when starting the audio thread.
|
||||
*
|
||||
* If this is turned on by the stream is started, the audio callback thread will be created
|
||||
* with the FIFO scheduling policy, which is suitable for realtime operation.
|
||||
**/
|
||||
void PaAlsa_EnableRealtimeScheduling( PaStream *s, int enable );
|
||||
|
||||
#if 0
|
||||
void PaAlsa_EnableWatchdog( PaStream *s, int enable );
|
||||
#endif
|
||||
|
||||
/** Get the ALSA-lib card index of this stream's input device. */
|
||||
PaError PaAlsa_GetStreamInputCard( PaStream *s, int *card );
|
||||
|
||||
/** Get the ALSA-lib card index of this stream's output device. */
|
||||
PaError PaAlsa_GetStreamOutputCard( PaStream *s, int *card );
|
||||
|
||||
/** Set the number of periods (buffer fragments) to configure devices with.
|
||||
*
|
||||
* By default the number of periods is 4, this is the lowest number of periods that works well on
|
||||
* the author's soundcard.
|
||||
* @param numPeriods The number of periods.
|
||||
*/
|
||||
PaError PaAlsa_SetNumPeriods( int numPeriods );
|
||||
|
||||
/** Set the maximum number of times to retry opening busy device (sleeping for a
|
||||
* short interval inbetween).
|
||||
*/
|
||||
PaError PaAlsa_SetRetriesBusy( int retries );
|
||||
|
||||
/** Set the path and name of ALSA library file if PortAudio is configured to load it dynamically (see
|
||||
* PA_ALSA_DYNAMIC). This setting will overwrite the default name set by PA_ALSA_PATHNAME define.
|
||||
* @param pathName Full path with filename. Only filename can be used, but dlopen() will lookup default
|
||||
* searchable directories (/usr/lib;/usr/local/lib) then.
|
||||
*/
|
||||
void PaAlsa_SetLibraryPathName( const char *pathName );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
191
pd-0.44-2/portaudio/include/pa_mac_core.h
Normal file
191
pd-0.44-2/portaudio/include/pa_mac_core.h
Normal file
|
@ -0,0 +1,191 @@
|
|||
#ifndef PA_MAC_CORE_H
|
||||
#define PA_MAC_CORE_H
|
||||
/*
|
||||
* PortAudio Portable Real-Time Audio Library
|
||||
* Macintosh Core Audio specific extensions
|
||||
* portaudio.h should be included before this file.
|
||||
*
|
||||
* Copyright (c) 2005-2006 Bjorn Roche
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
* @ingroup public_header
|
||||
* @brief CoreAudio-specific PortAudio API extension header file.
|
||||
*/
|
||||
|
||||
#include "portaudio.h"
|
||||
|
||||
#include <AudioUnit/AudioUnit.h>
|
||||
#include <AudioToolbox/AudioToolbox.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* A pointer to a paMacCoreStreamInfo may be passed as
|
||||
* the hostApiSpecificStreamInfo in the PaStreamParameters struct
|
||||
* when opening a stream or querying the format. Use NULL, for the
|
||||
* defaults. Note that for duplex streams, flags for input and output
|
||||
* should be the same or behaviour is undefined.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
unsigned long size; /**size of whole structure including this header */
|
||||
PaHostApiTypeId hostApiType; /**host API for which this data is intended */
|
||||
unsigned long version; /**structure version */
|
||||
unsigned long flags; /** flags to modify behaviour */
|
||||
SInt32 const * channelMap; /** Channel map for HAL channel mapping , if not needed, use NULL;*/
|
||||
unsigned long channelMapSize; /** Channel map size for HAL channel mapping , if not needed, use 0;*/
|
||||
} PaMacCoreStreamInfo;
|
||||
|
||||
/**
|
||||
* Functions
|
||||
*/
|
||||
|
||||
|
||||
/** Use this function to initialize a paMacCoreStreamInfo struct
|
||||
* using the requested flags. Note that channel mapping is turned
|
||||
* off after a call to this function.
|
||||
* @param data The datastructure to initialize
|
||||
* @param flags The flags to initialize the datastructure with.
|
||||
*/
|
||||
void PaMacCore_SetupStreamInfo( PaMacCoreStreamInfo *data, unsigned long flags );
|
||||
|
||||
/** call this after pa_SetupMacCoreStreamInfo to use channel mapping as described in notes.txt.
|
||||
* @param data The stream info structure to assign a channel mapping to
|
||||
* @param channelMap The channel map array, as described in notes.txt. This array pointer will be used directly (ie the underlying data will not be copied), so the caller should not free the array until after the stream has been opened.
|
||||
* @param channelMapSize The size of the channel map array.
|
||||
*/
|
||||
void PaMacCore_SetupChannelMap( PaMacCoreStreamInfo *data, const SInt32 * const channelMap, unsigned long channelMapSize );
|
||||
|
||||
/**
|
||||
* Retrieve the AudioDeviceID of the input device assigned to an open stream
|
||||
*
|
||||
* @param s The stream to query.
|
||||
*
|
||||
* @return A valid AudioDeviceID, or NULL if an error occurred.
|
||||
*/
|
||||
AudioDeviceID PaMacCore_GetStreamInputDevice( PaStream* s );
|
||||
|
||||
/**
|
||||
* Retrieve the AudioDeviceID of the output device assigned to an open stream
|
||||
*
|
||||
* @param s The stream to query.
|
||||
*
|
||||
* @return A valid AudioDeviceID, or NULL if an error occurred.
|
||||
*/
|
||||
AudioDeviceID PaMacCore_GetStreamOutputDevice( PaStream* s );
|
||||
|
||||
/**
|
||||
* Returns a statically allocated string with the device's name
|
||||
* for the given channel. NULL will be returned on failure.
|
||||
*
|
||||
* This function's implemenation is not complete!
|
||||
*
|
||||
* @param device The PortAudio device index.
|
||||
* @param channel The channel number who's name is requested.
|
||||
* @return a statically allocated string with the name of the device.
|
||||
* Because this string is statically allocated, it must be
|
||||
* coppied if it is to be saved and used by the user after
|
||||
* another call to this function.
|
||||
*
|
||||
*/
|
||||
const char *PaMacCore_GetChannelName( int device, int channelIndex, bool input );
|
||||
|
||||
|
||||
/** Retrieve the range of legal native buffer sizes for the specificed device, in sample frames.
|
||||
|
||||
@param device The global index of the PortAudio device about which the query is being made.
|
||||
@param minBufferSizeFrames A pointer to the location which will receive the minimum buffer size value.
|
||||
@param maxBufferSizeFrames A pointer to the location which will receive the maximum buffer size value.
|
||||
|
||||
@see kAudioDevicePropertyBufferFrameSizeRange in the CoreAudio SDK.
|
||||
*/
|
||||
PaError PaMacCore_GetBufferSizeRange( PaDeviceIndex device,
|
||||
long *minBufferSizeFrames, long *maxBufferSizeFrames );
|
||||
|
||||
|
||||
/**
|
||||
* Flags
|
||||
*/
|
||||
|
||||
/**
|
||||
* The following flags alter the behaviour of PA on the mac platform.
|
||||
* they can be ORed together. These should work both for opening and
|
||||
* checking a device.
|
||||
*/
|
||||
|
||||
/** Allows PortAudio to change things like the device's frame size,
|
||||
* which allows for much lower latency, but might disrupt the device
|
||||
* if other programs are using it, even when you are just Querying
|
||||
* the device. */
|
||||
#define paMacCoreChangeDeviceParameters (0x01)
|
||||
|
||||
/** In combination with the above flag,
|
||||
* causes the stream opening to fail, unless the exact sample rates
|
||||
* are supported by the device. */
|
||||
#define paMacCoreFailIfConversionRequired (0x02)
|
||||
|
||||
/** These flags set the SR conversion quality, if required. The wierd ordering
|
||||
* allows Maximum Quality to be the default.*/
|
||||
#define paMacCoreConversionQualityMin (0x0100)
|
||||
#define paMacCoreConversionQualityMedium (0x0200)
|
||||
#define paMacCoreConversionQualityLow (0x0300)
|
||||
#define paMacCoreConversionQualityHigh (0x0400)
|
||||
#define paMacCoreConversionQualityMax (0x0000)
|
||||
|
||||
/**
|
||||
* Here are some "preset" combinations of flags (above) to get to some
|
||||
* common configurations. THIS IS OVERKILL, but if more flags are added
|
||||
* it won't be.
|
||||
*/
|
||||
|
||||
/**This is the default setting: do as much sample rate conversion as possible
|
||||
* and as little mucking with the device as possible. */
|
||||
#define paMacCorePlayNice (0x00)
|
||||
/**This setting is tuned for pro audio apps. It allows SR conversion on input
|
||||
and output, but it tries to set the appropriate SR on the device.*/
|
||||
#define paMacCorePro (0x01)
|
||||
/**This is a setting to minimize CPU usage and still play nice.*/
|
||||
#define paMacCoreMinimizeCPUButPlayNice (0x0100)
|
||||
/**This is a setting to minimize CPU usage, even if that means interrupting the device. */
|
||||
#define paMacCoreMinimizeCPU (0x0101)
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /** __cplusplus */
|
||||
|
||||
#endif /** PA_MAC_CORE_H */
|
199
pd-0.44-2/portaudio/include/pa_win_waveformat.h
Normal file
199
pd-0.44-2/portaudio/include/pa_win_waveformat.h
Normal file
|
@ -0,0 +1,199 @@
|
|||
#ifndef PA_WIN_WAVEFORMAT_H
|
||||
#define PA_WIN_WAVEFORMAT_H
|
||||
|
||||
/*
|
||||
* PortAudio Portable Real-Time Audio Library
|
||||
* Windows WAVEFORMAT* data structure utilities
|
||||
* portaudio.h should be included before this file.
|
||||
*
|
||||
* Copyright (c) 2007 Ross Bencina
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
@ingroup public_header
|
||||
@brief Windows specific PortAudio API extension and utilities header file.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
The following #defines for speaker channel masks are the same
|
||||
as those in ksmedia.h, except with PAWIN_ prepended, KSAUDIO_ removed
|
||||
in some cases, and casts to PaWinWaveFormatChannelMask added.
|
||||
*/
|
||||
|
||||
typedef unsigned long PaWinWaveFormatChannelMask;
|
||||
|
||||
/* Speaker Positions: */
|
||||
#define PAWIN_SPEAKER_FRONT_LEFT ((PaWinWaveFormatChannelMask)0x1)
|
||||
#define PAWIN_SPEAKER_FRONT_RIGHT ((PaWinWaveFormatChannelMask)0x2)
|
||||
#define PAWIN_SPEAKER_FRONT_CENTER ((PaWinWaveFormatChannelMask)0x4)
|
||||
#define PAWIN_SPEAKER_LOW_FREQUENCY ((PaWinWaveFormatChannelMask)0x8)
|
||||
#define PAWIN_SPEAKER_BACK_LEFT ((PaWinWaveFormatChannelMask)0x10)
|
||||
#define PAWIN_SPEAKER_BACK_RIGHT ((PaWinWaveFormatChannelMask)0x20)
|
||||
#define PAWIN_SPEAKER_FRONT_LEFT_OF_CENTER ((PaWinWaveFormatChannelMask)0x40)
|
||||
#define PAWIN_SPEAKER_FRONT_RIGHT_OF_CENTER ((PaWinWaveFormatChannelMask)0x80)
|
||||
#define PAWIN_SPEAKER_BACK_CENTER ((PaWinWaveFormatChannelMask)0x100)
|
||||
#define PAWIN_SPEAKER_SIDE_LEFT ((PaWinWaveFormatChannelMask)0x200)
|
||||
#define PAWIN_SPEAKER_SIDE_RIGHT ((PaWinWaveFormatChannelMask)0x400)
|
||||
#define PAWIN_SPEAKER_TOP_CENTER ((PaWinWaveFormatChannelMask)0x800)
|
||||
#define PAWIN_SPEAKER_TOP_FRONT_LEFT ((PaWinWaveFormatChannelMask)0x1000)
|
||||
#define PAWIN_SPEAKER_TOP_FRONT_CENTER ((PaWinWaveFormatChannelMask)0x2000)
|
||||
#define PAWIN_SPEAKER_TOP_FRONT_RIGHT ((PaWinWaveFormatChannelMask)0x4000)
|
||||
#define PAWIN_SPEAKER_TOP_BACK_LEFT ((PaWinWaveFormatChannelMask)0x8000)
|
||||
#define PAWIN_SPEAKER_TOP_BACK_CENTER ((PaWinWaveFormatChannelMask)0x10000)
|
||||
#define PAWIN_SPEAKER_TOP_BACK_RIGHT ((PaWinWaveFormatChannelMask)0x20000)
|
||||
|
||||
/* Bit mask locations reserved for future use */
|
||||
#define PAWIN_SPEAKER_RESERVED ((PaWinWaveFormatChannelMask)0x7FFC0000)
|
||||
|
||||
/* Used to specify that any possible permutation of speaker configurations */
|
||||
#define PAWIN_SPEAKER_ALL ((PaWinWaveFormatChannelMask)0x80000000)
|
||||
|
||||
/* DirectSound Speaker Config */
|
||||
#define PAWIN_SPEAKER_DIRECTOUT 0
|
||||
#define PAWIN_SPEAKER_MONO (PAWIN_SPEAKER_FRONT_CENTER)
|
||||
#define PAWIN_SPEAKER_STEREO (PAWIN_SPEAKER_FRONT_LEFT | PAWIN_SPEAKER_FRONT_RIGHT)
|
||||
#define PAWIN_SPEAKER_QUAD (PAWIN_SPEAKER_FRONT_LEFT | PAWIN_SPEAKER_FRONT_RIGHT | \
|
||||
PAWIN_SPEAKER_BACK_LEFT | PAWIN_SPEAKER_BACK_RIGHT)
|
||||
#define PAWIN_SPEAKER_SURROUND (PAWIN_SPEAKER_FRONT_LEFT | PAWIN_SPEAKER_FRONT_RIGHT | \
|
||||
PAWIN_SPEAKER_FRONT_CENTER | PAWIN_SPEAKER_BACK_CENTER)
|
||||
#define PAWIN_SPEAKER_5POINT1 (PAWIN_SPEAKER_FRONT_LEFT | PAWIN_SPEAKER_FRONT_RIGHT | \
|
||||
PAWIN_SPEAKER_FRONT_CENTER | PAWIN_SPEAKER_LOW_FREQUENCY | \
|
||||
PAWIN_SPEAKER_BACK_LEFT | PAWIN_SPEAKER_BACK_RIGHT)
|
||||
#define PAWIN_SPEAKER_7POINT1 (PAWIN_SPEAKER_FRONT_LEFT | PAWIN_SPEAKER_FRONT_RIGHT | \
|
||||
PAWIN_SPEAKER_FRONT_CENTER | PAWIN_SPEAKER_LOW_FREQUENCY | \
|
||||
PAWIN_SPEAKER_BACK_LEFT | PAWIN_SPEAKER_BACK_RIGHT | \
|
||||
PAWIN_SPEAKER_FRONT_LEFT_OF_CENTER | PAWIN_SPEAKER_FRONT_RIGHT_OF_CENTER)
|
||||
#define PAWIN_SPEAKER_5POINT1_SURROUND (PAWIN_SPEAKER_FRONT_LEFT | PAWIN_SPEAKER_FRONT_RIGHT | \
|
||||
PAWIN_SPEAKER_FRONT_CENTER | PAWIN_SPEAKER_LOW_FREQUENCY | \
|
||||
PAWIN_SPEAKER_SIDE_LEFT | PAWIN_SPEAKER_SIDE_RIGHT)
|
||||
#define PAWIN_SPEAKER_7POINT1_SURROUND (PAWIN_SPEAKER_FRONT_LEFT | PAWIN_SPEAKER_FRONT_RIGHT | \
|
||||
PAWIN_SPEAKER_FRONT_CENTER | PAWIN_SPEAKER_LOW_FREQUENCY | \
|
||||
PAWIN_SPEAKER_BACK_LEFT | PAWIN_SPEAKER_BACK_RIGHT | \
|
||||
PAWIN_SPEAKER_SIDE_LEFT | PAWIN_SPEAKER_SIDE_RIGHT)
|
||||
/*
|
||||
According to the Microsoft documentation:
|
||||
The following are obsolete 5.1 and 7.1 settings (they lack side speakers). Note this means
|
||||
that the default 5.1 and 7.1 settings (KSAUDIO_SPEAKER_5POINT1 and KSAUDIO_SPEAKER_7POINT1 are
|
||||
similarly obsolete but are unchanged for compatibility reasons).
|
||||
*/
|
||||
#define PAWIN_SPEAKER_5POINT1_BACK PAWIN_SPEAKER_5POINT1
|
||||
#define PAWIN_SPEAKER_7POINT1_WIDE PAWIN_SPEAKER_7POINT1
|
||||
|
||||
/* DVD Speaker Positions */
|
||||
#define PAWIN_SPEAKER_GROUND_FRONT_LEFT PAWIN_SPEAKER_FRONT_LEFT
|
||||
#define PAWIN_SPEAKER_GROUND_FRONT_CENTER PAWIN_SPEAKER_FRONT_CENTER
|
||||
#define PAWIN_SPEAKER_GROUND_FRONT_RIGHT PAWIN_SPEAKER_FRONT_RIGHT
|
||||
#define PAWIN_SPEAKER_GROUND_REAR_LEFT PAWIN_SPEAKER_BACK_LEFT
|
||||
#define PAWIN_SPEAKER_GROUND_REAR_RIGHT PAWIN_SPEAKER_BACK_RIGHT
|
||||
#define PAWIN_SPEAKER_TOP_MIDDLE PAWIN_SPEAKER_TOP_CENTER
|
||||
#define PAWIN_SPEAKER_SUPER_WOOFER PAWIN_SPEAKER_LOW_FREQUENCY
|
||||
|
||||
|
||||
/*
|
||||
PaWinWaveFormat is defined here to provide compatibility with
|
||||
compilation environments which don't have headers defining
|
||||
WAVEFORMATEXTENSIBLE (e.g. older versions of MSVC, Borland C++ etc.
|
||||
|
||||
The fields for WAVEFORMATEX and WAVEFORMATEXTENSIBLE are declared as an
|
||||
unsigned char array here to avoid clients who include this file having
|
||||
a dependency on windows.h and mmsystem.h, and also to to avoid having
|
||||
to write separate packing pragmas for each compiler.
|
||||
*/
|
||||
#define PAWIN_SIZEOF_WAVEFORMATEX 18
|
||||
#define PAWIN_SIZEOF_WAVEFORMATEXTENSIBLE (PAWIN_SIZEOF_WAVEFORMATEX + 22)
|
||||
|
||||
typedef struct{
|
||||
unsigned char fields[ PAWIN_SIZEOF_WAVEFORMATEXTENSIBLE ];
|
||||
unsigned long extraLongForAlignment; /* ensure that compiler aligns struct to DWORD */
|
||||
} PaWinWaveFormat;
|
||||
|
||||
/*
|
||||
WAVEFORMATEXTENSIBLE fields:
|
||||
|
||||
union {
|
||||
WORD wValidBitsPerSample;
|
||||
WORD wSamplesPerBlock;
|
||||
WORD wReserved;
|
||||
} Samples;
|
||||
DWORD dwChannelMask;
|
||||
GUID SubFormat;
|
||||
*/
|
||||
|
||||
#define PAWIN_INDEXOF_WVALIDBITSPERSAMPLE (PAWIN_SIZEOF_WAVEFORMATEX+0)
|
||||
#define PAWIN_INDEXOF_DWCHANNELMASK (PAWIN_SIZEOF_WAVEFORMATEX+2)
|
||||
#define PAWIN_INDEXOF_SUBFORMAT (PAWIN_SIZEOF_WAVEFORMATEX+6)
|
||||
|
||||
|
||||
/*
|
||||
Valid values to pass for the waveFormatTag PaWin_InitializeWaveFormatEx and
|
||||
PaWin_InitializeWaveFormatExtensible functions below. These must match
|
||||
the standard Windows WAVE_FORMAT_* values.
|
||||
*/
|
||||
#define PAWIN_WAVE_FORMAT_PCM (1)
|
||||
#define PAWIN_WAVE_FORMAT_IEEE_FLOAT (3)
|
||||
#define PAWIN_WAVE_FORMAT_DOLBY_AC3_SPDIF (0x0092)
|
||||
#define PAWIN_WAVE_FORMAT_WMA_SPDIF (0x0164)
|
||||
|
||||
|
||||
/*
|
||||
returns PAWIN_WAVE_FORMAT_PCM or PAWIN_WAVE_FORMAT_IEEE_FLOAT
|
||||
depending on the sampleFormat parameter.
|
||||
*/
|
||||
int PaWin_SampleFormatToLinearWaveFormatTag( PaSampleFormat sampleFormat );
|
||||
|
||||
/*
|
||||
Use the following two functions to initialize the waveformat structure.
|
||||
*/
|
||||
|
||||
void PaWin_InitializeWaveFormatEx( PaWinWaveFormat *waveFormat,
|
||||
int numChannels, PaSampleFormat sampleFormat, int waveFormatTag, double sampleRate );
|
||||
|
||||
|
||||
void PaWin_InitializeWaveFormatExtensible( PaWinWaveFormat *waveFormat,
|
||||
int numChannels, PaSampleFormat sampleFormat, int waveFormatTag, double sampleRate,
|
||||
PaWinWaveFormatChannelMask channelMask );
|
||||
|
||||
|
||||
/* Map a channel count to a speaker channel mask */
|
||||
PaWinWaveFormatChannelMask PaWin_DefaultChannelMask( int numChannels );
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* PA_WIN_WAVEFORMAT_H */
|
185
pd-0.44-2/portaudio/include/pa_win_wmme.h
Normal file
185
pd-0.44-2/portaudio/include/pa_win_wmme.h
Normal file
|
@ -0,0 +1,185 @@
|
|||
#ifndef PA_WIN_WMME_H
|
||||
#define PA_WIN_WMME_H
|
||||
/*
|
||||
* $Id: pa_win_wmme.h 1592 2011-02-04 10:41:58Z rossb $
|
||||
* PortAudio Portable Real-Time Audio Library
|
||||
* MME specific extensions
|
||||
*
|
||||
* Copyright (c) 1999-2000 Ross Bencina and Phil Burk
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
@ingroup public_header
|
||||
@brief WMME-specific PortAudio API extension header file.
|
||||
*/
|
||||
|
||||
#include "portaudio.h"
|
||||
#include "pa_win_waveformat.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/* The following are flags which can be set in
|
||||
PaWinMmeStreamInfo's flags field.
|
||||
*/
|
||||
|
||||
#define paWinMmeUseLowLevelLatencyParameters (0x01)
|
||||
#define paWinMmeUseMultipleDevices (0x02) /* use mme specific multiple device feature */
|
||||
#define paWinMmeUseChannelMask (0x04)
|
||||
|
||||
/* By default, the mme implementation drops the processing thread's priority
|
||||
to THREAD_PRIORITY_NORMAL and sleeps the thread if the CPU load exceeds 100%
|
||||
This flag disables any priority throttling. The processing thread will always
|
||||
run at THREAD_PRIORITY_TIME_CRITICAL.
|
||||
*/
|
||||
#define paWinMmeDontThrottleOverloadedProcessingThread (0x08)
|
||||
|
||||
/* Flags for non-PCM spdif passthrough.
|
||||
*/
|
||||
#define paWinMmeWaveFormatDolbyAc3Spdif (0x10)
|
||||
#define paWinMmeWaveFormatWmaSpdif (0x20)
|
||||
|
||||
|
||||
typedef struct PaWinMmeDeviceAndChannelCount{
|
||||
PaDeviceIndex device;
|
||||
int channelCount;
|
||||
}PaWinMmeDeviceAndChannelCount;
|
||||
|
||||
|
||||
typedef struct PaWinMmeStreamInfo{
|
||||
unsigned long size; /**< sizeof(PaWinMmeStreamInfo) */
|
||||
PaHostApiTypeId hostApiType; /**< paMME */
|
||||
unsigned long version; /**< 1 */
|
||||
|
||||
unsigned long flags;
|
||||
|
||||
/* low-level latency setting support
|
||||
These settings control the number and size of host buffers in order
|
||||
to set latency. They will be used instead of the generic parameters
|
||||
to Pa_OpenStream() if flags contains the PaWinMmeUseLowLevelLatencyParameters
|
||||
flag.
|
||||
|
||||
If PaWinMmeStreamInfo structures with PaWinMmeUseLowLevelLatencyParameters
|
||||
are supplied for both input and output in a full duplex stream, then the
|
||||
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;
|
||||
unsigned long bufferCount; /* formerly numBuffers */
|
||||
|
||||
/* multiple devices per direction support
|
||||
If flags contains the PaWinMmeUseMultipleDevices flag,
|
||||
this functionality will be used, otherwise the device parameter to
|
||||
Pa_OpenStream() will be used instead.
|
||||
If devices are specified here, the corresponding device parameter
|
||||
to Pa_OpenStream() should be set to paUseHostApiSpecificDeviceSpecification,
|
||||
otherwise an paInvalidDevice error will result.
|
||||
The total number of channels accross all specified devices
|
||||
must agree with the corresponding channelCount parameter to
|
||||
Pa_OpenStream() otherwise a paInvalidChannelCount error will result.
|
||||
*/
|
||||
PaWinMmeDeviceAndChannelCount *devices;
|
||||
unsigned long deviceCount;
|
||||
|
||||
/*
|
||||
support for WAVEFORMATEXTENSIBLE channel masks. If flags contains
|
||||
paWinMmeUseChannelMask this allows you to specify which speakers
|
||||
to address in a multichannel stream. Constants for channelMask
|
||||
are specified in pa_win_waveformat.h
|
||||
|
||||
*/
|
||||
PaWinWaveFormatChannelMask channelMask;
|
||||
|
||||
}PaWinMmeStreamInfo;
|
||||
|
||||
|
||||
/** Retrieve the number of wave in handles used by a PortAudio WinMME stream.
|
||||
Returns zero if the stream is output only.
|
||||
|
||||
@return A non-negative value indicating the number of wave in handles
|
||||
or, a PaErrorCode (which are always negative) if PortAudio is not initialized
|
||||
or an error is encountered.
|
||||
|
||||
@see PaWinMME_GetStreamInputHandle
|
||||
*/
|
||||
int PaWinMME_GetStreamInputHandleCount( PaStream* stream );
|
||||
|
||||
|
||||
/** Retrieve a wave in handle used by a PortAudio WinMME stream.
|
||||
|
||||
@param stream The stream to query.
|
||||
@param handleIndex The zero based index of the wave in handle to retrieve. This
|
||||
should be in the range [0, PaWinMME_GetStreamInputHandleCount(stream)-1].
|
||||
|
||||
@return A valid wave in handle, or NULL if an error occurred.
|
||||
|
||||
@see PaWinMME_GetStreamInputHandle
|
||||
*/
|
||||
HWAVEIN PaWinMME_GetStreamInputHandle( PaStream* stream, int handleIndex );
|
||||
|
||||
|
||||
/** Retrieve the number of wave out handles used by a PortAudio WinMME stream.
|
||||
Returns zero if the stream is input only.
|
||||
|
||||
@return A non-negative value indicating the number of wave out handles
|
||||
or, a PaErrorCode (which are always negative) if PortAudio is not initialized
|
||||
or an error is encountered.
|
||||
|
||||
@see PaWinMME_GetStreamOutputHandle
|
||||
*/
|
||||
int PaWinMME_GetStreamOutputHandleCount( PaStream* stream );
|
||||
|
||||
|
||||
/** Retrieve a wave out handle used by a PortAudio WinMME stream.
|
||||
|
||||
@param stream The stream to query.
|
||||
@param handleIndex The zero based index of the wave out handle to retrieve.
|
||||
This should be in the range [0, PaWinMME_GetStreamOutputHandleCount(stream)-1].
|
||||
|
||||
@return A valid wave out handle, or NULL if an error occurred.
|
||||
|
||||
@see PaWinMME_GetStreamOutputHandleCount
|
||||
*/
|
||||
HWAVEOUT PaWinMME_GetStreamOutputHandle( PaStream* stream, int handleIndex );
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* PA_WIN_WMME_H */
|
1174
pd-0.44-2/portaudio/include/portaudio.h
Normal file
1174
pd-0.44-2/portaudio/include/portaudio.h
Normal file
File diff suppressed because it is too large
Load diff
527
pd-0.44-2/portaudio/install-sh
Executable file
527
pd-0.44-2/portaudio/install-sh
Executable file
|
@ -0,0 +1,527 @@
|
|||
#!/bin/sh
|
||||
# install - install a program, script, or datafile
|
||||
|
||||
scriptversion=2011-01-19.21; # UTC
|
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
#
|
||||
# Copyright (C) 1994 X Consortium
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch.
|
||||
|
||||
nl='
|
||||
'
|
||||
IFS=" "" $nl"
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit=${DOITPROG-}
|
||||
if test -z "$doit"; then
|
||||
doit_exec=exec
|
||||
else
|
||||
doit_exec=$doit
|
||||
fi
|
||||
|
||||
# Put in absolute file names if you don't have them in your path;
|
||||
# or use environment vars.
|
||||
|
||||
chgrpprog=${CHGRPPROG-chgrp}
|
||||
chmodprog=${CHMODPROG-chmod}
|
||||
chownprog=${CHOWNPROG-chown}
|
||||
cmpprog=${CMPPROG-cmp}
|
||||
cpprog=${CPPROG-cp}
|
||||
mkdirprog=${MKDIRPROG-mkdir}
|
||||
mvprog=${MVPROG-mv}
|
||||
rmprog=${RMPROG-rm}
|
||||
stripprog=${STRIPPROG-strip}
|
||||
|
||||
posix_glob='?'
|
||||
initialize_posix_glob='
|
||||
test "$posix_glob" != "?" || {
|
||||
if (set -f) 2>/dev/null; then
|
||||
posix_glob=
|
||||
else
|
||||
posix_glob=:
|
||||
fi
|
||||
}
|
||||
'
|
||||
|
||||
posix_mkdir=
|
||||
|
||||
# Desired mode of installed file.
|
||||
mode=0755
|
||||
|
||||
chgrpcmd=
|
||||
chmodcmd=$chmodprog
|
||||
chowncmd=
|
||||
mvcmd=$mvprog
|
||||
rmcmd="$rmprog -f"
|
||||
stripcmd=
|
||||
|
||||
src=
|
||||
dst=
|
||||
dir_arg=
|
||||
dst_arg=
|
||||
|
||||
copy_on_change=false
|
||||
no_target_directory=
|
||||
|
||||
usage="\
|
||||
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
||||
or: $0 [OPTION]... -d DIRECTORIES...
|
||||
|
||||
In the 1st form, copy SRCFILE to DSTFILE.
|
||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
||||
In the 4th, create DIRECTORIES.
|
||||
|
||||
Options:
|
||||
--help display this help and exit.
|
||||
--version display version info and exit.
|
||||
|
||||
-c (ignored)
|
||||
-C install only if different (preserve the last data modification time)
|
||||
-d create directories instead of installing files.
|
||||
-g GROUP $chgrpprog installed files to GROUP.
|
||||
-m MODE $chmodprog installed files to MODE.
|
||||
-o USER $chownprog installed files to USER.
|
||||
-s $stripprog installed files.
|
||||
-t DIRECTORY install into DIRECTORY.
|
||||
-T report an error if DSTFILE is a directory.
|
||||
|
||||
Environment variables override the default commands:
|
||||
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
|
||||
RMPROG STRIPPROG
|
||||
"
|
||||
|
||||
while test $# -ne 0; do
|
||||
case $1 in
|
||||
-c) ;;
|
||||
|
||||
-C) copy_on_change=true;;
|
||||
|
||||
-d) dir_arg=true;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift;;
|
||||
|
||||
--help) echo "$usage"; exit $?;;
|
||||
|
||||
-m) mode=$2
|
||||
case $mode in
|
||||
*' '* | *' '* | *'
|
||||
'* | *'*'* | *'?'* | *'['*)
|
||||
echo "$0: invalid mode: $mode" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift;;
|
||||
|
||||
-s) stripcmd=$stripprog;;
|
||||
|
||||
-t) dst_arg=$2
|
||||
# Protect names problematic for `test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-T) no_target_directory=true;;
|
||||
|
||||
--version) echo "$0 $scriptversion"; exit $?;;
|
||||
|
||||
--) shift
|
||||
break;;
|
||||
|
||||
-*) echo "$0: invalid option: $1" >&2
|
||||
exit 1;;
|
||||
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
|
||||
# When -d is used, all remaining arguments are directories to create.
|
||||
# When -t is used, the destination is already specified.
|
||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
||||
for arg
|
||||
do
|
||||
if test -n "$dst_arg"; then
|
||||
# $@ is not empty: it contains at least $arg.
|
||||
set fnord "$@" "$dst_arg"
|
||||
shift # fnord
|
||||
fi
|
||||
shift # arg
|
||||
dst_arg=$arg
|
||||
# Protect names problematic for `test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
if test $# -eq 0; then
|
||||
if test -z "$dir_arg"; then
|
||||
echo "$0: no input file specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
# It's OK to call `install-sh -d' without argument.
|
||||
# This can happen when creating conditional directories.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
do_exit='(exit $ret); exit $ret'
|
||||
trap "ret=129; $do_exit" 1
|
||||
trap "ret=130; $do_exit" 2
|
||||
trap "ret=141; $do_exit" 13
|
||||
trap "ret=143; $do_exit" 15
|
||||
|
||||
# Set umask so as not to create temps with too-generous modes.
|
||||
# However, 'strip' requires both read and write access to temps.
|
||||
case $mode in
|
||||
# Optimize common cases.
|
||||
*644) cp_umask=133;;
|
||||
*755) cp_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw='% 200'
|
||||
fi
|
||||
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
|
||||
*)
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw=,u+rw
|
||||
fi
|
||||
cp_umask=$mode$u_plus_rw;;
|
||||
esac
|
||||
fi
|
||||
|
||||
for src
|
||||
do
|
||||
# Protect names problematic for `test' and other utilities.
|
||||
case $src in
|
||||
-* | [=\(\)!]) src=./$src;;
|
||||
esac
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
dst=$src
|
||||
dstdir=$dst
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
if test ! -f "$src" && test ! -d "$src"; then
|
||||
echo "$0: $src does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$dst_arg"; then
|
||||
echo "$0: no destination specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
dst=$dst_arg
|
||||
|
||||
# If destination is a directory, append the input filename; won't work
|
||||
# if double slashes aren't ignored.
|
||||
if test -d "$dst"; then
|
||||
if test -n "$no_target_directory"; then
|
||||
echo "$0: $dst_arg: Is a directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
dstdir=$dst
|
||||
dst=$dstdir/`basename "$src"`
|
||||
dstdir_status=0
|
||||
else
|
||||
# Prefer dirname, but fall back on a substitute if dirname fails.
|
||||
dstdir=`
|
||||
(dirname "$dst") 2>/dev/null ||
|
||||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
|
||||
X"$dst" : 'X\(//\)[^/]' \| \
|
||||
X"$dst" : 'X\(//\)$' \| \
|
||||
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
|
||||
echo X"$dst" |
|
||||
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\/\)[^/].*/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\/\)$/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\).*/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
s/.*/./; q'
|
||||
`
|
||||
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
fi
|
||||
fi
|
||||
|
||||
obsolete_mkdir_used=false
|
||||
|
||||
if test $dstdir_status != 0; then
|
||||
case $posix_mkdir in
|
||||
'')
|
||||
# Create intermediate dirs using mode 755 as modified by the umask.
|
||||
# This is like FreeBSD 'install' as of 1997-10-28.
|
||||
umask=`umask`
|
||||
case $stripcmd.$umask in
|
||||
# Optimize common cases.
|
||||
*[2367][2367]) mkdir_umask=$umask;;
|
||||
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
mkdir_umask=`expr $umask + 22 \
|
||||
- $umask % 100 % 40 + $umask % 20 \
|
||||
- $umask % 10 % 4 + $umask % 2
|
||||
`;;
|
||||
*) mkdir_umask=$umask,go-w;;
|
||||
esac
|
||||
|
||||
# With -d, create the new directory with the user-specified mode.
|
||||
# Otherwise, rely on $mkdir_umask.
|
||||
if test -n "$dir_arg"; then
|
||||
mkdir_mode=-m$mode
|
||||
else
|
||||
mkdir_mode=
|
||||
fi
|
||||
|
||||
posix_mkdir=false
|
||||
case $umask in
|
||||
*[123567][0-7][0-7])
|
||||
# POSIX mkdir -p sets u+wx bits regardless of umask, which
|
||||
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
|
||||
;;
|
||||
*)
|
||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
||||
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
|
||||
|
||||
if (umask $mkdir_umask &&
|
||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
|
||||
then
|
||||
if test -z "$dir_arg" || {
|
||||
# Check for POSIX incompatibilities with -m.
|
||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
||||
# other-writeable bit of parent directory when it shouldn't.
|
||||
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
|
||||
ls_ld_tmpdir=`ls -ld "$tmpdir"`
|
||||
case $ls_ld_tmpdir in
|
||||
d????-?r-*) different_mode=700;;
|
||||
d????-?--*) different_mode=755;;
|
||||
*) false;;
|
||||
esac &&
|
||||
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
|
||||
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
|
||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
||||
}
|
||||
}
|
||||
then posix_mkdir=:
|
||||
fi
|
||||
rmdir "$tmpdir/d" "$tmpdir"
|
||||
else
|
||||
# Remove any dirs left behind by ancient mkdir implementations.
|
||||
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
|
||||
fi
|
||||
trap '' 0;;
|
||||
esac;;
|
||||
esac
|
||||
|
||||
if
|
||||
$posix_mkdir && (
|
||||
umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
|
||||
)
|
||||
then :
|
||||
else
|
||||
|
||||
# The umask is ridiculous, or mkdir does not conform to POSIX,
|
||||
# or it failed possibly due to a race condition. Create the
|
||||
# directory the slow way, step by step, checking for races as we go.
|
||||
|
||||
case $dstdir in
|
||||
/*) prefix='/';;
|
||||
[-=\(\)!]*) prefix='./';;
|
||||
*) prefix='';;
|
||||
esac
|
||||
|
||||
eval "$initialize_posix_glob"
|
||||
|
||||
oIFS=$IFS
|
||||
IFS=/
|
||||
$posix_glob set -f
|
||||
set fnord $dstdir
|
||||
shift
|
||||
$posix_glob set +f
|
||||
IFS=$oIFS
|
||||
|
||||
prefixes=
|
||||
|
||||
for d
|
||||
do
|
||||
test X"$d" = X && continue
|
||||
|
||||
prefix=$prefix$d
|
||||
if test -d "$prefix"; then
|
||||
prefixes=
|
||||
else
|
||||
if $posix_mkdir; then
|
||||
(umask=$mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
|
||||
# Don't fail if two instances are running concurrently.
|
||||
test -d "$prefix" || exit 1
|
||||
else
|
||||
case $prefix in
|
||||
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
|
||||
*) qprefix=$prefix;;
|
||||
esac
|
||||
prefixes="$prefixes '$qprefix'"
|
||||
fi
|
||||
fi
|
||||
prefix=$prefix/
|
||||
done
|
||||
|
||||
if test -n "$prefixes"; then
|
||||
# Don't fail if two instances are running concurrently.
|
||||
(umask $mkdir_umask &&
|
||||
eval "\$doit_exec \$mkdirprog $prefixes") ||
|
||||
test -d "$dstdir" || exit 1
|
||||
obsolete_mkdir_used=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
|
||||
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
|
||||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
|
||||
else
|
||||
|
||||
# Make a couple of temp file names in the proper directory.
|
||||
dsttmp=$dstdir/_inst.$$_
|
||||
rmtmp=$dstdir/_rm.$$_
|
||||
|
||||
# Trap to clean up those temp files at exit.
|
||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
||||
|
||||
# Copy the file name to the temp name.
|
||||
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits.
|
||||
#
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
||||
#
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
|
||||
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
|
||||
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
|
||||
|
||||
# If -C, don't bother to copy if it wouldn't change the file.
|
||||
if $copy_on_change &&
|
||||
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
||||
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
||||
|
||||
eval "$initialize_posix_glob" &&
|
||||
$posix_glob set -f &&
|
||||
set X $old && old=:$2:$4:$5:$6 &&
|
||||
set X $new && new=:$2:$4:$5:$6 &&
|
||||
$posix_glob set +f &&
|
||||
|
||||
test "$old" = "$new" &&
|
||||
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
||||
then
|
||||
rm -f "$dsttmp"
|
||||
else
|
||||
# Rename the file to the real destination.
|
||||
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
|
||||
|
||||
# The rename failed, perhaps because mv can't rename something else
|
||||
# to itself, or perhaps because mv is so ancient that it does not
|
||||
# support -f.
|
||||
{
|
||||
# Now remove or move aside any old file at destination location.
|
||||
# We try this two ways since rm can't unlink itself on some
|
||||
# systems and the destination file might be busy for other
|
||||
# reasons. In this case, the final cleanup might fail but the new
|
||||
# file should still install successfully.
|
||||
{
|
||||
test ! -f "$dst" ||
|
||||
$doit $rmcmd -f "$dst" 2>/dev/null ||
|
||||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
||||
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
|
||||
} ||
|
||||
{ echo "$0: cannot unlink or rename $dst" >&2
|
||||
(exit 1); exit 1
|
||||
}
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
$doit $mvcmd "$dsttmp" "$dst"
|
||||
}
|
||||
fi || exit 1
|
||||
|
||||
trap '' 0
|
||||
fi
|
||||
done
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
9661
pd-0.44-2/portaudio/ltmain.sh
Normal file
9661
pd-0.44-2/portaudio/ltmain.sh
Normal file
File diff suppressed because it is too large
Load diff
243
pd-0.44-2/portaudio/src/common/pa_allocation.c
Normal file
243
pd-0.44-2/portaudio/src/common/pa_allocation.c
Normal file
|
@ -0,0 +1,243 @@
|
|||
/*
|
||||
* $Id: pa_allocation.c 1097 2006-08-26 08:27:53Z rossb $
|
||||
* Portable Audio I/O Library allocation group implementation
|
||||
* memory allocation group for tracking allocation groups
|
||||
*
|
||||
* Based on the Open Source API proposed by Ross Bencina
|
||||
* Copyright (c) 1999-2002 Ross Bencina, Phil Burk
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
@ingroup common_src
|
||||
|
||||
@brief Allocation Group implementation.
|
||||
*/
|
||||
|
||||
|
||||
#include "pa_allocation.h"
|
||||
#include "pa_util.h"
|
||||
|
||||
|
||||
/*
|
||||
Maintain 3 singly linked lists...
|
||||
linkBlocks: the buffers used to allocate the links
|
||||
spareLinks: links available for use in the allocations list
|
||||
allocations: the buffers currently allocated using PaUtil_ContextAllocateMemory()
|
||||
|
||||
Link block size is doubled every time new links are allocated.
|
||||
*/
|
||||
|
||||
|
||||
#define PA_INITIAL_LINK_COUNT_ 16
|
||||
|
||||
struct PaUtilAllocationGroupLink
|
||||
{
|
||||
struct PaUtilAllocationGroupLink *next;
|
||||
void *buffer;
|
||||
};
|
||||
|
||||
/*
|
||||
Allocate a block of links. The first link will have it's buffer member
|
||||
pointing to the block, and it's next member set to <nextBlock>. The remaining
|
||||
links will have NULL buffer members, and each link will point to
|
||||
the next link except the last, which will point to <nextSpare>
|
||||
*/
|
||||
static struct PaUtilAllocationGroupLink *AllocateLinks( long count,
|
||||
struct PaUtilAllocationGroupLink *nextBlock,
|
||||
struct PaUtilAllocationGroupLink *nextSpare )
|
||||
{
|
||||
struct PaUtilAllocationGroupLink *result;
|
||||
int i;
|
||||
|
||||
result = (struct PaUtilAllocationGroupLink *)PaUtil_AllocateMemory(
|
||||
sizeof(struct PaUtilAllocationGroupLink) * count );
|
||||
if( result )
|
||||
{
|
||||
/* the block link */
|
||||
result[0].buffer = result;
|
||||
result[0].next = nextBlock;
|
||||
|
||||
/* the spare links */
|
||||
for( i=1; i<count; ++i )
|
||||
{
|
||||
result[i].buffer = 0;
|
||||
result[i].next = &result[i+1];
|
||||
}
|
||||
result[count-1].next = nextSpare;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
PaUtilAllocationGroup* PaUtil_CreateAllocationGroup( void )
|
||||
{
|
||||
PaUtilAllocationGroup* result = 0;
|
||||
struct PaUtilAllocationGroupLink *links;
|
||||
|
||||
|
||||
links = AllocateLinks( PA_INITIAL_LINK_COUNT_, 0, 0 );
|
||||
if( links != 0 )
|
||||
{
|
||||
result = (PaUtilAllocationGroup*)PaUtil_AllocateMemory( sizeof(PaUtilAllocationGroup) );
|
||||
if( result )
|
||||
{
|
||||
result->linkCount = PA_INITIAL_LINK_COUNT_;
|
||||
result->linkBlocks = &links[0];
|
||||
result->spareLinks = &links[1];
|
||||
result->allocations = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
PaUtil_FreeMemory( links );
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void PaUtil_DestroyAllocationGroup( PaUtilAllocationGroup* group )
|
||||
{
|
||||
struct PaUtilAllocationGroupLink *current = group->linkBlocks;
|
||||
struct PaUtilAllocationGroupLink *next;
|
||||
|
||||
while( current )
|
||||
{
|
||||
next = current->next;
|
||||
PaUtil_FreeMemory( current->buffer );
|
||||
current = next;
|
||||
}
|
||||
|
||||
PaUtil_FreeMemory( group );
|
||||
}
|
||||
|
||||
|
||||
void* PaUtil_GroupAllocateMemory( PaUtilAllocationGroup* group, long size )
|
||||
{
|
||||
struct PaUtilAllocationGroupLink *links, *link;
|
||||
void *result = 0;
|
||||
|
||||
/* allocate more links if necessary */
|
||||
if( !group->spareLinks )
|
||||
{
|
||||
/* double the link count on each block allocation */
|
||||
links = AllocateLinks( group->linkCount, group->linkBlocks, group->spareLinks );
|
||||
if( links )
|
||||
{
|
||||
group->linkCount += group->linkCount;
|
||||
group->linkBlocks = &links[0];
|
||||
group->spareLinks = &links[1];
|
||||
}
|
||||
}
|
||||
|
||||
if( group->spareLinks )
|
||||
{
|
||||
result = PaUtil_AllocateMemory( size );
|
||||
if( result )
|
||||
{
|
||||
link = group->spareLinks;
|
||||
group->spareLinks = link->next;
|
||||
|
||||
link->buffer = result;
|
||||
link->next = group->allocations;
|
||||
|
||||
group->allocations = link;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void PaUtil_GroupFreeMemory( PaUtilAllocationGroup* group, void *buffer )
|
||||
{
|
||||
struct PaUtilAllocationGroupLink *current = group->allocations;
|
||||
struct PaUtilAllocationGroupLink *previous = 0;
|
||||
|
||||
if( buffer == 0 )
|
||||
return;
|
||||
|
||||
/* find the right link and remove it */
|
||||
while( current )
|
||||
{
|
||||
if( current->buffer == buffer )
|
||||
{
|
||||
if( previous )
|
||||
{
|
||||
previous->next = current->next;
|
||||
}
|
||||
else
|
||||
{
|
||||
group->allocations = current->next;
|
||||
}
|
||||
|
||||
current->buffer = 0;
|
||||
current->next = group->spareLinks;
|
||||
group->spareLinks = current;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
previous = current;
|
||||
current = current->next;
|
||||
}
|
||||
|
||||
PaUtil_FreeMemory( buffer ); /* free the memory whether we found it in the list or not */
|
||||
}
|
||||
|
||||
|
||||
void PaUtil_FreeAllAllocations( PaUtilAllocationGroup* group )
|
||||
{
|
||||
struct PaUtilAllocationGroupLink *current = group->allocations;
|
||||
struct PaUtilAllocationGroupLink *previous = 0;
|
||||
|
||||
/* free all buffers in the allocations list */
|
||||
while( current )
|
||||
{
|
||||
PaUtil_FreeMemory( current->buffer );
|
||||
current->buffer = 0;
|
||||
|
||||
previous = current;
|
||||
current = current->next;
|
||||
}
|
||||
|
||||
/* link the former allocations list onto the front of the spareLinks list */
|
||||
if( previous )
|
||||
{
|
||||
previous->next = group->spareLinks;
|
||||
group->spareLinks = group->allocations;
|
||||
group->allocations = 0;
|
||||
}
|
||||
}
|
||||
|
104
pd-0.44-2/portaudio/src/common/pa_allocation.h
Normal file
104
pd-0.44-2/portaudio/src/common/pa_allocation.h
Normal file
|
@ -0,0 +1,104 @@
|
|||
#ifndef PA_ALLOCATION_H
|
||||
#define PA_ALLOCATION_H
|
||||
/*
|
||||
* $Id: pa_allocation.h 1339 2008-02-15 07:50:33Z rossb $
|
||||
* Portable Audio I/O Library allocation context header
|
||||
* memory allocation context for tracking allocation groups
|
||||
*
|
||||
* Based on the Open Source API proposed by Ross Bencina
|
||||
* Copyright (c) 1999-2008 Ross Bencina, Phil Burk
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
@ingroup common_src
|
||||
|
||||
@brief Allocation Group prototypes. An Allocation Group makes it easy to
|
||||
allocate multiple blocks of memory and free them all at once.
|
||||
|
||||
An allocation group is useful for keeping track of multiple blocks
|
||||
of memory which are allocated at the same time (such as during initialization)
|
||||
and need to be deallocated at the same time. The allocation group maintains
|
||||
a list of allocated blocks, and can free all allocations at once. This
|
||||
can be usefull for cleaning up after a partially initialized object fails.
|
||||
|
||||
The allocation group implementation is built on top of the lower
|
||||
level allocation functions defined in pa_util.h
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
long linkCount;
|
||||
struct PaUtilAllocationGroupLink *linkBlocks;
|
||||
struct PaUtilAllocationGroupLink *spareLinks;
|
||||
struct PaUtilAllocationGroupLink *allocations;
|
||||
}PaUtilAllocationGroup;
|
||||
|
||||
|
||||
|
||||
/** Create an allocation group.
|
||||
*/
|
||||
PaUtilAllocationGroup* PaUtil_CreateAllocationGroup( void );
|
||||
|
||||
/** Destroy an allocation group, but not the memory allocated through the group.
|
||||
*/
|
||||
void PaUtil_DestroyAllocationGroup( PaUtilAllocationGroup* group );
|
||||
|
||||
/** Allocate a block of memory though an allocation group.
|
||||
*/
|
||||
void* PaUtil_GroupAllocateMemory( PaUtilAllocationGroup* group, long size );
|
||||
|
||||
/** Free a block of memory that was previously allocated though an allocation
|
||||
group. Calling this function is a relatively time consuming operation.
|
||||
Under normal circumstances clients should call PaUtil_FreeAllAllocations to
|
||||
free all allocated blocks simultaneously.
|
||||
@see PaUtil_FreeAllAllocations
|
||||
*/
|
||||
void PaUtil_GroupFreeMemory( PaUtilAllocationGroup* group, void *buffer );
|
||||
|
||||
/** Free all blocks of memory which have been allocated through the allocation
|
||||
group. This function doesn't destroy the group itself.
|
||||
*/
|
||||
void PaUtil_FreeAllAllocations( PaUtilAllocationGroup* group );
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* PA_ALLOCATION_H */
|
1983
pd-0.44-2/portaudio/src/common/pa_converters.c
Normal file
1983
pd-0.44-2/portaudio/src/common/pa_converters.c
Normal file
File diff suppressed because it is too large
Load diff
263
pd-0.44-2/portaudio/src/common/pa_converters.h
Normal file
263
pd-0.44-2/portaudio/src/common/pa_converters.h
Normal file
|
@ -0,0 +1,263 @@
|
|||
#ifndef PA_CONVERTERS_H
|
||||
#define PA_CONVERTERS_H
|
||||
/*
|
||||
* $Id: pa_converters.h 1097 2006-08-26 08:27:53Z rossb $
|
||||
* Portable Audio I/O Library sample conversion mechanism
|
||||
*
|
||||
* Based on the Open Source API proposed by Ross Bencina
|
||||
* Copyright (c) 1999-2002 Phil Burk, Ross Bencina
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
@ingroup common_src
|
||||
|
||||
@brief Conversion functions used to convert buffers of samples from one
|
||||
format to another.
|
||||
*/
|
||||
|
||||
|
||||
#include "portaudio.h" /* for PaSampleFormat */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
struct PaUtilTriangularDitherGenerator;
|
||||
|
||||
|
||||
/** Choose an available sample format which is most appropriate for
|
||||
representing the requested format. If the requested format is not available
|
||||
higher quality formats are considered before lower quality formates.
|
||||
@param availableFormats A variable containing the logical OR of all available
|
||||
formats.
|
||||
@param format The desired format.
|
||||
@return The most appropriate available format for representing the requested
|
||||
format.
|
||||
*/
|
||||
PaSampleFormat PaUtil_SelectClosestAvailableFormat(
|
||||
PaSampleFormat availableFormats, PaSampleFormat format );
|
||||
|
||||
|
||||
/* high level conversions functions for use by implementations */
|
||||
|
||||
|
||||
/** The generic sample converter prototype. Sample converters convert count
|
||||
samples from sourceBuffer to destinationBuffer. The actual type of the data
|
||||
pointed to by these parameters varys for different converter functions.
|
||||
@param destinationBuffer A pointer to the first sample of the destination.
|
||||
@param destinationStride An offset between successive destination samples
|
||||
expressed in samples (not bytes.) It may be negative.
|
||||
@param sourceBuffer A pointer to the first sample of the source.
|
||||
@param sourceStride An offset between successive source samples
|
||||
expressed in samples (not bytes.) It may be negative.
|
||||
@param count The number of samples to convert.
|
||||
@param ditherState State information used to calculate dither. Converters
|
||||
that do not perform dithering will ignore this parameter, in which case
|
||||
NULL or invalid dither state may be passed.
|
||||
*/
|
||||
typedef void PaUtilConverter(
|
||||
void *destinationBuffer, signed int destinationStride,
|
||||
void *sourceBuffer, signed int sourceStride,
|
||||
unsigned int count, struct PaUtilTriangularDitherGenerator *ditherGenerator );
|
||||
|
||||
|
||||
/** Find a sample converter function for the given source and destinations
|
||||
formats and flags (clip and dither.)
|
||||
@return
|
||||
A pointer to a PaUtilConverter which will perform the requested
|
||||
conversion, or NULL if the given format conversion is not supported.
|
||||
For conversions where clipping or dithering is not necessary, the
|
||||
clip and dither flags are ignored and a non-clipping or dithering
|
||||
version is returned.
|
||||
If the source and destination formats are the same, a function which
|
||||
copies data of the appropriate size will be returned.
|
||||
*/
|
||||
PaUtilConverter* PaUtil_SelectConverter( PaSampleFormat sourceFormat,
|
||||
PaSampleFormat destinationFormat, PaStreamFlags flags );
|
||||
|
||||
|
||||
/** The generic buffer zeroer prototype. Buffer zeroers copy count zeros to
|
||||
destinationBuffer. The actual type of the data pointed to varys for
|
||||
different zeroer functions.
|
||||
@param destinationBuffer A pointer to the first sample of the destination.
|
||||
@param destinationStride An offset between successive destination samples
|
||||
expressed in samples (not bytes.) It may be negative.
|
||||
@param count The number of samples to zero.
|
||||
*/
|
||||
typedef void PaUtilZeroer(
|
||||
void *destinationBuffer, signed int destinationStride, unsigned int count );
|
||||
|
||||
|
||||
/** Find a buffer zeroer function for the given destination format.
|
||||
@return
|
||||
A pointer to a PaUtilZeroer which will perform the requested
|
||||
zeroing.
|
||||
*/
|
||||
PaUtilZeroer* PaUtil_SelectZeroer( PaSampleFormat destinationFormat );
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* low level functions and data structures which may be used for
|
||||
substituting conversion functions */
|
||||
|
||||
|
||||
/** The type used to store all sample conversion functions.
|
||||
@see paConverters;
|
||||
*/
|
||||
typedef struct{
|
||||
PaUtilConverter *Float32_To_Int32;
|
||||
PaUtilConverter *Float32_To_Int32_Dither;
|
||||
PaUtilConverter *Float32_To_Int32_Clip;
|
||||
PaUtilConverter *Float32_To_Int32_DitherClip;
|
||||
|
||||
PaUtilConverter *Float32_To_Int24;
|
||||
PaUtilConverter *Float32_To_Int24_Dither;
|
||||
PaUtilConverter *Float32_To_Int24_Clip;
|
||||
PaUtilConverter *Float32_To_Int24_DitherClip;
|
||||
|
||||
PaUtilConverter *Float32_To_Int16;
|
||||
PaUtilConverter *Float32_To_Int16_Dither;
|
||||
PaUtilConverter *Float32_To_Int16_Clip;
|
||||
PaUtilConverter *Float32_To_Int16_DitherClip;
|
||||
|
||||
PaUtilConverter *Float32_To_Int8;
|
||||
PaUtilConverter *Float32_To_Int8_Dither;
|
||||
PaUtilConverter *Float32_To_Int8_Clip;
|
||||
PaUtilConverter *Float32_To_Int8_DitherClip;
|
||||
|
||||
PaUtilConverter *Float32_To_UInt8;
|
||||
PaUtilConverter *Float32_To_UInt8_Dither;
|
||||
PaUtilConverter *Float32_To_UInt8_Clip;
|
||||
PaUtilConverter *Float32_To_UInt8_DitherClip;
|
||||
|
||||
PaUtilConverter *Int32_To_Float32;
|
||||
PaUtilConverter *Int32_To_Int24;
|
||||
PaUtilConverter *Int32_To_Int24_Dither;
|
||||
PaUtilConverter *Int32_To_Int16;
|
||||
PaUtilConverter *Int32_To_Int16_Dither;
|
||||
PaUtilConverter *Int32_To_Int8;
|
||||
PaUtilConverter *Int32_To_Int8_Dither;
|
||||
PaUtilConverter *Int32_To_UInt8;
|
||||
PaUtilConverter *Int32_To_UInt8_Dither;
|
||||
|
||||
PaUtilConverter *Int24_To_Float32;
|
||||
PaUtilConverter *Int24_To_Int32;
|
||||
PaUtilConverter *Int24_To_Int16;
|
||||
PaUtilConverter *Int24_To_Int16_Dither;
|
||||
PaUtilConverter *Int24_To_Int8;
|
||||
PaUtilConverter *Int24_To_Int8_Dither;
|
||||
PaUtilConverter *Int24_To_UInt8;
|
||||
PaUtilConverter *Int24_To_UInt8_Dither;
|
||||
|
||||
PaUtilConverter *Int16_To_Float32;
|
||||
PaUtilConverter *Int16_To_Int32;
|
||||
PaUtilConverter *Int16_To_Int24;
|
||||
PaUtilConverter *Int16_To_Int8;
|
||||
PaUtilConverter *Int16_To_Int8_Dither;
|
||||
PaUtilConverter *Int16_To_UInt8;
|
||||
PaUtilConverter *Int16_To_UInt8_Dither;
|
||||
|
||||
PaUtilConverter *Int8_To_Float32;
|
||||
PaUtilConverter *Int8_To_Int32;
|
||||
PaUtilConverter *Int8_To_Int24;
|
||||
PaUtilConverter *Int8_To_Int16;
|
||||
PaUtilConverter *Int8_To_UInt8;
|
||||
|
||||
PaUtilConverter *UInt8_To_Float32;
|
||||
PaUtilConverter *UInt8_To_Int32;
|
||||
PaUtilConverter *UInt8_To_Int24;
|
||||
PaUtilConverter *UInt8_To_Int16;
|
||||
PaUtilConverter *UInt8_To_Int8;
|
||||
|
||||
PaUtilConverter *Copy_8_To_8; /* copy without any conversion */
|
||||
PaUtilConverter *Copy_16_To_16; /* copy without any conversion */
|
||||
PaUtilConverter *Copy_24_To_24; /* copy without any conversion */
|
||||
PaUtilConverter *Copy_32_To_32; /* copy without any conversion */
|
||||
} PaUtilConverterTable;
|
||||
|
||||
|
||||
/** A table of pointers to all required converter functions.
|
||||
PaUtil_SelectConverter() uses this table to lookup the appropriate
|
||||
conversion functions. The fields of this structure are initialized
|
||||
with default conversion functions. Fields may be NULL, indicating that
|
||||
no conversion function is available. User code may substitue optimised
|
||||
conversion functions by assigning different function pointers to
|
||||
these fields.
|
||||
|
||||
@note
|
||||
If the PA_NO_STANDARD_CONVERTERS preprocessor variable is defined,
|
||||
PortAudio's standard converters will not be compiled, and all fields
|
||||
of this structure will be initialized to NULL. In such cases, users
|
||||
should supply their own conversion functions if the require PortAudio
|
||||
to open a stream that requires sample conversion.
|
||||
|
||||
@see PaUtilConverterTable, PaUtilConverter, PaUtil_SelectConverter
|
||||
*/
|
||||
extern PaUtilConverterTable paConverters;
|
||||
|
||||
|
||||
/** The type used to store all buffer zeroing functions.
|
||||
@see paZeroers;
|
||||
*/
|
||||
typedef struct{
|
||||
PaUtilZeroer *ZeroU8; /* unsigned 8 bit, zero == 128 */
|
||||
PaUtilZeroer *Zero8;
|
||||
PaUtilZeroer *Zero16;
|
||||
PaUtilZeroer *Zero24;
|
||||
PaUtilZeroer *Zero32;
|
||||
} PaUtilZeroerTable;
|
||||
|
||||
|
||||
/** A table of pointers to all required zeroer functions.
|
||||
PaUtil_SelectZeroer() uses this table to lookup the appropriate
|
||||
conversion functions. The fields of this structure are initialized
|
||||
with default conversion functions. User code may substitue optimised
|
||||
conversion functions by assigning different function pointers to
|
||||
these fields.
|
||||
|
||||
@note
|
||||
If the PA_NO_STANDARD_ZEROERS preprocessor variable is defined,
|
||||
PortAudio's standard zeroers will not be compiled, and all fields
|
||||
of this structure will be initialized to NULL. In such cases, users
|
||||
should supply their own zeroing functions for the sample sizes which
|
||||
they intend to use.
|
||||
|
||||
@see PaUtilZeroerTable, PaUtilZeroer, PaUtil_SelectZeroer
|
||||
*/
|
||||
extern PaUtilZeroerTable paZeroers;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* PA_CONVERTERS_H */
|
105
pd-0.44-2/portaudio/src/common/pa_cpuload.c
Normal file
105
pd-0.44-2/portaudio/src/common/pa_cpuload.c
Normal file
|
@ -0,0 +1,105 @@
|
|||
/*
|
||||
* $Id: pa_cpuload.c 1577 2011-02-01 13:03:45Z rossb $
|
||||
* Portable Audio I/O Library CPU Load measurement functions
|
||||
* Portable CPU load measurement facility.
|
||||
*
|
||||
* Based on the Open Source API proposed by Ross Bencina
|
||||
* Copyright (c) 2002 Ross Bencina
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
@ingroup common_src
|
||||
|
||||
@brief Functions to assist in measuring the CPU utilization of a callback
|
||||
stream. Used to implement the Pa_GetStreamCpuLoad() function.
|
||||
|
||||
@todo Dynamically calculate the coefficients used to smooth the CPU Load
|
||||
Measurements over time to provide a uniform characterisation of CPU Load
|
||||
independent of rate at which PaUtil_BeginCpuLoadMeasurement /
|
||||
PaUtil_EndCpuLoadMeasurement are called. see http://www.portaudio.com/trac/ticket/113
|
||||
*/
|
||||
|
||||
|
||||
#include "pa_cpuload.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "pa_util.h" /* for PaUtil_GetTime() */
|
||||
|
||||
|
||||
void PaUtil_InitializeCpuLoadMeasurer( PaUtilCpuLoadMeasurer* measurer, double sampleRate )
|
||||
{
|
||||
assert( sampleRate > 0 );
|
||||
|
||||
measurer->samplingPeriod = 1. / sampleRate;
|
||||
measurer->averageLoad = 0.;
|
||||
}
|
||||
|
||||
void PaUtil_ResetCpuLoadMeasurer( PaUtilCpuLoadMeasurer* measurer )
|
||||
{
|
||||
measurer->averageLoad = 0.;
|
||||
}
|
||||
|
||||
void PaUtil_BeginCpuLoadMeasurement( PaUtilCpuLoadMeasurer* measurer )
|
||||
{
|
||||
measurer->measurementStartTime = PaUtil_GetTime();
|
||||
}
|
||||
|
||||
|
||||
void PaUtil_EndCpuLoadMeasurement( PaUtilCpuLoadMeasurer* measurer, unsigned long framesProcessed )
|
||||
{
|
||||
double measurementEndTime, secondsFor100Percent, measuredLoad;
|
||||
|
||||
if( framesProcessed > 0 ){
|
||||
measurementEndTime = PaUtil_GetTime();
|
||||
|
||||
assert( framesProcessed > 0 );
|
||||
secondsFor100Percent = framesProcessed * measurer->samplingPeriod;
|
||||
|
||||
measuredLoad = (measurementEndTime - measurer->measurementStartTime) / secondsFor100Percent;
|
||||
|
||||
/* Low pass filter the calculated CPU load to reduce jitter using a simple IIR low pass filter. */
|
||||
/** FIXME @todo these coefficients shouldn't be hardwired see: http://www.portaudio.com/trac/ticket/113 */
|
||||
#define LOWPASS_COEFFICIENT_0 (0.9)
|
||||
#define LOWPASS_COEFFICIENT_1 (0.99999 - LOWPASS_COEFFICIENT_0)
|
||||
|
||||
measurer->averageLoad = (LOWPASS_COEFFICIENT_0 * measurer->averageLoad) +
|
||||
(LOWPASS_COEFFICIENT_1 * measuredLoad);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
double PaUtil_GetCpuLoad( PaUtilCpuLoadMeasurer* measurer )
|
||||
{
|
||||
return measurer->averageLoad;
|
||||
}
|
72
pd-0.44-2/portaudio/src/common/pa_cpuload.h
Normal file
72
pd-0.44-2/portaudio/src/common/pa_cpuload.h
Normal file
|
@ -0,0 +1,72 @@
|
|||
#ifndef PA_CPULOAD_H
|
||||
#define PA_CPULOAD_H
|
||||
/*
|
||||
* $Id: pa_cpuload.h 1097 2006-08-26 08:27:53Z rossb $
|
||||
* Portable Audio I/O Library CPU Load measurement functions
|
||||
* Portable CPU load measurement facility.
|
||||
*
|
||||
* Based on the Open Source API proposed by Ross Bencina
|
||||
* Copyright (c) 2002 Ross Bencina
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
@ingroup common_src
|
||||
|
||||
@brief Functions to assist in measuring the CPU utilization of a callback
|
||||
stream. Used to implement the Pa_GetStreamCpuLoad() function.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
typedef struct {
|
||||
double samplingPeriod;
|
||||
double measurementStartTime;
|
||||
double averageLoad;
|
||||
} PaUtilCpuLoadMeasurer; /**< @todo need better name than measurer */
|
||||
|
||||
void PaUtil_InitializeCpuLoadMeasurer( PaUtilCpuLoadMeasurer* measurer, double sampleRate );
|
||||
void PaUtil_BeginCpuLoadMeasurement( PaUtilCpuLoadMeasurer* measurer );
|
||||
void PaUtil_EndCpuLoadMeasurement( PaUtilCpuLoadMeasurer* measurer, unsigned long framesProcessed );
|
||||
void PaUtil_ResetCpuLoadMeasurer( PaUtilCpuLoadMeasurer* measurer );
|
||||
double PaUtil_GetCpuLoad( PaUtilCpuLoadMeasurer* measurer );
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* PA_CPULOAD_H */
|
123
pd-0.44-2/portaudio/src/common/pa_debugprint.c
Normal file
123
pd-0.44-2/portaudio/src/common/pa_debugprint.c
Normal file
|
@ -0,0 +1,123 @@
|
|||
/*
|
||||
* $Id: pa_log.c $
|
||||
* Portable Audio I/O Library Multi-Host API front end
|
||||
* Validate function parameters and manage multiple host APIs.
|
||||
*
|
||||
* Based on the Open Source API proposed by Ross Bencina
|
||||
* Copyright (c) 1999-2006 Ross Bencina, Phil Burk
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
@ingroup common_src
|
||||
|
||||
@brief Implements log function.
|
||||
|
||||
PaUtil_SetLogPrintFunction can be user called to replace the provided
|
||||
DefaultLogPrint function, which writes to stderr.
|
||||
One can NOT pass var_args across compiler/dll boundaries as it is not
|
||||
"byte code/abi portable". So the technique used here is to allocate a local
|
||||
a static array, write in it, then callback the user with a pointer to its
|
||||
start.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "pa_debugprint.h"
|
||||
|
||||
// for OutputDebugStringA
|
||||
#if defined(_MSC_VER) && defined(PA_ENABLE_MSVC_DEBUG_OUTPUT)
|
||||
#define WIN32_LEAN_AND_MEAN // exclude rare headers
|
||||
#include "windows.h"
|
||||
#endif
|
||||
|
||||
// User callback
|
||||
static PaUtilLogCallback userCB = NULL;
|
||||
|
||||
// Sets user callback
|
||||
void PaUtil_SetDebugPrintFunction(PaUtilLogCallback cb)
|
||||
{
|
||||
userCB = cb;
|
||||
}
|
||||
|
||||
/*
|
||||
If your platform doesn’t have vsnprintf, you are stuck with a
|
||||
VERY dangerous alternative, vsprintf (with no n)
|
||||
*/
|
||||
#if _MSC_VER
|
||||
/* Some Windows Mobile SDKs don't define vsnprintf but all define _vsnprintf (hopefully).
|
||||
According to MSDN "vsnprintf is identical to _vsnprintf". So we use _vsnprintf with MSC.
|
||||
*/
|
||||
#define VSNPRINTF _vsnprintf
|
||||
#else
|
||||
#define VSNPRINTF vsnprintf
|
||||
#endif
|
||||
|
||||
#define PA_LOG_BUF_SIZE 2048
|
||||
|
||||
void PaUtil_DebugPrint( const char *format, ... )
|
||||
{
|
||||
// Optional logging into Output console of Visual Studio
|
||||
#if defined(_MSC_VER) && defined(PA_ENABLE_MSVC_DEBUG_OUTPUT)
|
||||
{
|
||||
char buf[PA_LOG_BUF_SIZE];
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
VSNPRINTF(buf, sizeof(buf), format, ap);
|
||||
buf[sizeof(buf)-1] = 0;
|
||||
OutputDebugStringA(buf);
|
||||
va_end(ap);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Output to User-Callback
|
||||
if (userCB != NULL)
|
||||
{
|
||||
char strdump[PA_LOG_BUF_SIZE];
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
VSNPRINTF(strdump, sizeof(strdump), format, ap);
|
||||
strdump[sizeof(strdump)-1] = 0;
|
||||
userCB(strdump);
|
||||
va_end(ap);
|
||||
}
|
||||
else
|
||||
// Standard output to stderr
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
vfprintf(stderr, format, ap);
|
||||
va_end(ap);
|
||||
fflush(stderr);
|
||||
}
|
||||
}
|
149
pd-0.44-2/portaudio/src/common/pa_debugprint.h
Normal file
149
pd-0.44-2/portaudio/src/common/pa_debugprint.h
Normal file
|
@ -0,0 +1,149 @@
|
|||
#ifndef PA_LOG_H
|
||||
#define PA_LOG_H
|
||||
/*
|
||||
* Log file redirector function
|
||||
* Copyright (c) 1999-2006 Ross Bencina, Phil Burk
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
@ingroup common_src
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
|
||||
void PaUtil_DebugPrint( const char *format, ... );
|
||||
|
||||
|
||||
/*
|
||||
The basic format for log messages is described below. If you need to
|
||||
add any log messages, please follow this format.
|
||||
|
||||
Function entry (void function):
|
||||
|
||||
"FunctionName called.\n"
|
||||
|
||||
Function entry (non void function):
|
||||
|
||||
"FunctionName called:\n"
|
||||
"\tParam1Type param1: param1Value\n"
|
||||
"\tParam2Type param2: param2Value\n" (etc...)
|
||||
|
||||
|
||||
Function exit (no return value):
|
||||
|
||||
"FunctionName returned.\n"
|
||||
|
||||
Function exit (simple return value):
|
||||
|
||||
"FunctionName returned:\n"
|
||||
"\tReturnType: returnValue\n"
|
||||
|
||||
If the return type is an error code, the error text is displayed in ()
|
||||
|
||||
If the return type is not an error code, but has taken a special value
|
||||
because an error occurred, then the reason for the error is shown in []
|
||||
|
||||
If the return type is a struct ptr, the struct is dumped.
|
||||
|
||||
See the code below for examples
|
||||
*/
|
||||
|
||||
/** PA_DEBUG() provides a simple debug message printing facility. The macro
|
||||
passes it's argument to a printf-like function called PaUtil_DebugPrint()
|
||||
which prints to stderr and always flushes the stream after printing.
|
||||
Because preprocessor macros cannot directly accept variable length argument
|
||||
lists, calls to the macro must include an additional set of parenthesis, eg:
|
||||
PA_DEBUG(("errorno: %d", 1001 ));
|
||||
*/
|
||||
|
||||
|
||||
#ifdef PA_ENABLE_DEBUG_OUTPUT
|
||||
#define PA_DEBUG(x) PaUtil_DebugPrint x ;
|
||||
#else
|
||||
#define PA_DEBUG(x)
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef PA_LOG_API_CALLS
|
||||
#define PA_LOGAPI(x) PaUtil_DebugPrint x
|
||||
|
||||
#define PA_LOGAPI_ENTER(functionName) PaUtil_DebugPrint( functionName " called.\n" )
|
||||
|
||||
#define PA_LOGAPI_ENTER_PARAMS(functionName) PaUtil_DebugPrint( functionName " called:\n" )
|
||||
|
||||
#define PA_LOGAPI_EXIT(functionName) PaUtil_DebugPrint( functionName " returned.\n" )
|
||||
|
||||
#define PA_LOGAPI_EXIT_PAERROR( functionName, result ) \
|
||||
PaUtil_DebugPrint( functionName " returned:\n" ); \
|
||||
PaUtil_DebugPrint("\tPaError: %d ( %s )\n", result, Pa_GetErrorText( result ) )
|
||||
|
||||
#define PA_LOGAPI_EXIT_T( functionName, resultFormatString, result ) \
|
||||
PaUtil_DebugPrint( functionName " returned:\n" ); \
|
||||
PaUtil_DebugPrint("\t" resultFormatString "\n", result )
|
||||
|
||||
#define PA_LOGAPI_EXIT_PAERROR_OR_T_RESULT( functionName, positiveResultFormatString, result ) \
|
||||
PaUtil_DebugPrint( functionName " returned:\n" ); \
|
||||
if( result > 0 ) \
|
||||
PaUtil_DebugPrint("\t" positiveResultFormatString "\n", result ); \
|
||||
else \
|
||||
PaUtil_DebugPrint("\tPaError: %d ( %s )\n", result, Pa_GetErrorText( result ) )
|
||||
#else
|
||||
#define PA_LOGAPI(x)
|
||||
#define PA_LOGAPI_ENTER(functionName)
|
||||
#define PA_LOGAPI_ENTER_PARAMS(functionName)
|
||||
#define PA_LOGAPI_EXIT(functionName)
|
||||
#define PA_LOGAPI_EXIT_PAERROR( functionName, result )
|
||||
#define PA_LOGAPI_EXIT_T( functionName, resultFormatString, result )
|
||||
#define PA_LOGAPI_EXIT_PAERROR_OR_T_RESULT( functionName, positiveResultFormatString, result )
|
||||
#endif
|
||||
|
||||
|
||||
typedef void (*PaUtilLogCallback ) (const char *log);
|
||||
|
||||
/**
|
||||
Install user provided log function
|
||||
*/
|
||||
void PaUtil_SetDebugPrintFunction(PaUtilLogCallback cb);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* PA_LOG_H */
|
218
pd-0.44-2/portaudio/src/common/pa_dither.c
Normal file
218
pd-0.44-2/portaudio/src/common/pa_dither.c
Normal file
|
@ -0,0 +1,218 @@
|
|||
/*
|
||||
* $Id: pa_dither.c 1418 2009-10-12 21:00:53Z philburk $
|
||||
* Portable Audio I/O Library triangular dither generator
|
||||
*
|
||||
* Based on the Open Source API proposed by Ross Bencina
|
||||
* Copyright (c) 1999-2002 Phil Burk, Ross Bencina
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
@ingroup common_src
|
||||
|
||||
@brief Functions for generating dither noise
|
||||
*/
|
||||
|
||||
#include "pa_types.h"
|
||||
#include "pa_dither.h"
|
||||
|
||||
|
||||
/* Note that the linear congruential algorithm requires 32 bit integers
|
||||
* because it uses arithmetic overflow. So use PaUint32 instead of
|
||||
* unsigned long so it will work on 64 bit systems.
|
||||
*/
|
||||
|
||||
#define PA_DITHER_BITS_ (15)
|
||||
|
||||
|
||||
void PaUtil_InitializeTriangularDitherState( PaUtilTriangularDitherGenerator *state )
|
||||
{
|
||||
state->previous = 0;
|
||||
state->randSeed1 = 22222;
|
||||
state->randSeed2 = 5555555;
|
||||
}
|
||||
|
||||
|
||||
PaInt32 PaUtil_Generate16BitTriangularDither( PaUtilTriangularDitherGenerator *state )
|
||||
{
|
||||
PaInt32 current, highPass;
|
||||
|
||||
/* Generate two random numbers. */
|
||||
state->randSeed1 = (state->randSeed1 * 196314165) + 907633515;
|
||||
state->randSeed2 = (state->randSeed2 * 196314165) + 907633515;
|
||||
|
||||
/* Generate triangular distribution about 0.
|
||||
* Shift before adding to prevent overflow which would skew the distribution.
|
||||
* Also shift an extra bit for the high pass filter.
|
||||
*/
|
||||
#define DITHER_SHIFT_ ((sizeof(PaInt32)*8 - PA_DITHER_BITS_) + 1)
|
||||
|
||||
current = (((PaInt32)state->randSeed1)>>DITHER_SHIFT_) +
|
||||
(((PaInt32)state->randSeed2)>>DITHER_SHIFT_);
|
||||
|
||||
/* High pass filter to reduce audibility. */
|
||||
highPass = current - state->previous;
|
||||
state->previous = current;
|
||||
return highPass;
|
||||
}
|
||||
|
||||
|
||||
/* Multiply by PA_FLOAT_DITHER_SCALE_ to get a float between -2.0 and +1.99999 */
|
||||
#define PA_FLOAT_DITHER_SCALE_ (1.0f / ((1<<PA_DITHER_BITS_)-1))
|
||||
static const float const_float_dither_scale_ = PA_FLOAT_DITHER_SCALE_;
|
||||
|
||||
float PaUtil_GenerateFloatTriangularDither( PaUtilTriangularDitherGenerator *state )
|
||||
{
|
||||
PaInt32 current, highPass;
|
||||
|
||||
/* Generate two random numbers. */
|
||||
state->randSeed1 = (state->randSeed1 * 196314165) + 907633515;
|
||||
state->randSeed2 = (state->randSeed2 * 196314165) + 907633515;
|
||||
|
||||
/* Generate triangular distribution about 0.
|
||||
* Shift before adding to prevent overflow which would skew the distribution.
|
||||
* Also shift an extra bit for the high pass filter.
|
||||
*/
|
||||
current = (((PaInt32)state->randSeed1)>>DITHER_SHIFT_) +
|
||||
(((PaInt32)state->randSeed2)>>DITHER_SHIFT_);
|
||||
|
||||
/* High pass filter to reduce audibility. */
|
||||
highPass = current - state->previous;
|
||||
state->previous = current;
|
||||
return ((float)highPass) * const_float_dither_scale_;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
The following alternate dither algorithms (from musicdsp.org) could be
|
||||
considered
|
||||
*/
|
||||
|
||||
/*Noise shaped dither (March 2000)
|
||||
-------------------
|
||||
|
||||
This is a simple implementation of highpass triangular-PDF dither with
|
||||
2nd-order noise shaping, for use when truncating floating point audio
|
||||
data to fixed point.
|
||||
|
||||
The noise shaping lowers the noise floor by 11dB below 5kHz (@ 44100Hz
|
||||
sample rate) compared to triangular-PDF dither. The code below assumes
|
||||
input data is in the range +1 to -1 and doesn't check for overloads!
|
||||
|
||||
To save time when generating dither for multiple channels you can do
|
||||
things like this: r3=(r1 & 0x7F)<<8; instead of calling rand() again.
|
||||
|
||||
|
||||
|
||||
int r1, r2; //rectangular-PDF random numbers
|
||||
float s1, s2; //error feedback buffers
|
||||
float s = 0.5f; //set to 0.0f for no noise shaping
|
||||
float w = pow(2.0,bits-1); //word length (usually bits=16)
|
||||
float wi= 1.0f/w;
|
||||
float d = wi / RAND_MAX; //dither amplitude (2 lsb)
|
||||
float o = wi * 0.5f; //remove dc offset
|
||||
float in, tmp;
|
||||
int out;
|
||||
|
||||
|
||||
//for each sample...
|
||||
|
||||
r2=r1; //can make HP-TRI dither by
|
||||
r1=rand(); //subtracting previous rand()
|
||||
|
||||
in += s * (s1 + s1 - s2); //error feedback
|
||||
tmp = in + o + d * (float)(r1 - r2); //dc offset and dither
|
||||
|
||||
out = (int)(w * tmp); //truncate downwards
|
||||
if(tmp<0.0f) out--; //this is faster than floor()
|
||||
|
||||
s2 = s1;
|
||||
s1 = in - wi * (float)out; //error
|
||||
|
||||
|
||||
|
||||
--
|
||||
paul.kellett@maxim.abel.co.uk
|
||||
http://www.maxim.abel.co.uk
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
16-to-8-bit first-order dither
|
||||
|
||||
Type : First order error feedforward dithering code
|
||||
References : Posted by Jon Watte
|
||||
|
||||
Notes :
|
||||
This is about as simple a dithering algorithm as you can implement, but it's
|
||||
likely to sound better than just truncating to N bits.
|
||||
|
||||
Note that you might not want to carry forward the full difference for infinity.
|
||||
It's probably likely that the worst performance hit comes from the saturation
|
||||
conditionals, which can be avoided with appropriate instructions on many DSPs
|
||||
and integer SIMD type instructions, or CMOV.
|
||||
|
||||
Last, if sound quality is paramount (such as when going from > 16 bits to 16
|
||||
bits) you probably want to use a higher-order dither function found elsewhere
|
||||
on this site.
|
||||
|
||||
|
||||
Code :
|
||||
// This code will down-convert and dither a 16-bit signed short
|
||||
// mono signal into an 8-bit unsigned char signal, using a first
|
||||
// order forward-feeding error term dither.
|
||||
|
||||
#define uchar unsigned char
|
||||
|
||||
void dither_one_channel_16_to_8( short * input, uchar * output, int count, int * memory )
|
||||
{
|
||||
int m = *memory;
|
||||
while( count-- > 0 ) {
|
||||
int i = *input++;
|
||||
i += m;
|
||||
int j = i + 32768 - 128;
|
||||
uchar o;
|
||||
if( j < 0 ) {
|
||||
o = 0;
|
||||
}
|
||||
else if( j > 65535 ) {
|
||||
o = 255;
|
||||
}
|
||||
else {
|
||||
o = (uchar)((j>>8)&0xff);
|
||||
}
|
||||
m = ((j-32768+128)-i);
|
||||
*output++ = o;
|
||||
}
|
||||
*memory = m;
|
||||
}
|
||||
*/
|
106
pd-0.44-2/portaudio/src/common/pa_dither.h
Normal file
106
pd-0.44-2/portaudio/src/common/pa_dither.h
Normal file
|
@ -0,0 +1,106 @@
|
|||
#ifndef PA_DITHER_H
|
||||
#define PA_DITHER_H
|
||||
/*
|
||||
* $Id: pa_dither.h 1418 2009-10-12 21:00:53Z philburk $
|
||||
* Portable Audio I/O Library triangular dither generator
|
||||
*
|
||||
* Based on the Open Source API proposed by Ross Bencina
|
||||
* Copyright (c) 1999-2002 Phil Burk, Ross Bencina
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
@ingroup common_src
|
||||
|
||||
@brief Functions for generating dither noise
|
||||
*/
|
||||
|
||||
#include "pa_types.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* Note that the linear congruential algorithm requires 32 bit integers
|
||||
* because it uses arithmetic overflow. So use PaUint32 instead of
|
||||
* unsigned long so it will work on 64 bit systems.
|
||||
*/
|
||||
|
||||
/** @brief State needed to generate a dither signal */
|
||||
typedef struct PaUtilTriangularDitherGenerator{
|
||||
PaUint32 previous;
|
||||
PaUint32 randSeed1;
|
||||
PaUint32 randSeed2;
|
||||
} PaUtilTriangularDitherGenerator;
|
||||
|
||||
|
||||
/** @brief Initialize dither state */
|
||||
void PaUtil_InitializeTriangularDitherState( PaUtilTriangularDitherGenerator *ditherState );
|
||||
|
||||
|
||||
/**
|
||||
@brief Calculate 2 LSB dither signal with a triangular distribution.
|
||||
Ranged for adding to a 1 bit right-shifted 32 bit integer
|
||||
prior to >>15. eg:
|
||||
<pre>
|
||||
signed long in = *
|
||||
signed long dither = PaUtil_Generate16BitTriangularDither( ditherState );
|
||||
signed short out = (signed short)(((in>>1) + dither) >> 15);
|
||||
</pre>
|
||||
@return
|
||||
A signed 32-bit integer with a range of +32767 to -32768
|
||||
*/
|
||||
PaInt32 PaUtil_Generate16BitTriangularDither( PaUtilTriangularDitherGenerator *ditherState );
|
||||
|
||||
|
||||
/**
|
||||
@brief Calculate 2 LSB dither signal with a triangular distribution.
|
||||
Ranged for adding to a pre-scaled float.
|
||||
<pre>
|
||||
float in = *
|
||||
float dither = PaUtil_GenerateFloatTriangularDither( ditherState );
|
||||
// use smaller scaler to prevent overflow when we add the dither
|
||||
signed short out = (signed short)(in*(32766.0f) + dither );
|
||||
</pre>
|
||||
@return
|
||||
A float with a range of -2.0 to +1.99999.
|
||||
*/
|
||||
float PaUtil_GenerateFloatTriangularDither( PaUtilTriangularDitherGenerator *ditherState );
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* PA_DITHER_H */
|
145
pd-0.44-2/portaudio/src/common/pa_endianness.h
Normal file
145
pd-0.44-2/portaudio/src/common/pa_endianness.h
Normal file
|
@ -0,0 +1,145 @@
|
|||
#ifndef PA_ENDIANNESS_H
|
||||
#define PA_ENDIANNESS_H
|
||||
/*
|
||||
* $Id: pa_endianness.h 1324 2008-01-27 02:03:30Z bjornroche $
|
||||
* Portable Audio I/O Library current platform endianness macros
|
||||
*
|
||||
* Based on the Open Source API proposed by Ross Bencina
|
||||
* Copyright (c) 1999-2002 Phil Burk, Ross Bencina
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
@ingroup common_src
|
||||
|
||||
@brief Configure endianness symbols for the target processor.
|
||||
|
||||
Arrange for either the PA_LITTLE_ENDIAN or PA_BIG_ENDIAN preprocessor symbols
|
||||
to be defined. The one that is defined reflects the endianness of the target
|
||||
platform and may be used to implement conditional compilation of byte-order
|
||||
dependent code.
|
||||
|
||||
If either PA_LITTLE_ENDIAN or PA_BIG_ENDIAN is defined already, then no attempt
|
||||
is made to override that setting. This may be useful if you have a better way
|
||||
of determining the platform's endianness. The autoconf mechanism uses this for
|
||||
example.
|
||||
|
||||
A PA_VALIDATE_ENDIANNESS macro is provided to compare the compile time
|
||||
and runtime endiannes and raise an assertion if they don't match.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* If this is an apple, we need to do detect endianness this way */
|
||||
#if defined(__APPLE__)
|
||||
/* we need to do some endian detection that is sensitive to harware arch */
|
||||
#if defined(__LITTLE_ENDIAN__)
|
||||
#if !defined( PA_LITTLE_ENDIAN )
|
||||
#define PA_LITTLE_ENDIAN
|
||||
#endif
|
||||
#if defined( PA_BIG_ENDIAN )
|
||||
#undef PA_BIG_ENDIAN
|
||||
#endif
|
||||
#else
|
||||
#if !defined( PA_BIG_ENDIAN )
|
||||
#define PA_BIG_ENDIAN
|
||||
#endif
|
||||
#if defined( PA_LITTLE_ENDIAN )
|
||||
#undef PA_LITTLE_ENDIAN
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
/* this is not an apple, so first check the existing defines, and, failing that,
|
||||
detect well-known architechtures. */
|
||||
|
||||
#if defined(PA_LITTLE_ENDIAN) || defined(PA_BIG_ENDIAN)
|
||||
/* endianness define has been set externally, such as by autoconf */
|
||||
|
||||
#if defined(PA_LITTLE_ENDIAN) && defined(PA_BIG_ENDIAN)
|
||||
#error both PA_LITTLE_ENDIAN and PA_BIG_ENDIAN have been defined externally to pa_endianness.h - only one endianness at a time please
|
||||
#endif
|
||||
|
||||
#else
|
||||
/* endianness define has not been set externally */
|
||||
|
||||
/* set PA_LITTLE_ENDIAN or PA_BIG_ENDIAN by testing well known platform specific defines */
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) || defined(LITTLE_ENDIAN) || defined(__i386) || defined(_M_IX86) || defined(__x86_64__)
|
||||
#define PA_LITTLE_ENDIAN /* win32, assume intel byte order */
|
||||
#else
|
||||
#define PA_BIG_ENDIAN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(PA_LITTLE_ENDIAN) && !defined(PA_BIG_ENDIAN)
|
||||
/*
|
||||
If the following error is raised, you either need to modify the code above
|
||||
to automatically determine the endianness from other symbols defined on your
|
||||
platform, or define either PA_LITTLE_ENDIAN or PA_BIG_ENDIAN externally.
|
||||
*/
|
||||
#error pa_endianness.h was unable to automatically determine the endianness of the target platform
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* PA_VALIDATE_ENDIANNESS compares the compile time and runtime endianness,
|
||||
and raises an assertion if they don't match. <assert.h> must be included in
|
||||
the context in which this macro is used.
|
||||
*/
|
||||
#if defined(NDEBUG)
|
||||
#define PA_VALIDATE_ENDIANNESS
|
||||
#else
|
||||
#if defined(PA_LITTLE_ENDIAN)
|
||||
#define PA_VALIDATE_ENDIANNESS \
|
||||
{ \
|
||||
const long nativeOne = 1; \
|
||||
assert( "PortAudio: compile time and runtime endianness don't match" && (((char *)&nativeOne)[0]) == 1 ); \
|
||||
}
|
||||
#elif defined(PA_BIG_ENDIAN)
|
||||
#define PA_VALIDATE_ENDIANNESS \
|
||||
{ \
|
||||
const long nativeOne = 1; \
|
||||
assert( "PortAudio: compile time and runtime endianness don't match" && (((char *)&nativeOne)[0]) == 0 ); \
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* PA_ENDIANNESS_H */
|
1770
pd-0.44-2/portaudio/src/common/pa_front.c
Normal file
1770
pd-0.44-2/portaudio/src/common/pa_front.c
Normal file
File diff suppressed because it is too large
Load diff
362
pd-0.44-2/portaudio/src/common/pa_hostapi.h
Normal file
362
pd-0.44-2/portaudio/src/common/pa_hostapi.h
Normal file
|
@ -0,0 +1,362 @@
|
|||
#ifndef PA_HOSTAPI_H
|
||||
#define PA_HOSTAPI_H
|
||||
/*
|
||||
* $Id: pa_hostapi.h 1740 2011-08-25 07:17:48Z philburk $
|
||||
* Portable Audio I/O Library
|
||||
* host api representation
|
||||
*
|
||||
* Based on the Open Source API proposed by Ross Bencina
|
||||
* Copyright (c) 1999-2008 Ross Bencina, Phil Burk
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
@ingroup common_src
|
||||
|
||||
@brief Interfaces and representation structures used by pa_front.c
|
||||
to manage and communicate with host API implementations.
|
||||
*/
|
||||
|
||||
#include "portaudio.h"
|
||||
|
||||
/**
|
||||
The PA_NO_* host API macros are now deprecated in favor of PA_USE_* macros.
|
||||
PA_USE_* indicates whether a particular host API will be initialized by PortAudio.
|
||||
An undefined or 0 value indicates that the host API will not be used. A value of 1
|
||||
indicates that the host API will be used. PA_USE_* macros should be left undefined
|
||||
or defined to either 0 or 1.
|
||||
|
||||
The code below ensures that PA_USE_* macros are always defined and have value
|
||||
0 or 1. Undefined symbols are defaulted to 0. Symbols that are neither 0 nor 1
|
||||
are defaulted to 1.
|
||||
*/
|
||||
|
||||
#ifndef PA_USE_SKELETON
|
||||
#define PA_USE_SKELETON 0
|
||||
#elif (PA_USE_SKELETON != 0) && (PA_USE_SKELETON != 1)
|
||||
#undef PA_USE_SKELETON
|
||||
#define PA_USE_SKELETON 1
|
||||
#endif
|
||||
|
||||
#if defined(PA_NO_ASIO) || defined(PA_NO_DS) || defined(PA_NO_WMME) || defined(PA_NO_WASAPI) || defined(PA_NO_WDMKS)
|
||||
#error "Portaudio: PA_NO_<APINAME> is no longer supported, please remove definition and use PA_USE_<APINAME> instead"
|
||||
#endif
|
||||
|
||||
#ifndef PA_USE_ASIO
|
||||
#define PA_USE_ASIO 0
|
||||
#elif (PA_USE_ASIO != 0) && (PA_USE_ASIO != 1)
|
||||
#undef PA_USE_ASIO
|
||||
#define PA_USE_ASIO 1
|
||||
#endif
|
||||
|
||||
#ifndef PA_USE_DS
|
||||
#define PA_USE_DS 0
|
||||
#elif (PA_USE_DS != 0) && (PA_USE_DS != 1)
|
||||
#undef PA_USE_DS
|
||||
#define PA_USE_DS 1
|
||||
#endif
|
||||
|
||||
#ifndef PA_USE_WMME
|
||||
#define PA_USE_WMME 0
|
||||
#elif (PA_USE_WMME != 0) && (PA_USE_WMME != 1)
|
||||
#undef PA_USE_WMME
|
||||
#define PA_USE_WMME 1
|
||||
#endif
|
||||
|
||||
#ifndef PA_USE_WASAPI
|
||||
#define PA_USE_WASAPI 0
|
||||
#elif (PA_USE_WASAPI != 0) && (PA_USE_WASAPI != 1)
|
||||
#undef PA_USE_WASAPI
|
||||
#define PA_USE_WASAPI 1
|
||||
#endif
|
||||
|
||||
#ifndef PA_USE_WDMKS
|
||||
#define PA_USE_WDMKS 0
|
||||
#elif (PA_USE_WDMKS != 0) && (PA_USE_WDMKS != 1)
|
||||
#undef PA_USE_WDMKS
|
||||
#define PA_USE_WDMKS 1
|
||||
#endif
|
||||
|
||||
/* Set default values for Unix based APIs. */
|
||||
#if defined(PA_NO_OSS) || defined(PA_NO_ALSA) || defined(PA_NO_JACK) || defined(PA_NO_COREAUDIO) || defined(PA_NO_SGI) || defined(PA_NO_ASIHPI)
|
||||
#error "Portaudio: PA_NO_<APINAME> is no longer supported, please remove definition and use PA_USE_<APINAME> instead"
|
||||
#endif
|
||||
|
||||
#ifndef PA_USE_OSS
|
||||
#define PA_USE_OSS 0
|
||||
#elif (PA_USE_OSS != 0) && (PA_USE_OSS != 1)
|
||||
#undef PA_USE_OSS
|
||||
#define PA_USE_OSS 1
|
||||
#endif
|
||||
|
||||
#ifndef PA_USE_ALSA
|
||||
#define PA_USE_ALSA 0
|
||||
#elif (PA_USE_ALSA != 0) && (PA_USE_ALSA != 1)
|
||||
#undef PA_USE_ALSA
|
||||
#define PA_USE_ALSA 1
|
||||
#endif
|
||||
|
||||
#ifndef PA_USE_JACK
|
||||
#define PA_USE_JACK 0
|
||||
#elif (PA_USE_JACK != 0) && (PA_USE_JACK != 1)
|
||||
#undef PA_USE_JACK
|
||||
#define PA_USE_JACK 1
|
||||
#endif
|
||||
|
||||
#ifndef PA_USE_SGI
|
||||
#define PA_USE_SGI 0
|
||||
#elif (PA_USE_SGI != 0) && (PA_USE_SGI != 1)
|
||||
#undef PA_USE_SGI
|
||||
#define PA_USE_SGI 1
|
||||
#endif
|
||||
|
||||
#ifndef PA_USE_COREAUDIO
|
||||
#define PA_USE_COREAUDIO 0
|
||||
#elif (PA_USE_COREAUDIO != 0) && (PA_USE_COREAUDIO != 1)
|
||||
#undef PA_USE_COREAUDIO
|
||||
#define PA_USE_COREAUDIO 1
|
||||
#endif
|
||||
|
||||
#ifndef PA_USE_ASIHPI
|
||||
#define PA_USE_ASIHPI 0
|
||||
#elif (PA_USE_ASIHPI != 0) && (PA_USE_ASIHPI != 1)
|
||||
#undef PA_USE_ASIHPI
|
||||
#define PA_USE_ASIHPI 1
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/** **FOR THE USE OF pa_front.c ONLY**
|
||||
Do NOT use fields in this structure, they my change at any time.
|
||||
Use functions defined in pa_util.h if you think you need functionality
|
||||
which can be derived from here.
|
||||
*/
|
||||
typedef struct PaUtilPrivatePaFrontHostApiInfo {
|
||||
|
||||
|
||||
unsigned long baseDeviceIndex;
|
||||
}PaUtilPrivatePaFrontHostApiInfo;
|
||||
|
||||
|
||||
/** The common header for all data structures whose pointers are passed through
|
||||
the hostApiSpecificStreamInfo field of the PaStreamParameters structure.
|
||||
Note that in order to keep the public PortAudio interface clean, this structure
|
||||
is not used explicitly when declaring hostApiSpecificStreamInfo data structures.
|
||||
However, some code in pa_front depends on the first 3 members being equivalent
|
||||
with this structure.
|
||||
@see PaStreamParameters
|
||||
*/
|
||||
typedef struct PaUtilHostApiSpecificStreamInfoHeader
|
||||
{
|
||||
unsigned long size; /**< size of whole structure including this header */
|
||||
PaHostApiTypeId hostApiType; /**< host API for which this data is intended */
|
||||
unsigned long version; /**< structure version */
|
||||
} PaUtilHostApiSpecificStreamInfoHeader;
|
||||
|
||||
|
||||
|
||||
/** A structure representing the interface to a host API. Contains both
|
||||
concrete data and pointers to functions which implement the interface.
|
||||
*/
|
||||
typedef struct PaUtilHostApiRepresentation {
|
||||
PaUtilPrivatePaFrontHostApiInfo privatePaFrontInfo;
|
||||
|
||||
/** The host api implementation should populate the info field. In the
|
||||
case of info.defaultInputDevice and info.defaultOutputDevice the
|
||||
values stored should be 0 based indices within the host api's own
|
||||
device index range (0 to deviceCount). These values will be converted
|
||||
to global device indices by pa_front after PaUtilHostApiInitializer()
|
||||
returns.
|
||||
*/
|
||||
PaHostApiInfo info;
|
||||
|
||||
PaDeviceInfo** deviceInfos;
|
||||
|
||||
/**
|
||||
(*Terminate)() is guaranteed to be called with a valid <hostApi>
|
||||
parameter, which was previously returned from the same implementation's
|
||||
initializer.
|
||||
*/
|
||||
void (*Terminate)( struct PaUtilHostApiRepresentation *hostApi );
|
||||
|
||||
/**
|
||||
The inputParameters and outputParameters pointers should not be saved
|
||||
as they will not remain valid after OpenStream is called.
|
||||
|
||||
|
||||
The following guarantees are made about parameters to (*OpenStream)():
|
||||
|
||||
[NOTE: the following list up to *END PA FRONT VALIDATIONS* should be
|
||||
kept in sync with the one for ValidateOpenStreamParameters and
|
||||
Pa_OpenStream in pa_front.c]
|
||||
|
||||
PaHostApiRepresentation *hostApi
|
||||
- is valid for this implementation
|
||||
|
||||
PaStream** stream
|
||||
- is non-null
|
||||
|
||||
- at least one of inputParameters & outputParmeters is valid (not NULL)
|
||||
|
||||
- if inputParameters & outputParmeters are both valid, that
|
||||
inputParameters->device & outputParmeters->device both use the same host api
|
||||
|
||||
PaDeviceIndex inputParameters->device
|
||||
- is within range (0 to Pa_CountDevices-1) Or:
|
||||
- is paUseHostApiSpecificDeviceSpecification and
|
||||
inputParameters->hostApiSpecificStreamInfo is non-NULL and refers
|
||||
to a valid host api
|
||||
|
||||
int inputParameters->numChannels
|
||||
- if inputParameters->device is not paUseHostApiSpecificDeviceSpecification, numInputChannels is > 0
|
||||
- upper bound is NOT validated against device capabilities
|
||||
|
||||
PaSampleFormat inputParameters->sampleFormat
|
||||
- is one of the sample formats defined in portaudio.h
|
||||
|
||||
void *inputParameters->hostApiSpecificStreamInfo
|
||||
- if supplied its hostApi field matches the input device's host Api
|
||||
|
||||
PaDeviceIndex outputParmeters->device
|
||||
- is within range (0 to Pa_CountDevices-1)
|
||||
|
||||
int outputParmeters->numChannels
|
||||
- if inputDevice is valid, numInputChannels is > 0
|
||||
- upper bound is NOT validated against device capabilities
|
||||
|
||||
PaSampleFormat outputParmeters->sampleFormat
|
||||
- is one of the sample formats defined in portaudio.h
|
||||
|
||||
void *outputParmeters->hostApiSpecificStreamInfo
|
||||
- if supplied its hostApi field matches the output device's host Api
|
||||
|
||||
double sampleRate
|
||||
- is not an 'absurd' rate (less than 1000. or greater than 200000.)
|
||||
- sampleRate is NOT validated against device capabilities
|
||||
|
||||
PaStreamFlags streamFlags
|
||||
- unused platform neutral flags are zero
|
||||
- paNeverDropInput is only used for full-duplex callback streams
|
||||
with variable buffer size (paFramesPerBufferUnspecified)
|
||||
|
||||
[*END PA FRONT VALIDATIONS*]
|
||||
|
||||
|
||||
The following validations MUST be performed by (*OpenStream)():
|
||||
|
||||
- check that input device can support numInputChannels
|
||||
|
||||
- check that input device can support inputSampleFormat, or that
|
||||
we have the capability to convert from outputSampleFormat to
|
||||
a native format
|
||||
|
||||
- if inputStreamInfo is supplied, validate its contents,
|
||||
or return an error if no inputStreamInfo is expected
|
||||
|
||||
- check that output device can support numOutputChannels
|
||||
|
||||
- check that output device can support outputSampleFormat, or that
|
||||
we have the capability to convert from outputSampleFormat to
|
||||
a native format
|
||||
|
||||
- if outputStreamInfo is supplied, validate its contents,
|
||||
or return an error if no outputStreamInfo is expected
|
||||
|
||||
- if a full duplex stream is requested, check that the combination
|
||||
of input and output parameters is supported
|
||||
|
||||
- check that the device supports sampleRate
|
||||
|
||||
- alter sampleRate to a close allowable rate if necessary
|
||||
|
||||
- validate inputLatency and outputLatency
|
||||
|
||||
- validate any platform specific flags, if flags are supplied they
|
||||
must be valid.
|
||||
*/
|
||||
PaError (*OpenStream)( struct PaUtilHostApiRepresentation *hostApi,
|
||||
PaStream** stream,
|
||||
const PaStreamParameters *inputParameters,
|
||||
const PaStreamParameters *outputParameters,
|
||||
double sampleRate,
|
||||
unsigned long framesPerCallback,
|
||||
PaStreamFlags streamFlags,
|
||||
PaStreamCallback *streamCallback,
|
||||
void *userData );
|
||||
|
||||
|
||||
PaError (*IsFormatSupported)( struct PaUtilHostApiRepresentation *hostApi,
|
||||
const PaStreamParameters *inputParameters,
|
||||
const PaStreamParameters *outputParameters,
|
||||
double sampleRate );
|
||||
} PaUtilHostApiRepresentation;
|
||||
|
||||
|
||||
/** Prototype for the initialization function which must be implemented by every
|
||||
host API.
|
||||
|
||||
This function should only return an error other than paNoError if it encounters
|
||||
an unexpected and fatal error (memory allocation error for example). In general,
|
||||
there may be conditions under which it returns a NULL interface pointer and also
|
||||
returns paNoError. For example, if the ASIO implementation detects that ASIO is
|
||||
not installed, it should return a NULL interface, and paNoError.
|
||||
|
||||
@see paHostApiInitializers
|
||||
*/
|
||||
typedef PaError PaUtilHostApiInitializer( PaUtilHostApiRepresentation**, PaHostApiIndex );
|
||||
|
||||
|
||||
/** paHostApiInitializers is a NULL-terminated array of host API initialization
|
||||
functions. These functions are called by pa_front.c to initialize the host APIs
|
||||
when the client calls Pa_Initialize().
|
||||
|
||||
The initialization functions are invoked in order.
|
||||
|
||||
The first successfully initialized host API that has a default input *or* output
|
||||
device is used as the default PortAudio host API. This is based on the logic that
|
||||
there is only one default host API, and it must contain the default input and output
|
||||
devices (if defined).
|
||||
|
||||
There is a platform specific file that defines paHostApiInitializers for that
|
||||
platform, pa_win/pa_win_hostapis.c contains the Win32 definitions for example.
|
||||
*/
|
||||
extern PaUtilHostApiInitializer *paHostApiInitializers[];
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* PA_HOSTAPI_H */
|
128
pd-0.44-2/portaudio/src/common/pa_memorybarrier.h
Normal file
128
pd-0.44-2/portaudio/src/common/pa_memorybarrier.h
Normal file
|
@ -0,0 +1,128 @@
|
|||
/*
|
||||
* $Id: pa_memorybarrier.h 1240 2007-07-17 13:05:07Z bjornroche $
|
||||
* Portable Audio I/O Library
|
||||
* Memory barrier utilities
|
||||
*
|
||||
* Author: Bjorn Roche, XO Audio, LLC
|
||||
*
|
||||
* This program uses the PortAudio Portable Audio Library.
|
||||
* For more information see: http://www.portaudio.com
|
||||
* Copyright (c) 1999-2000 Ross Bencina and Phil Burk
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
/**
|
||||
@file pa_memorybarrier.h
|
||||
@ingroup common_src
|
||||
*/
|
||||
|
||||
/****************
|
||||
* Some memory barrier primitives based on the system.
|
||||
* right now only OS X, FreeBSD, and Linux are supported. In addition to providing
|
||||
* memory barriers, these functions should ensure that data cached in registers
|
||||
* is written out to cache where it can be snooped by other CPUs. (ie, the volatile
|
||||
* keyword should not be required)
|
||||
*
|
||||
* the primitives that must be defined are:
|
||||
*
|
||||
* PaUtil_FullMemoryBarrier()
|
||||
* PaUtil_ReadMemoryBarrier()
|
||||
* PaUtil_WriteMemoryBarrier()
|
||||
*
|
||||
****************/
|
||||
|
||||
#if defined(__APPLE__)
|
||||
# include <libkern/OSAtomic.h>
|
||||
/* Here are the memory barrier functions. Mac OS X only provides
|
||||
full memory barriers, so the three types of barriers are the same,
|
||||
however, these barriers are superior to compiler-based ones. */
|
||||
# define PaUtil_FullMemoryBarrier() OSMemoryBarrier()
|
||||
# define PaUtil_ReadMemoryBarrier() OSMemoryBarrier()
|
||||
# define PaUtil_WriteMemoryBarrier() OSMemoryBarrier()
|
||||
#elif defined(__GNUC__)
|
||||
/* GCC >= 4.1 has built-in intrinsics. We'll use those */
|
||||
# if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)
|
||||
# define PaUtil_FullMemoryBarrier() __sync_synchronize()
|
||||
# define PaUtil_ReadMemoryBarrier() __sync_synchronize()
|
||||
# define PaUtil_WriteMemoryBarrier() __sync_synchronize()
|
||||
/* as a fallback, GCC understands volatile asm and "memory" to mean it
|
||||
* should not reorder memory read/writes */
|
||||
/* Note that it is not clear that any compiler actually defines __PPC__,
|
||||
* it can probably removed safely. */
|
||||
# elif defined( __ppc__ ) || defined( __powerpc__) || defined( __PPC__ )
|
||||
# define PaUtil_FullMemoryBarrier() asm volatile("sync":::"memory")
|
||||
# define PaUtil_ReadMemoryBarrier() asm volatile("sync":::"memory")
|
||||
# define PaUtil_WriteMemoryBarrier() asm volatile("sync":::"memory")
|
||||
# elif defined( __i386__ ) || defined( __i486__ ) || defined( __i586__ ) || \
|
||||
defined( __i686__ ) || defined( __x86_64__ )
|
||||
# define PaUtil_FullMemoryBarrier() asm volatile("mfence":::"memory")
|
||||
# define PaUtil_ReadMemoryBarrier() asm volatile("lfence":::"memory")
|
||||
# define PaUtil_WriteMemoryBarrier() asm volatile("sfence":::"memory")
|
||||
# else
|
||||
# ifdef ALLOW_SMP_DANGERS
|
||||
# warning Memory barriers not defined on this system or system unknown
|
||||
# warning For SMP safety, you should fix this.
|
||||
# define PaUtil_FullMemoryBarrier()
|
||||
# define PaUtil_ReadMemoryBarrier()
|
||||
# define PaUtil_WriteMemoryBarrier()
|
||||
# else
|
||||
# error Memory barriers are not defined on this system. You can still compile by defining ALLOW_SMP_DANGERS, but SMP safety will not be guaranteed.
|
||||
# endif
|
||||
# endif
|
||||
#elif (_MSC_VER >= 1400) && !defined(_WIN32_WCE)
|
||||
# include <intrin.h>
|
||||
# pragma intrinsic(_ReadWriteBarrier)
|
||||
# pragma intrinsic(_ReadBarrier)
|
||||
# pragma intrinsic(_WriteBarrier)
|
||||
/* note that MSVC intrinsics _ReadWriteBarrier(), _ReadBarrier(), _WriteBarrier() are just compiler barriers *not* memory barriers */
|
||||
# define PaUtil_FullMemoryBarrier() _ReadWriteBarrier()
|
||||
# define PaUtil_ReadMemoryBarrier() _ReadBarrier()
|
||||
# define PaUtil_WriteMemoryBarrier() _WriteBarrier()
|
||||
#elif defined(_WIN32_WCE)
|
||||
# define PaUtil_FullMemoryBarrier()
|
||||
# define PaUtil_ReadMemoryBarrier()
|
||||
# define PaUtil_WriteMemoryBarrier()
|
||||
#elif defined(_MSC_VER) || defined(__BORLANDC__)
|
||||
# define PaUtil_FullMemoryBarrier() _asm { lock add [esp], 0 }
|
||||
# define PaUtil_ReadMemoryBarrier() _asm { lock add [esp], 0 }
|
||||
# define PaUtil_WriteMemoryBarrier() _asm { lock add [esp], 0 }
|
||||
#else
|
||||
# ifdef ALLOW_SMP_DANGERS
|
||||
# warning Memory barriers not defined on this system or system unknown
|
||||
# warning For SMP safety, you should fix this.
|
||||
# define PaUtil_FullMemoryBarrier()
|
||||
# define PaUtil_ReadMemoryBarrier()
|
||||
# define PaUtil_WriteMemoryBarrier()
|
||||
# else
|
||||
# error Memory barriers are not defined on this system. You can still compile by defining ALLOW_SMP_DANGERS, but SMP safety will not be guaranteed.
|
||||
# endif
|
||||
#endif
|
1827
pd-0.44-2/portaudio/src/common/pa_process.c
Normal file
1827
pd-0.44-2/portaudio/src/common/pa_process.c
Normal file
File diff suppressed because it is too large
Load diff
754
pd-0.44-2/portaudio/src/common/pa_process.h
Normal file
754
pd-0.44-2/portaudio/src/common/pa_process.h
Normal file
|
@ -0,0 +1,754 @@
|
|||
#ifndef PA_PROCESS_H
|
||||
#define PA_PROCESS_H
|
||||
/*
|
||||
* $Id: pa_process.h 1668 2011-05-02 17:07:11Z rossb $
|
||||
* Portable Audio I/O Library callback buffer processing adapters
|
||||
*
|
||||
* Based on the Open Source API proposed by Ross Bencina
|
||||
* Copyright (c) 1999-2002 Phil Burk, Ross Bencina
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
@ingroup common_src
|
||||
|
||||
@brief Buffer Processor prototypes. A Buffer Processor performs buffer length
|
||||
adaption, coordinates sample format conversion, and interleaves/deinterleaves
|
||||
channels.
|
||||
|
||||
<h3>Overview</h3>
|
||||
|
||||
The "Buffer Processor" (PaUtilBufferProcessor) manages conversion of audio
|
||||
data from host buffers to user buffers and back again. Where required, the
|
||||
buffer processor takes care of converting between host and user sample formats,
|
||||
interleaving and deinterleaving multichannel buffers, and adapting between host
|
||||
and user buffers with different lengths. The buffer processor may be used with
|
||||
full and half duplex streams, for both callback streams and blocking read/write
|
||||
streams.
|
||||
|
||||
One of the important capabilities provided by the buffer processor is
|
||||
the ability to adapt between user and host buffer sizes of different lengths
|
||||
with minimum latency. Although this task is relatively easy to perform when
|
||||
the host buffer size is an integer multiple of the user buffer size, the
|
||||
problem is more complicated when this is not the case - especially for
|
||||
full-duplex callback streams. Where necessary the adaption is implemented by
|
||||
internally buffering some input and/or output data. The buffer adation
|
||||
algorithm used by the buffer processor was originally implemented by
|
||||
Stephan Letz for the ASIO version of PortAudio, and is described in his
|
||||
Callback_adaption_.pdf which is included in the distribution.
|
||||
|
||||
The buffer processor performs sample conversion using the functions provided
|
||||
by pa_converters.c.
|
||||
|
||||
The following sections provide an overview of how to use the buffer processor.
|
||||
Interested readers are advised to consult the host API implementations for
|
||||
examples of buffer processor usage.
|
||||
|
||||
|
||||
<h4>Initialization, resetting and termination</h4>
|
||||
|
||||
When a stream is opened, the buffer processor should be initialized using
|
||||
PaUtil_InitializeBufferProcessor. This function initializes internal state
|
||||
and allocates temporary buffers as neccesary according to the supplied
|
||||
configuration parameters. Some of the parameters correspond to those requested
|
||||
by the user in their call to Pa_OpenStream(), others reflect the requirements
|
||||
of the host API implementation - they indicate host buffer sizes, formats,
|
||||
and the type of buffering which the Host API uses. The buffer processor should
|
||||
be initialized for callback streams and blocking read/write streams.
|
||||
|
||||
Call PaUtil_ResetBufferProcessor to clear any sample data which is present
|
||||
in the buffer processor before starting to use it (for example when
|
||||
Pa_StartStream is called).
|
||||
|
||||
When the buffer processor is no longer used call
|
||||
PaUtil_TerminateBufferProcessor.
|
||||
|
||||
|
||||
<h4>Using the buffer processor for a callback stream</h4>
|
||||
|
||||
The buffer processor's role in a callback stream is to take host input buffers
|
||||
process them with the stream callback, and fill host output buffers. For a
|
||||
full duplex stream, the buffer processor handles input and output simultaneously
|
||||
due to the requirements of the minimum-latency buffer adation algorithm.
|
||||
|
||||
When a host buffer becomes available, the implementation should call
|
||||
the buffer processor to process the buffer. The buffer processor calls the
|
||||
stream callback to consume and/or produce audio data as necessary. The buffer
|
||||
processor will convert sample formats, interleave/deinterleave channels,
|
||||
and slice or chunk the data to the appropriate buffer lengths according to
|
||||
the requirements of the stream callback and the host API.
|
||||
|
||||
To process a host buffer (or a pair of host buffers for a full-duplex stream)
|
||||
use the following calling sequence:
|
||||
|
||||
-# Call PaUtil_BeginBufferProcessing
|
||||
-# For a stream which takes input:
|
||||
- Call PaUtil_SetInputFrameCount with the number of frames in the host input
|
||||
buffer.
|
||||
- Call one of the following functions one or more times to tell the
|
||||
buffer processor about the host input buffer(s): PaUtil_SetInputChannel,
|
||||
PaUtil_SetInterleavedInputChannels, PaUtil_SetNonInterleavedInputChannel.
|
||||
Which function you call will depend on whether the host buffer(s) are
|
||||
interleaved or not.
|
||||
- If the available host data is split accross two buffers (for example a
|
||||
data range at the end of a circular buffer and another range at the
|
||||
beginning of the circular buffer), also call
|
||||
PaUtil_Set2ndInputFrameCount, PaUtil_Set2ndInputChannel,
|
||||
PaUtil_Set2ndInterleavedInputChannels,
|
||||
PaUtil_Set2ndNonInterleavedInputChannel as necessary to tell the buffer
|
||||
processor about the second buffer.
|
||||
-# For a stream which generates output:
|
||||
- Call PaUtil_SetOutputFrameCount with the number of frames in the host
|
||||
output buffer.
|
||||
- Call one of the following functions one or more times to tell the
|
||||
buffer processor about the host output buffer(s): PaUtil_SetOutputChannel,
|
||||
PaUtil_SetInterleavedOutputChannels, PaUtil_SetNonInterleavedOutputChannel.
|
||||
Which function you call will depend on whether the host buffer(s) are
|
||||
interleaved or not.
|
||||
- If the available host output buffer space is split accross two buffers
|
||||
(for example a data range at the end of a circular buffer and another
|
||||
range at the beginning of the circular buffer), call
|
||||
PaUtil_Set2ndOutputFrameCount, PaUtil_Set2ndOutputChannel,
|
||||
PaUtil_Set2ndInterleavedOutputChannels,
|
||||
PaUtil_Set2ndNonInterleavedOutputChannel as necessary to tell the buffer
|
||||
processor about the second buffer.
|
||||
-# Call PaUtil_EndBufferProcessing, this function performs the actual data
|
||||
conversion and processing.
|
||||
|
||||
|
||||
<h4>Using the buffer processor for a blocking read/write stream</h4>
|
||||
|
||||
Blocking read/write streams use the buffer processor to convert and copy user
|
||||
output data to a host buffer, and to convert and copy host input data to
|
||||
the user's buffer. The buffer processor does not perform any buffer adaption.
|
||||
When using the buffer processor in a blocking read/write stream the input and
|
||||
output conversion are performed separately by the PaUtil_CopyInput and
|
||||
PaUtil_CopyOutput functions.
|
||||
|
||||
To copy data from a host input buffer to the buffer(s) which the user supplies
|
||||
to Pa_ReadStream, use the following calling sequence.
|
||||
|
||||
- Repeat the following three steps until the user buffer(s) have been filled
|
||||
with samples from the host input buffers:
|
||||
-# Call PaUtil_SetInputFrameCount with the number of frames in the host
|
||||
input buffer.
|
||||
-# Call one of the following functions one or more times to tell the
|
||||
buffer processor about the host input buffer(s): PaUtil_SetInputChannel,
|
||||
PaUtil_SetInterleavedInputChannels, PaUtil_SetNonInterleavedInputChannel.
|
||||
Which function you call will depend on whether the host buffer(s) are
|
||||
interleaved or not.
|
||||
-# Call PaUtil_CopyInput with the user buffer pointer (or a copy of the
|
||||
array of buffer pointers for a non-interleaved stream) passed to
|
||||
Pa_ReadStream, along with the number of frames in the user buffer(s).
|
||||
Be careful to pass a <i>copy</i> of the user buffer pointers to
|
||||
PaUtil_CopyInput because PaUtil_CopyInput advances the pointers to
|
||||
the start of the next region to copy.
|
||||
- PaUtil_CopyInput will not copy more data than is available in the
|
||||
host buffer(s), so the above steps need to be repeated until the user
|
||||
buffer(s) are full.
|
||||
|
||||
|
||||
To copy data to the host output buffer from the user buffers(s) supplied
|
||||
to Pa_WriteStream use the following calling sequence.
|
||||
|
||||
- Repeat the following three steps until all frames from the user buffer(s)
|
||||
have been copied to the host API:
|
||||
-# Call PaUtil_SetOutputFrameCount with the number of frames in the host
|
||||
output buffer.
|
||||
-# Call one of the following functions one or more times to tell the
|
||||
buffer processor about the host output buffer(s): PaUtil_SetOutputChannel,
|
||||
PaUtil_SetInterleavedOutputChannels, PaUtil_SetNonInterleavedOutputChannel.
|
||||
Which function you call will depend on whether the host buffer(s) are
|
||||
interleaved or not.
|
||||
-# Call PaUtil_CopyOutput with the user buffer pointer (or a copy of the
|
||||
array of buffer pointers for a non-interleaved stream) passed to
|
||||
Pa_WriteStream, along with the number of frames in the user buffer(s).
|
||||
Be careful to pass a <i>copy</i> of the user buffer pointers to
|
||||
PaUtil_CopyOutput because PaUtil_CopyOutput advances the pointers to
|
||||
the start of the next region to copy.
|
||||
- PaUtil_CopyOutput will not copy more data than fits in the host buffer(s),
|
||||
so the above steps need to be repeated until all user data is copied.
|
||||
*/
|
||||
|
||||
|
||||
#include "portaudio.h"
|
||||
#include "pa_converters.h"
|
||||
#include "pa_dither.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/** @brief Mode flag passed to PaUtil_InitializeBufferProcessor indicating the type
|
||||
of buffering that the host API uses.
|
||||
|
||||
The mode used depends on whether the host API or the implementation manages
|
||||
the buffers, and how these buffers are used (scatter gather, circular buffer).
|
||||
*/
|
||||
typedef enum {
|
||||
/** The host buffer size is a fixed known size. */
|
||||
paUtilFixedHostBufferSize,
|
||||
|
||||
/** The host buffer size may vary, but has a known maximum size. */
|
||||
paUtilBoundedHostBufferSize,
|
||||
|
||||
/** Nothing is known about the host buffer size. */
|
||||
paUtilUnknownHostBufferSize,
|
||||
|
||||
/** The host buffer size varies, and the client does not require the buffer
|
||||
processor to consume all of the input and fill all of the output buffer. This
|
||||
is useful when the implementation has access to the host API's circular buffer
|
||||
and only needs to consume/fill some of it, not necessarily all of it, with each
|
||||
call to the buffer processor. This is the only mode where
|
||||
PaUtil_EndBufferProcessing() may not consume the whole buffer.
|
||||
*/
|
||||
paUtilVariableHostBufferSizePartialUsageAllowed
|
||||
}PaUtilHostBufferSizeMode;
|
||||
|
||||
|
||||
/** @brief An auxilliary data structure used internally by the buffer processor
|
||||
to represent host input and output buffers. */
|
||||
typedef struct PaUtilChannelDescriptor{
|
||||
void *data;
|
||||
unsigned int stride; /**< stride in samples, not bytes */
|
||||
}PaUtilChannelDescriptor;
|
||||
|
||||
|
||||
/** @brief The main buffer processor data structure.
|
||||
|
||||
Allocate one of these, initialize it with PaUtil_InitializeBufferProcessor
|
||||
and terminate it with PaUtil_TerminateBufferProcessor.
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned long framesPerUserBuffer;
|
||||
unsigned long framesPerHostBuffer;
|
||||
|
||||
PaUtilHostBufferSizeMode hostBufferSizeMode;
|
||||
int useNonAdaptingProcess;
|
||||
int userOutputSampleFormatIsEqualToHost;
|
||||
int userInputSampleFormatIsEqualToHost;
|
||||
unsigned long framesPerTempBuffer;
|
||||
|
||||
unsigned int inputChannelCount;
|
||||
unsigned int bytesPerHostInputSample;
|
||||
unsigned int bytesPerUserInputSample;
|
||||
int userInputIsInterleaved;
|
||||
PaUtilConverter *inputConverter;
|
||||
PaUtilZeroer *inputZeroer;
|
||||
|
||||
unsigned int outputChannelCount;
|
||||
unsigned int bytesPerHostOutputSample;
|
||||
unsigned int bytesPerUserOutputSample;
|
||||
int userOutputIsInterleaved;
|
||||
PaUtilConverter *outputConverter;
|
||||
PaUtilZeroer *outputZeroer;
|
||||
|
||||
unsigned long initialFramesInTempInputBuffer;
|
||||
unsigned long initialFramesInTempOutputBuffer;
|
||||
|
||||
void *tempInputBuffer; /**< used for slips, block adaption, and conversion. */
|
||||
void **tempInputBufferPtrs; /**< storage for non-interleaved buffer pointers, NULL for interleaved user input */
|
||||
unsigned long framesInTempInputBuffer; /**< frames remaining in input buffer from previous adaption iteration */
|
||||
|
||||
void *tempOutputBuffer; /**< used for slips, block adaption, and conversion. */
|
||||
void **tempOutputBufferPtrs; /**< storage for non-interleaved buffer pointers, NULL for interleaved user output */
|
||||
unsigned long framesInTempOutputBuffer; /**< frames remaining in input buffer from previous adaption iteration */
|
||||
|
||||
PaStreamCallbackTimeInfo *timeInfo;
|
||||
|
||||
PaStreamCallbackFlags callbackStatusFlags;
|
||||
|
||||
int hostInputIsInterleaved;
|
||||
unsigned long hostInputFrameCount[2];
|
||||
PaUtilChannelDescriptor *hostInputChannels[2]; /**< pointers to arrays of channel descriptors.
|
||||
pointers are NULL for half-duplex output processing.
|
||||
hostInputChannels[i].data is NULL when the caller
|
||||
calls PaUtil_SetNoInput()
|
||||
*/
|
||||
int hostOutputIsInterleaved;
|
||||
unsigned long hostOutputFrameCount[2];
|
||||
PaUtilChannelDescriptor *hostOutputChannels[2]; /**< pointers to arrays of channel descriptors.
|
||||
pointers are NULL for half-duplex input processing.
|
||||
hostOutputChannels[i].data is NULL when the caller
|
||||
calls PaUtil_SetNoOutput()
|
||||
*/
|
||||
|
||||
PaUtilTriangularDitherGenerator ditherGenerator;
|
||||
|
||||
double samplePeriod;
|
||||
|
||||
PaStreamCallback *streamCallback;
|
||||
void *userData;
|
||||
} PaUtilBufferProcessor;
|
||||
|
||||
|
||||
/** @name Initialization, termination, resetting and info */
|
||||
/*@{*/
|
||||
|
||||
/** Initialize a buffer processor's representation stored in a
|
||||
PaUtilBufferProcessor structure. Be sure to call
|
||||
PaUtil_TerminateBufferProcessor after finishing with a buffer processor.
|
||||
|
||||
@param bufferProcessor The buffer processor structure to initialize.
|
||||
|
||||
@param inputChannelCount The number of input channels as passed to
|
||||
Pa_OpenStream or 0 for an output-only stream.
|
||||
|
||||
@param userInputSampleFormat Format of user input samples, as passed to
|
||||
Pa_OpenStream. This parameter is ignored for ouput-only streams.
|
||||
|
||||
@param hostInputSampleFormat Format of host input samples. This parameter is
|
||||
ignored for output-only streams. See note about host buffer interleave below.
|
||||
|
||||
@param outputChannelCount The number of output channels as passed to
|
||||
Pa_OpenStream or 0 for an input-only stream.
|
||||
|
||||
@param userOutputSampleFormat Format of user output samples, as passed to
|
||||
Pa_OpenStream. This parameter is ignored for input-only streams.
|
||||
|
||||
@param hostOutputSampleFormat Format of host output samples. This parameter is
|
||||
ignored for input-only streams. See note about host buffer interleave below.
|
||||
|
||||
@param sampleRate Sample rate of the stream. The more accurate this is the
|
||||
better - it is used for updating time stamps when adapting buffers.
|
||||
|
||||
@param streamFlags Stream flags as passed to Pa_OpenStream, this parameter is
|
||||
used for selecting special sample conversion options such as clipping and
|
||||
dithering.
|
||||
|
||||
@param framesPerUserBuffer Number of frames per user buffer, as requested
|
||||
by the framesPerBuffer parameter to Pa_OpenStream. This parameter may be
|
||||
zero to indicate that the user will accept any (and varying) buffer sizes.
|
||||
|
||||
@param framesPerHostBuffer Specifies the number of frames per host buffer
|
||||
for the fixed buffer size mode, and the maximum number of frames
|
||||
per host buffer for the bounded host buffer size mode. It is ignored for
|
||||
the other modes.
|
||||
|
||||
@param hostBufferSizeMode A mode flag indicating the size variability of
|
||||
host buffers that will be passed to the buffer processor. See
|
||||
PaUtilHostBufferSizeMode for further details.
|
||||
|
||||
@param streamCallback The user stream callback passed to Pa_OpenStream.
|
||||
|
||||
@param userData The user data field passed to Pa_OpenStream.
|
||||
|
||||
@note The interleave flag is ignored for host buffer formats. Host
|
||||
interleave is determined by the use of different SetInput and SetOutput
|
||||
functions.
|
||||
|
||||
@return An error code indicating whether the initialization was successful.
|
||||
If the error code is not PaNoError, the buffer processor was not initialized
|
||||
and should not be used.
|
||||
|
||||
@see Pa_OpenStream, PaUtilHostBufferSizeMode, PaUtil_TerminateBufferProcessor
|
||||
*/
|
||||
PaError PaUtil_InitializeBufferProcessor( PaUtilBufferProcessor* bufferProcessor,
|
||||
int inputChannelCount, PaSampleFormat userInputSampleFormat,
|
||||
PaSampleFormat hostInputSampleFormat,
|
||||
int outputChannelCount, PaSampleFormat userOutputSampleFormat,
|
||||
PaSampleFormat hostOutputSampleFormat,
|
||||
double sampleRate,
|
||||
PaStreamFlags streamFlags,
|
||||
unsigned long framesPerUserBuffer, /* 0 indicates don't care */
|
||||
unsigned long framesPerHostBuffer,
|
||||
PaUtilHostBufferSizeMode hostBufferSizeMode,
|
||||
PaStreamCallback *streamCallback, void *userData );
|
||||
|
||||
|
||||
/** Terminate a buffer processor's representation. Deallocates any temporary
|
||||
buffers allocated by PaUtil_InitializeBufferProcessor.
|
||||
|
||||
@param bufferProcessor The buffer processor structure to terminate.
|
||||
|
||||
@see PaUtil_InitializeBufferProcessor.
|
||||
*/
|
||||
void PaUtil_TerminateBufferProcessor( PaUtilBufferProcessor* bufferProcessor );
|
||||
|
||||
|
||||
/** Clear any internally buffered data. If you call
|
||||
PaUtil_InitializeBufferProcessor in your OpenStream routine, make sure you
|
||||
call PaUtil_ResetBufferProcessor in your StartStream call.
|
||||
|
||||
@param bufferProcessor The buffer processor to reset.
|
||||
*/
|
||||
void PaUtil_ResetBufferProcessor( PaUtilBufferProcessor* bufferProcessor );
|
||||
|
||||
|
||||
/** Retrieve the input latency of a buffer processor, in frames.
|
||||
|
||||
@param bufferProcessor The buffer processor examine.
|
||||
|
||||
@return The input latency introduced by the buffer processor, in frames.
|
||||
|
||||
@see PaUtil_GetBufferProcessorOutputLatencyFrames
|
||||
*/
|
||||
unsigned long PaUtil_GetBufferProcessorInputLatencyFrames( PaUtilBufferProcessor* bufferProcessor );
|
||||
|
||||
/** Retrieve the output latency of a buffer processor, in frames.
|
||||
|
||||
@param bufferProcessor The buffer processor examine.
|
||||
|
||||
@return The output latency introduced by the buffer processor, in frames.
|
||||
|
||||
@see PaUtil_GetBufferProcessorInputLatencyFrames
|
||||
*/
|
||||
unsigned long PaUtil_GetBufferProcessorOutputLatencyFrames( PaUtilBufferProcessor* bufferProcessor );
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/** @name Host buffer pointer configuration
|
||||
|
||||
Functions to set host input and output buffers, used by both callback streams
|
||||
and blocking read/write streams.
|
||||
*/
|
||||
/*@{*/
|
||||
|
||||
|
||||
/** Set the number of frames in the input host buffer(s) specified by the
|
||||
PaUtil_Set*InputChannel functions.
|
||||
|
||||
@param bufferProcessor The buffer processor.
|
||||
|
||||
@param frameCount The number of host input frames. A 0 frameCount indicates to
|
||||
use the framesPerHostBuffer value passed to PaUtil_InitializeBufferProcessor.
|
||||
|
||||
@see PaUtil_SetNoInput, PaUtil_SetInputChannel,
|
||||
PaUtil_SetInterleavedInputChannels, PaUtil_SetNonInterleavedInputChannel
|
||||
*/
|
||||
void PaUtil_SetInputFrameCount( PaUtilBufferProcessor* bufferProcessor,
|
||||
unsigned long frameCount );
|
||||
|
||||
|
||||
/** Indicate that no input is avalable. This function should be used when
|
||||
priming the output of a full-duplex stream opened with the
|
||||
paPrimeOutputBuffersUsingStreamCallback flag. Note that it is not necessary
|
||||
to call this or any othe PaUtil_Set*Input* functions for ouput-only streams.
|
||||
|
||||
@param bufferProcessor The buffer processor.
|
||||
*/
|
||||
void PaUtil_SetNoInput( PaUtilBufferProcessor* bufferProcessor );
|
||||
|
||||
|
||||
/** Provide the buffer processor with a pointer to a host input channel.
|
||||
|
||||
@param bufferProcessor The buffer processor.
|
||||
@param channel The channel number.
|
||||
@param data The buffer.
|
||||
@param stride The stride from one sample to the next, in samples. For
|
||||
interleaved host buffers, the stride will usually be the same as the number of
|
||||
channels in the buffer.
|
||||
*/
|
||||
void PaUtil_SetInputChannel( PaUtilBufferProcessor* bufferProcessor,
|
||||
unsigned int channel, void *data, unsigned int stride );
|
||||
|
||||
|
||||
/** Provide the buffer processor with a pointer to an number of interleaved
|
||||
host input channels.
|
||||
|
||||
@param bufferProcessor The buffer processor.
|
||||
@param firstChannel The first channel number.
|
||||
@param data The buffer.
|
||||
@param channelCount The number of interleaved channels in the buffer. If
|
||||
channelCount is zero, the number of channels specified to
|
||||
PaUtil_InitializeBufferProcessor will be used.
|
||||
*/
|
||||
void PaUtil_SetInterleavedInputChannels( PaUtilBufferProcessor* bufferProcessor,
|
||||
unsigned int firstChannel, void *data, unsigned int channelCount );
|
||||
|
||||
|
||||
/** Provide the buffer processor with a pointer to one non-interleaved host
|
||||
output channel.
|
||||
|
||||
@param bufferProcessor The buffer processor.
|
||||
@param channel The channel number.
|
||||
@param data The buffer.
|
||||
*/
|
||||
void PaUtil_SetNonInterleavedInputChannel( PaUtilBufferProcessor* bufferProcessor,
|
||||
unsigned int channel, void *data );
|
||||
|
||||
|
||||
/** Use for the second buffer half when the input buffer is split in two halves.
|
||||
@see PaUtil_SetInputFrameCount
|
||||
*/
|
||||
void PaUtil_Set2ndInputFrameCount( PaUtilBufferProcessor* bufferProcessor,
|
||||
unsigned long frameCount );
|
||||
|
||||
/** Use for the second buffer half when the input buffer is split in two halves.
|
||||
@see PaUtil_SetInputChannel
|
||||
*/
|
||||
void PaUtil_Set2ndInputChannel( PaUtilBufferProcessor* bufferProcessor,
|
||||
unsigned int channel, void *data, unsigned int stride );
|
||||
|
||||
/** Use for the second buffer half when the input buffer is split in two halves.
|
||||
@see PaUtil_SetInterleavedInputChannels
|
||||
*/
|
||||
void PaUtil_Set2ndInterleavedInputChannels( PaUtilBufferProcessor* bufferProcessor,
|
||||
unsigned int firstChannel, void *data, unsigned int channelCount );
|
||||
|
||||
/** Use for the second buffer half when the input buffer is split in two halves.
|
||||
@see PaUtil_SetNonInterleavedInputChannel
|
||||
*/
|
||||
void PaUtil_Set2ndNonInterleavedInputChannel( PaUtilBufferProcessor* bufferProcessor,
|
||||
unsigned int channel, void *data );
|
||||
|
||||
|
||||
/** Set the number of frames in the output host buffer(s) specified by the
|
||||
PaUtil_Set*OutputChannel functions.
|
||||
|
||||
@param bufferProcessor The buffer processor.
|
||||
|
||||
@param frameCount The number of host output frames. A 0 frameCount indicates to
|
||||
use the framesPerHostBuffer value passed to PaUtil_InitializeBufferProcessor.
|
||||
|
||||
@see PaUtil_SetOutputChannel, PaUtil_SetInterleavedOutputChannels,
|
||||
PaUtil_SetNonInterleavedOutputChannel
|
||||
*/
|
||||
void PaUtil_SetOutputFrameCount( PaUtilBufferProcessor* bufferProcessor,
|
||||
unsigned long frameCount );
|
||||
|
||||
|
||||
/** Indicate that the output will be discarded. This function should be used
|
||||
when implementing the paNeverDropInput mode for full duplex streams.
|
||||
|
||||
@param bufferProcessor The buffer processor.
|
||||
*/
|
||||
void PaUtil_SetNoOutput( PaUtilBufferProcessor* bufferProcessor );
|
||||
|
||||
|
||||
/** Provide the buffer processor with a pointer to a host output channel.
|
||||
|
||||
@param bufferProcessor The buffer processor.
|
||||
@param channel The channel number.
|
||||
@param data The buffer.
|
||||
@param stride The stride from one sample to the next, in samples. For
|
||||
interleaved host buffers, the stride will usually be the same as the number of
|
||||
channels in the buffer.
|
||||
*/
|
||||
void PaUtil_SetOutputChannel( PaUtilBufferProcessor* bufferProcessor,
|
||||
unsigned int channel, void *data, unsigned int stride );
|
||||
|
||||
|
||||
/** Provide the buffer processor with a pointer to a number of interleaved
|
||||
host output channels.
|
||||
|
||||
@param bufferProcessor The buffer processor.
|
||||
@param firstChannel The first channel number.
|
||||
@param data The buffer.
|
||||
@param channelCount The number of interleaved channels in the buffer. If
|
||||
channelCount is zero, the number of channels specified to
|
||||
PaUtil_InitializeBufferProcessor will be used.
|
||||
*/
|
||||
void PaUtil_SetInterleavedOutputChannels( PaUtilBufferProcessor* bufferProcessor,
|
||||
unsigned int firstChannel, void *data, unsigned int channelCount );
|
||||
|
||||
|
||||
/** Provide the buffer processor with a pointer to one non-interleaved host
|
||||
output channel.
|
||||
|
||||
@param bufferProcessor The buffer processor.
|
||||
@param channel The channel number.
|
||||
@param data The buffer.
|
||||
*/
|
||||
void PaUtil_SetNonInterleavedOutputChannel( PaUtilBufferProcessor* bufferProcessor,
|
||||
unsigned int channel, void *data );
|
||||
|
||||
|
||||
/** Use for the second buffer half when the output buffer is split in two halves.
|
||||
@see PaUtil_SetOutputFrameCount
|
||||
*/
|
||||
void PaUtil_Set2ndOutputFrameCount( PaUtilBufferProcessor* bufferProcessor,
|
||||
unsigned long frameCount );
|
||||
|
||||
/** Use for the second buffer half when the output buffer is split in two halves.
|
||||
@see PaUtil_SetOutputChannel
|
||||
*/
|
||||
void PaUtil_Set2ndOutputChannel( PaUtilBufferProcessor* bufferProcessor,
|
||||
unsigned int channel, void *data, unsigned int stride );
|
||||
|
||||
/** Use for the second buffer half when the output buffer is split in two halves.
|
||||
@see PaUtil_SetInterleavedOutputChannels
|
||||
*/
|
||||
void PaUtil_Set2ndInterleavedOutputChannels( PaUtilBufferProcessor* bufferProcessor,
|
||||
unsigned int firstChannel, void *data, unsigned int channelCount );
|
||||
|
||||
/** Use for the second buffer half when the output buffer is split in two halves.
|
||||
@see PaUtil_SetNonInterleavedOutputChannel
|
||||
*/
|
||||
void PaUtil_Set2ndNonInterleavedOutputChannel( PaUtilBufferProcessor* bufferProcessor,
|
||||
unsigned int channel, void *data );
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/** @name Buffer processing functions for callback streams
|
||||
*/
|
||||
/*@{*/
|
||||
|
||||
/** Commence processing a host buffer (or a pair of host buffers in the
|
||||
full-duplex case) for a callback stream.
|
||||
|
||||
@param bufferProcessor The buffer processor.
|
||||
|
||||
@param timeInfo Timing information for the first sample of the host
|
||||
buffer(s). This information may be adjusted when buffer adaption is being
|
||||
performed.
|
||||
|
||||
@param callbackStatusFlags Flags indicating whether underruns and overruns
|
||||
have occurred since the last time the buffer processor was called.
|
||||
*/
|
||||
void PaUtil_BeginBufferProcessing( PaUtilBufferProcessor* bufferProcessor,
|
||||
PaStreamCallbackTimeInfo* timeInfo, PaStreamCallbackFlags callbackStatusFlags );
|
||||
|
||||
|
||||
/** Finish processing a host buffer (or a pair of host buffers in the
|
||||
full-duplex case) for a callback stream.
|
||||
|
||||
@param bufferProcessor The buffer processor.
|
||||
|
||||
@param callbackResult On input, indicates a previous callback result, and on
|
||||
exit, the result of the user stream callback, if it is called.
|
||||
On entry callbackResult should contain one of { paContinue, paComplete, or
|
||||
paAbort}. If paComplete is passed, the stream callback will not be called
|
||||
but any audio that was generated by previous stream callbacks will be copied
|
||||
to the output buffer(s). You can check whether the buffer processor's internal
|
||||
buffer is empty by calling PaUtil_IsBufferProcessorOutputEmpty.
|
||||
|
||||
If the stream callback is called its result is stored in *callbackResult. If
|
||||
the stream callback returns paComplete or paAbort, all output buffers will be
|
||||
full of valid data - some of which may be zeros to acount for data that
|
||||
wasn't generated by the terminating callback.
|
||||
|
||||
@return The number of frames processed. This usually corresponds to the
|
||||
number of frames specified by the PaUtil_Set*FrameCount functions, exept in
|
||||
the paUtilVariableHostBufferSizePartialUsageAllowed buffer size mode when a
|
||||
smaller value may be returned.
|
||||
*/
|
||||
unsigned long PaUtil_EndBufferProcessing( PaUtilBufferProcessor* bufferProcessor,
|
||||
int *callbackResult );
|
||||
|
||||
|
||||
/** Determine whether any callback generated output remains in the bufffer
|
||||
processor's internal buffers. This method may be used to determine when to
|
||||
continue calling PaUtil_EndBufferProcessing() after the callback has returned
|
||||
a callbackResult of paComplete.
|
||||
|
||||
@param bufferProcessor The buffer processor.
|
||||
|
||||
@return Returns non-zero when callback generated output remains in the internal
|
||||
buffer and zero (0) when there internal buffer contains no callback generated
|
||||
data.
|
||||
*/
|
||||
int PaUtil_IsBufferProcessorOutputEmpty( PaUtilBufferProcessor* bufferProcessor );
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/** @name Buffer processing functions for blocking read/write streams
|
||||
*/
|
||||
/*@{*/
|
||||
|
||||
/** Copy samples from host input channels set up by the PaUtil_Set*InputChannels
|
||||
functions to a user supplied buffer. This function is intended for use with
|
||||
blocking read/write streams. Copies the minimum of the number of
|
||||
user frames (specified by the frameCount parameter) and the number of available
|
||||
host frames (specified in a previous call to SetInputFrameCount()).
|
||||
|
||||
@param bufferProcessor The buffer processor.
|
||||
|
||||
@param buffer A pointer to the user buffer pointer, or a pointer to a pointer
|
||||
to an array of user buffer pointers for a non-interleaved stream. It is
|
||||
important that this parameter points to a copy of the user buffer pointers,
|
||||
not to the actual user buffer pointers, because this function updates the
|
||||
pointers before returning.
|
||||
|
||||
@param frameCount The number of frames of data in the buffer(s) pointed to by
|
||||
the buffer parameter.
|
||||
|
||||
@return The number of frames copied. The buffer pointer(s) pointed to by the
|
||||
buffer parameter are advanced to point to the frame(s) following the last one
|
||||
filled.
|
||||
*/
|
||||
unsigned long PaUtil_CopyInput( PaUtilBufferProcessor* bufferProcessor,
|
||||
void **buffer, unsigned long frameCount );
|
||||
|
||||
|
||||
/* Copy samples from a user supplied buffer to host output channels set up by
|
||||
the PaUtil_Set*OutputChannels functions. This function is intended for use with
|
||||
blocking read/write streams. Copies the minimum of the number of
|
||||
user frames (specified by the frameCount parameter) and the number of
|
||||
host frames (specified in a previous call to SetOutputFrameCount()).
|
||||
|
||||
@param bufferProcessor The buffer processor.
|
||||
|
||||
@param buffer A pointer to the user buffer pointer, or a pointer to a pointer
|
||||
to an array of user buffer pointers for a non-interleaved stream. It is
|
||||
important that this parameter points to a copy of the user buffer pointers,
|
||||
not to the actual user buffer pointers, because this function updates the
|
||||
pointers before returning.
|
||||
|
||||
@param frameCount The number of frames of data in the buffer(s) pointed to by
|
||||
the buffer parameter.
|
||||
|
||||
@return The number of frames copied. The buffer pointer(s) pointed to by the
|
||||
buffer parameter are advanced to point to the frame(s) following the last one
|
||||
copied.
|
||||
*/
|
||||
unsigned long PaUtil_CopyOutput( PaUtilBufferProcessor* bufferProcessor,
|
||||
const void ** buffer, unsigned long frameCount );
|
||||
|
||||
|
||||
/* Zero samples in host output channels set up by the PaUtil_Set*OutputChannels
|
||||
functions. This function is useful for flushing streams.
|
||||
Zeros the minimum of frameCount and the number of host frames specified in a
|
||||
previous call to SetOutputFrameCount().
|
||||
|
||||
@param bufferProcessor The buffer processor.
|
||||
|
||||
@param frameCount The maximum number of frames to zero.
|
||||
|
||||
@return The number of frames zeroed.
|
||||
*/
|
||||
unsigned long PaUtil_ZeroOutput( PaUtilBufferProcessor* bufferProcessor,
|
||||
unsigned long frameCount );
|
||||
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* PA_PROCESS_H */
|
237
pd-0.44-2/portaudio/src/common/pa_ringbuffer.c
Normal file
237
pd-0.44-2/portaudio/src/common/pa_ringbuffer.c
Normal file
|
@ -0,0 +1,237 @@
|
|||
/*
|
||||
* $Id: pa_ringbuffer.c 1738 2011-08-18 11:47:28Z rossb $
|
||||
* Portable Audio I/O Library
|
||||
* Ring Buffer utility.
|
||||
*
|
||||
* Author: Phil Burk, http://www.softsynth.com
|
||||
* modified for SMP safety on Mac OS X by Bjorn Roche
|
||||
* modified for SMP safety on Linux by Leland Lucius
|
||||
* also, allowed for const where possible
|
||||
* modified for multiple-byte-sized data elements by Sven Fischer
|
||||
*
|
||||
* Note that this is safe only for a single-thread reader and a
|
||||
* single-thread writer.
|
||||
*
|
||||
* This program uses the PortAudio Portable Audio Library.
|
||||
* For more information see: http://www.portaudio.com
|
||||
* Copyright (c) 1999-2000 Ross Bencina and Phil Burk
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
/**
|
||||
@file
|
||||
@ingroup common_src
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "pa_ringbuffer.h"
|
||||
#include <string.h>
|
||||
#include "pa_memorybarrier.h"
|
||||
|
||||
/***************************************************************************
|
||||
* Initialize FIFO.
|
||||
* elementCount must be power of 2, returns -1 if not.
|
||||
*/
|
||||
ring_buffer_size_t PaUtil_InitializeRingBuffer( PaUtilRingBuffer *rbuf, ring_buffer_size_t elementSizeBytes, ring_buffer_size_t elementCount, void *dataPtr )
|
||||
{
|
||||
if( ((elementCount-1) & elementCount) != 0) return -1; /* Not Power of two. */
|
||||
rbuf->bufferSize = elementCount;
|
||||
rbuf->buffer = (char *)dataPtr;
|
||||
PaUtil_FlushRingBuffer( rbuf );
|
||||
rbuf->bigMask = (elementCount*2)-1;
|
||||
rbuf->smallMask = (elementCount)-1;
|
||||
rbuf->elementSizeBytes = elementSizeBytes;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
** Return number of elements available for reading. */
|
||||
ring_buffer_size_t PaUtil_GetRingBufferReadAvailable( const PaUtilRingBuffer *rbuf )
|
||||
{
|
||||
return ( (rbuf->writeIndex - rbuf->readIndex) & rbuf->bigMask );
|
||||
}
|
||||
/***************************************************************************
|
||||
** Return number of elements available for writing. */
|
||||
ring_buffer_size_t PaUtil_GetRingBufferWriteAvailable( const PaUtilRingBuffer *rbuf )
|
||||
{
|
||||
return ( rbuf->bufferSize - PaUtil_GetRingBufferReadAvailable(rbuf));
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
** Clear buffer. Should only be called when buffer is NOT being read or written. */
|
||||
void PaUtil_FlushRingBuffer( PaUtilRingBuffer *rbuf )
|
||||
{
|
||||
rbuf->writeIndex = rbuf->readIndex = 0;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
** Get address of region(s) to which we can write data.
|
||||
** If the region is contiguous, size2 will be zero.
|
||||
** If non-contiguous, size2 will be the size of second region.
|
||||
** Returns room available to be written or elementCount, whichever is smaller.
|
||||
*/
|
||||
ring_buffer_size_t PaUtil_GetRingBufferWriteRegions( PaUtilRingBuffer *rbuf, ring_buffer_size_t elementCount,
|
||||
void **dataPtr1, ring_buffer_size_t *sizePtr1,
|
||||
void **dataPtr2, ring_buffer_size_t *sizePtr2 )
|
||||
{
|
||||
ring_buffer_size_t index;
|
||||
ring_buffer_size_t available = PaUtil_GetRingBufferWriteAvailable( rbuf );
|
||||
if( elementCount > available ) elementCount = available;
|
||||
/* Check to see if write is not contiguous. */
|
||||
index = rbuf->writeIndex & rbuf->smallMask;
|
||||
if( (index + elementCount) > rbuf->bufferSize )
|
||||
{
|
||||
/* Write data in two blocks that wrap the buffer. */
|
||||
ring_buffer_size_t firstHalf = rbuf->bufferSize - index;
|
||||
*dataPtr1 = &rbuf->buffer[index*rbuf->elementSizeBytes];
|
||||
*sizePtr1 = firstHalf;
|
||||
*dataPtr2 = &rbuf->buffer[0];
|
||||
*sizePtr2 = elementCount - firstHalf;
|
||||
}
|
||||
else
|
||||
{
|
||||
*dataPtr1 = &rbuf->buffer[index*rbuf->elementSizeBytes];
|
||||
*sizePtr1 = elementCount;
|
||||
*dataPtr2 = NULL;
|
||||
*sizePtr2 = 0;
|
||||
}
|
||||
|
||||
if( available )
|
||||
PaUtil_FullMemoryBarrier(); /* (write-after-read) => full barrier */
|
||||
|
||||
return elementCount;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
*/
|
||||
ring_buffer_size_t PaUtil_AdvanceRingBufferWriteIndex( PaUtilRingBuffer *rbuf, ring_buffer_size_t elementCount )
|
||||
{
|
||||
/* ensure that previous writes are seen before we update the write index
|
||||
(write after write)
|
||||
*/
|
||||
PaUtil_WriteMemoryBarrier();
|
||||
return rbuf->writeIndex = (rbuf->writeIndex + elementCount) & rbuf->bigMask;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
** Get address of region(s) from which we can read data.
|
||||
** If the region is contiguous, size2 will be zero.
|
||||
** If non-contiguous, size2 will be the size of second region.
|
||||
** Returns room available to be read or elementCount, whichever is smaller.
|
||||
*/
|
||||
ring_buffer_size_t PaUtil_GetRingBufferReadRegions( PaUtilRingBuffer *rbuf, ring_buffer_size_t elementCount,
|
||||
void **dataPtr1, ring_buffer_size_t *sizePtr1,
|
||||
void **dataPtr2, ring_buffer_size_t *sizePtr2 )
|
||||
{
|
||||
ring_buffer_size_t index;
|
||||
ring_buffer_size_t available = PaUtil_GetRingBufferReadAvailable( rbuf ); /* doesn't use memory barrier */
|
||||
if( elementCount > available ) elementCount = available;
|
||||
/* Check to see if read is not contiguous. */
|
||||
index = rbuf->readIndex & rbuf->smallMask;
|
||||
if( (index + elementCount) > rbuf->bufferSize )
|
||||
{
|
||||
/* Write data in two blocks that wrap the buffer. */
|
||||
ring_buffer_size_t firstHalf = rbuf->bufferSize - index;
|
||||
*dataPtr1 = &rbuf->buffer[index*rbuf->elementSizeBytes];
|
||||
*sizePtr1 = firstHalf;
|
||||
*dataPtr2 = &rbuf->buffer[0];
|
||||
*sizePtr2 = elementCount - firstHalf;
|
||||
}
|
||||
else
|
||||
{
|
||||
*dataPtr1 = &rbuf->buffer[index*rbuf->elementSizeBytes];
|
||||
*sizePtr1 = elementCount;
|
||||
*dataPtr2 = NULL;
|
||||
*sizePtr2 = 0;
|
||||
}
|
||||
|
||||
if( available )
|
||||
PaUtil_ReadMemoryBarrier(); /* (read-after-read) => read barrier */
|
||||
|
||||
return elementCount;
|
||||
}
|
||||
/***************************************************************************
|
||||
*/
|
||||
ring_buffer_size_t PaUtil_AdvanceRingBufferReadIndex( PaUtilRingBuffer *rbuf, ring_buffer_size_t elementCount )
|
||||
{
|
||||
/* ensure that previous reads (copies out of the ring buffer) are always completed before updating (writing) the read index.
|
||||
(write-after-read) => full barrier
|
||||
*/
|
||||
PaUtil_FullMemoryBarrier();
|
||||
return rbuf->readIndex = (rbuf->readIndex + elementCount) & rbuf->bigMask;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
** Return elements written. */
|
||||
ring_buffer_size_t PaUtil_WriteRingBuffer( PaUtilRingBuffer *rbuf, const void *data, ring_buffer_size_t elementCount )
|
||||
{
|
||||
ring_buffer_size_t size1, size2, numWritten;
|
||||
void *data1, *data2;
|
||||
numWritten = PaUtil_GetRingBufferWriteRegions( rbuf, elementCount, &data1, &size1, &data2, &size2 );
|
||||
if( size2 > 0 )
|
||||
{
|
||||
|
||||
memcpy( data1, data, size1*rbuf->elementSizeBytes );
|
||||
data = ((char *)data) + size1*rbuf->elementSizeBytes;
|
||||
memcpy( data2, data, size2*rbuf->elementSizeBytes );
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy( data1, data, size1*rbuf->elementSizeBytes );
|
||||
}
|
||||
PaUtil_AdvanceRingBufferWriteIndex( rbuf, numWritten );
|
||||
return numWritten;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
** Return elements read. */
|
||||
ring_buffer_size_t PaUtil_ReadRingBuffer( PaUtilRingBuffer *rbuf, void *data, ring_buffer_size_t elementCount )
|
||||
{
|
||||
ring_buffer_size_t size1, size2, numRead;
|
||||
void *data1, *data2;
|
||||
numRead = PaUtil_GetRingBufferReadRegions( rbuf, elementCount, &data1, &size1, &data2, &size2 );
|
||||
if( size2 > 0 )
|
||||
{
|
||||
memcpy( data, data1, size1*rbuf->elementSizeBytes );
|
||||
data = ((char *)data) + size1*rbuf->elementSizeBytes;
|
||||
memcpy( data, data2, size2*rbuf->elementSizeBytes );
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy( data, data1, size1*rbuf->elementSizeBytes );
|
||||
}
|
||||
PaUtil_AdvanceRingBufferReadIndex( rbuf, numRead );
|
||||
return numRead;
|
||||
}
|
236
pd-0.44-2/portaudio/src/common/pa_ringbuffer.h
Normal file
236
pd-0.44-2/portaudio/src/common/pa_ringbuffer.h
Normal file
|
@ -0,0 +1,236 @@
|
|||
#ifndef PA_RINGBUFFER_H
|
||||
#define PA_RINGBUFFER_H
|
||||
/*
|
||||
* $Id: pa_ringbuffer.h 1873 2012-10-07 19:00:11Z philburk $
|
||||
* Portable Audio I/O Library
|
||||
* Ring Buffer utility.
|
||||
*
|
||||
* Author: Phil Burk, http://www.softsynth.com
|
||||
* modified for SMP safety on OS X by Bjorn Roche.
|
||||
* also allowed for const where possible.
|
||||
* modified for multiple-byte-sized data elements by Sven Fischer
|
||||
*
|
||||
* Note that this is safe only for a single-thread reader
|
||||
* and a single-thread writer.
|
||||
*
|
||||
* This program is distributed with the PortAudio Portable Audio Library.
|
||||
* For more information see: http://www.portaudio.com
|
||||
* Copyright (c) 1999-2000 Ross Bencina and Phil Burk
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
@ingroup common_src
|
||||
@brief Single-reader single-writer lock-free ring buffer
|
||||
|
||||
PaUtilRingBuffer is a ring buffer used to transport samples between
|
||||
different execution contexts (threads, OS callbacks, interrupt handlers)
|
||||
without requiring the use of any locks. This only works when there is
|
||||
a single reader and a single writer (ie. one thread or callback writes
|
||||
to the ring buffer, another thread or callback reads from it).
|
||||
|
||||
The PaUtilRingBuffer structure manages a ring buffer containing N
|
||||
elements, where N must be a power of two. An element may be any size
|
||||
(specified in bytes).
|
||||
|
||||
The memory area used to store the buffer elements must be allocated by
|
||||
the client prior to calling PaUtil_InitializeRingBuffer() and must outlive
|
||||
the use of the ring buffer.
|
||||
|
||||
@note The ring buffer functions are not normally exposed in the PortAudio libraries.
|
||||
If you want to call them then you will need to add pa_ringbuffer.c to your application source code.
|
||||
*/
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#include <sys/types.h>
|
||||
typedef int32_t ring_buffer_size_t;
|
||||
#elif defined( __GNUC__ )
|
||||
typedef long ring_buffer_size_t;
|
||||
#elif (_MSC_VER >= 1400)
|
||||
typedef long ring_buffer_size_t;
|
||||
#elif defined(_MSC_VER) || defined(__BORLANDC__)
|
||||
typedef long ring_buffer_size_t;
|
||||
#else
|
||||
typedef long ring_buffer_size_t;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
typedef struct PaUtilRingBuffer
|
||||
{
|
||||
ring_buffer_size_t bufferSize; /**< Number of elements in FIFO. Power of 2. Set by PaUtil_InitRingBuffer. */
|
||||
volatile ring_buffer_size_t writeIndex; /**< Index of next writable element. Set by PaUtil_AdvanceRingBufferWriteIndex. */
|
||||
volatile ring_buffer_size_t readIndex; /**< Index of next readable element. Set by PaUtil_AdvanceRingBufferReadIndex. */
|
||||
ring_buffer_size_t bigMask; /**< Used for wrapping indices with extra bit to distinguish full/empty. */
|
||||
ring_buffer_size_t smallMask; /**< Used for fitting indices to buffer. */
|
||||
ring_buffer_size_t elementSizeBytes; /**< Number of bytes per element. */
|
||||
char *buffer; /**< Pointer to the buffer containing the actual data. */
|
||||
}PaUtilRingBuffer;
|
||||
|
||||
/** Initialize Ring Buffer to empty state ready to have elements written to it.
|
||||
|
||||
@param rbuf The ring buffer.
|
||||
|
||||
@param elementSizeBytes The size of a single data element in bytes.
|
||||
|
||||
@param elementCount The number of elements in the buffer (must be a power of 2).
|
||||
|
||||
@param dataPtr A pointer to a previously allocated area where the data
|
||||
will be maintained. It must be elementCount*elementSizeBytes long.
|
||||
|
||||
@return -1 if elementCount is not a power of 2, otherwise 0.
|
||||
*/
|
||||
ring_buffer_size_t PaUtil_InitializeRingBuffer( PaUtilRingBuffer *rbuf, ring_buffer_size_t elementSizeBytes, ring_buffer_size_t elementCount, void *dataPtr );
|
||||
|
||||
/** Reset buffer to empty. Should only be called when buffer is NOT being read or written.
|
||||
|
||||
@param rbuf The ring buffer.
|
||||
*/
|
||||
void PaUtil_FlushRingBuffer( PaUtilRingBuffer *rbuf );
|
||||
|
||||
/** Retrieve the number of elements available in the ring buffer for writing.
|
||||
|
||||
@param rbuf The ring buffer.
|
||||
|
||||
@return The number of elements available for writing.
|
||||
*/
|
||||
ring_buffer_size_t PaUtil_GetRingBufferWriteAvailable( const PaUtilRingBuffer *rbuf );
|
||||
|
||||
/** Retrieve the number of elements available in the ring buffer for reading.
|
||||
|
||||
@param rbuf The ring buffer.
|
||||
|
||||
@return The number of elements available for reading.
|
||||
*/
|
||||
ring_buffer_size_t PaUtil_GetRingBufferReadAvailable( const PaUtilRingBuffer *rbuf );
|
||||
|
||||
/** Write data to the ring buffer.
|
||||
|
||||
@param rbuf The ring buffer.
|
||||
|
||||
@param data The address of new data to write to the buffer.
|
||||
|
||||
@param elementCount The number of elements to be written.
|
||||
|
||||
@return The number of elements written.
|
||||
*/
|
||||
ring_buffer_size_t PaUtil_WriteRingBuffer( PaUtilRingBuffer *rbuf, const void *data, ring_buffer_size_t elementCount );
|
||||
|
||||
/** Read data from the ring buffer.
|
||||
|
||||
@param rbuf The ring buffer.
|
||||
|
||||
@param data The address where the data should be stored.
|
||||
|
||||
@param elementCount The number of elements to be read.
|
||||
|
||||
@return The number of elements read.
|
||||
*/
|
||||
ring_buffer_size_t PaUtil_ReadRingBuffer( PaUtilRingBuffer *rbuf, void *data, ring_buffer_size_t elementCount );
|
||||
|
||||
/** Get address of region(s) to which we can write data.
|
||||
|
||||
@param rbuf The ring buffer.
|
||||
|
||||
@param elementCount The number of elements desired.
|
||||
|
||||
@param dataPtr1 The address where the first (or only) region pointer will be
|
||||
stored.
|
||||
|
||||
@param sizePtr1 The address where the first (or only) region length will be
|
||||
stored.
|
||||
|
||||
@param dataPtr2 The address where the second region pointer will be stored if
|
||||
the first region is too small to satisfy elementCount.
|
||||
|
||||
@param sizePtr2 The address where the second region length will be stored if
|
||||
the first region is too small to satisfy elementCount.
|
||||
|
||||
@return The room available to be written or elementCount, whichever is smaller.
|
||||
*/
|
||||
ring_buffer_size_t PaUtil_GetRingBufferWriteRegions( PaUtilRingBuffer *rbuf, ring_buffer_size_t elementCount,
|
||||
void **dataPtr1, ring_buffer_size_t *sizePtr1,
|
||||
void **dataPtr2, ring_buffer_size_t *sizePtr2 );
|
||||
|
||||
/** Advance the write index to the next location to be written.
|
||||
|
||||
@param rbuf The ring buffer.
|
||||
|
||||
@param elementCount The number of elements to advance.
|
||||
|
||||
@return The new position.
|
||||
*/
|
||||
ring_buffer_size_t PaUtil_AdvanceRingBufferWriteIndex( PaUtilRingBuffer *rbuf, ring_buffer_size_t elementCount );
|
||||
|
||||
/** Get address of region(s) from which we can read data.
|
||||
|
||||
@param rbuf The ring buffer.
|
||||
|
||||
@param elementCount The number of elements desired.
|
||||
|
||||
@param dataPtr1 The address where the first (or only) region pointer will be
|
||||
stored.
|
||||
|
||||
@param sizePtr1 The address where the first (or only) region length will be
|
||||
stored.
|
||||
|
||||
@param dataPtr2 The address where the second region pointer will be stored if
|
||||
the first region is too small to satisfy elementCount.
|
||||
|
||||
@param sizePtr2 The address where the second region length will be stored if
|
||||
the first region is too small to satisfy elementCount.
|
||||
|
||||
@return The number of elements available for reading.
|
||||
*/
|
||||
ring_buffer_size_t PaUtil_GetRingBufferReadRegions( PaUtilRingBuffer *rbuf, ring_buffer_size_t elementCount,
|
||||
void **dataPtr1, ring_buffer_size_t *sizePtr1,
|
||||
void **dataPtr2, ring_buffer_size_t *sizePtr2 );
|
||||
|
||||
/** Advance the read index to the next location to be read.
|
||||
|
||||
@param rbuf The ring buffer.
|
||||
|
||||
@param elementCount The number of elements to advance.
|
||||
|
||||
@return The new position.
|
||||
*/
|
||||
ring_buffer_size_t PaUtil_AdvanceRingBufferReadIndex( PaUtilRingBuffer *rbuf, ring_buffer_size_t elementCount );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* PA_RINGBUFFER_H */
|
150
pd-0.44-2/portaudio/src/common/pa_stream.c
Normal file
150
pd-0.44-2/portaudio/src/common/pa_stream.c
Normal file
|
@ -0,0 +1,150 @@
|
|||
/*
|
||||
* $Id: pa_stream.c 1339 2008-02-15 07:50:33Z rossb $
|
||||
* Portable Audio I/O Library
|
||||
* stream interface
|
||||
*
|
||||
* Based on the Open Source API proposed by Ross Bencina
|
||||
* Copyright (c) 2008 Ross Bencina
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
@ingroup common_src
|
||||
|
||||
@brief Stream interfaces, representation structures and helper functions
|
||||
used to interface between pa_front.c host API implementations.
|
||||
*/
|
||||
|
||||
|
||||
#include "pa_stream.h"
|
||||
|
||||
|
||||
void PaUtil_InitializeStreamInterface( PaUtilStreamInterface *streamInterface,
|
||||
PaError (*Close)( PaStream* ),
|
||||
PaError (*Start)( PaStream* ),
|
||||
PaError (*Stop)( PaStream* ),
|
||||
PaError (*Abort)( PaStream* ),
|
||||
PaError (*IsStopped)( PaStream* ),
|
||||
PaError (*IsActive)( PaStream* ),
|
||||
PaTime (*GetTime)( PaStream* ),
|
||||
double (*GetCpuLoad)( PaStream* ),
|
||||
PaError (*Read)( PaStream*, void *, unsigned long ),
|
||||
PaError (*Write)( PaStream*, const void *, unsigned long ),
|
||||
signed long (*GetReadAvailable)( PaStream* ),
|
||||
signed long (*GetWriteAvailable)( PaStream* ) )
|
||||
{
|
||||
streamInterface->Close = Close;
|
||||
streamInterface->Start = Start;
|
||||
streamInterface->Stop = Stop;
|
||||
streamInterface->Abort = Abort;
|
||||
streamInterface->IsStopped = IsStopped;
|
||||
streamInterface->IsActive = IsActive;
|
||||
streamInterface->GetTime = GetTime;
|
||||
streamInterface->GetCpuLoad = GetCpuLoad;
|
||||
streamInterface->Read = Read;
|
||||
streamInterface->Write = Write;
|
||||
streamInterface->GetReadAvailable = GetReadAvailable;
|
||||
streamInterface->GetWriteAvailable = GetWriteAvailable;
|
||||
}
|
||||
|
||||
|
||||
void PaUtil_InitializeStreamRepresentation( PaUtilStreamRepresentation *streamRepresentation,
|
||||
PaUtilStreamInterface *streamInterface,
|
||||
PaStreamCallback *streamCallback,
|
||||
void *userData )
|
||||
{
|
||||
streamRepresentation->magic = PA_STREAM_MAGIC;
|
||||
streamRepresentation->nextOpenStream = 0;
|
||||
streamRepresentation->streamInterface = streamInterface;
|
||||
streamRepresentation->streamCallback = streamCallback;
|
||||
streamRepresentation->streamFinishedCallback = 0;
|
||||
|
||||
streamRepresentation->userData = userData;
|
||||
|
||||
streamRepresentation->streamInfo.inputLatency = 0.;
|
||||
streamRepresentation->streamInfo.outputLatency = 0.;
|
||||
streamRepresentation->streamInfo.sampleRate = 0.;
|
||||
}
|
||||
|
||||
|
||||
void PaUtil_TerminateStreamRepresentation( PaUtilStreamRepresentation *streamRepresentation )
|
||||
{
|
||||
streamRepresentation->magic = 0;
|
||||
}
|
||||
|
||||
|
||||
PaError PaUtil_DummyRead( PaStream* stream,
|
||||
void *buffer,
|
||||
unsigned long frames )
|
||||
{
|
||||
(void)stream; /* unused parameter */
|
||||
(void)buffer; /* unused parameter */
|
||||
(void)frames; /* unused parameter */
|
||||
|
||||
return paCanNotReadFromACallbackStream;
|
||||
}
|
||||
|
||||
|
||||
PaError PaUtil_DummyWrite( PaStream* stream,
|
||||
const void *buffer,
|
||||
unsigned long frames )
|
||||
{
|
||||
(void)stream; /* unused parameter */
|
||||
(void)buffer; /* unused parameter */
|
||||
(void)frames; /* unused parameter */
|
||||
|
||||
return paCanNotWriteToACallbackStream;
|
||||
}
|
||||
|
||||
|
||||
signed long PaUtil_DummyGetReadAvailable( PaStream* stream )
|
||||
{
|
||||
(void)stream; /* unused parameter */
|
||||
|
||||
return paCanNotReadFromACallbackStream;
|
||||
}
|
||||
|
||||
|
||||
signed long PaUtil_DummyGetWriteAvailable( PaStream* stream )
|
||||
{
|
||||
(void)stream; /* unused parameter */
|
||||
|
||||
return paCanNotWriteToACallbackStream;
|
||||
}
|
||||
|
||||
|
||||
double PaUtil_DummyGetCpuLoad( PaStream* stream )
|
||||
{
|
||||
(void)stream; /* unused parameter */
|
||||
|
||||
return 0.0;
|
||||
}
|
205
pd-0.44-2/portaudio/src/common/pa_stream.h
Normal file
205
pd-0.44-2/portaudio/src/common/pa_stream.h
Normal file
|
@ -0,0 +1,205 @@
|
|||
#ifndef PA_STREAM_H
|
||||
#define PA_STREAM_H
|
||||
/*
|
||||
* $Id: pa_stream.h 1339 2008-02-15 07:50:33Z rossb $
|
||||
* Portable Audio I/O Library
|
||||
* stream interface
|
||||
*
|
||||
* Based on the Open Source API proposed by Ross Bencina
|
||||
* Copyright (c) 1999-2008 Ross Bencina, Phil Burk
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
@ingroup common_src
|
||||
|
||||
@brief Stream interfaces, representation structures and helper functions
|
||||
used to interface between pa_front.c host API implementations.
|
||||
*/
|
||||
|
||||
|
||||
#include "portaudio.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#define PA_STREAM_MAGIC (0x18273645)
|
||||
|
||||
|
||||
/** A structure representing an (abstract) interface to a host API. Contains
|
||||
pointers to functions which implement the interface.
|
||||
|
||||
All PaStreamInterface functions are guaranteed to be called with a non-null,
|
||||
valid stream parameter.
|
||||
*/
|
||||
typedef struct {
|
||||
PaError (*Close)( PaStream* stream );
|
||||
PaError (*Start)( PaStream *stream );
|
||||
PaError (*Stop)( PaStream *stream );
|
||||
PaError (*Abort)( PaStream *stream );
|
||||
PaError (*IsStopped)( PaStream *stream );
|
||||
PaError (*IsActive)( PaStream *stream );
|
||||
PaTime (*GetTime)( PaStream *stream );
|
||||
double (*GetCpuLoad)( PaStream* stream );
|
||||
PaError (*Read)( PaStream* stream, void *buffer, unsigned long frames );
|
||||
PaError (*Write)( PaStream* stream, const void *buffer, unsigned long frames );
|
||||
signed long (*GetReadAvailable)( PaStream* stream );
|
||||
signed long (*GetWriteAvailable)( PaStream* stream );
|
||||
} PaUtilStreamInterface;
|
||||
|
||||
|
||||
/** Initialize the fields of a PaUtilStreamInterface structure.
|
||||
*/
|
||||
void PaUtil_InitializeStreamInterface( PaUtilStreamInterface *streamInterface,
|
||||
PaError (*Close)( PaStream* ),
|
||||
PaError (*Start)( PaStream* ),
|
||||
PaError (*Stop)( PaStream* ),
|
||||
PaError (*Abort)( PaStream* ),
|
||||
PaError (*IsStopped)( PaStream* ),
|
||||
PaError (*IsActive)( PaStream* ),
|
||||
PaTime (*GetTime)( PaStream* ),
|
||||
double (*GetCpuLoad)( PaStream* ),
|
||||
PaError (*Read)( PaStream* stream, void *buffer, unsigned long frames ),
|
||||
PaError (*Write)( PaStream* stream, const void *buffer, unsigned long frames ),
|
||||
signed long (*GetReadAvailable)( PaStream* stream ),
|
||||
signed long (*GetWriteAvailable)( PaStream* stream ) );
|
||||
|
||||
|
||||
/** Dummy Read function for use in interfaces to a callback based streams.
|
||||
Pass to the Read parameter of PaUtil_InitializeStreamInterface.
|
||||
@return An error code indicating that the function has no effect
|
||||
because the stream is a callback stream.
|
||||
*/
|
||||
PaError PaUtil_DummyRead( PaStream* stream,
|
||||
void *buffer,
|
||||
unsigned long frames );
|
||||
|
||||
|
||||
/** Dummy Write function for use in an interfaces to callback based streams.
|
||||
Pass to the Write parameter of PaUtil_InitializeStreamInterface.
|
||||
@return An error code indicating that the function has no effect
|
||||
because the stream is a callback stream.
|
||||
*/
|
||||
PaError PaUtil_DummyWrite( PaStream* stream,
|
||||
const void *buffer,
|
||||
unsigned long frames );
|
||||
|
||||
|
||||
/** Dummy GetReadAvailable function for use in interfaces to callback based
|
||||
streams. Pass to the GetReadAvailable parameter of PaUtil_InitializeStreamInterface.
|
||||
@return An error code indicating that the function has no effect
|
||||
because the stream is a callback stream.
|
||||
*/
|
||||
signed long PaUtil_DummyGetReadAvailable( PaStream* stream );
|
||||
|
||||
|
||||
/** Dummy GetWriteAvailable function for use in interfaces to callback based
|
||||
streams. Pass to the GetWriteAvailable parameter of PaUtil_InitializeStreamInterface.
|
||||
@return An error code indicating that the function has no effect
|
||||
because the stream is a callback stream.
|
||||
*/
|
||||
signed long PaUtil_DummyGetWriteAvailable( PaStream* stream );
|
||||
|
||||
|
||||
|
||||
/** Dummy GetCpuLoad function for use in an interface to a read/write stream.
|
||||
Pass to the GetCpuLoad parameter of PaUtil_InitializeStreamInterface.
|
||||
@return Returns 0.
|
||||
*/
|
||||
double PaUtil_DummyGetCpuLoad( PaStream* stream );
|
||||
|
||||
|
||||
/** Non host specific data for a stream. This data is used by pa_front to
|
||||
forward to the appropriate functions in the streamInterface structure.
|
||||
*/
|
||||
typedef struct PaUtilStreamRepresentation {
|
||||
unsigned long magic; /**< set to PA_STREAM_MAGIC */
|
||||
struct PaUtilStreamRepresentation *nextOpenStream; /**< field used by multi-api code */
|
||||
PaUtilStreamInterface *streamInterface;
|
||||
PaStreamCallback *streamCallback;
|
||||
PaStreamFinishedCallback *streamFinishedCallback;
|
||||
void *userData;
|
||||
PaStreamInfo streamInfo;
|
||||
} PaUtilStreamRepresentation;
|
||||
|
||||
|
||||
/** Initialize a PaUtilStreamRepresentation structure.
|
||||
|
||||
@see PaUtil_InitializeStreamRepresentation
|
||||
*/
|
||||
void PaUtil_InitializeStreamRepresentation(
|
||||
PaUtilStreamRepresentation *streamRepresentation,
|
||||
PaUtilStreamInterface *streamInterface,
|
||||
PaStreamCallback *streamCallback,
|
||||
void *userData );
|
||||
|
||||
|
||||
/** Clean up a PaUtilStreamRepresentation structure previously initialized
|
||||
by a call to PaUtil_InitializeStreamRepresentation.
|
||||
|
||||
@see PaUtil_InitializeStreamRepresentation
|
||||
*/
|
||||
void PaUtil_TerminateStreamRepresentation( PaUtilStreamRepresentation *streamRepresentation );
|
||||
|
||||
|
||||
/** Check that the stream pointer is valid.
|
||||
|
||||
@return Returns paNoError if the stream pointer appears to be OK, otherwise
|
||||
returns an error indicating the cause of failure.
|
||||
*/
|
||||
PaError PaUtil_ValidateStreamPointer( PaStream *stream );
|
||||
|
||||
|
||||
/** Cast an opaque stream pointer into a pointer to a PaUtilStreamRepresentation.
|
||||
|
||||
@see PaUtilStreamRepresentation
|
||||
*/
|
||||
#define PA_STREAM_REP( stream )\
|
||||
((PaUtilStreamRepresentation*) (stream) )
|
||||
|
||||
|
||||
/** Cast an opaque stream pointer into a pointer to a PaUtilStreamInterface.
|
||||
|
||||
@see PaUtilStreamRepresentation, PaUtilStreamInterface
|
||||
*/
|
||||
#define PA_STREAM_INTERFACE( stream )\
|
||||
PA_STREAM_REP( (stream) )->streamInterface
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* PA_STREAM_H */
|
230
pd-0.44-2/portaudio/src/common/pa_trace.c
Normal file
230
pd-0.44-2/portaudio/src/common/pa_trace.c
Normal file
|
@ -0,0 +1,230 @@
|
|||
/*
|
||||
* $Id: pa_trace.c 1812 2012-02-14 09:32:57Z robiwan $
|
||||
* Portable Audio I/O Library Trace Facility
|
||||
* Store trace information in real-time for later printing.
|
||||
*
|
||||
* Based on the Open Source API proposed by Ross Bencina
|
||||
* Copyright (c) 1999-2000 Phil Burk
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
@ingroup common_src
|
||||
|
||||
@brief Real-time safe event trace logging facility for debugging.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include "pa_trace.h"
|
||||
#include "pa_util.h"
|
||||
#include "pa_debugprint.h"
|
||||
|
||||
#if PA_TRACE_REALTIME_EVENTS
|
||||
|
||||
static char const *traceTextArray[PA_MAX_TRACE_RECORDS];
|
||||
static int traceIntArray[PA_MAX_TRACE_RECORDS];
|
||||
static int traceIndex = 0;
|
||||
static int traceBlock = 0;
|
||||
|
||||
/*********************************************************************/
|
||||
void PaUtil_ResetTraceMessages()
|
||||
{
|
||||
traceIndex = 0;
|
||||
}
|
||||
|
||||
/*********************************************************************/
|
||||
void PaUtil_DumpTraceMessages()
|
||||
{
|
||||
int i;
|
||||
int messageCount = (traceIndex < PA_MAX_TRACE_RECORDS) ? traceIndex : PA_MAX_TRACE_RECORDS;
|
||||
|
||||
printf("DumpTraceMessages: traceIndex = %d\n", traceIndex );
|
||||
for( i=0; i<messageCount; i++ )
|
||||
{
|
||||
printf("%3d: %s = 0x%08X\n",
|
||||
i, traceTextArray[i], traceIntArray[i] );
|
||||
}
|
||||
PaUtil_ResetTraceMessages();
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
/*********************************************************************/
|
||||
void PaUtil_AddTraceMessage( const char *msg, int data )
|
||||
{
|
||||
if( (traceIndex == PA_MAX_TRACE_RECORDS) && (traceBlock == 0) )
|
||||
{
|
||||
traceBlock = 1;
|
||||
/* PaUtil_DumpTraceMessages(); */
|
||||
}
|
||||
else if( traceIndex < PA_MAX_TRACE_RECORDS )
|
||||
{
|
||||
traceTextArray[traceIndex] = msg;
|
||||
traceIntArray[traceIndex] = data;
|
||||
traceIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* High performance log alternative */
|
||||
/************************************************************************/
|
||||
|
||||
typedef unsigned long long PaUint64;
|
||||
|
||||
typedef struct __PaHighPerformanceLog
|
||||
{
|
||||
unsigned magik;
|
||||
int writePtr;
|
||||
int readPtr;
|
||||
int size;
|
||||
double refTime;
|
||||
char* data;
|
||||
} PaHighPerformanceLog;
|
||||
|
||||
static const unsigned kMagik = 0xcafebabe;
|
||||
|
||||
#define USEC_PER_SEC (1000000ULL)
|
||||
|
||||
int PaUtil_InitializeHighSpeedLog( LogHandle* phLog, unsigned maxSizeInBytes )
|
||||
{
|
||||
PaHighPerformanceLog* pLog = (PaHighPerformanceLog*)PaUtil_AllocateMemory(sizeof(PaHighPerformanceLog));
|
||||
if (pLog == 0)
|
||||
{
|
||||
return paInsufficientMemory;
|
||||
}
|
||||
assert(phLog != 0);
|
||||
*phLog = pLog;
|
||||
|
||||
pLog->data = (char*)PaUtil_AllocateMemory(maxSizeInBytes);
|
||||
if (pLog->data == 0)
|
||||
{
|
||||
PaUtil_FreeMemory(pLog);
|
||||
return paInsufficientMemory;
|
||||
}
|
||||
pLog->magik = kMagik;
|
||||
pLog->size = maxSizeInBytes;
|
||||
pLog->refTime = PaUtil_GetTime();
|
||||
return paNoError;
|
||||
}
|
||||
|
||||
void PaUtil_ResetHighSpeedLogTimeRef( LogHandle hLog )
|
||||
{
|
||||
PaHighPerformanceLog* pLog = (PaHighPerformanceLog*)hLog;
|
||||
assert(pLog->magik == kMagik);
|
||||
pLog->refTime = PaUtil_GetTime();
|
||||
}
|
||||
|
||||
typedef struct __PaLogEntryHeader
|
||||
{
|
||||
int size;
|
||||
double timeStamp;
|
||||
} PaLogEntryHeader;
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define _vsnprintf vsnprintf
|
||||
#define min(a,b) ((a)<(b)?(a):(b))
|
||||
#endif
|
||||
|
||||
|
||||
int PaUtil_AddHighSpeedLogMessage( LogHandle hLog, const char* fmt, ... )
|
||||
{
|
||||
va_list l;
|
||||
int n = 0;
|
||||
PaHighPerformanceLog* pLog = (PaHighPerformanceLog*)hLog;
|
||||
if (pLog != 0)
|
||||
{
|
||||
PaLogEntryHeader* pHeader;
|
||||
char* p;
|
||||
int maxN;
|
||||
assert(pLog->magik == kMagik);
|
||||
pHeader = (PaLogEntryHeader*)( pLog->data + pLog->writePtr );
|
||||
p = (char*)( pHeader + 1 );
|
||||
maxN = pLog->size - pLog->writePtr - 2 * sizeof(PaLogEntryHeader);
|
||||
|
||||
pHeader->timeStamp = PaUtil_GetTime() - pLog->refTime;
|
||||
if (maxN > 0)
|
||||
{
|
||||
if (maxN > 32)
|
||||
{
|
||||
va_start(l, fmt);
|
||||
n = _vsnprintf(p, min(1024, maxN), fmt, l);
|
||||
va_end(l);
|
||||
}
|
||||
else {
|
||||
n = sprintf(p, "End of log...");
|
||||
}
|
||||
n = ((n + sizeof(unsigned)) & ~(sizeof(unsigned)-1)) + sizeof(PaLogEntryHeader);
|
||||
pHeader->size = n;
|
||||
#if 0
|
||||
PaUtil_DebugPrint("%05u.%03u: %s\n", pHeader->timeStamp/1000, pHeader->timeStamp%1000, p);
|
||||
#endif
|
||||
pLog->writePtr += n;
|
||||
}
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
void PaUtil_DumpHighSpeedLog( LogHandle hLog, const char* fileName )
|
||||
{
|
||||
FILE* f = (fileName != NULL) ? fopen(fileName, "w") : stdout;
|
||||
unsigned localWritePtr;
|
||||
PaHighPerformanceLog* pLog = (PaHighPerformanceLog*)hLog;
|
||||
assert(pLog->magik == kMagik);
|
||||
localWritePtr = pLog->writePtr;
|
||||
while (pLog->readPtr != localWritePtr)
|
||||
{
|
||||
const PaLogEntryHeader* pHeader = (const PaLogEntryHeader*)( pLog->data + pLog->readPtr );
|
||||
const char* p = (const char*)( pHeader + 1 );
|
||||
const PaUint64 ts = (const PaUint64)( pHeader->timeStamp * USEC_PER_SEC );
|
||||
assert(pHeader->size < (1024+sizeof(unsigned)+sizeof(PaLogEntryHeader)));
|
||||
fprintf(f, "%05u.%03u: %s\n", (unsigned)(ts/1000), (unsigned)(ts%1000), p);
|
||||
pLog->readPtr += pHeader->size;
|
||||
}
|
||||
if (f != stdout)
|
||||
{
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
|
||||
void PaUtil_DiscardHighSpeedLog( LogHandle hLog )
|
||||
{
|
||||
PaHighPerformanceLog* pLog = (PaHighPerformanceLog*)hLog;
|
||||
assert(pLog->magik == kMagik);
|
||||
PaUtil_FreeMemory(pLog->data);
|
||||
PaUtil_FreeMemory(pLog);
|
||||
}
|
||||
|
||||
#endif /* TRACE_REALTIME_EVENTS */
|
117
pd-0.44-2/portaudio/src/common/pa_trace.h
Normal file
117
pd-0.44-2/portaudio/src/common/pa_trace.h
Normal file
|
@ -0,0 +1,117 @@
|
|||
#ifndef PA_TRACE_H
|
||||
#define PA_TRACE_H
|
||||
/*
|
||||
* $Id: pa_trace.h 1812 2012-02-14 09:32:57Z robiwan $
|
||||
* Portable Audio I/O Library Trace Facility
|
||||
* Store trace information in real-time for later printing.
|
||||
*
|
||||
* Based on the Open Source API proposed by Ross Bencina
|
||||
* Copyright (c) 1999-2000 Phil Burk
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
@ingroup common_src
|
||||
|
||||
@brief Real-time safe event trace logging facility for debugging.
|
||||
|
||||
Allows data to be logged to a fixed size trace buffer in a real-time
|
||||
execution context (such as at interrupt time). Each log entry consists
|
||||
of a message comprising a string pointer and an int. The trace buffer
|
||||
may be dumped to stdout later.
|
||||
|
||||
This facility is only active if PA_TRACE_REALTIME_EVENTS is set to 1,
|
||||
otherwise the trace functions expand to no-ops.
|
||||
|
||||
@fn PaUtil_ResetTraceMessages
|
||||
@brief Clear the trace buffer.
|
||||
|
||||
@fn PaUtil_AddTraceMessage
|
||||
@brief Add a message to the trace buffer. A message consists of string and an int.
|
||||
@param msg The string pointer must remain valid until PaUtil_DumpTraceMessages
|
||||
is called. As a result, usually only string literals should be passed as
|
||||
the msg parameter.
|
||||
|
||||
@fn PaUtil_DumpTraceMessages
|
||||
@brief Print all messages in the trace buffer to stdout and clear the trace buffer.
|
||||
*/
|
||||
|
||||
#ifndef PA_TRACE_REALTIME_EVENTS
|
||||
#define PA_TRACE_REALTIME_EVENTS (0) /**< Set to 1 to enable logging using the trace functions defined below */
|
||||
#endif
|
||||
|
||||
#ifndef PA_MAX_TRACE_RECORDS
|
||||
#define PA_MAX_TRACE_RECORDS (2048) /**< Maximum number of records stored in trace buffer */
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#if PA_TRACE_REALTIME_EVENTS
|
||||
|
||||
void PaUtil_ResetTraceMessages();
|
||||
void PaUtil_AddTraceMessage( const char *msg, int data );
|
||||
void PaUtil_DumpTraceMessages();
|
||||
|
||||
/* Alternative interface */
|
||||
|
||||
typedef void* LogHandle;
|
||||
|
||||
int PaUtil_InitializeHighSpeedLog(LogHandle* phLog, unsigned maxSizeInBytes);
|
||||
void PaUtil_ResetHighSpeedLogTimeRef(LogHandle hLog);
|
||||
int PaUtil_AddHighSpeedLogMessage(LogHandle hLog, const char* fmt, ...);
|
||||
void PaUtil_DumpHighSpeedLog(LogHandle hLog, const char* fileName);
|
||||
void PaUtil_DiscardHighSpeedLog(LogHandle hLog);
|
||||
|
||||
#else
|
||||
|
||||
#define PaUtil_ResetTraceMessages() /* noop */
|
||||
#define PaUtil_AddTraceMessage(msg,data) /* noop */
|
||||
#define PaUtil_DumpTraceMessages() /* noop */
|
||||
|
||||
#define PaUtil_InitializeHighSpeedLog(phLog, maxSizeInBytes) (0)
|
||||
#define PaUtil_ResetHighSpeedLogTimeRef(hLog)
|
||||
#define PaUtil_AddHighSpeedLogMessage(...) (0)
|
||||
#define PaUtil_DumpHighSpeedLog(hLog, fileName)
|
||||
#define PaUtil_DiscardHighSpeedLog(hLog)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* PA_TRACE_H */
|
107
pd-0.44-2/portaudio/src/common/pa_types.h
Normal file
107
pd-0.44-2/portaudio/src/common/pa_types.h
Normal file
|
@ -0,0 +1,107 @@
|
|||
#ifndef PA_TYPES_H
|
||||
#define PA_TYPES_H
|
||||
|
||||
/*
|
||||
* Portable Audio I/O Library
|
||||
* integer type definitions
|
||||
*
|
||||
* Based on the Open Source API proposed by Ross Bencina
|
||||
* Copyright (c) 1999-2006 Ross Bencina, Phil Burk
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
@ingroup common_src
|
||||
|
||||
@brief Definition of 16 and 32 bit integer types (PaInt16, PaInt32 etc)
|
||||
|
||||
SIZEOF_SHORT, SIZEOF_INT and SIZEOF_LONG are set by the configure script
|
||||
when it is used. Otherwise we default to the common 32 bit values, if your
|
||||
platform doesn't use configure, and doesn't use the default values below
|
||||
you will need to explicitly define these symbols in your make file.
|
||||
|
||||
A PA_VALIDATE_SIZES macro is provided to assert that the values set in this
|
||||
file are correct.
|
||||
*/
|
||||
|
||||
#ifndef SIZEOF_SHORT
|
||||
#define SIZEOF_SHORT 2
|
||||
#endif
|
||||
|
||||
#ifndef SIZEOF_INT
|
||||
#define SIZEOF_INT 4
|
||||
#endif
|
||||
|
||||
#ifndef SIZEOF_LONG
|
||||
#define SIZEOF_LONG 4
|
||||
#endif
|
||||
|
||||
|
||||
#if SIZEOF_SHORT == 2
|
||||
typedef signed short PaInt16;
|
||||
typedef unsigned short PaUint16;
|
||||
#elif SIZEOF_INT == 2
|
||||
typedef signed int PaInt16;
|
||||
typedef unsigned int PaUint16;
|
||||
#else
|
||||
#error pa_types.h was unable to determine which type to use for 16bit integers on the target platform
|
||||
#endif
|
||||
|
||||
#if SIZEOF_SHORT == 4
|
||||
typedef signed short PaInt32;
|
||||
typedef unsigned short PaUint32;
|
||||
#elif SIZEOF_INT == 4
|
||||
typedef signed int PaInt32;
|
||||
typedef unsigned int PaUint32;
|
||||
#elif SIZEOF_LONG == 4
|
||||
typedef signed long PaInt32;
|
||||
typedef unsigned long PaUint32;
|
||||
#else
|
||||
#error pa_types.h was unable to determine which type to use for 32bit integers on the target platform
|
||||
#endif
|
||||
|
||||
|
||||
/* PA_VALIDATE_TYPE_SIZES compares the size of the integer types at runtime to
|
||||
ensure that PortAudio was configured correctly, and raises an assertion if
|
||||
they don't match the expected values. <assert.h> must be included in the
|
||||
context in which this macro is used.
|
||||
*/
|
||||
#define PA_VALIDATE_TYPE_SIZES \
|
||||
{ \
|
||||
assert( "PortAudio: type sizes are not correct in pa_types.h" && sizeof( PaUint16 ) == 2 ); \
|
||||
assert( "PortAudio: type sizes are not correct in pa_types.h" && sizeof( PaInt16 ) == 2 ); \
|
||||
assert( "PortAudio: type sizes are not correct in pa_types.h" && sizeof( PaUint32 ) == 4 ); \
|
||||
assert( "PortAudio: type sizes are not correct in pa_types.h" && sizeof( PaInt32 ) == 4 ); \
|
||||
}
|
||||
|
||||
|
||||
#endif /* PA_TYPES_H */
|
159
pd-0.44-2/portaudio/src/common/pa_util.h
Normal file
159
pd-0.44-2/portaudio/src/common/pa_util.h
Normal file
|
@ -0,0 +1,159 @@
|
|||
#ifndef PA_UTIL_H
|
||||
#define PA_UTIL_H
|
||||
/*
|
||||
* $Id: pa_util.h 1584 2011-02-02 18:58:17Z rossb $
|
||||
* Portable Audio I/O Library implementation utilities header
|
||||
* common implementation utilities and interfaces
|
||||
*
|
||||
* Based on the Open Source API proposed by Ross Bencina
|
||||
* Copyright (c) 1999-2008 Ross Bencina, Phil Burk
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
@ingroup common_src
|
||||
|
||||
@brief Prototypes for utility functions used by PortAudio implementations.
|
||||
|
||||
Some functions declared here are defined in pa_front.c while others
|
||||
are implemented separately for each platform.
|
||||
*/
|
||||
|
||||
|
||||
#include "portaudio.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
struct PaUtilHostApiRepresentation;
|
||||
|
||||
|
||||
/** Retrieve a specific host API representation. This function can be used
|
||||
by implementations to retrieve a pointer to their representation in
|
||||
host api specific extension functions which aren't passed a rep pointer
|
||||
by pa_front.c.
|
||||
|
||||
@param hostApi A pointer to a host API represenation pointer. Apon success
|
||||
this will receive the requested representation pointer.
|
||||
|
||||
@param type A valid host API type identifier.
|
||||
|
||||
@returns An error code. If the result is PaNoError then a pointer to the
|
||||
requested host API representation will be stored in *hostApi. If the host API
|
||||
specified by type is not found, this function returns paHostApiNotFound.
|
||||
*/
|
||||
PaError PaUtil_GetHostApiRepresentation( struct PaUtilHostApiRepresentation **hostApi,
|
||||
PaHostApiTypeId type );
|
||||
|
||||
|
||||
/** Convert a PortAudio device index into a host API specific device index.
|
||||
@param hostApiDevice Pointer to a device index, on success this will recieve the
|
||||
converted device index value.
|
||||
@param device The PortAudio device index to convert.
|
||||
@param hostApi The host api which the index should be converted for.
|
||||
|
||||
@returns On success returns PaNoError and places the converted index in the
|
||||
hostApiDevice parameter.
|
||||
*/
|
||||
PaError PaUtil_DeviceIndexToHostApiDeviceIndex(
|
||||
PaDeviceIndex *hostApiDevice, PaDeviceIndex device,
|
||||
struct PaUtilHostApiRepresentation *hostApi );
|
||||
|
||||
|
||||
/** Set the host error information returned by Pa_GetLastHostErrorInfo. This
|
||||
function and the paUnanticipatedHostError error code should be used as a
|
||||
last resort. Implementors should use existing PA error codes where possible,
|
||||
or nominate new ones. Note that at it is always better to use
|
||||
PaUtil_SetLastHostErrorInfo() and paUnanticipatedHostError than to return an
|
||||
ambiguous or inaccurate PaError code.
|
||||
|
||||
@param hostApiType The host API which encountered the error (ie of the caller)
|
||||
|
||||
@param errorCode The error code returned by the native API function.
|
||||
|
||||
@param errorText A string describing the error. PaUtil_SetLastHostErrorInfo
|
||||
makes a copy of the string, so it is not necessary for the pointer to remain
|
||||
valid after the call to PaUtil_SetLastHostErrorInfo() returns.
|
||||
|
||||
*/
|
||||
void PaUtil_SetLastHostErrorInfo( PaHostApiTypeId hostApiType, long errorCode,
|
||||
const char *errorText );
|
||||
|
||||
|
||||
|
||||
/* the following functions are implemented in a platform platform specific
|
||||
.c file
|
||||
*/
|
||||
|
||||
/** Allocate size bytes, guaranteed to be aligned to a FIXME byte boundary */
|
||||
void *PaUtil_AllocateMemory( long size );
|
||||
|
||||
|
||||
/** Realease block if non-NULL. block may be NULL */
|
||||
void PaUtil_FreeMemory( void *block );
|
||||
|
||||
|
||||
/** Return the number of currently allocated blocks. This function can be
|
||||
used for detecting memory leaks.
|
||||
|
||||
@note Allocations will only be tracked if PA_TRACK_MEMORY is #defined. If
|
||||
it isn't, this function will always return 0.
|
||||
*/
|
||||
int PaUtil_CountCurrentlyAllocatedBlocks( void );
|
||||
|
||||
|
||||
/** Initialize the clock used by PaUtil_GetTime(). Call this before calling
|
||||
PaUtil_GetTime.
|
||||
|
||||
@see PaUtil_GetTime
|
||||
*/
|
||||
void PaUtil_InitializeClock( void );
|
||||
|
||||
|
||||
/** Return the system time in seconds. Used to implement CPU load functions
|
||||
|
||||
@see PaUtil_InitializeClock
|
||||
*/
|
||||
double PaUtil_GetTime( void );
|
||||
|
||||
|
||||
/* void Pa_Sleep( long msec ); must also be implemented in per-platform .c file */
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* PA_UTIL_H */
|
4593
pd-0.44-2/portaudio/src/hostapi/alsa/pa_linux_alsa.c
Normal file
4593
pd-0.44-2/portaudio/src/hostapi/alsa/pa_linux_alsa.c
Normal file
File diff suppressed because it is too large
Load diff
572
pd-0.44-2/portaudio/src/hostapi/asio/iasiothiscallresolver.cpp
Normal file
572
pd-0.44-2/portaudio/src/hostapi/asio/iasiothiscallresolver.cpp
Normal file
|
@ -0,0 +1,572 @@
|
|||
/*
|
||||
IASIOThiscallResolver.cpp see the comments in iasiothiscallresolver.h for
|
||||
the top level description - this comment describes the technical details of
|
||||
the implementation.
|
||||
|
||||
The latest version of this file is available from:
|
||||
http://www.audiomulch.com/~rossb/code/calliasio
|
||||
|
||||
please email comments to Ross Bencina <rossb@audiomulch.com>
|
||||
|
||||
BACKGROUND
|
||||
|
||||
The IASIO interface declared in the Steinberg ASIO 2 SDK declares
|
||||
functions with no explicit calling convention. This causes MSVC++ to default
|
||||
to using the thiscall convention, which is a proprietary convention not
|
||||
implemented by some non-microsoft compilers - notably borland BCC,
|
||||
C++Builder, and gcc. MSVC++ is the defacto standard compiler used by
|
||||
Steinberg. As a result of this situation, the ASIO sdk will compile with
|
||||
any compiler, however attempting to execute the compiled code will cause a
|
||||
crash due to different default calling conventions on non-Microsoft
|
||||
compilers.
|
||||
|
||||
IASIOThiscallResolver solves the problem by providing an adapter class that
|
||||
delegates to the IASIO interface using the correct calling convention
|
||||
(thiscall). Due to the lack of support for thiscall in the Borland and GCC
|
||||
compilers, the calls have been implemented in assembly language.
|
||||
|
||||
A number of macros are defined for thiscall function calls with different
|
||||
numbers of parameters, with and without return values - it may be possible
|
||||
to modify the format of these macros to make them work with other inline
|
||||
assemblers.
|
||||
|
||||
|
||||
THISCALL DEFINITION
|
||||
|
||||
A number of definitions of the thiscall calling convention are floating
|
||||
around the internet. The following definition has been validated against
|
||||
output from the MSVC++ compiler:
|
||||
|
||||
For non-vararg functions, thiscall works as follows: the object (this)
|
||||
pointer is passed in ECX. All arguments are passed on the stack in
|
||||
right to left order. The return value is placed in EAX. The callee
|
||||
clears the passed arguments from the stack.
|
||||
|
||||
|
||||
FINDING FUNCTION POINTERS FROM AN IASIO POINTER
|
||||
|
||||
The first field of a COM object is a pointer to its vtble. Thus a pointer
|
||||
to an object implementing the IASIO interface also points to a pointer to
|
||||
that object's vtbl. The vtble is a table of function pointers for all of
|
||||
the virtual functions exposed by the implemented interfaces.
|
||||
|
||||
If we consider a variable declared as a pointer to IASO:
|
||||
|
||||
IASIO *theAsioDriver
|
||||
|
||||
theAsioDriver points to:
|
||||
|
||||
object implementing IASIO
|
||||
{
|
||||
IASIOvtbl *vtbl
|
||||
other data
|
||||
}
|
||||
|
||||
in other words, theAsioDriver points to a pointer to an IASIOvtbl
|
||||
|
||||
vtbl points to a table of function pointers:
|
||||
|
||||
IASIOvtbl ( interface IASIO : public IUnknown )
|
||||
{
|
||||
(IUnknown functions)
|
||||
0 virtual HRESULT STDMETHODCALLTYPE (*QueryInterface)(REFIID riid, void **ppv) = 0;
|
||||
4 virtual ULONG STDMETHODCALLTYPE (*AddRef)() = 0;
|
||||
8 virtual ULONG STDMETHODCALLTYPE (*Release)() = 0;
|
||||
|
||||
(IASIO functions)
|
||||
12 virtual ASIOBool (*init)(void *sysHandle) = 0;
|
||||
16 virtual void (*getDriverName)(char *name) = 0;
|
||||
20 virtual long (*getDriverVersion)() = 0;
|
||||
24 virtual void (*getErrorMessage)(char *string) = 0;
|
||||
28 virtual ASIOError (*start)() = 0;
|
||||
32 virtual ASIOError (*stop)() = 0;
|
||||
36 virtual ASIOError (*getChannels)(long *numInputChannels, long *numOutputChannels) = 0;
|
||||
40 virtual ASIOError (*getLatencies)(long *inputLatency, long *outputLatency) = 0;
|
||||
44 virtual ASIOError (*getBufferSize)(long *minSize, long *maxSize,
|
||||
long *preferredSize, long *granularity) = 0;
|
||||
48 virtual ASIOError (*canSampleRate)(ASIOSampleRate sampleRate) = 0;
|
||||
52 virtual ASIOError (*getSampleRate)(ASIOSampleRate *sampleRate) = 0;
|
||||
56 virtual ASIOError (*setSampleRate)(ASIOSampleRate sampleRate) = 0;
|
||||
60 virtual ASIOError (*getClockSources)(ASIOClockSource *clocks, long *numSources) = 0;
|
||||
64 virtual ASIOError (*setClockSource)(long reference) = 0;
|
||||
68 virtual ASIOError (*getSamplePosition)(ASIOSamples *sPos, ASIOTimeStamp *tStamp) = 0;
|
||||
72 virtual ASIOError (*getChannelInfo)(ASIOChannelInfo *info) = 0;
|
||||
76 virtual ASIOError (*createBuffers)(ASIOBufferInfo *bufferInfos, long numChannels,
|
||||
long bufferSize, ASIOCallbacks *callbacks) = 0;
|
||||
80 virtual ASIOError (*disposeBuffers)() = 0;
|
||||
84 virtual ASIOError (*controlPanel)() = 0;
|
||||
88 virtual ASIOError (*future)(long selector,void *opt) = 0;
|
||||
92 virtual ASIOError (*outputReady)() = 0;
|
||||
};
|
||||
|
||||
The numbers in the left column show the byte offset of each function ptr
|
||||
from the beginning of the vtbl. These numbers are used in the code below
|
||||
to select different functions.
|
||||
|
||||
In order to find the address of a particular function, theAsioDriver
|
||||
must first be dereferenced to find the value of the vtbl pointer:
|
||||
|
||||
mov eax, theAsioDriver
|
||||
mov edx, [theAsioDriver] // edx now points to vtbl[0]
|
||||
|
||||
Then an offset must be added to the vtbl pointer to select a
|
||||
particular function, for example vtbl+44 points to the slot containing
|
||||
a pointer to the getBufferSize function.
|
||||
|
||||
Finally vtbl+x must be dereferenced to obtain the value of the function
|
||||
pointer stored in that address:
|
||||
|
||||
call [edx+44] // call the function pointed to by
|
||||
// the value in the getBufferSize field of the vtbl
|
||||
|
||||
|
||||
SEE ALSO
|
||||
|
||||
Martin Fay's OpenASIO DLL at http://www.martinfay.com solves the same
|
||||
problem by providing a new COM interface which wraps IASIO with an
|
||||
interface that uses portable calling conventions. OpenASIO must be compiled
|
||||
with MSVC, and requires that you ship the OpenASIO DLL with your
|
||||
application.
|
||||
|
||||
|
||||
ACKNOWLEDGEMENTS
|
||||
|
||||
Ross Bencina: worked out the thiscall details above, wrote the original
|
||||
Borland asm macros, and a patch for asio.cpp (which is no longer needed).
|
||||
Thanks to Martin Fay for introducing me to the issues discussed here,
|
||||
and to Rene G. Ceballos for assisting with asm dumps from MSVC++.
|
||||
|
||||
Antti Silvast: converted the original calliasio to work with gcc and NASM
|
||||
by implementing the asm code in a separate file.
|
||||
|
||||
Fraser Adams: modified the original calliasio containing the Borland inline
|
||||
asm to add inline asm for gcc i.e. Intel syntax for Borland and AT&T syntax
|
||||
for gcc. This seems a neater approach for gcc than to have a separate .asm
|
||||
file and it means that we only need one version of the thiscall patch.
|
||||
|
||||
Fraser Adams: rewrote the original calliasio patch in the form of the
|
||||
IASIOThiscallResolver class in order to avoid modifications to files from
|
||||
the Steinberg SDK, which may have had potential licence issues.
|
||||
|
||||
Andrew Baldwin: contributed fixes for compatibility problems with more
|
||||
recent versions of the gcc assembler.
|
||||
*/
|
||||
|
||||
|
||||
// We only need IASIOThiscallResolver at all if we are on Win32. For other
|
||||
// platforms we simply bypass the IASIOThiscallResolver definition to allow us
|
||||
// to be safely #include'd whatever the platform to keep client code portable
|
||||
#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__)) && !defined(_WIN64)
|
||||
|
||||
|
||||
// If microsoft compiler we can call IASIO directly so IASIOThiscallResolver
|
||||
// is not used.
|
||||
#if !defined(_MSC_VER)
|
||||
|
||||
|
||||
#include <new>
|
||||
#include <assert.h>
|
||||
|
||||
// We have a mechanism in iasiothiscallresolver.h to ensure that asio.h is
|
||||
// #include'd before it in client code, we do NOT want to do this test here.
|
||||
#define iasiothiscallresolver_sourcefile 1
|
||||
#include "iasiothiscallresolver.h"
|
||||
#undef iasiothiscallresolver_sourcefile
|
||||
|
||||
// iasiothiscallresolver.h redefines ASIOInit for clients, but we don't want
|
||||
// this macro defined in this translation unit.
|
||||
#undef ASIOInit
|
||||
|
||||
|
||||
// theAsioDriver is a global pointer to the current IASIO instance which the
|
||||
// ASIO SDK uses to perform all actions on the IASIO interface. We substitute
|
||||
// our own forwarding interface into this pointer.
|
||||
extern IASIO* theAsioDriver;
|
||||
|
||||
|
||||
// The following macros define the inline assembler for BORLAND first then gcc
|
||||
|
||||
#if defined(__BCPLUSPLUS__) || defined(__BORLANDC__)
|
||||
|
||||
|
||||
#define CALL_THISCALL_0( resultName, thisPtr, funcOffset )\
|
||||
void *this_ = (thisPtr); \
|
||||
__asm { \
|
||||
mov ecx, this_ ; \
|
||||
mov eax, [ecx] ; \
|
||||
call [eax+funcOffset] ; \
|
||||
mov resultName, eax ; \
|
||||
}
|
||||
|
||||
|
||||
#define CALL_VOID_THISCALL_1( thisPtr, funcOffset, param1 )\
|
||||
void *this_ = (thisPtr); \
|
||||
__asm { \
|
||||
mov eax, param1 ; \
|
||||
push eax ; \
|
||||
mov ecx, this_ ; \
|
||||
mov eax, [ecx] ; \
|
||||
call [eax+funcOffset] ; \
|
||||
}
|
||||
|
||||
|
||||
#define CALL_THISCALL_1( resultName, thisPtr, funcOffset, param1 )\
|
||||
void *this_ = (thisPtr); \
|
||||
__asm { \
|
||||
mov eax, param1 ; \
|
||||
push eax ; \
|
||||
mov ecx, this_ ; \
|
||||
mov eax, [ecx] ; \
|
||||
call [eax+funcOffset] ; \
|
||||
mov resultName, eax ; \
|
||||
}
|
||||
|
||||
|
||||
#define CALL_THISCALL_1_DOUBLE( resultName, thisPtr, funcOffset, param1 )\
|
||||
void *this_ = (thisPtr); \
|
||||
void *doubleParamPtr_ (¶m1); \
|
||||
__asm { \
|
||||
mov eax, doubleParamPtr_ ; \
|
||||
push [eax+4] ; \
|
||||
push [eax] ; \
|
||||
mov ecx, this_ ; \
|
||||
mov eax, [ecx] ; \
|
||||
call [eax+funcOffset] ; \
|
||||
mov resultName, eax ; \
|
||||
}
|
||||
|
||||
|
||||
#define CALL_THISCALL_2( resultName, thisPtr, funcOffset, param1, param2 )\
|
||||
void *this_ = (thisPtr); \
|
||||
__asm { \
|
||||
mov eax, param2 ; \
|
||||
push eax ; \
|
||||
mov eax, param1 ; \
|
||||
push eax ; \
|
||||
mov ecx, this_ ; \
|
||||
mov eax, [ecx] ; \
|
||||
call [eax+funcOffset] ; \
|
||||
mov resultName, eax ; \
|
||||
}
|
||||
|
||||
|
||||
#define CALL_THISCALL_4( resultName, thisPtr, funcOffset, param1, param2, param3, param4 )\
|
||||
void *this_ = (thisPtr); \
|
||||
__asm { \
|
||||
mov eax, param4 ; \
|
||||
push eax ; \
|
||||
mov eax, param3 ; \
|
||||
push eax ; \
|
||||
mov eax, param2 ; \
|
||||
push eax ; \
|
||||
mov eax, param1 ; \
|
||||
push eax ; \
|
||||
mov ecx, this_ ; \
|
||||
mov eax, [ecx] ; \
|
||||
call [eax+funcOffset] ; \
|
||||
mov resultName, eax ; \
|
||||
}
|
||||
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
|
||||
|
||||
#define CALL_THISCALL_0( resultName, thisPtr, funcOffset ) \
|
||||
__asm__ __volatile__ ("movl (%1), %%edx\n\t" \
|
||||
"call *"#funcOffset"(%%edx)\n\t" \
|
||||
:"=a"(resultName) /* Output Operands */ \
|
||||
:"c"(thisPtr) /* Input Operands */ \
|
||||
: "%edx" /* Clobbered Registers */ \
|
||||
); \
|
||||
|
||||
|
||||
#define CALL_VOID_THISCALL_1( thisPtr, funcOffset, param1 ) \
|
||||
__asm__ __volatile__ ("pushl %0\n\t" \
|
||||
"movl (%1), %%edx\n\t" \
|
||||
"call *"#funcOffset"(%%edx)\n\t" \
|
||||
: /* Output Operands */ \
|
||||
:"r"(param1), /* Input Operands */ \
|
||||
"c"(thisPtr) \
|
||||
: "%edx" /* Clobbered Registers */ \
|
||||
); \
|
||||
|
||||
|
||||
#define CALL_THISCALL_1( resultName, thisPtr, funcOffset, param1 ) \
|
||||
__asm__ __volatile__ ("pushl %1\n\t" \
|
||||
"movl (%2), %%edx\n\t" \
|
||||
"call *"#funcOffset"(%%edx)\n\t" \
|
||||
:"=a"(resultName) /* Output Operands */ \
|
||||
:"r"(param1), /* Input Operands */ \
|
||||
"c"(thisPtr) \
|
||||
: "%edx" /* Clobbered Registers */ \
|
||||
); \
|
||||
|
||||
|
||||
#define CALL_THISCALL_1_DOUBLE( resultName, thisPtr, funcOffset, param1 ) \
|
||||
do { \
|
||||
double param1f64 = param1; /* Cast explicitly to double */ \
|
||||
double *param1f64Ptr = ¶m1f64; /* Make pointer to address */ \
|
||||
__asm__ __volatile__ ("pushl 4(%1)\n\t" \
|
||||
"pushl (%1)\n\t" \
|
||||
"movl (%2), %%edx\n\t" \
|
||||
"call *"#funcOffset"(%%edx);\n\t" \
|
||||
: "=a"(resultName) /* Output Operands */ \
|
||||
: "r"(param1f64Ptr), /* Input Operands */ \
|
||||
"c"(thisPtr), \
|
||||
"m"(*param1f64Ptr) /* Using address */ \
|
||||
: "%edx" /* Clobbered Registers */ \
|
||||
); \
|
||||
} while (0); \
|
||||
|
||||
|
||||
#define CALL_THISCALL_2( resultName, thisPtr, funcOffset, param1, param2 ) \
|
||||
__asm__ __volatile__ ("pushl %1\n\t" \
|
||||
"pushl %2\n\t" \
|
||||
"movl (%3), %%edx\n\t" \
|
||||
"call *"#funcOffset"(%%edx)\n\t" \
|
||||
:"=a"(resultName) /* Output Operands */ \
|
||||
:"r"(param2), /* Input Operands */ \
|
||||
"r"(param1), \
|
||||
"c"(thisPtr) \
|
||||
: "%edx" /* Clobbered Registers */ \
|
||||
); \
|
||||
|
||||
|
||||
#define CALL_THISCALL_4( resultName, thisPtr, funcOffset, param1, param2, param3, param4 )\
|
||||
__asm__ __volatile__ ("pushl %1\n\t" \
|
||||
"pushl %2\n\t" \
|
||||
"pushl %3\n\t" \
|
||||
"pushl %4\n\t" \
|
||||
"movl (%5), %%edx\n\t" \
|
||||
"call *"#funcOffset"(%%edx)\n\t" \
|
||||
:"=a"(resultName) /* Output Operands */ \
|
||||
:"r"(param4), /* Input Operands */ \
|
||||
"r"(param3), \
|
||||
"r"(param2), \
|
||||
"r"(param1), \
|
||||
"c"(thisPtr) \
|
||||
: "%edx" /* Clobbered Registers */ \
|
||||
); \
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// Our static singleton instance.
|
||||
IASIOThiscallResolver IASIOThiscallResolver::instance;
|
||||
|
||||
// Constructor called to initialize static Singleton instance above. Note that
|
||||
// it is important not to clear that_ incase it has already been set by the call
|
||||
// to placement new in ASIOInit().
|
||||
IASIOThiscallResolver::IASIOThiscallResolver()
|
||||
{
|
||||
}
|
||||
|
||||
// Constructor called from ASIOInit() below
|
||||
IASIOThiscallResolver::IASIOThiscallResolver(IASIO* that)
|
||||
: that_( that )
|
||||
{
|
||||
}
|
||||
|
||||
// Implement IUnknown methods as assert(false). IASIOThiscallResolver is not
|
||||
// really a COM object, just a wrapper which will work with the ASIO SDK.
|
||||
// If you wanted to use ASIO without the SDK you might want to implement COM
|
||||
// aggregation in these methods.
|
||||
HRESULT STDMETHODCALLTYPE IASIOThiscallResolver::QueryInterface(REFIID riid, void **ppv)
|
||||
{
|
||||
(void)riid; // suppress unused variable warning
|
||||
|
||||
assert( false ); // this function should never be called by the ASIO SDK.
|
||||
|
||||
*ppv = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
ULONG STDMETHODCALLTYPE IASIOThiscallResolver::AddRef()
|
||||
{
|
||||
assert( false ); // this function should never be called by the ASIO SDK.
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
ULONG STDMETHODCALLTYPE IASIOThiscallResolver::Release()
|
||||
{
|
||||
assert( false ); // this function should never be called by the ASIO SDK.
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
// Implement the IASIO interface methods by performing the vptr manipulation
|
||||
// described above then delegating to the real implementation.
|
||||
ASIOBool IASIOThiscallResolver::init(void *sysHandle)
|
||||
{
|
||||
ASIOBool result;
|
||||
CALL_THISCALL_1( result, that_, 12, sysHandle );
|
||||
return result;
|
||||
}
|
||||
|
||||
void IASIOThiscallResolver::getDriverName(char *name)
|
||||
{
|
||||
CALL_VOID_THISCALL_1( that_, 16, name );
|
||||
}
|
||||
|
||||
long IASIOThiscallResolver::getDriverVersion()
|
||||
{
|
||||
ASIOBool result;
|
||||
CALL_THISCALL_0( result, that_, 20 );
|
||||
return result;
|
||||
}
|
||||
|
||||
void IASIOThiscallResolver::getErrorMessage(char *string)
|
||||
{
|
||||
CALL_VOID_THISCALL_1( that_, 24, string );
|
||||
}
|
||||
|
||||
ASIOError IASIOThiscallResolver::start()
|
||||
{
|
||||
ASIOBool result;
|
||||
CALL_THISCALL_0( result, that_, 28 );
|
||||
return result;
|
||||
}
|
||||
|
||||
ASIOError IASIOThiscallResolver::stop()
|
||||
{
|
||||
ASIOBool result;
|
||||
CALL_THISCALL_0( result, that_, 32 );
|
||||
return result;
|
||||
}
|
||||
|
||||
ASIOError IASIOThiscallResolver::getChannels(long *numInputChannels, long *numOutputChannels)
|
||||
{
|
||||
ASIOBool result;
|
||||
CALL_THISCALL_2( result, that_, 36, numInputChannels, numOutputChannels );
|
||||
return result;
|
||||
}
|
||||
|
||||
ASIOError IASIOThiscallResolver::getLatencies(long *inputLatency, long *outputLatency)
|
||||
{
|
||||
ASIOBool result;
|
||||
CALL_THISCALL_2( result, that_, 40, inputLatency, outputLatency );
|
||||
return result;
|
||||
}
|
||||
|
||||
ASIOError IASIOThiscallResolver::getBufferSize(long *minSize, long *maxSize,
|
||||
long *preferredSize, long *granularity)
|
||||
{
|
||||
ASIOBool result;
|
||||
CALL_THISCALL_4( result, that_, 44, minSize, maxSize, preferredSize, granularity );
|
||||
return result;
|
||||
}
|
||||
|
||||
ASIOError IASIOThiscallResolver::canSampleRate(ASIOSampleRate sampleRate)
|
||||
{
|
||||
ASIOBool result;
|
||||
CALL_THISCALL_1_DOUBLE( result, that_, 48, sampleRate );
|
||||
return result;
|
||||
}
|
||||
|
||||
ASIOError IASIOThiscallResolver::getSampleRate(ASIOSampleRate *sampleRate)
|
||||
{
|
||||
ASIOBool result;
|
||||
CALL_THISCALL_1( result, that_, 52, sampleRate );
|
||||
return result;
|
||||
}
|
||||
|
||||
ASIOError IASIOThiscallResolver::setSampleRate(ASIOSampleRate sampleRate)
|
||||
{
|
||||
ASIOBool result;
|
||||
CALL_THISCALL_1_DOUBLE( result, that_, 56, sampleRate );
|
||||
return result;
|
||||
}
|
||||
|
||||
ASIOError IASIOThiscallResolver::getClockSources(ASIOClockSource *clocks, long *numSources)
|
||||
{
|
||||
ASIOBool result;
|
||||
CALL_THISCALL_2( result, that_, 60, clocks, numSources );
|
||||
return result;
|
||||
}
|
||||
|
||||
ASIOError IASIOThiscallResolver::setClockSource(long reference)
|
||||
{
|
||||
ASIOBool result;
|
||||
CALL_THISCALL_1( result, that_, 64, reference );
|
||||
return result;
|
||||
}
|
||||
|
||||
ASIOError IASIOThiscallResolver::getSamplePosition(ASIOSamples *sPos, ASIOTimeStamp *tStamp)
|
||||
{
|
||||
ASIOBool result;
|
||||
CALL_THISCALL_2( result, that_, 68, sPos, tStamp );
|
||||
return result;
|
||||
}
|
||||
|
||||
ASIOError IASIOThiscallResolver::getChannelInfo(ASIOChannelInfo *info)
|
||||
{
|
||||
ASIOBool result;
|
||||
CALL_THISCALL_1( result, that_, 72, info );
|
||||
return result;
|
||||
}
|
||||
|
||||
ASIOError IASIOThiscallResolver::createBuffers(ASIOBufferInfo *bufferInfos,
|
||||
long numChannels, long bufferSize, ASIOCallbacks *callbacks)
|
||||
{
|
||||
ASIOBool result;
|
||||
CALL_THISCALL_4( result, that_, 76, bufferInfos, numChannels, bufferSize, callbacks );
|
||||
return result;
|
||||
}
|
||||
|
||||
ASIOError IASIOThiscallResolver::disposeBuffers()
|
||||
{
|
||||
ASIOBool result;
|
||||
CALL_THISCALL_0( result, that_, 80 );
|
||||
return result;
|
||||
}
|
||||
|
||||
ASIOError IASIOThiscallResolver::controlPanel()
|
||||
{
|
||||
ASIOBool result;
|
||||
CALL_THISCALL_0( result, that_, 84 );
|
||||
return result;
|
||||
}
|
||||
|
||||
ASIOError IASIOThiscallResolver::future(long selector,void *opt)
|
||||
{
|
||||
ASIOBool result;
|
||||
CALL_THISCALL_2( result, that_, 88, selector, opt );
|
||||
return result;
|
||||
}
|
||||
|
||||
ASIOError IASIOThiscallResolver::outputReady()
|
||||
{
|
||||
ASIOBool result;
|
||||
CALL_THISCALL_0( result, that_, 92 );
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// Implement our substitute ASIOInit() method
|
||||
ASIOError IASIOThiscallResolver::ASIOInit(ASIODriverInfo *info)
|
||||
{
|
||||
// To ensure that our instance's vptr is correctly constructed, even if
|
||||
// ASIOInit is called prior to main(), we explicitly call its constructor
|
||||
// (potentially over the top of an existing instance). Note that this is
|
||||
// pretty ugly, and is only safe because IASIOThiscallResolver has no
|
||||
// destructor and contains no objects with destructors.
|
||||
new((void*)&instance) IASIOThiscallResolver( theAsioDriver );
|
||||
|
||||
// Interpose between ASIO client code and the real driver.
|
||||
theAsioDriver = &instance;
|
||||
|
||||
// Note that we never need to switch theAsioDriver back to point to the
|
||||
// real driver because theAsioDriver is reset to zero in ASIOExit().
|
||||
|
||||
// Delegate to the real ASIOInit
|
||||
return ::ASIOInit(info);
|
||||
}
|
||||
|
||||
|
||||
#endif /* !defined(_MSC_VER) */
|
||||
|
||||
#endif /* Win32 */
|
||||
|
197
pd-0.44-2/portaudio/src/hostapi/asio/iasiothiscallresolver.h
Normal file
197
pd-0.44-2/portaudio/src/hostapi/asio/iasiothiscallresolver.h
Normal file
|
@ -0,0 +1,197 @@
|
|||
// ****************************************************************************
|
||||
// File: IASIOThiscallResolver.h
|
||||
// Description: The IASIOThiscallResolver class implements the IASIO
|
||||
// interface and acts as a proxy to the real IASIO interface by
|
||||
// calling through its vptr table using the thiscall calling
|
||||
// convention. To put it another way, we interpose
|
||||
// IASIOThiscallResolver between ASIO SDK code and the driver.
|
||||
// This is necessary because most non-Microsoft compilers don't
|
||||
// implement the thiscall calling convention used by IASIO.
|
||||
//
|
||||
// iasiothiscallresolver.cpp contains the background of this
|
||||
// problem plus a technical description of the vptr
|
||||
// manipulations.
|
||||
//
|
||||
// In order to use this mechanism one simply has to add
|
||||
// iasiothiscallresolver.cpp to the list of files to compile
|
||||
// and #include <iasiothiscallresolver.h>
|
||||
//
|
||||
// Note that this #include must come after the other ASIO SDK
|
||||
// #includes, for example:
|
||||
//
|
||||
// #include <windows.h>
|
||||
// #include <asiosys.h>
|
||||
// #include <asio.h>
|
||||
// #include <asiodrivers.h>
|
||||
// #include <iasiothiscallresolver.h>
|
||||
//
|
||||
// Actually the important thing is to #include
|
||||
// <iasiothiscallresolver.h> after <asio.h>. We have
|
||||
// incorporated a test to enforce this ordering.
|
||||
//
|
||||
// The code transparently takes care of the interposition by
|
||||
// using macro substitution to intercept calls to ASIOInit()
|
||||
// and ASIOExit(). We save the original ASIO global
|
||||
// "theAsioDriver" in our "that" variable, and then set
|
||||
// "theAsioDriver" to equal our IASIOThiscallResolver instance.
|
||||
//
|
||||
// Whilst this method of resolving the thiscall problem requires
|
||||
// the addition of #include <iasiothiscallresolver.h> to client
|
||||
// code it has the advantage that it does not break the terms
|
||||
// of the ASIO licence by publishing it. We are NOT modifying
|
||||
// any Steinberg code here, we are merely implementing the IASIO
|
||||
// interface in the same way that we would need to do if we
|
||||
// wished to provide an open source ASIO driver.
|
||||
//
|
||||
// For compilation with MinGW -lole32 needs to be added to the
|
||||
// linker options. For BORLAND, linking with Import32.lib is
|
||||
// sufficient.
|
||||
//
|
||||
// The dependencies are with: CoInitialize, CoUninitialize,
|
||||
// CoCreateInstance, CLSIDFromString - used by asiolist.cpp
|
||||
// and are required on Windows whether ThiscallResolver is used
|
||||
// or not.
|
||||
//
|
||||
// Searching for the above strings in the root library path
|
||||
// of your compiler should enable the correct libraries to be
|
||||
// identified if they aren't immediately obvious.
|
||||
//
|
||||
// Note that the current implementation of IASIOThiscallResolver
|
||||
// is not COM compliant - it does not correctly implement the
|
||||
// IUnknown interface. Implementing it is not necessary because
|
||||
// it is not called by parts of the ASIO SDK which call through
|
||||
// theAsioDriver ptr. The IUnknown methods are implemented as
|
||||
// assert(false) to ensure that the code fails if they are
|
||||
// ever called.
|
||||
// Restrictions: None. Public Domain & Open Source distribute freely
|
||||
// You may use IASIOThiscallResolver commercially as well as
|
||||
// privately.
|
||||
// You the user assume the responsibility for the use of the
|
||||
// files, binary or text, and there is no guarantee or warranty,
|
||||
// expressed or implied, including but not limited to the
|
||||
// implied warranties of merchantability and fitness for a
|
||||
// particular purpose. You assume all responsibility and agree
|
||||
// to hold no entity, copyright holder or distributors liable
|
||||
// for any loss of data or inaccurate representations of data
|
||||
// as a result of using IASIOThiscallResolver.
|
||||
// Version: 1.4 Added separate macro CALL_THISCALL_1_DOUBLE from
|
||||
// Andrew Baldwin, and volatile for whole gcc asm blocks,
|
||||
// both for compatibility with newer gcc versions. Cleaned up
|
||||
// Borland asm to use one less register.
|
||||
// 1.3 Switched to including assert.h for better compatibility.
|
||||
// Wrapped entire .h and .cpp contents with a check for
|
||||
// _MSC_VER to provide better compatibility with MS compilers.
|
||||
// Changed Singleton implementation to use static instance
|
||||
// instead of freestore allocated instance. Removed ASIOExit
|
||||
// macro as it is no longer needed.
|
||||
// 1.2 Removed semicolons from ASIOInit and ASIOExit macros to
|
||||
// allow them to be embedded in expressions (if statements).
|
||||
// Cleaned up some comments. Removed combase.c dependency (it
|
||||
// doesn't compile with BCB anyway) by stubbing IUnknown.
|
||||
// 1.1 Incorporated comments from Ross Bencina including things
|
||||
// such as changing name from ThiscallResolver to
|
||||
// IASIOThiscallResolver, tidying up the constructor, fixing
|
||||
// a bug in IASIOThiscallResolver::ASIOExit() and improving
|
||||
// portability through the use of conditional compilation
|
||||
// 1.0 Initial working version.
|
||||
// Created: 6/09/2003
|
||||
// Authors: Fraser Adams
|
||||
// Ross Bencina
|
||||
// Rene G. Ceballos
|
||||
// Martin Fay
|
||||
// Antti Silvast
|
||||
// Andrew Baldwin
|
||||
//
|
||||
// ****************************************************************************
|
||||
|
||||
|
||||
#ifndef included_iasiothiscallresolver_h
|
||||
#define included_iasiothiscallresolver_h
|
||||
|
||||
// We only need IASIOThiscallResolver at all if we are on Win32. For other
|
||||
// platforms we simply bypass the IASIOThiscallResolver definition to allow us
|
||||
// to be safely #include'd whatever the platform to keep client code portable
|
||||
#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__)) && !defined(_WIN64)
|
||||
|
||||
|
||||
// If microsoft compiler we can call IASIO directly so IASIOThiscallResolver
|
||||
// is not used.
|
||||
#if !defined(_MSC_VER)
|
||||
|
||||
|
||||
// The following is in order to ensure that this header is only included after
|
||||
// the other ASIO headers (except for the case of iasiothiscallresolver.cpp).
|
||||
// We need to do this because IASIOThiscallResolver works by eclipsing the
|
||||
// original definition of ASIOInit() with a macro (see below).
|
||||
#if !defined(iasiothiscallresolver_sourcefile)
|
||||
#if !defined(__ASIO_H)
|
||||
#error iasiothiscallresolver.h must be included AFTER asio.h
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <windows.h>
|
||||
#include <asiodrvr.h> /* From ASIO SDK */
|
||||
|
||||
|
||||
class IASIOThiscallResolver : public IASIO {
|
||||
private:
|
||||
IASIO* that_; // Points to the real IASIO
|
||||
|
||||
static IASIOThiscallResolver instance; // Singleton instance
|
||||
|
||||
// Constructors - declared private so construction is limited to
|
||||
// our Singleton instance
|
||||
IASIOThiscallResolver();
|
||||
IASIOThiscallResolver(IASIO* that);
|
||||
public:
|
||||
|
||||
// Methods from the IUnknown interface. We don't fully implement IUnknown
|
||||
// because the ASIO SDK never calls these methods through theAsioDriver ptr.
|
||||
// These methods are implemented as assert(false).
|
||||
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppv);
|
||||
virtual ULONG STDMETHODCALLTYPE AddRef();
|
||||
virtual ULONG STDMETHODCALLTYPE Release();
|
||||
|
||||
// Methods from the IASIO interface, implemented as forwarning calls to that.
|
||||
virtual ASIOBool init(void *sysHandle);
|
||||
virtual void getDriverName(char *name);
|
||||
virtual long getDriverVersion();
|
||||
virtual void getErrorMessage(char *string);
|
||||
virtual ASIOError start();
|
||||
virtual ASIOError stop();
|
||||
virtual ASIOError getChannels(long *numInputChannels, long *numOutputChannels);
|
||||
virtual ASIOError getLatencies(long *inputLatency, long *outputLatency);
|
||||
virtual ASIOError getBufferSize(long *minSize, long *maxSize, long *preferredSize, long *granularity);
|
||||
virtual ASIOError canSampleRate(ASIOSampleRate sampleRate);
|
||||
virtual ASIOError getSampleRate(ASIOSampleRate *sampleRate);
|
||||
virtual ASIOError setSampleRate(ASIOSampleRate sampleRate);
|
||||
virtual ASIOError getClockSources(ASIOClockSource *clocks, long *numSources);
|
||||
virtual ASIOError setClockSource(long reference);
|
||||
virtual ASIOError getSamplePosition(ASIOSamples *sPos, ASIOTimeStamp *tStamp);
|
||||
virtual ASIOError getChannelInfo(ASIOChannelInfo *info);
|
||||
virtual ASIOError createBuffers(ASIOBufferInfo *bufferInfos, long numChannels, long bufferSize, ASIOCallbacks *callbacks);
|
||||
virtual ASIOError disposeBuffers();
|
||||
virtual ASIOError controlPanel();
|
||||
virtual ASIOError future(long selector,void *opt);
|
||||
virtual ASIOError outputReady();
|
||||
|
||||
// Class method, see ASIOInit() macro below.
|
||||
static ASIOError ASIOInit(ASIODriverInfo *info); // Delegates to ::ASIOInit
|
||||
};
|
||||
|
||||
|
||||
// Replace calls to ASIOInit with our interposing version.
|
||||
// This macro enables us to perform thiscall resolution simply by #including
|
||||
// <iasiothiscallresolver.h> after the asio #includes (this file _must_ be
|
||||
// included _after_ the asio #includes)
|
||||
|
||||
#define ASIOInit(name) IASIOThiscallResolver::ASIOInit((name))
|
||||
|
||||
|
||||
#endif /* !defined(_MSC_VER) */
|
||||
|
||||
#endif /* Win32 */
|
||||
|
||||
#endif /* included_iasiothiscallresolver_h */
|
||||
|
||||
|
4222
pd-0.44-2/portaudio/src/hostapi/asio/pa_asio.cpp
Normal file
4222
pd-0.44-2/portaudio/src/hostapi/asio/pa_asio.cpp
Normal file
File diff suppressed because it is too large
Load diff
196
pd-0.44-2/portaudio/src/hostapi/coreaudio/notes.txt
Normal file
196
pd-0.44-2/portaudio/src/hostapi/coreaudio/notes.txt
Normal file
|
@ -0,0 +1,196 @@
|
|||
Notes on status of CoreAudio Implementation of PortAudio
|
||||
|
||||
Document Last Updated December 9, 2005
|
||||
|
||||
There are currently two implementations of PortAudio for Mac Core Audio.
|
||||
|
||||
The original is in pa_mac_core_old.c, and the newer, default implementation
|
||||
is in pa_mac_core.c.
|
||||
Only pa_mac_core.c is currently developed and supported as it uses apple's
|
||||
current core audio technology. To select use the old implementation, replace
|
||||
pa_mac_core.c with pa_mac_core_old.c (eg. "cp pa_mac_core_auhal.c
|
||||
pa_mac_core.c"), then run configure and make as usual.
|
||||
|
||||
-------------------------------------------
|
||||
|
||||
Notes on Newer/Default AUHAL implementation:
|
||||
|
||||
by Bjorn Roche
|
||||
|
||||
Last Updated December 9, 2005
|
||||
|
||||
Principle of Operation:
|
||||
|
||||
This implementation uses AUHAL for audio I/O. To some extent, it also
|
||||
operates at the "HAL" Layer, though this behavior can be limited by
|
||||
platform specific flags (see pa_mac_core.h for details). The default
|
||||
settings should be reasonable: they don't change the SR of the device and
|
||||
don't cause interruptions if other devices are using the device.
|
||||
|
||||
Major Software Elements Used: Apple's HAL AUs provide output SR
|
||||
conversion transparently, however, only on output, so this
|
||||
implementation uses AudioConverters to convert the sample rate on input.
|
||||
A PortAudio ring buffer is used to buffer input when sample rate
|
||||
conversion is required or when separate audio units are used for duplex
|
||||
IO. Finally, a PortAudio buffer processor is used to convert formats and
|
||||
provide additional buffers if needed. Internally, interleaved floating
|
||||
point data streams are used exclusively - the audio unit converts from
|
||||
the audio hardware's native format to interleaved float PCM and
|
||||
PortAudio's Buffer processor is used for conversion to user formats.
|
||||
|
||||
Simplex Input: Simplex input uses a single callback. If sample rate
|
||||
conversion is required, a ring buffer and AudioConverter are used as
|
||||
well.
|
||||
|
||||
Simplex output: Simplex output uses a single callback. No ring buffer or
|
||||
audio converter is used because AUHAL does its own output SR conversion.
|
||||
|
||||
Duplex, one device (no SR conversion): When one device is used, a single
|
||||
callback is used. This achieves very low latency.
|
||||
|
||||
Duplex, separate devices or SR conversion: When SR conversion is
|
||||
required, data must be buffered before it is converted and data is not
|
||||
always available at the same times on input and output, so SR conversion
|
||||
requires the same treatment as separate devices. The input callback
|
||||
reads data and puts it in the ring buffer. The output callback reads the
|
||||
data off the ring buffer, into an audio converter and finally to the
|
||||
buffer processor.
|
||||
|
||||
Platform Specific Options:
|
||||
|
||||
By using the flags in pa_mac_core.h, the user may specify several options.
|
||||
For example, the user can specify the sample-rate conversion quality, and
|
||||
the extent to which PA will attempt to "play nice" and to what extent it
|
||||
will interrupt other apps to improve performance. For example, if 44100 Hz
|
||||
sample rate is requested but the device is set at 48000 Hz, PA can either
|
||||
change the device for optimal playback ("Pro" mode), which may interrupt
|
||||
other programs playing back audio, or simple use a sample-rate coversion,
|
||||
which allows for friendlier sharing of the device ("Play Nice" mode).
|
||||
|
||||
Additionally, the user may define a "channel mapping" by calling
|
||||
paSetupMacCoreChannelMap() on their stream info structure before opening
|
||||
the stream with it. See below for creating a channel map.
|
||||
|
||||
Known issues:
|
||||
|
||||
- Buffering: No buffering beyond that provided by core audio is provided
|
||||
except where absolutely needed for the implementation to work. This may cause
|
||||
issues with large framesPerBuffer settings and it also means that no additional
|
||||
latency will be provided even if a large latency setting is selected.
|
||||
|
||||
- Latency: Latency settings are generally ignored. They may be used as a
|
||||
hint for buffer size in paHostFramesPerBufferUnspecified, or the value may
|
||||
be used in cases where additional buffering is needed, such as doing input and
|
||||
output on seperate devices. Latency settings are always automatically bound
|
||||
to "safe" values, however, so setting extreme values here should not be
|
||||
an issue.
|
||||
|
||||
- Buffer Size: paHostFramesPerBufferUnspecified and specific host buffer sizes
|
||||
are supported. paHostFramesPerBufferUnspecified works best in "pro" mode,
|
||||
where the buffer size and sample rate of the audio device is most likely
|
||||
to match the expected values. In the case of paHostFramesPerBuffer, an
|
||||
appropriate framesPerBuffer value will be used that guarantees minimum
|
||||
requested latency if that's possible.
|
||||
|
||||
- Timing info. It reports on stream time, but I'm probably doing something
|
||||
wrong since patest_sine_time often reports negative latency numbers. Also,
|
||||
there are currently issues with some devices whehn plugging/unplugging
|
||||
devices.
|
||||
|
||||
- xrun detection: The only xrun detection performed is when reading
|
||||
and writing the ring buffer. There is probably more that can be done.
|
||||
|
||||
- abort/stop issues: stopping a stream is always a complete operation,
|
||||
but latency should be low enough to make the lack of a separate abort
|
||||
unnecessary. Apple clarifies its AudioOutputUnitStop() call here:
|
||||
http://lists.apple.com/archives/coreaudio-api/2005/Dec/msg00055.html
|
||||
|
||||
- blocking interface: should work fine.
|
||||
|
||||
- multichannel: It has been tested successfully on multichannel hardware
|
||||
from MOTU: traveler and 896HD. Also Presonus firepod and others. It is
|
||||
believed to work with all Core Audio devices, including virtual devices
|
||||
such as soundflower.
|
||||
|
||||
- sample rate conversion quality: By default, SR conversion is the maximum
|
||||
available. This can be tweaked using flags pa_mac_core.h. Note that the AU
|
||||
render quyality property is used to set the sample rate conversion quality
|
||||
as "documented" here:
|
||||
http://lists.apple.com/archives/coreaudio-api/2004/Jan/msg00141.html
|
||||
|
||||
- x86/Universal Binary: Universal binaries can be build.
|
||||
|
||||
|
||||
|
||||
Creating a channel map:
|
||||
|
||||
How to create the map array - Text taken From AUHAL.rtfd :
|
||||
[3] Channel Maps
|
||||
Clients can tell the AUHAL units which channels of the device they are interested in. For example, the client may be processing stereo data, but outputting to a six-channel device. This is done by using the kAudioOutputUnitProperty_ChannelMap property. To use this property:
|
||||
|
||||
For Output:
|
||||
Create an array of SInt32 that is the size of the number of channels of the device (Get the Format of the AUHAL's output Element == 0)
|
||||
Initialize each of the array's values to -1 (-1 indicates that that channel is NOT to be presented in the conversion.)
|
||||
|
||||
Next, for each channel of your app's output, set:
|
||||
channelMapArray[deviceOutputChannel] = desiredAppOutputChannel.
|
||||
|
||||
For example: we have a 6 channel output device and our application has a stereo source it wants to provide to the device. Suppose we want that stereo source to go to the 3rd and 4th channels of the device. The channel map would look like this: { -1, -1, 0, 1, -1, -1 }
|
||||
|
||||
Where the formats are:
|
||||
Input Element == 0: 2 channels (- client format - settable)
|
||||
Output Element == 0: 6 channels (- device format - NOT settable)
|
||||
|
||||
So channel 2 (zero-based) of the device will take the first channel of output and channel 3 will take the second channel of output. (This translates to the 3rd and 4th plugs of the 6 output plugs of the device of course!)
|
||||
|
||||
For Input:
|
||||
Create an array of SInt32 that is the size of the number of channels of the format you require for input. Get (or Set in this case as needed) the AUHAL's output Element == 1.
|
||||
|
||||
Next, for each channel of input you require, set:
|
||||
channelMapArray[desiredAppInputChannel] = deviceOutputChannel;
|
||||
|
||||
For example: we have a 6 channel input device from which we wish to receive stereo input from the 3rd and 4th channels. The channel map looks like this: { 2, 3 }
|
||||
|
||||
Where the formats are:
|
||||
Input Element == 0: 2 channels (- device format - NOT settable)
|
||||
Output Element == 0: 6 channels (- client format - settable)
|
||||
|
||||
|
||||
|
||||
----------------------------------------
|
||||
|
||||
Notes on Original implementation:
|
||||
|
||||
by Phil Burk and Darren Gibbs
|
||||
|
||||
Last updated March 20, 2002
|
||||
|
||||
WHAT WORKS
|
||||
|
||||
Output with very low latency, <10 msec.
|
||||
Half duplex input or output.
|
||||
Full duplex on the same CoreAudio device.
|
||||
The paFLoat32, paInt16, paInt8, paUInt8 sample formats.
|
||||
Pa_GetCPULoad()
|
||||
Pa_StreamTime()
|
||||
|
||||
KNOWN BUGS OR LIMITATIONS
|
||||
|
||||
We do not yet support simultaneous input and output on different
|
||||
devices. Note that some CoreAudio devices like the Roland UH30 look
|
||||
like one device but are actually two different CoreAudio devices. The
|
||||
Built-In audio is typically one CoreAudio device.
|
||||
|
||||
Mono doesn't work.
|
||||
|
||||
DEVICE MAPPING
|
||||
|
||||
CoreAudio devices can support both input and output. But the sample
|
||||
rates supported may be different. So we have map one or two PortAudio
|
||||
device to each CoreAudio device depending on whether it supports
|
||||
input, output or both.
|
||||
|
||||
When we query devices, we first get a list of CoreAudio devices. Then
|
||||
we scan the list and add a PortAudio device for each CoreAudio device
|
||||
that supports input. Then we make a scan for output devices.
|
||||
|
2790
pd-0.44-2/portaudio/src/hostapi/coreaudio/pa_mac_core.c
Normal file
2790
pd-0.44-2/portaudio/src/hostapi/coreaudio/pa_mac_core.c
Normal file
File diff suppressed because it is too large
Load diff
593
pd-0.44-2/portaudio/src/hostapi/coreaudio/pa_mac_core_blocking.c
Normal file
593
pd-0.44-2/portaudio/src/hostapi/coreaudio/pa_mac_core_blocking.c
Normal file
|
@ -0,0 +1,593 @@
|
|||
/*
|
||||
* Implementation of the PortAudio API for Apple AUHAL
|
||||
*
|
||||
* PortAudio Portable Real-Time Audio Library
|
||||
* Latest Version at: http://www.portaudio.com
|
||||
*
|
||||
* Written by Bjorn Roche of XO Audio LLC, from PA skeleton code.
|
||||
* Portions copied from code by Dominic Mazzoni (who wrote a HAL implementation)
|
||||
*
|
||||
* Dominic's code was based on code by Phil Burk, Darren Gibbs,
|
||||
* Gord Peters, Stephane Letz, and Greg Pfiel.
|
||||
*
|
||||
* The following people also deserve acknowledgements:
|
||||
*
|
||||
* Olivier Tristan for feedback and testing
|
||||
* Glenn Zelniker and Z-Systems engineering for sponsoring the Blocking I/O
|
||||
* interface.
|
||||
*
|
||||
*
|
||||
* Based on the Open Source API proposed by Ross Bencina
|
||||
* Copyright (c) 1999-2002 Ross Bencina, Phil Burk
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
/**
|
||||
@file
|
||||
@ingroup hostapi_src
|
||||
|
||||
This file contains the implementation
|
||||
required for blocking I/O. It is separated from pa_mac_core.c simply to ease
|
||||
development.
|
||||
*/
|
||||
|
||||
#include "pa_mac_core_blocking.h"
|
||||
#include "pa_mac_core_internal.h"
|
||||
#include <assert.h>
|
||||
#ifdef MOSX_USE_NON_ATOMIC_FLAG_BITS
|
||||
# define OSAtomicOr32( a, b ) ( (*(b)) |= (a) )
|
||||
# define OSAtomicAnd32( a, b ) ( (*(b)) &= (a) )
|
||||
#else
|
||||
# include <libkern/OSAtomic.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This function determines the size of a particular sample format.
|
||||
* if the format is not recognized, this returns zero.
|
||||
*/
|
||||
static size_t computeSampleSizeFromFormat( PaSampleFormat format )
|
||||
{
|
||||
switch( format & (~paNonInterleaved) ) {
|
||||
case paFloat32: return 4;
|
||||
case paInt32: return 4;
|
||||
case paInt24: return 3;
|
||||
case paInt16: return 2;
|
||||
case paInt8: case paUInt8: return 1;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Same as computeSampleSizeFromFormat, except that if
|
||||
* the size is not a power of two, it returns the next power of two up
|
||||
*/
|
||||
static size_t computeSampleSizeFromFormatPow2( PaSampleFormat format )
|
||||
{
|
||||
switch( format & (~paNonInterleaved) ) {
|
||||
case paFloat32: return 4;
|
||||
case paInt32: return 4;
|
||||
case paInt24: return 4;
|
||||
case paInt16: return 2;
|
||||
case paInt8: case paUInt8: return 1;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Functions for initializing, resetting, and destroying BLIO structures.
|
||||
*
|
||||
*/
|
||||
|
||||
/* This should be called with the relevant info when initializing a stream for
|
||||
callback. */
|
||||
PaError initializeBlioRingBuffers(
|
||||
PaMacBlio *blio,
|
||||
PaSampleFormat inputSampleFormat,
|
||||
PaSampleFormat outputSampleFormat,
|
||||
size_t framesPerBuffer,
|
||||
long ringBufferSize,
|
||||
int inChan,
|
||||
int outChan )
|
||||
{
|
||||
void *data;
|
||||
int result;
|
||||
OSStatus err;
|
||||
|
||||
/* zeroify things */
|
||||
bzero( blio, sizeof( PaMacBlio ) );
|
||||
/* this is redundant, but the buffers are used to check
|
||||
if the bufffers have been initialized, so we do it explicitly. */
|
||||
blio->inputRingBuffer.buffer = NULL;
|
||||
blio->outputRingBuffer.buffer = NULL;
|
||||
|
||||
/* initialize simple data */
|
||||
blio->ringBufferFrames = ringBufferSize;
|
||||
blio->inputSampleFormat = inputSampleFormat;
|
||||
blio->inputSampleSizeActual = computeSampleSizeFromFormat(inputSampleFormat);
|
||||
blio->inputSampleSizePow2 = computeSampleSizeFromFormatPow2(inputSampleFormat);
|
||||
blio->outputSampleFormat = outputSampleFormat;
|
||||
blio->outputSampleSizeActual = computeSampleSizeFromFormat(outputSampleFormat);
|
||||
blio->outputSampleSizePow2 = computeSampleSizeFromFormatPow2(outputSampleFormat);
|
||||
|
||||
blio->framesPerBuffer = framesPerBuffer;
|
||||
blio->inChan = inChan;
|
||||
blio->outChan = outChan;
|
||||
blio->statusFlags = 0;
|
||||
blio->errors = paNoError;
|
||||
#ifdef PA_MAC_BLIO_MUTEX
|
||||
blio->isInputEmpty = false;
|
||||
blio->isOutputFull = false;
|
||||
#endif
|
||||
|
||||
/* setup ring buffers */
|
||||
#ifdef PA_MAC_BLIO_MUTEX
|
||||
result = PaMacCore_SetUnixError( pthread_mutex_init(&(blio->inputMutex),NULL), 0 );
|
||||
if( result )
|
||||
goto error;
|
||||
result = UNIX_ERR( pthread_cond_init( &(blio->inputCond), NULL ) );
|
||||
if( result )
|
||||
goto error;
|
||||
result = UNIX_ERR( pthread_mutex_init(&(blio->outputMutex),NULL) );
|
||||
if( result )
|
||||
goto error;
|
||||
result = UNIX_ERR( pthread_cond_init( &(blio->outputCond), NULL ) );
|
||||
#endif
|
||||
if( inChan ) {
|
||||
data = calloc( ringBufferSize, blio->inputSampleSizePow2*inChan );
|
||||
if( !data )
|
||||
{
|
||||
result = paInsufficientMemory;
|
||||
goto error;
|
||||
}
|
||||
|
||||
err = PaUtil_InitializeRingBuffer(
|
||||
&blio->inputRingBuffer,
|
||||
1, ringBufferSize*blio->inputSampleSizePow2*inChan,
|
||||
data );
|
||||
assert( !err );
|
||||
}
|
||||
if( outChan ) {
|
||||
data = calloc( ringBufferSize, blio->outputSampleSizePow2*outChan );
|
||||
if( !data )
|
||||
{
|
||||
result = paInsufficientMemory;
|
||||
goto error;
|
||||
}
|
||||
|
||||
err = PaUtil_InitializeRingBuffer(
|
||||
&blio->outputRingBuffer,
|
||||
1, ringBufferSize*blio->outputSampleSizePow2*outChan,
|
||||
data );
|
||||
assert( !err );
|
||||
}
|
||||
|
||||
result = resetBlioRingBuffers( blio );
|
||||
if( result )
|
||||
goto error;
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
destroyBlioRingBuffers( blio );
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef PA_MAC_BLIO_MUTEX
|
||||
PaError blioSetIsInputEmpty( PaMacBlio *blio, bool isEmpty )
|
||||
{
|
||||
PaError result = paNoError;
|
||||
if( isEmpty == blio->isInputEmpty )
|
||||
goto done;
|
||||
|
||||
/* we need to update the value. Here's what we do:
|
||||
* - Lock the mutex, so noone else can write.
|
||||
* - update the value.
|
||||
* - unlock.
|
||||
* - broadcast to all listeners.
|
||||
*/
|
||||
result = UNIX_ERR( pthread_mutex_lock( &blio->inputMutex ) );
|
||||
if( result )
|
||||
goto done;
|
||||
blio->isInputEmpty = isEmpty;
|
||||
result = UNIX_ERR( pthread_mutex_unlock( &blio->inputMutex ) );
|
||||
if( result )
|
||||
goto done;
|
||||
result = UNIX_ERR( pthread_cond_broadcast( &blio->inputCond ) );
|
||||
if( result )
|
||||
goto done;
|
||||
|
||||
done:
|
||||
return result;
|
||||
}
|
||||
PaError blioSetIsOutputFull( PaMacBlio *blio, bool isFull )
|
||||
{
|
||||
PaError result = paNoError;
|
||||
if( isFull == blio->isOutputFull )
|
||||
goto done;
|
||||
|
||||
/* we need to update the value. Here's what we do:
|
||||
* - Lock the mutex, so noone else can write.
|
||||
* - update the value.
|
||||
* - unlock.
|
||||
* - broadcast to all listeners.
|
||||
*/
|
||||
result = UNIX_ERR( pthread_mutex_lock( &blio->outputMutex ) );
|
||||
if( result )
|
||||
goto done;
|
||||
blio->isOutputFull = isFull;
|
||||
result = UNIX_ERR( pthread_mutex_unlock( &blio->outputMutex ) );
|
||||
if( result )
|
||||
goto done;
|
||||
result = UNIX_ERR( pthread_cond_broadcast( &blio->outputCond ) );
|
||||
if( result )
|
||||
goto done;
|
||||
|
||||
done:
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* This should be called after stopping or aborting the stream, so that on next
|
||||
start, the buffers will be ready. */
|
||||
PaError resetBlioRingBuffers( PaMacBlio *blio )
|
||||
{
|
||||
#ifdef PA_MAC__BLIO_MUTEX
|
||||
int result;
|
||||
#endif
|
||||
blio->statusFlags = 0;
|
||||
if( blio->outputRingBuffer.buffer ) {
|
||||
PaUtil_FlushRingBuffer( &blio->outputRingBuffer );
|
||||
bzero( blio->outputRingBuffer.buffer,
|
||||
blio->outputRingBuffer.bufferSize );
|
||||
/* Advance buffer */
|
||||
PaUtil_AdvanceRingBufferWriteIndex( &blio->outputRingBuffer, blio->ringBufferFrames*blio->outputSampleSizeActual*blio->outChan );
|
||||
//PaUtil_AdvanceRingBufferWriteIndex( &blio->outputRingBuffer, blio->outputRingBuffer.bufferSize );
|
||||
|
||||
/* Update isOutputFull. */
|
||||
#ifdef PA_MAC__BLIO_MUTEX
|
||||
result = blioSetIsOutputFull( blio, toAdvance == blio->outputRingBuffer.bufferSize );
|
||||
if( result )
|
||||
goto error;
|
||||
#endif
|
||||
/*
|
||||
printf( "------%d\n" , blio->framesPerBuffer );
|
||||
printf( "------%d\n" , blio->outChan );
|
||||
printf( "------%d\n" , blio->outputSampleSize );
|
||||
printf( "------%d\n" , blio->framesPerBuffer*blio->outChan*blio->outputSampleSize );
|
||||
*/
|
||||
}
|
||||
if( blio->inputRingBuffer.buffer ) {
|
||||
PaUtil_FlushRingBuffer( &blio->inputRingBuffer );
|
||||
bzero( blio->inputRingBuffer.buffer,
|
||||
blio->inputRingBuffer.bufferSize );
|
||||
/* Update isInputEmpty. */
|
||||
#ifdef PA_MAC__BLIO_MUTEX
|
||||
result = blioSetIsInputEmpty( blio, true );
|
||||
if( result )
|
||||
goto error;
|
||||
#endif
|
||||
}
|
||||
return paNoError;
|
||||
#ifdef PA_MAC__BLIO_MUTEX
|
||||
error:
|
||||
return result;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*This should be called when you are done with the blio. It can safely be called
|
||||
multiple times if there are no exceptions. */
|
||||
PaError destroyBlioRingBuffers( PaMacBlio *blio )
|
||||
{
|
||||
PaError result = paNoError;
|
||||
if( blio->inputRingBuffer.buffer ) {
|
||||
free( blio->inputRingBuffer.buffer );
|
||||
#ifdef PA_MAC__BLIO_MUTEX
|
||||
result = UNIX_ERR( pthread_mutex_destroy( & blio->inputMutex ) );
|
||||
if( result ) return result;
|
||||
result = UNIX_ERR( pthread_cond_destroy( & blio->inputCond ) );
|
||||
if( result ) return result;
|
||||
#endif
|
||||
}
|
||||
blio->inputRingBuffer.buffer = NULL;
|
||||
if( blio->outputRingBuffer.buffer ) {
|
||||
free( blio->outputRingBuffer.buffer );
|
||||
#ifdef PA_MAC__BLIO_MUTEX
|
||||
result = UNIX_ERR( pthread_mutex_destroy( & blio->outputMutex ) );
|
||||
if( result ) return result;
|
||||
result = UNIX_ERR( pthread_cond_destroy( & blio->outputCond ) );
|
||||
if( result ) return result;
|
||||
#endif
|
||||
}
|
||||
blio->outputRingBuffer.buffer = NULL;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* this is the BlioCallback function. It expects to recieve a PaMacBlio Object
|
||||
* pointer as userData.
|
||||
*
|
||||
*/
|
||||
int BlioCallback( const void *input, void *output, unsigned long frameCount,
|
||||
const PaStreamCallbackTimeInfo* timeInfo,
|
||||
PaStreamCallbackFlags statusFlags,
|
||||
void *userData )
|
||||
{
|
||||
PaMacBlio *blio = (PaMacBlio*)userData;
|
||||
long avail;
|
||||
long toRead;
|
||||
long toWrite;
|
||||
long read;
|
||||
long written;
|
||||
|
||||
/* set flags returned by OS: */
|
||||
OSAtomicOr32( statusFlags, &blio->statusFlags ) ;
|
||||
|
||||
/* --- Handle Input Buffer --- */
|
||||
if( blio->inChan ) {
|
||||
avail = PaUtil_GetRingBufferWriteAvailable( &blio->inputRingBuffer );
|
||||
|
||||
/* check for underflow */
|
||||
if( avail < frameCount * blio->inputSampleSizeActual * blio->inChan )
|
||||
{
|
||||
OSAtomicOr32( paInputOverflow, &blio->statusFlags );
|
||||
}
|
||||
toRead = MIN( avail, frameCount * blio->inputSampleSizeActual * blio->inChan );
|
||||
|
||||
/* copy the data */
|
||||
/*printf( "reading %d\n", toRead );*/
|
||||
read = PaUtil_WriteRingBuffer( &blio->inputRingBuffer, input, toRead );
|
||||
assert( toRead == read );
|
||||
#ifdef PA_MAC__BLIO_MUTEX
|
||||
/* Priority inversion. See notes below. */
|
||||
blioSetIsInputEmpty( blio, false );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* --- Handle Output Buffer --- */
|
||||
if( blio->outChan ) {
|
||||
avail = PaUtil_GetRingBufferReadAvailable( &blio->outputRingBuffer );
|
||||
|
||||
/* check for underflow */
|
||||
if( avail < frameCount * blio->outputSampleSizeActual * blio->outChan )
|
||||
OSAtomicOr32( paOutputUnderflow, &blio->statusFlags );
|
||||
|
||||
toWrite = MIN( avail, frameCount * blio->outputSampleSizeActual * blio->outChan );
|
||||
|
||||
if( toWrite != frameCount * blio->outputSampleSizeActual * blio->outChan )
|
||||
bzero( ((char *)output)+toWrite,
|
||||
frameCount * blio->outputSampleSizeActual * blio->outChan - toWrite );
|
||||
/* copy the data */
|
||||
/*printf( "writing %d\n", toWrite );*/
|
||||
written = PaUtil_ReadRingBuffer( &blio->outputRingBuffer, output, toWrite );
|
||||
assert( toWrite == written );
|
||||
#ifdef PA_MAC__BLIO_MUTEX
|
||||
/* We have a priority inversion here. However, we will only have to
|
||||
wait if this was true and is now false, which means we've got
|
||||
some room in the buffer.
|
||||
Hopefully problems will be minimized. */
|
||||
blioSetIsOutputFull( blio, false );
|
||||
#endif
|
||||
}
|
||||
|
||||
return paContinue;
|
||||
}
|
||||
|
||||
PaError ReadStream( PaStream* stream,
|
||||
void *buffer,
|
||||
unsigned long frames )
|
||||
{
|
||||
PaMacBlio *blio = & ((PaMacCoreStream*)stream) -> blio;
|
||||
char *cbuf = (char *) buffer;
|
||||
PaError ret = paNoError;
|
||||
VVDBUG(("ReadStream()\n"));
|
||||
|
||||
while( frames > 0 ) {
|
||||
long avail;
|
||||
long toRead;
|
||||
do {
|
||||
avail = PaUtil_GetRingBufferReadAvailable( &blio->inputRingBuffer );
|
||||
/*
|
||||
printf( "Read Buffer is %%%g full: %ld of %ld.\n",
|
||||
100 * (float)avail / (float) blio->inputRingBuffer.bufferSize,
|
||||
avail, blio->inputRingBuffer.bufferSize );
|
||||
*/
|
||||
if( avail == 0 ) {
|
||||
#ifdef PA_MAC_BLIO_MUTEX
|
||||
/**block when empty*/
|
||||
ret = UNIX_ERR( pthread_mutex_lock( &blio->inputMutex ) );
|
||||
if( ret )
|
||||
return ret;
|
||||
while( blio->isInputEmpty ) {
|
||||
ret = UNIX_ERR( pthread_cond_wait( &blio->inputCond, &blio->inputMutex ) );
|
||||
if( ret )
|
||||
return ret;
|
||||
}
|
||||
ret = UNIX_ERR( pthread_mutex_unlock( &blio->inputMutex ) );
|
||||
if( ret )
|
||||
return ret;
|
||||
#else
|
||||
Pa_Sleep( PA_MAC_BLIO_BUSY_WAIT_SLEEP_INTERVAL );
|
||||
#endif
|
||||
}
|
||||
} while( avail == 0 );
|
||||
toRead = MIN( avail, frames * blio->inputSampleSizeActual * blio->inChan );
|
||||
toRead -= toRead % blio->inputSampleSizeActual * blio->inChan ;
|
||||
PaUtil_ReadRingBuffer( &blio->inputRingBuffer, (void *)cbuf, toRead );
|
||||
cbuf += toRead;
|
||||
frames -= toRead / ( blio->inputSampleSizeActual * blio->inChan );
|
||||
|
||||
if( toRead == avail ) {
|
||||
#ifdef PA_MAC_BLIO_MUTEX
|
||||
/* we just emptied the buffer, so we need to mark it as empty. */
|
||||
ret = blioSetIsInputEmpty( blio, true );
|
||||
if( ret )
|
||||
return ret;
|
||||
/* of course, in the meantime, the callback may have put some sats
|
||||
in, so
|
||||
so check for that, too, to avoid a race condition. */
|
||||
if( PaUtil_GetRingBufferReadAvailable( &blio->inputRingBuffer ) ) {
|
||||
blioSetIsInputEmpty( blio, false );
|
||||
if( ret )
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/* Report either paNoError or paInputOverflowed. */
|
||||
/* may also want to report other errors, but this is non-standard. */
|
||||
ret = blio->statusFlags & paInputOverflow;
|
||||
|
||||
/* report underflow only once: */
|
||||
if( ret ) {
|
||||
OSAtomicAnd32( (uint32_t)(~paInputOverflow), &blio->statusFlags );
|
||||
ret = paInputOverflowed;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
PaError WriteStream( PaStream* stream,
|
||||
const void *buffer,
|
||||
unsigned long frames )
|
||||
{
|
||||
PaMacBlio *blio = & ((PaMacCoreStream*)stream) -> blio;
|
||||
char *cbuf = (char *) buffer;
|
||||
PaError ret = paNoError;
|
||||
VVDBUG(("WriteStream()\n"));
|
||||
|
||||
while( frames > 0 ) {
|
||||
long avail = 0;
|
||||
long toWrite;
|
||||
|
||||
do {
|
||||
avail = PaUtil_GetRingBufferWriteAvailable( &blio->outputRingBuffer );
|
||||
/*
|
||||
printf( "Write Buffer is %%%g full: %ld of %ld.\n",
|
||||
100 - 100 * (float)avail / (float) blio->outputRingBuffer.bufferSize,
|
||||
avail, blio->outputRingBuffer.bufferSize );
|
||||
*/
|
||||
if( avail == 0 ) {
|
||||
#ifdef PA_MAC_BLIO_MUTEX
|
||||
/*block while full*/
|
||||
ret = UNIX_ERR( pthread_mutex_lock( &blio->outputMutex ) );
|
||||
if( ret )
|
||||
return ret;
|
||||
while( blio->isOutputFull ) {
|
||||
ret = UNIX_ERR( pthread_cond_wait( &blio->outputCond, &blio->outputMutex ) );
|
||||
if( ret )
|
||||
return ret;
|
||||
}
|
||||
ret = UNIX_ERR( pthread_mutex_unlock( &blio->outputMutex ) );
|
||||
if( ret )
|
||||
return ret;
|
||||
#else
|
||||
Pa_Sleep( PA_MAC_BLIO_BUSY_WAIT_SLEEP_INTERVAL );
|
||||
#endif
|
||||
}
|
||||
} while( avail == 0 );
|
||||
|
||||
toWrite = MIN( avail, frames * blio->outputSampleSizeActual * blio->outChan );
|
||||
toWrite -= toWrite % blio->outputSampleSizeActual * blio->outChan ;
|
||||
PaUtil_WriteRingBuffer( &blio->outputRingBuffer, (void *)cbuf, toWrite );
|
||||
cbuf += toWrite;
|
||||
frames -= toWrite / ( blio->outputSampleSizeActual * blio->outChan );
|
||||
|
||||
#ifdef PA_MAC_BLIO_MUTEX
|
||||
if( toWrite == avail ) {
|
||||
/* we just filled up the buffer, so we need to mark it as filled. */
|
||||
ret = blioSetIsOutputFull( blio, true );
|
||||
if( ret )
|
||||
return ret;
|
||||
/* of course, in the meantime, we may have emptied the buffer, so
|
||||
so check for that, too, to avoid a race condition. */
|
||||
if( PaUtil_GetRingBufferWriteAvailable( &blio->outputRingBuffer ) ) {
|
||||
blioSetIsOutputFull( blio, false );
|
||||
if( ret )
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Report either paNoError or paOutputUnderflowed. */
|
||||
/* may also want to report other errors, but this is non-standard. */
|
||||
ret = blio->statusFlags & paOutputUnderflow;
|
||||
|
||||
/* report underflow only once: */
|
||||
if( ret ) {
|
||||
OSAtomicAnd32( (uint32_t)(~paOutputUnderflow), &blio->statusFlags );
|
||||
ret = paOutputUnderflowed;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void waitUntilBlioWriteBufferIsFlushed( PaMacBlio *blio )
|
||||
{
|
||||
if( blio->outputRingBuffer.buffer ) {
|
||||
long avail = PaUtil_GetRingBufferWriteAvailable( &blio->outputRingBuffer );
|
||||
while( avail != blio->outputRingBuffer.bufferSize ) {
|
||||
if( avail == 0 )
|
||||
Pa_Sleep( PA_MAC_BLIO_BUSY_WAIT_SLEEP_INTERVAL );
|
||||
avail = PaUtil_GetRingBufferWriteAvailable( &blio->outputRingBuffer );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
signed long GetStreamReadAvailable( PaStream* stream )
|
||||
{
|
||||
PaMacBlio *blio = & ((PaMacCoreStream*)stream) -> blio;
|
||||
VVDBUG(("GetStreamReadAvailable()\n"));
|
||||
|
||||
return PaUtil_GetRingBufferReadAvailable( &blio->inputRingBuffer )
|
||||
/ ( blio->inputSampleSizeActual * blio->inChan );
|
||||
}
|
||||
|
||||
|
||||
signed long GetStreamWriteAvailable( PaStream* stream )
|
||||
{
|
||||
PaMacBlio *blio = & ((PaMacCoreStream*)stream) -> blio;
|
||||
VVDBUG(("GetStreamWriteAvailable()\n"));
|
||||
|
||||
return PaUtil_GetRingBufferWriteAvailable( &blio->outputRingBuffer )
|
||||
/ ( blio->outputSampleSizeActual * blio->outChan );
|
||||
}
|
||||
|
136
pd-0.44-2/portaudio/src/hostapi/coreaudio/pa_mac_core_blocking.h
Normal file
136
pd-0.44-2/portaudio/src/hostapi/coreaudio/pa_mac_core_blocking.h
Normal file
|
@ -0,0 +1,136 @@
|
|||
/*
|
||||
* Internal blocking interfaces for PortAudio Apple AUHAL implementation
|
||||
*
|
||||
* PortAudio Portable Real-Time Audio Library
|
||||
* Latest Version at: http://www.portaudio.com
|
||||
*
|
||||
* Written by Bjorn Roche of XO Audio LLC, from PA skeleton code.
|
||||
* Portions copied from code by Dominic Mazzoni (who wrote a HAL implementation)
|
||||
*
|
||||
* Dominic's code was based on code by Phil Burk, Darren Gibbs,
|
||||
* Gord Peters, Stephane Letz, and Greg Pfiel.
|
||||
*
|
||||
* The following people also deserve acknowledgements:
|
||||
*
|
||||
* Olivier Tristan for feedback and testing
|
||||
* Glenn Zelniker and Z-Systems engineering for sponsoring the Blocking I/O
|
||||
* interface.
|
||||
*
|
||||
*
|
||||
* Based on the Open Source API proposed by Ross Bencina
|
||||
* Copyright (c) 1999-2002 Ross Bencina, Phil Burk
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
/**
|
||||
@file
|
||||
@ingroup hostapi_src
|
||||
*/
|
||||
|
||||
#ifndef PA_MAC_CORE_BLOCKING_H_
|
||||
#define PA_MAC_CORE_BLOCKING_H_
|
||||
|
||||
#include "pa_ringbuffer.h"
|
||||
#include "portaudio.h"
|
||||
#include "pa_mac_core_utilities.h"
|
||||
|
||||
/*
|
||||
* Number of miliseconds to busy wait whil waiting for data in blocking calls.
|
||||
*/
|
||||
#define PA_MAC_BLIO_BUSY_WAIT_SLEEP_INTERVAL (5)
|
||||
/*
|
||||
* Define exactly one of these blocking methods
|
||||
* PA_MAC_BLIO_MUTEX is not actively maintained.
|
||||
*/
|
||||
#define PA_MAC_BLIO_BUSY_WAIT
|
||||
/*
|
||||
#define PA_MAC_BLIO_MUTEX
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
PaUtilRingBuffer inputRingBuffer;
|
||||
PaUtilRingBuffer outputRingBuffer;
|
||||
size_t ringBufferFrames;
|
||||
PaSampleFormat inputSampleFormat;
|
||||
size_t inputSampleSizeActual;
|
||||
size_t inputSampleSizePow2;
|
||||
PaSampleFormat outputSampleFormat;
|
||||
size_t outputSampleSizeActual;
|
||||
size_t outputSampleSizePow2;
|
||||
|
||||
size_t framesPerBuffer;
|
||||
|
||||
int inChan;
|
||||
int outChan;
|
||||
|
||||
//PaStreamCallbackFlags statusFlags;
|
||||
uint32_t statusFlags;
|
||||
PaError errors;
|
||||
|
||||
/* Here we handle blocking, using condition variables. */
|
||||
#ifdef PA_MAC_BLIO_MUTEX
|
||||
volatile bool isInputEmpty;
|
||||
pthread_mutex_t inputMutex;
|
||||
pthread_cond_t inputCond;
|
||||
|
||||
volatile bool isOutputFull;
|
||||
pthread_mutex_t outputMutex;
|
||||
pthread_cond_t outputCond;
|
||||
#endif
|
||||
}
|
||||
PaMacBlio;
|
||||
|
||||
/*
|
||||
* These functions operate on condition and related variables.
|
||||
*/
|
||||
|
||||
PaError initializeBlioRingBuffers(
|
||||
PaMacBlio *blio,
|
||||
PaSampleFormat inputSampleFormat,
|
||||
PaSampleFormat outputSampleFormat,
|
||||
size_t framesPerBuffer,
|
||||
long ringBufferSize,
|
||||
int inChan,
|
||||
int outChan );
|
||||
PaError destroyBlioRingBuffers( PaMacBlio *blio );
|
||||
PaError resetBlioRingBuffers( PaMacBlio *blio );
|
||||
|
||||
int BlioCallback(
|
||||
const void *input, void *output,
|
||||
unsigned long frameCount,
|
||||
const PaStreamCallbackTimeInfo* timeInfo,
|
||||
PaStreamCallbackFlags statusFlags,
|
||||
void *userData );
|
||||
|
||||
void waitUntilBlioWriteBufferIsFlushed( PaMacBlio *blio );
|
||||
|
||||
#endif /*PA_MAC_CORE_BLOCKING_H_*/
|
194
pd-0.44-2/portaudio/src/hostapi/coreaudio/pa_mac_core_internal.h
Normal file
194
pd-0.44-2/portaudio/src/hostapi/coreaudio/pa_mac_core_internal.h
Normal file
|
@ -0,0 +1,194 @@
|
|||
/*
|
||||
* Internal interfaces for PortAudio Apple AUHAL implementation
|
||||
*
|
||||
* PortAudio Portable Real-Time Audio Library
|
||||
* Latest Version at: http://www.portaudio.com
|
||||
*
|
||||
* Written by Bjorn Roche of XO Audio LLC, from PA skeleton code.
|
||||
* Portions copied from code by Dominic Mazzoni (who wrote a HAL implementation)
|
||||
*
|
||||
* Dominic's code was based on code by Phil Burk, Darren Gibbs,
|
||||
* Gord Peters, Stephane Letz, and Greg Pfiel.
|
||||
*
|
||||
* The following people also deserve acknowledgements:
|
||||
*
|
||||
* Olivier Tristan for feedback and testing
|
||||
* Glenn Zelniker and Z-Systems engineering for sponsoring the Blocking I/O
|
||||
* interface.
|
||||
*
|
||||
*
|
||||
* Based on the Open Source API proposed by Ross Bencina
|
||||
* Copyright (c) 1999-2002 Ross Bencina, Phil Burk
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
/**
|
||||
@file pa_mac_core
|
||||
@ingroup hostapi_src
|
||||
@author Bjorn Roche
|
||||
@brief AUHAL implementation of PortAudio
|
||||
*/
|
||||
|
||||
#ifndef PA_MAC_CORE_INTERNAL_H__
|
||||
#define PA_MAC_CORE_INTERNAL_H__
|
||||
|
||||
#include <CoreAudio/CoreAudio.h>
|
||||
#include <CoreServices/CoreServices.h>
|
||||
#include <AudioUnit/AudioUnit.h>
|
||||
#include <AudioToolbox/AudioToolbox.h>
|
||||
|
||||
#include "portaudio.h"
|
||||
#include "pa_util.h"
|
||||
#include "pa_hostapi.h"
|
||||
#include "pa_stream.h"
|
||||
#include "pa_allocation.h"
|
||||
#include "pa_cpuload.h"
|
||||
#include "pa_process.h"
|
||||
#include "pa_ringbuffer.h"
|
||||
|
||||
#include "pa_mac_core_blocking.h"
|
||||
|
||||
/* function prototypes */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
PaError PaMacCore_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define RING_BUFFER_ADVANCE_DENOMINATOR (4)
|
||||
|
||||
PaError ReadStream( PaStream* stream, void *buffer, unsigned long frames );
|
||||
PaError WriteStream( PaStream* stream, const void *buffer, unsigned long frames );
|
||||
signed long GetStreamReadAvailable( PaStream* stream );
|
||||
signed long GetStreamWriteAvailable( PaStream* stream );
|
||||
/* PaMacAUHAL - host api datastructure specific to this implementation */
|
||||
typedef struct
|
||||
{
|
||||
PaUtilHostApiRepresentation inheritedHostApiRep;
|
||||
PaUtilStreamInterface callbackStreamInterface;
|
||||
PaUtilStreamInterface blockingStreamInterface;
|
||||
|
||||
PaUtilAllocationGroup *allocations;
|
||||
|
||||
/* implementation specific data goes here */
|
||||
long devCount;
|
||||
AudioDeviceID *devIds; /*array of all audio devices*/
|
||||
AudioDeviceID defaultIn;
|
||||
AudioDeviceID defaultOut;
|
||||
}
|
||||
PaMacAUHAL;
|
||||
|
||||
typedef struct PaMacCoreDeviceProperties
|
||||
{
|
||||
/* Values in Frames from property queries. */
|
||||
UInt32 safetyOffset;
|
||||
UInt32 bufferFrameSize;
|
||||
// UInt32 streamLatency; // Seems to be the same as deviceLatency!?
|
||||
UInt32 deviceLatency;
|
||||
/* 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 samplePeriod; // reciprocal
|
||||
}
|
||||
PaMacCoreDeviceProperties;
|
||||
|
||||
/* stream data structure specifically for this implementation */
|
||||
typedef struct PaMacCoreStream
|
||||
{
|
||||
PaUtilStreamRepresentation streamRepresentation;
|
||||
PaUtilCpuLoadMeasurer cpuLoadMeasurer;
|
||||
PaUtilBufferProcessor bufferProcessor;
|
||||
|
||||
/* implementation specific data goes here */
|
||||
bool bufferProcessorIsInitialized;
|
||||
AudioUnit inputUnit;
|
||||
AudioUnit outputUnit;
|
||||
AudioDeviceID inputDevice;
|
||||
AudioDeviceID outputDevice;
|
||||
size_t userInChan;
|
||||
size_t userOutChan;
|
||||
size_t inputFramesPerBuffer;
|
||||
size_t outputFramesPerBuffer;
|
||||
PaMacBlio blio;
|
||||
/* We use this ring buffer when input and out devs are different. */
|
||||
PaUtilRingBuffer inputRingBuffer;
|
||||
/* We may need to do SR conversion on input. */
|
||||
AudioConverterRef inputSRConverter;
|
||||
/* We need to preallocate an inputBuffer for reading data. */
|
||||
AudioBufferList inputAudioBufferList;
|
||||
AudioTimeStamp startTime;
|
||||
/* FIXME: instead of volatile, these should be properly memory barriered */
|
||||
volatile uint32_t xrunFlags; /*PaStreamCallbackFlags*/
|
||||
volatile enum {
|
||||
STOPPED = 0, /* playback is completely stopped,
|
||||
and the user has called StopStream(). */
|
||||
CALLBACK_STOPPED = 1, /* callback has requested stop,
|
||||
but user has not yet called StopStream(). */
|
||||
STOPPING = 2, /* The stream is in the process of closing
|
||||
because the user has called StopStream.
|
||||
This state is just used internally;
|
||||
externally it is indistinguishable from
|
||||
ACTIVE.*/
|
||||
ACTIVE = 3 /* The stream is active and running. */
|
||||
} state;
|
||||
double sampleRate;
|
||||
PaMacCoreDeviceProperties inputProperties;
|
||||
PaMacCoreDeviceProperties outputProperties;
|
||||
|
||||
/* data updated by main thread and notifications, protected by timingInformationMutex */
|
||||
int timingInformationMutexIsInitialized;
|
||||
pthread_mutex_t timingInformationMutex;
|
||||
|
||||
/* These are written by the PA thread or from CoreAudio callbacks. Protected by the mutex. */
|
||||
Float64 timestampOffsetCombined;
|
||||
Float64 timestampOffsetInputDevice;
|
||||
Float64 timestampOffsetOutputDevice;
|
||||
|
||||
/* Offsets in seconds to be applied to Apple timestamps to convert them to PA timestamps.
|
||||
* While the io proc is active, the following values are only accessed and manipulated by the ioproc */
|
||||
Float64 timestampOffsetCombined_ioProcCopy;
|
||||
Float64 timestampOffsetInputDevice_ioProcCopy;
|
||||
Float64 timestampOffsetOutputDevice_ioProcCopy;
|
||||
|
||||
}
|
||||
PaMacCoreStream;
|
||||
|
||||
#endif /* PA_MAC_CORE_INTERNAL_H__ */
|
913
pd-0.44-2/portaudio/src/hostapi/coreaudio/pa_mac_core_old.c
Normal file
913
pd-0.44-2/portaudio/src/hostapi/coreaudio/pa_mac_core_old.c
Normal file
|
@ -0,0 +1,913 @@
|
|||
/*
|
||||
* $Id: pa_mac_core_old.c 1083 2006-08-23 07:30:49Z rossb $
|
||||
* pa_mac_core.c
|
||||
* Implementation of PortAudio for Mac OS X CoreAudio
|
||||
*
|
||||
* PortAudio Portable Real-Time Audio Library
|
||||
* Latest Version at: http://www.portaudio.com
|
||||
*
|
||||
* Authors: Ross Bencina and Phil Burk
|
||||
* Copyright (c) 1999-2000 Ross Bencina and Phil Burk
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
#include <CoreAudio/CoreAudio.h>
|
||||
#include <AudioToolbox/AudioToolbox.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "portaudio.h"
|
||||
#include "pa_trace.h"
|
||||
#include "pa_util.h"
|
||||
#include "pa_allocation.h"
|
||||
#include "pa_hostapi.h"
|
||||
#include "pa_stream.h"
|
||||
#include "pa_cpuload.h"
|
||||
#include "pa_process.h"
|
||||
|
||||
// ===== constants =====
|
||||
|
||||
// ===== structs =====
|
||||
#pragma mark structs
|
||||
|
||||
// PaMacCoreHostApiRepresentation - host api datastructure specific to this implementation
|
||||
typedef struct PaMacCore_HAR
|
||||
{
|
||||
PaUtilHostApiRepresentation inheritedHostApiRep;
|
||||
PaUtilStreamInterface callbackStreamInterface;
|
||||
PaUtilStreamInterface blockingStreamInterface;
|
||||
|
||||
PaUtilAllocationGroup *allocations;
|
||||
AudioDeviceID *macCoreDeviceIds;
|
||||
}
|
||||
PaMacCoreHostApiRepresentation;
|
||||
|
||||
typedef struct PaMacCore_DI
|
||||
{
|
||||
PaDeviceInfo inheritedDeviceInfo;
|
||||
}
|
||||
PaMacCoreDeviceInfo;
|
||||
|
||||
// PaMacCoreStream - a stream data structure specifically for this implementation
|
||||
typedef struct PaMacCore_S
|
||||
{
|
||||
PaUtilStreamRepresentation streamRepresentation;
|
||||
PaUtilCpuLoadMeasurer cpuLoadMeasurer;
|
||||
PaUtilBufferProcessor bufferProcessor;
|
||||
|
||||
int primeStreamUsingCallback;
|
||||
|
||||
AudioDeviceID inputDevice;
|
||||
AudioDeviceID outputDevice;
|
||||
|
||||
// Processing thread management --------------
|
||||
// HANDLE abortEvent;
|
||||
// HANDLE processingThread;
|
||||
// DWORD processingThreadId;
|
||||
|
||||
char throttleProcessingThreadOnOverload; // 0 -> don't throtte, non-0 -> throttle
|
||||
int processingThreadPriority;
|
||||
int highThreadPriority;
|
||||
int throttledThreadPriority;
|
||||
unsigned long throttledSleepMsecs;
|
||||
|
||||
int isStopped;
|
||||
volatile int isActive;
|
||||
volatile int stopProcessing; // stop thread once existing buffers have been returned
|
||||
volatile int abortProcessing; // stop thread immediately
|
||||
|
||||
// DWORD allBuffersDurationMs; // used to calculate timeouts
|
||||
}
|
||||
PaMacCoreStream;
|
||||
|
||||
// Data needed by the CoreAudio callback functions
|
||||
typedef struct PaMacCore_CD
|
||||
{
|
||||
PaMacCoreStream *stream;
|
||||
PaStreamCallback *callback;
|
||||
void *userData;
|
||||
PaUtilConverter *inputConverter;
|
||||
PaUtilConverter *outputConverter;
|
||||
void *inputBuffer;
|
||||
void *outputBuffer;
|
||||
int inputChannelCount;
|
||||
int outputChannelCount;
|
||||
PaSampleFormat inputSampleFormat;
|
||||
PaSampleFormat outputSampleFormat;
|
||||
PaUtilTriangularDitherGenerator *ditherGenerator;
|
||||
}
|
||||
PaMacClientData;
|
||||
|
||||
// ===== CoreAudio-PortAudio bridge functions =====
|
||||
#pragma mark CoreAudio-PortAudio bridge functions
|
||||
|
||||
// Maps CoreAudio OSStatus codes to PortAudio PaError codes
|
||||
static PaError conv_err(OSStatus error)
|
||||
{
|
||||
PaError result;
|
||||
|
||||
switch (error) {
|
||||
case kAudioHardwareNoError:
|
||||
result = paNoError; break;
|
||||
case kAudioHardwareNotRunningError:
|
||||
result = paInternalError; break;
|
||||
case kAudioHardwareUnspecifiedError:
|
||||
result = paInternalError; break;
|
||||
case kAudioHardwareUnknownPropertyError:
|
||||
result = paInternalError; break;
|
||||
case kAudioHardwareBadPropertySizeError:
|
||||
result = paInternalError; break;
|
||||
case kAudioHardwareIllegalOperationError:
|
||||
result = paInternalError; break;
|
||||
case kAudioHardwareBadDeviceError:
|
||||
result = paInvalidDevice; break;
|
||||
case kAudioHardwareBadStreamError:
|
||||
result = paBadStreamPtr; break;
|
||||
case kAudioHardwareUnsupportedOperationError:
|
||||
result = paInternalError; break;
|
||||
case kAudioDeviceUnsupportedFormatError:
|
||||
result = paSampleFormatNotSupported; break;
|
||||
case kAudioDevicePermissionsError:
|
||||
result = paDeviceUnavailable; break;
|
||||
default:
|
||||
result = paInternalError;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* This function is unused
|
||||
static AudioStreamBasicDescription *InitializeStreamDescription(const PaStreamParameters *parameters, double sampleRate)
|
||||
{
|
||||
struct AudioStreamBasicDescription *streamDescription = PaUtil_AllocateMemory(sizeof(AudioStreamBasicDescription));
|
||||
streamDescription->mSampleRate = sampleRate;
|
||||
streamDescription->mFormatID = kAudioFormatLinearPCM;
|
||||
streamDescription->mFormatFlags = 0;
|
||||
streamDescription->mFramesPerPacket = 1;
|
||||
|
||||
if (parameters->sampleFormat & paNonInterleaved) {
|
||||
streamDescription->mFormatFlags |= kLinearPCMFormatFlagIsNonInterleaved;
|
||||
streamDescription->mChannelsPerFrame = 1;
|
||||
streamDescription->mBytesPerFrame = Pa_GetSampleSize(parameters->sampleFormat);
|
||||
streamDescription->mBytesPerPacket = Pa_GetSampleSize(parameters->sampleFormat);
|
||||
}
|
||||
else {
|
||||
streamDescription->mChannelsPerFrame = parameters->channelCount;
|
||||
}
|
||||
|
||||
streamDescription->mBytesPerFrame = Pa_GetSampleSize(parameters->sampleFormat) * streamDescription->mChannelsPerFrame;
|
||||
streamDescription->mBytesPerPacket = streamDescription->mBytesPerFrame * streamDescription->mFramesPerPacket;
|
||||
|
||||
if (parameters->sampleFormat & paFloat32) {
|
||||
streamDescription->mFormatFlags |= kLinearPCMFormatFlagIsFloat;
|
||||
streamDescription->mBitsPerChannel = 32;
|
||||
}
|
||||
else if (parameters->sampleFormat & paInt32) {
|
||||
streamDescription->mFormatFlags |= kLinearPCMFormatFlagIsSignedInteger;
|
||||
streamDescription->mBitsPerChannel = 32;
|
||||
}
|
||||
else if (parameters->sampleFormat & paInt24) {
|
||||
streamDescription->mFormatFlags |= kLinearPCMFormatFlagIsSignedInteger;
|
||||
streamDescription->mBitsPerChannel = 24;
|
||||
}
|
||||
else if (parameters->sampleFormat & paInt16) {
|
||||
streamDescription->mFormatFlags |= kLinearPCMFormatFlagIsSignedInteger;
|
||||
streamDescription->mBitsPerChannel = 16;
|
||||
}
|
||||
else if (parameters->sampleFormat & paInt8) {
|
||||
streamDescription->mFormatFlags |= kLinearPCMFormatFlagIsSignedInteger;
|
||||
streamDescription->mBitsPerChannel = 8;
|
||||
}
|
||||
else if (parameters->sampleFormat & paInt32) {
|
||||
streamDescription->mBitsPerChannel = 8;
|
||||
}
|
||||
|
||||
return streamDescription;
|
||||
}
|
||||
*/
|
||||
|
||||
static PaStreamCallbackTimeInfo *InitializeTimeInfo(const AudioTimeStamp* now, const AudioTimeStamp* inputTime, const AudioTimeStamp* outputTime)
|
||||
{
|
||||
PaStreamCallbackTimeInfo *timeInfo = PaUtil_AllocateMemory(sizeof(PaStreamCallbackTimeInfo));
|
||||
|
||||
timeInfo->inputBufferAdcTime = inputTime->mSampleTime;
|
||||
timeInfo->currentTime = now->mSampleTime;
|
||||
timeInfo->outputBufferDacTime = outputTime->mSampleTime;
|
||||
|
||||
return timeInfo;
|
||||
}
|
||||
|
||||
// ===== support functions =====
|
||||
#pragma mark support functions
|
||||
|
||||
static void CleanUp(PaMacCoreHostApiRepresentation *macCoreHostApi)
|
||||
{
|
||||
if( macCoreHostApi->allocations )
|
||||
{
|
||||
PaUtil_FreeAllAllocations( macCoreHostApi->allocations );
|
||||
PaUtil_DestroyAllocationGroup( macCoreHostApi->allocations );
|
||||
}
|
||||
|
||||
PaUtil_FreeMemory( macCoreHostApi );
|
||||
}
|
||||
|
||||
static PaError GetChannelInfo(PaDeviceInfo *deviceInfo, AudioDeviceID macCoreDeviceId, int isInput)
|
||||
{
|
||||
UInt32 propSize;
|
||||
PaError err = paNoError;
|
||||
UInt32 i;
|
||||
int numChannels = 0;
|
||||
AudioBufferList *buflist;
|
||||
|
||||
err = conv_err(AudioDeviceGetPropertyInfo(macCoreDeviceId, 0, isInput, kAudioDevicePropertyStreamConfiguration, &propSize, NULL));
|
||||
buflist = PaUtil_AllocateMemory(propSize);
|
||||
err = conv_err(AudioDeviceGetProperty(macCoreDeviceId, 0, isInput, kAudioDevicePropertyStreamConfiguration, &propSize, buflist));
|
||||
if (!err) {
|
||||
for (i = 0; i < buflist->mNumberBuffers; ++i) {
|
||||
numChannels += buflist->mBuffers[i].mNumberChannels;
|
||||
}
|
||||
|
||||
if (isInput)
|
||||
deviceInfo->maxInputChannels = numChannels;
|
||||
else
|
||||
deviceInfo->maxOutputChannels = numChannels;
|
||||
|
||||
int frameLatency;
|
||||
propSize = sizeof(UInt32);
|
||||
err = conv_err(AudioDeviceGetProperty(macCoreDeviceId, 0, isInput, kAudioDevicePropertyLatency, &propSize, &frameLatency));
|
||||
if (!err) {
|
||||
double secondLatency = frameLatency / deviceInfo->defaultSampleRate;
|
||||
if (isInput) {
|
||||
deviceInfo->defaultLowInputLatency = secondLatency;
|
||||
deviceInfo->defaultHighInputLatency = secondLatency;
|
||||
}
|
||||
else {
|
||||
deviceInfo->defaultLowOutputLatency = secondLatency;
|
||||
deviceInfo->defaultHighOutputLatency = secondLatency;
|
||||
}
|
||||
}
|
||||
}
|
||||
PaUtil_FreeMemory(buflist);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static PaError InitializeDeviceInfo(PaMacCoreDeviceInfo *macCoreDeviceInfo, AudioDeviceID macCoreDeviceId, PaHostApiIndex hostApiIndex )
|
||||
{
|
||||
PaDeviceInfo *deviceInfo = &macCoreDeviceInfo->inheritedDeviceInfo;
|
||||
deviceInfo->structVersion = 2;
|
||||
deviceInfo->hostApi = hostApiIndex;
|
||||
|
||||
PaError err = paNoError;
|
||||
UInt32 propSize;
|
||||
|
||||
err = conv_err(AudioDeviceGetPropertyInfo(macCoreDeviceId, 0, 0, kAudioDevicePropertyDeviceName, &propSize, NULL));
|
||||
// FIXME: this allocation should be part of the allocations group
|
||||
char *name = PaUtil_AllocateMemory(propSize);
|
||||
err = conv_err(AudioDeviceGetProperty(macCoreDeviceId, 0, 0, kAudioDevicePropertyDeviceName, &propSize, name));
|
||||
if (!err) {
|
||||
deviceInfo->name = name;
|
||||
}
|
||||
|
||||
Float64 sampleRate;
|
||||
propSize = sizeof(Float64);
|
||||
err = conv_err(AudioDeviceGetProperty(macCoreDeviceId, 0, 0, kAudioDevicePropertyNominalSampleRate, &propSize, &sampleRate));
|
||||
if (!err) {
|
||||
deviceInfo->defaultSampleRate = sampleRate;
|
||||
}
|
||||
|
||||
|
||||
// Get channel info
|
||||
err = GetChannelInfo(deviceInfo, macCoreDeviceId, 1);
|
||||
err = GetChannelInfo(deviceInfo, macCoreDeviceId, 0);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static PaError InitializeDeviceInfos( PaMacCoreHostApiRepresentation *macCoreHostApi, PaHostApiIndex hostApiIndex )
|
||||
{
|
||||
PaError result = paNoError;
|
||||
PaUtilHostApiRepresentation *hostApi;
|
||||
PaMacCoreDeviceInfo *deviceInfoArray;
|
||||
|
||||
// initialise device counts and default devices under the assumption that there are no devices. These values are incremented below if and when devices are successfully initialized.
|
||||
hostApi = &macCoreHostApi->inheritedHostApiRep;
|
||||
hostApi->info.deviceCount = 0;
|
||||
hostApi->info.defaultInputDevice = paNoDevice;
|
||||
hostApi->info.defaultOutputDevice = paNoDevice;
|
||||
|
||||
UInt32 propsize;
|
||||
AudioHardwareGetPropertyInfo(kAudioHardwarePropertyDevices, &propsize, NULL);
|
||||
int numDevices = propsize / sizeof(AudioDeviceID);
|
||||
hostApi->info.deviceCount = numDevices;
|
||||
if (numDevices > 0) {
|
||||
hostApi->deviceInfos = (PaDeviceInfo**)PaUtil_GroupAllocateMemory(
|
||||
macCoreHostApi->allocations, sizeof(PaDeviceInfo*) * numDevices );
|
||||
if( !hostApi->deviceInfos )
|
||||
{
|
||||
return paInsufficientMemory;
|
||||
}
|
||||
|
||||
// allocate all device info structs in a contiguous block
|
||||
deviceInfoArray = (PaMacCoreDeviceInfo*)PaUtil_GroupAllocateMemory(
|
||||
macCoreHostApi->allocations, sizeof(PaMacCoreDeviceInfo) * numDevices );
|
||||
if( !deviceInfoArray )
|
||||
{
|
||||
return paInsufficientMemory;
|
||||
}
|
||||
|
||||
macCoreHostApi->macCoreDeviceIds = PaUtil_GroupAllocateMemory(macCoreHostApi->allocations, propsize);
|
||||
AudioHardwareGetProperty(kAudioHardwarePropertyDevices, &propsize, macCoreHostApi->macCoreDeviceIds);
|
||||
|
||||
AudioDeviceID defaultInputDevice, defaultOutputDevice;
|
||||
propsize = sizeof(AudioDeviceID);
|
||||
AudioHardwareGetProperty(kAudioHardwarePropertyDefaultInputDevice, &propsize, &defaultInputDevice);
|
||||
AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice, &propsize, &defaultOutputDevice);
|
||||
|
||||
UInt32 i;
|
||||
for (i = 0; i < numDevices; ++i) {
|
||||
if (macCoreHostApi->macCoreDeviceIds[i] == defaultInputDevice) {
|
||||
hostApi->info.defaultInputDevice = i;
|
||||
}
|
||||
if (macCoreHostApi->macCoreDeviceIds[i] == defaultOutputDevice) {
|
||||
hostApi->info.defaultOutputDevice = i;
|
||||
}
|
||||
InitializeDeviceInfo(&deviceInfoArray[i], macCoreHostApi->macCoreDeviceIds[i], hostApiIndex);
|
||||
hostApi->deviceInfos[i] = &(deviceInfoArray[i].inheritedDeviceInfo);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static OSStatus CheckFormat(AudioDeviceID macCoreDeviceId, const PaStreamParameters *parameters, double sampleRate, int isInput)
|
||||
{
|
||||
UInt32 propSize = sizeof(AudioStreamBasicDescription);
|
||||
AudioStreamBasicDescription *streamDescription = PaUtil_AllocateMemory(propSize);
|
||||
|
||||
streamDescription->mSampleRate = sampleRate;
|
||||
streamDescription->mFormatID = 0;
|
||||
streamDescription->mFormatFlags = 0;
|
||||
streamDescription->mBytesPerPacket = 0;
|
||||
streamDescription->mFramesPerPacket = 0;
|
||||
streamDescription->mBytesPerFrame = 0;
|
||||
streamDescription->mChannelsPerFrame = 0;
|
||||
streamDescription->mBitsPerChannel = 0;
|
||||
streamDescription->mReserved = 0;
|
||||
|
||||
OSStatus result = AudioDeviceGetProperty(macCoreDeviceId, 0, isInput, kAudioDevicePropertyStreamFormatSupported, &propSize, streamDescription);
|
||||
PaUtil_FreeMemory(streamDescription);
|
||||
return result;
|
||||
}
|
||||
|
||||
static OSStatus CopyInputData(PaMacClientData* destination, const AudioBufferList *source, unsigned long frameCount)
|
||||
{
|
||||
int frameSpacing, channelSpacing;
|
||||
if (destination->inputSampleFormat & paNonInterleaved) {
|
||||
frameSpacing = 1;
|
||||
channelSpacing = destination->inputChannelCount;
|
||||
}
|
||||
else {
|
||||
frameSpacing = destination->inputChannelCount;
|
||||
channelSpacing = 1;
|
||||
}
|
||||
|
||||
AudioBuffer const *inputBuffer = &source->mBuffers[0];
|
||||
void *coreAudioBuffer = inputBuffer->mData;
|
||||
void *portAudioBuffer = destination->inputBuffer;
|
||||
UInt32 i, streamNumber, streamChannel;
|
||||
for (i = streamNumber = streamChannel = 0; i < destination->inputChannelCount; ++i, ++streamChannel) {
|
||||
if (streamChannel >= inputBuffer->mNumberChannels) {
|
||||
++streamNumber;
|
||||
inputBuffer = &source->mBuffers[streamNumber];
|
||||
coreAudioBuffer = inputBuffer->mData;
|
||||
streamChannel = 0;
|
||||
}
|
||||
destination->inputConverter(portAudioBuffer, frameSpacing, coreAudioBuffer, inputBuffer->mNumberChannels, frameCount, destination->ditherGenerator);
|
||||
coreAudioBuffer += sizeof(Float32);
|
||||
portAudioBuffer += Pa_GetSampleSize(destination->inputSampleFormat) * channelSpacing;
|
||||
}
|
||||
return noErr;
|
||||
}
|
||||
|
||||
static OSStatus CopyOutputData(AudioBufferList* destination, PaMacClientData *source, unsigned long frameCount)
|
||||
{
|
||||
int frameSpacing, channelSpacing;
|
||||
if (source->outputSampleFormat & paNonInterleaved) {
|
||||
frameSpacing = 1;
|
||||
channelSpacing = source->outputChannelCount;
|
||||
}
|
||||
else {
|
||||
frameSpacing = source->outputChannelCount;
|
||||
channelSpacing = 1;
|
||||
}
|
||||
|
||||
AudioBuffer *outputBuffer = &destination->mBuffers[0];
|
||||
void *coreAudioBuffer = outputBuffer->mData;
|
||||
void *portAudioBuffer = source->outputBuffer;
|
||||
UInt32 i, streamNumber, streamChannel;
|
||||
for (i = streamNumber = streamChannel = 0; i < source->outputChannelCount; ++i, ++streamChannel) {
|
||||
if (streamChannel >= outputBuffer->mNumberChannels) {
|
||||
++streamNumber;
|
||||
outputBuffer = &destination->mBuffers[streamNumber];
|
||||
coreAudioBuffer = outputBuffer->mData;
|
||||
streamChannel = 0;
|
||||
}
|
||||
source->outputConverter(coreAudioBuffer, outputBuffer->mNumberChannels, portAudioBuffer, frameSpacing, frameCount, NULL);
|
||||
coreAudioBuffer += sizeof(Float32);
|
||||
portAudioBuffer += Pa_GetSampleSize(source->outputSampleFormat) * channelSpacing;
|
||||
}
|
||||
return noErr;
|
||||
}
|
||||
|
||||
static OSStatus AudioIOProc( AudioDeviceID inDevice,
|
||||
const AudioTimeStamp* inNow,
|
||||
const AudioBufferList* inInputData,
|
||||
const AudioTimeStamp* inInputTime,
|
||||
AudioBufferList* outOutputData,
|
||||
const AudioTimeStamp* inOutputTime,
|
||||
void* inClientData)
|
||||
{
|
||||
PaMacClientData *clientData = (PaMacClientData *)inClientData;
|
||||
PaStreamCallbackTimeInfo *timeInfo = InitializeTimeInfo(inNow, inInputTime, inOutputTime);
|
||||
|
||||
PaUtil_BeginCpuLoadMeasurement( &clientData->stream->cpuLoadMeasurer );
|
||||
|
||||
AudioBuffer *outputBuffer = &outOutputData->mBuffers[0];
|
||||
unsigned long frameCount = outputBuffer->mDataByteSize / (outputBuffer->mNumberChannels * sizeof(Float32));
|
||||
|
||||
if (clientData->inputBuffer) {
|
||||
CopyInputData(clientData, inInputData, frameCount);
|
||||
}
|
||||
PaStreamCallbackResult result = clientData->callback(clientData->inputBuffer, clientData->outputBuffer, frameCount, timeInfo, paNoFlag, clientData->userData);
|
||||
if (clientData->outputBuffer) {
|
||||
CopyOutputData(outOutputData, clientData, frameCount);
|
||||
}
|
||||
|
||||
PaUtil_EndCpuLoadMeasurement( &clientData->stream->cpuLoadMeasurer, frameCount );
|
||||
|
||||
if (result == paComplete || result == paAbort) {
|
||||
Pa_StopStream(clientData->stream);
|
||||
}
|
||||
|
||||
PaUtil_FreeMemory( timeInfo );
|
||||
return noErr;
|
||||
}
|
||||
|
||||
// This is not for input-only streams, this is for streams where the input device is different from the output device
|
||||
static OSStatus AudioInputProc( AudioDeviceID inDevice,
|
||||
const AudioTimeStamp* inNow,
|
||||
const AudioBufferList* inInputData,
|
||||
const AudioTimeStamp* inInputTime,
|
||||
AudioBufferList* outOutputData,
|
||||
const AudioTimeStamp* inOutputTime,
|
||||
void* inClientData)
|
||||
{
|
||||
PaMacClientData *clientData = (PaMacClientData *)inClientData;
|
||||
PaStreamCallbackTimeInfo *timeInfo = InitializeTimeInfo(inNow, inInputTime, inOutputTime);
|
||||
|
||||
PaUtil_BeginCpuLoadMeasurement( &clientData->stream->cpuLoadMeasurer );
|
||||
|
||||
AudioBuffer const *inputBuffer = &inInputData->mBuffers[0];
|
||||
unsigned long frameCount = inputBuffer->mDataByteSize / (inputBuffer->mNumberChannels * sizeof(Float32));
|
||||
|
||||
CopyInputData(clientData, inInputData, frameCount);
|
||||
PaStreamCallbackResult result = clientData->callback(clientData->inputBuffer, clientData->outputBuffer, frameCount, timeInfo, paNoFlag, clientData->userData);
|
||||
|
||||
PaUtil_EndCpuLoadMeasurement( &clientData->stream->cpuLoadMeasurer, frameCount );
|
||||
if( result == paComplete || result == paAbort )
|
||||
Pa_StopStream(clientData->stream);
|
||||
PaUtil_FreeMemory( timeInfo );
|
||||
return noErr;
|
||||
}
|
||||
|
||||
// This is not for output-only streams, this is for streams where the input device is different from the output device
|
||||
static OSStatus AudioOutputProc( AudioDeviceID inDevice,
|
||||
const AudioTimeStamp* inNow,
|
||||
const AudioBufferList* inInputData,
|
||||
const AudioTimeStamp* inInputTime,
|
||||
AudioBufferList* outOutputData,
|
||||
const AudioTimeStamp* inOutputTime,
|
||||
void* inClientData)
|
||||
{
|
||||
PaMacClientData *clientData = (PaMacClientData *)inClientData;
|
||||
//PaStreamCallbackTimeInfo *timeInfo = InitializeTimeInfo(inNow, inInputTime, inOutputTime);
|
||||
|
||||
PaUtil_BeginCpuLoadMeasurement( &clientData->stream->cpuLoadMeasurer );
|
||||
|
||||
AudioBuffer *outputBuffer = &outOutputData->mBuffers[0];
|
||||
unsigned long frameCount = outputBuffer->mDataByteSize / (outputBuffer->mNumberChannels * sizeof(Float32));
|
||||
|
||||
//clientData->callback(NULL, clientData->outputBuffer, frameCount, timeInfo, paNoFlag, clientData->userData);
|
||||
|
||||
CopyOutputData(outOutputData, clientData, frameCount);
|
||||
|
||||
PaUtil_EndCpuLoadMeasurement( &clientData->stream->cpuLoadMeasurer, frameCount );
|
||||
return noErr;
|
||||
}
|
||||
|
||||
static PaError SetSampleRate(AudioDeviceID device, double sampleRate, int isInput)
|
||||
{
|
||||
PaError result = paNoError;
|
||||
|
||||
double actualSampleRate;
|
||||
UInt32 propSize = sizeof(double);
|
||||
result = conv_err(AudioDeviceSetProperty(device, NULL, 0, isInput, kAudioDevicePropertyNominalSampleRate, propSize, &sampleRate));
|
||||
|
||||
result = conv_err(AudioDeviceGetProperty(device, 0, isInput, kAudioDevicePropertyNominalSampleRate, &propSize, &actualSampleRate));
|
||||
|
||||
if (result == paNoError && actualSampleRate != sampleRate) {
|
||||
result = paInvalidSampleRate;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static PaError SetFramesPerBuffer(AudioDeviceID device, unsigned long framesPerBuffer, int isInput)
|
||||
{
|
||||
PaError result = paNoError;
|
||||
UInt32 preferredFramesPerBuffer = framesPerBuffer;
|
||||
// while (preferredFramesPerBuffer > UINT32_MAX) {
|
||||
// preferredFramesPerBuffer /= 2;
|
||||
// }
|
||||
|
||||
UInt32 actualFramesPerBuffer;
|
||||
UInt32 propSize = sizeof(UInt32);
|
||||
result = conv_err(AudioDeviceSetProperty(device, NULL, 0, isInput, kAudioDevicePropertyBufferFrameSize, propSize, &preferredFramesPerBuffer));
|
||||
|
||||
result = conv_err(AudioDeviceGetProperty(device, 0, isInput, kAudioDevicePropertyBufferFrameSize, &propSize, &actualFramesPerBuffer));
|
||||
|
||||
if (result != paNoError) {
|
||||
// do nothing
|
||||
}
|
||||
else if (actualFramesPerBuffer > framesPerBuffer) {
|
||||
result = paBufferTooSmall;
|
||||
}
|
||||
else if (actualFramesPerBuffer < framesPerBuffer) {
|
||||
result = paBufferTooBig;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static PaError SetUpUnidirectionalStream(AudioDeviceID device, double sampleRate, unsigned long framesPerBuffer, int isInput)
|
||||
{
|
||||
PaError err = paNoError;
|
||||
err = SetSampleRate(device, sampleRate, isInput);
|
||||
if( err == paNoError )
|
||||
err = SetFramesPerBuffer(device, framesPerBuffer, isInput);
|
||||
return err;
|
||||
}
|
||||
|
||||
// ===== PortAudio functions =====
|
||||
#pragma mark PortAudio functions
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif // __cplusplus
|
||||
|
||||
PaError PaMacCore_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
static void Terminate( struct PaUtilHostApiRepresentation *hostApi )
|
||||
{
|
||||
PaMacCoreHostApiRepresentation *macCoreHostApi = (PaMacCoreHostApiRepresentation*)hostApi;
|
||||
|
||||
CleanUp(macCoreHostApi);
|
||||
}
|
||||
|
||||
static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi,
|
||||
const PaStreamParameters *inputParameters,
|
||||
const PaStreamParameters *outputParameters,
|
||||
double sampleRate )
|
||||
{
|
||||
PaMacCoreHostApiRepresentation *macCoreHostApi = (PaMacCoreHostApiRepresentation*)hostApi;
|
||||
PaDeviceInfo *deviceInfo;
|
||||
|
||||
PaError result = paNoError;
|
||||
if (inputParameters) {
|
||||
deviceInfo = macCoreHostApi->inheritedHostApiRep.deviceInfos[inputParameters->device];
|
||||
if (inputParameters->channelCount > deviceInfo->maxInputChannels)
|
||||
result = paInvalidChannelCount;
|
||||
else if (CheckFormat(macCoreHostApi->macCoreDeviceIds[inputParameters->device], inputParameters, sampleRate, 1) != kAudioHardwareNoError) {
|
||||
result = paInvalidSampleRate;
|
||||
}
|
||||
}
|
||||
if (outputParameters && result == paNoError) {
|
||||
deviceInfo = macCoreHostApi->inheritedHostApiRep.deviceInfos[outputParameters->device];
|
||||
if (outputParameters->channelCount > deviceInfo->maxOutputChannels)
|
||||
result = paInvalidChannelCount;
|
||||
else if (CheckFormat(macCoreHostApi->macCoreDeviceIds[outputParameters->device], outputParameters, sampleRate, 0) != kAudioHardwareNoError) {
|
||||
result = paInvalidSampleRate;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
|
||||
PaStream** s,
|
||||
const PaStreamParameters *inputParameters,
|
||||
const PaStreamParameters *outputParameters,
|
||||
double sampleRate,
|
||||
unsigned long framesPerBuffer,
|
||||
PaStreamFlags streamFlags,
|
||||
PaStreamCallback *streamCallback,
|
||||
void *userData )
|
||||
{
|
||||
PaError err = paNoError;
|
||||
PaMacCoreHostApiRepresentation *macCoreHostApi = (PaMacCoreHostApiRepresentation *)hostApi;
|
||||
PaMacCoreStream *stream = PaUtil_AllocateMemory(sizeof(PaMacCoreStream));
|
||||
stream->isActive = 0;
|
||||
stream->isStopped = 1;
|
||||
stream->inputDevice = kAudioDeviceUnknown;
|
||||
stream->outputDevice = kAudioDeviceUnknown;
|
||||
|
||||
PaUtil_InitializeStreamRepresentation( &stream->streamRepresentation,
|
||||
( (streamCallback)
|
||||
? &macCoreHostApi->callbackStreamInterface
|
||||
: &macCoreHostApi->blockingStreamInterface ),
|
||||
streamCallback, userData );
|
||||
PaUtil_InitializeCpuLoadMeasurer( &stream->cpuLoadMeasurer, sampleRate );
|
||||
|
||||
*s = (PaStream*)stream;
|
||||
PaMacClientData *clientData = PaUtil_AllocateMemory(sizeof(PaMacClientData));
|
||||
clientData->stream = stream;
|
||||
clientData->callback = streamCallback;
|
||||
clientData->userData = userData;
|
||||
clientData->inputBuffer = 0;
|
||||
clientData->outputBuffer = 0;
|
||||
clientData->ditherGenerator = PaUtil_AllocateMemory(sizeof(PaUtilTriangularDitherGenerator));
|
||||
PaUtil_InitializeTriangularDitherState(clientData->ditherGenerator);
|
||||
|
||||
if (inputParameters != NULL) {
|
||||
stream->inputDevice = macCoreHostApi->macCoreDeviceIds[inputParameters->device];
|
||||
clientData->inputConverter = PaUtil_SelectConverter(paFloat32, inputParameters->sampleFormat, streamFlags);
|
||||
clientData->inputBuffer = PaUtil_AllocateMemory(Pa_GetSampleSize(inputParameters->sampleFormat) * framesPerBuffer * inputParameters->channelCount);
|
||||
clientData->inputChannelCount = inputParameters->channelCount;
|
||||
clientData->inputSampleFormat = inputParameters->sampleFormat;
|
||||
err = SetUpUnidirectionalStream(stream->inputDevice, sampleRate, framesPerBuffer, 1);
|
||||
}
|
||||
|
||||
if (err == paNoError && outputParameters != NULL) {
|
||||
stream->outputDevice = macCoreHostApi->macCoreDeviceIds[outputParameters->device];
|
||||
clientData->outputConverter = PaUtil_SelectConverter(outputParameters->sampleFormat, paFloat32, streamFlags);
|
||||
clientData->outputBuffer = PaUtil_AllocateMemory(Pa_GetSampleSize(outputParameters->sampleFormat) * framesPerBuffer * outputParameters->channelCount);
|
||||
clientData->outputChannelCount = outputParameters->channelCount;
|
||||
clientData->outputSampleFormat = outputParameters->sampleFormat;
|
||||
err = SetUpUnidirectionalStream(stream->outputDevice, sampleRate, framesPerBuffer, 0);
|
||||
}
|
||||
|
||||
if (inputParameters == NULL || outputParameters == NULL || stream->inputDevice == stream->outputDevice) {
|
||||
AudioDeviceID device = (inputParameters == NULL) ? stream->outputDevice : stream->inputDevice;
|
||||
|
||||
AudioDeviceAddIOProc(device, AudioIOProc, clientData);
|
||||
}
|
||||
else {
|
||||
// using different devices for input and output
|
||||
AudioDeviceAddIOProc(stream->inputDevice, AudioInputProc, clientData);
|
||||
AudioDeviceAddIOProc(stream->outputDevice, AudioOutputProc, clientData);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
// Note: When CloseStream() is called, the multi-api layer ensures that the stream has already been stopped or aborted.
|
||||
static PaError CloseStream( PaStream* s )
|
||||
{
|
||||
PaError err = paNoError;
|
||||
PaMacCoreStream *stream = (PaMacCoreStream*)s;
|
||||
|
||||
PaUtil_ResetCpuLoadMeasurer( &stream->cpuLoadMeasurer );
|
||||
|
||||
if (stream->inputDevice != kAudioDeviceUnknown) {
|
||||
if (stream->outputDevice == kAudioDeviceUnknown || stream->outputDevice == stream->inputDevice) {
|
||||
err = conv_err(AudioDeviceRemoveIOProc(stream->inputDevice, AudioIOProc));
|
||||
}
|
||||
else {
|
||||
err = conv_err(AudioDeviceRemoveIOProc(stream->inputDevice, AudioInputProc));
|
||||
err = conv_err(AudioDeviceRemoveIOProc(stream->outputDevice, AudioOutputProc));
|
||||
}
|
||||
}
|
||||
else {
|
||||
err = conv_err(AudioDeviceRemoveIOProc(stream->outputDevice, AudioIOProc));
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
static PaError StartStream( PaStream *s )
|
||||
{
|
||||
PaError err = paNoError;
|
||||
PaMacCoreStream *stream = (PaMacCoreStream*)s;
|
||||
|
||||
if (stream->inputDevice != kAudioDeviceUnknown) {
|
||||
if (stream->outputDevice == kAudioDeviceUnknown || stream->outputDevice == stream->inputDevice) {
|
||||
err = conv_err(AudioDeviceStart(stream->inputDevice, AudioIOProc));
|
||||
}
|
||||
else {
|
||||
err = conv_err(AudioDeviceStart(stream->inputDevice, AudioInputProc));
|
||||
err = conv_err(AudioDeviceStart(stream->outputDevice, AudioOutputProc));
|
||||
}
|
||||
}
|
||||
else {
|
||||
err = conv_err(AudioDeviceStart(stream->outputDevice, AudioIOProc));
|
||||
}
|
||||
|
||||
stream->isActive = 1;
|
||||
stream->isStopped = 0;
|
||||
return err;
|
||||
}
|
||||
|
||||
static PaError AbortStream( PaStream *s )
|
||||
{
|
||||
PaError err = paNoError;
|
||||
PaMacCoreStream *stream = (PaMacCoreStream*)s;
|
||||
|
||||
if (stream->inputDevice != kAudioDeviceUnknown) {
|
||||
if (stream->outputDevice == kAudioDeviceUnknown || stream->outputDevice == stream->inputDevice) {
|
||||
err = conv_err(AudioDeviceStop(stream->inputDevice, AudioIOProc));
|
||||
}
|
||||
else {
|
||||
err = conv_err(AudioDeviceStop(stream->inputDevice, AudioInputProc));
|
||||
err = conv_err(AudioDeviceStop(stream->outputDevice, AudioOutputProc));
|
||||
}
|
||||
}
|
||||
else {
|
||||
err = conv_err(AudioDeviceStop(stream->outputDevice, AudioIOProc));
|
||||
}
|
||||
|
||||
stream->isActive = 0;
|
||||
stream->isStopped = 1;
|
||||
return err;
|
||||
}
|
||||
|
||||
static PaError StopStream( PaStream *s )
|
||||
{
|
||||
// TODO: this should be nicer than abort
|
||||
return AbortStream(s);
|
||||
}
|
||||
|
||||
static PaError IsStreamStopped( PaStream *s )
|
||||
{
|
||||
PaMacCoreStream *stream = (PaMacCoreStream*)s;
|
||||
|
||||
return stream->isStopped;
|
||||
}
|
||||
|
||||
|
||||
static PaError IsStreamActive( PaStream *s )
|
||||
{
|
||||
PaMacCoreStream *stream = (PaMacCoreStream*)s;
|
||||
|
||||
return stream->isActive;
|
||||
}
|
||||
|
||||
|
||||
static PaTime GetStreamTime( PaStream *s )
|
||||
{
|
||||
OSStatus err;
|
||||
PaTime result;
|
||||
PaMacCoreStream *stream = (PaMacCoreStream*)s;
|
||||
|
||||
AudioTimeStamp *timeStamp = PaUtil_AllocateMemory(sizeof(AudioTimeStamp));
|
||||
if (stream->inputDevice != kAudioDeviceUnknown) {
|
||||
err = AudioDeviceGetCurrentTime(stream->inputDevice, timeStamp);
|
||||
}
|
||||
else {
|
||||
err = AudioDeviceGetCurrentTime(stream->outputDevice, timeStamp);
|
||||
}
|
||||
|
||||
result = err ? 0 : timeStamp->mSampleTime;
|
||||
PaUtil_FreeMemory(timeStamp);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
static double GetStreamCpuLoad( PaStream* s )
|
||||
{
|
||||
PaMacCoreStream *stream = (PaMacCoreStream*)s;
|
||||
|
||||
return PaUtil_GetCpuLoad( &stream->cpuLoadMeasurer );
|
||||
}
|
||||
|
||||
|
||||
// As separate stream interfaces are used for blocking and callback streams, the following functions can be guaranteed to only be called for blocking streams.
|
||||
|
||||
static PaError ReadStream( PaStream* s,
|
||||
void *buffer,
|
||||
unsigned long frames )
|
||||
{
|
||||
return paInternalError;
|
||||
}
|
||||
|
||||
|
||||
static PaError WriteStream( PaStream* s,
|
||||
const void *buffer,
|
||||
unsigned long frames )
|
||||
{
|
||||
return paInternalError;
|
||||
}
|
||||
|
||||
|
||||
static signed long GetStreamReadAvailable( PaStream* s )
|
||||
{
|
||||
return paInternalError;
|
||||
}
|
||||
|
||||
|
||||
static signed long GetStreamWriteAvailable( PaStream* s )
|
||||
{
|
||||
return paInternalError;
|
||||
}
|
||||
|
||||
// HostAPI-specific initialization function
|
||||
PaError PaMacCore_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex hostApiIndex )
|
||||
{
|
||||
PaError result = paNoError;
|
||||
PaMacCoreHostApiRepresentation *macCoreHostApi = (PaMacCoreHostApiRepresentation *)PaUtil_AllocateMemory( sizeof(PaMacCoreHostApiRepresentation) );
|
||||
if( !macCoreHostApi )
|
||||
{
|
||||
result = paInsufficientMemory;
|
||||
goto error;
|
||||
}
|
||||
|
||||
macCoreHostApi->allocations = PaUtil_CreateAllocationGroup();
|
||||
if( !macCoreHostApi->allocations )
|
||||
{
|
||||
result = paInsufficientMemory;
|
||||
goto error;
|
||||
}
|
||||
|
||||
*hostApi = &macCoreHostApi->inheritedHostApiRep;
|
||||
(*hostApi)->info.structVersion = 1;
|
||||
(*hostApi)->info.type = paCoreAudio;
|
||||
(*hostApi)->info.name = "CoreAudio";
|
||||
|
||||
result = InitializeDeviceInfos(macCoreHostApi, hostApiIndex);
|
||||
if (result != paNoError) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
// Set up the proper callbacks to this HostApi's functions
|
||||
(*hostApi)->Terminate = Terminate;
|
||||
(*hostApi)->OpenStream = OpenStream;
|
||||
(*hostApi)->IsFormatSupported = IsFormatSupported;
|
||||
|
||||
PaUtil_InitializeStreamInterface( &macCoreHostApi->callbackStreamInterface, CloseStream, StartStream,
|
||||
StopStream, AbortStream, IsStreamStopped, IsStreamActive,
|
||||
GetStreamTime, GetStreamCpuLoad,
|
||||
PaUtil_DummyRead, PaUtil_DummyWrite,
|
||||
PaUtil_DummyGetReadAvailable, PaUtil_DummyGetWriteAvailable );
|
||||
|
||||
PaUtil_InitializeStreamInterface( &macCoreHostApi->blockingStreamInterface, CloseStream, StartStream,
|
||||
StopStream, AbortStream, IsStreamStopped, IsStreamActive,
|
||||
GetStreamTime, PaUtil_DummyGetCpuLoad,
|
||||
ReadStream, WriteStream, GetStreamReadAvailable, GetStreamWriteAvailable );
|
||||
|
||||
return result;
|
||||
|
||||
error:
|
||||
if( macCoreHostApi ) {
|
||||
CleanUp(macCoreHostApi);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
|
@ -0,0 +1,701 @@
|
|||
/*
|
||||
* Helper and utility functions for pa_mac_core.c (Apple AUHAL implementation)
|
||||
*
|
||||
* PortAudio Portable Real-Time Audio Library
|
||||
* Latest Version at: http://www.portaudio.com
|
||||
*
|
||||
* Written by Bjorn Roche of XO Audio LLC, from PA skeleton code.
|
||||
* Portions copied from code by Dominic Mazzoni (who wrote a HAL implementation)
|
||||
*
|
||||
* Dominic's code was based on code by Phil Burk, Darren Gibbs,
|
||||
* Gord Peters, Stephane Letz, and Greg Pfiel.
|
||||
*
|
||||
* The following people also deserve acknowledgements:
|
||||
*
|
||||
* Olivier Tristan for feedback and testing
|
||||
* Glenn Zelniker and Z-Systems engineering for sponsoring the Blocking I/O
|
||||
* interface.
|
||||
*
|
||||
*
|
||||
* Based on the Open Source API proposed by Ross Bencina
|
||||
* Copyright (c) 1999-2002 Ross Bencina, Phil Burk
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
/**
|
||||
@file
|
||||
@ingroup hostapi_src
|
||||
*/
|
||||
|
||||
#include "pa_mac_core_utilities.h"
|
||||
#include "pa_mac_core_internal.h"
|
||||
#include <libkern/OSAtomic.h>
|
||||
#include <strings.h>
|
||||
#include <pthread.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
PaError PaMacCore_SetUnixError( int err, int line )
|
||||
{
|
||||
PaError ret;
|
||||
const char *errorText;
|
||||
|
||||
if( err == 0 )
|
||||
{
|
||||
return paNoError;
|
||||
}
|
||||
|
||||
ret = paNoError;
|
||||
errorText = strerror( err );
|
||||
|
||||
/** Map Unix error to PaError. Pretty much the only one that maps
|
||||
is ENOMEM. */
|
||||
if( err == ENOMEM )
|
||||
ret = paInsufficientMemory;
|
||||
else
|
||||
ret = paInternalError;
|
||||
|
||||
DBUG(("%d on line %d: msg='%s'\n", err, line, errorText));
|
||||
PaUtil_SetLastHostErrorInfo( paCoreAudio, err, errorText );
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Translates MacOS generated errors into PaErrors
|
||||
*/
|
||||
PaError PaMacCore_SetError(OSStatus error, int line, int isError)
|
||||
{
|
||||
/*FIXME: still need to handle possible ComponentResult values.*/
|
||||
/* unfortunately, they don't seem to be documented anywhere.*/
|
||||
PaError result;
|
||||
const char *errorType;
|
||||
const char *errorText;
|
||||
|
||||
switch (error) {
|
||||
case kAudioHardwareNoError:
|
||||
return paNoError;
|
||||
case kAudioHardwareNotRunningError:
|
||||
errorText = "Audio Hardware Not Running";
|
||||
result = paInternalError; break;
|
||||
case kAudioHardwareUnspecifiedError:
|
||||
errorText = "Unspecified Audio Hardware Error";
|
||||
result = paInternalError; break;
|
||||
case kAudioHardwareUnknownPropertyError:
|
||||
errorText = "Audio Hardware: Unknown Property";
|
||||
result = paInternalError; break;
|
||||
case kAudioHardwareBadPropertySizeError:
|
||||
errorText = "Audio Hardware: Bad Property Size";
|
||||
result = paInternalError; break;
|
||||
case kAudioHardwareIllegalOperationError:
|
||||
errorText = "Audio Hardware: Illegal Operation";
|
||||
result = paInternalError; break;
|
||||
case kAudioHardwareBadDeviceError:
|
||||
errorText = "Audio Hardware: Bad Device";
|
||||
result = paInvalidDevice; break;
|
||||
case kAudioHardwareBadStreamError:
|
||||
errorText = "Audio Hardware: BadStream";
|
||||
result = paBadStreamPtr; break;
|
||||
case kAudioHardwareUnsupportedOperationError:
|
||||
errorText = "Audio Hardware: Unsupported Operation";
|
||||
result = paInternalError; break;
|
||||
case kAudioDeviceUnsupportedFormatError:
|
||||
errorText = "Audio Device: Unsupported Format";
|
||||
result = paSampleFormatNotSupported; break;
|
||||
case kAudioDevicePermissionsError:
|
||||
errorText = "Audio Device: Permissions Error";
|
||||
result = paDeviceUnavailable; break;
|
||||
/* Audio Unit Errors: http://developer.apple.com/documentation/MusicAudio/Reference/CoreAudio/audio_units/chapter_5_section_3.html */
|
||||
case kAudioUnitErr_InvalidProperty:
|
||||
errorText = "Audio Unit: Invalid Property";
|
||||
result = paInternalError; break;
|
||||
case kAudioUnitErr_InvalidParameter:
|
||||
errorText = "Audio Unit: Invalid Parameter";
|
||||
result = paInternalError; break;
|
||||
case kAudioUnitErr_NoConnection:
|
||||
errorText = "Audio Unit: No Connection";
|
||||
result = paInternalError; break;
|
||||
case kAudioUnitErr_FailedInitialization:
|
||||
errorText = "Audio Unit: Initialization Failed";
|
||||
result = paInternalError; break;
|
||||
case kAudioUnitErr_TooManyFramesToProcess:
|
||||
errorText = "Audio Unit: Too Many Frames";
|
||||
result = paInternalError; break;
|
||||
case kAudioUnitErr_IllegalInstrument:
|
||||
errorText = "Audio Unit: Illegal Instrument";
|
||||
result = paInternalError; break;
|
||||
case kAudioUnitErr_InstrumentTypeNotFound:
|
||||
errorText = "Audio Unit: Instrument Type Not Found";
|
||||
result = paInternalError; break;
|
||||
case kAudioUnitErr_InvalidFile:
|
||||
errorText = "Audio Unit: Invalid File";
|
||||
result = paInternalError; break;
|
||||
case kAudioUnitErr_UnknownFileType:
|
||||
errorText = "Audio Unit: Unknown File Type";
|
||||
result = paInternalError; break;
|
||||
case kAudioUnitErr_FileNotSpecified:
|
||||
errorText = "Audio Unit: File Not Specified";
|
||||
result = paInternalError; break;
|
||||
case kAudioUnitErr_FormatNotSupported:
|
||||
errorText = "Audio Unit: Format Not Supported";
|
||||
result = paInternalError; break;
|
||||
case kAudioUnitErr_Uninitialized:
|
||||
errorText = "Audio Unit: Unitialized";
|
||||
result = paInternalError; break;
|
||||
case kAudioUnitErr_InvalidScope:
|
||||
errorText = "Audio Unit: Invalid Scope";
|
||||
result = paInternalError; break;
|
||||
case kAudioUnitErr_PropertyNotWritable:
|
||||
errorText = "Audio Unit: PropertyNotWritable";
|
||||
result = paInternalError; break;
|
||||
case kAudioUnitErr_InvalidPropertyValue:
|
||||
errorText = "Audio Unit: Invalid Property Value";
|
||||
result = paInternalError; break;
|
||||
case kAudioUnitErr_PropertyNotInUse:
|
||||
errorText = "Audio Unit: Property Not In Use";
|
||||
result = paInternalError; break;
|
||||
case kAudioUnitErr_Initialized:
|
||||
errorText = "Audio Unit: Initialized";
|
||||
result = paInternalError; break;
|
||||
case kAudioUnitErr_InvalidOfflineRender:
|
||||
errorText = "Audio Unit: Invalid Offline Render";
|
||||
result = paInternalError; break;
|
||||
case kAudioUnitErr_Unauthorized:
|
||||
errorText = "Audio Unit: Unauthorized";
|
||||
result = paInternalError; break;
|
||||
case kAudioUnitErr_CannotDoInCurrentContext:
|
||||
errorText = "Audio Unit: cannot do in current context";
|
||||
result = paInternalError; break;
|
||||
default:
|
||||
errorText = "Unknown Error";
|
||||
result = paInternalError;
|
||||
}
|
||||
|
||||
if (isError)
|
||||
errorType = "Error";
|
||||
else
|
||||
errorType = "Warning";
|
||||
|
||||
char str[20];
|
||||
// see if it appears to be a 4-char-code
|
||||
*(UInt32 *)(str + 1) = CFSwapInt32HostToBig(error);
|
||||
if (isprint(str[1]) && isprint(str[2]) && isprint(str[3]) && isprint(str[4]))
|
||||
{
|
||||
str[0] = str[5] = '\'';
|
||||
str[6] = '\0';
|
||||
} else {
|
||||
// no, format it as an integer
|
||||
sprintf(str, "%d", (int)error);
|
||||
}
|
||||
|
||||
DBUG(("%s on line %d: err='%s', msg=%s\n", errorType, line, str, errorText));
|
||||
|
||||
PaUtil_SetLastHostErrorInfo( paCoreAudio, error, errorText );
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function computes an appropriate ring buffer size given
|
||||
* a requested latency (in seconds), sample rate and framesPerBuffer.
|
||||
*
|
||||
* The returned ringBufferSize is computed using the following
|
||||
* constraints:
|
||||
* - it must be at least 4.
|
||||
* - it must be at least 3x framesPerBuffer.
|
||||
* - it must be at least 2x the suggestedLatency.
|
||||
* - it must be a power of 2.
|
||||
* This function attempts to compute the minimum such size.
|
||||
*
|
||||
* FEEDBACK: too liberal/conservative/another way?
|
||||
*/
|
||||
long computeRingBufferSize( const PaStreamParameters *inputParameters,
|
||||
const PaStreamParameters *outputParameters,
|
||||
long inputFramesPerBuffer,
|
||||
long outputFramesPerBuffer,
|
||||
double sampleRate )
|
||||
{
|
||||
long ringSize;
|
||||
int index;
|
||||
int i;
|
||||
double latency ;
|
||||
long framesPerBuffer ;
|
||||
|
||||
VVDBUG(( "computeRingBufferSize()\n" ));
|
||||
|
||||
assert( inputParameters || outputParameters );
|
||||
|
||||
if( outputParameters && inputParameters )
|
||||
{
|
||||
latency = MAX( inputParameters->suggestedLatency, outputParameters->suggestedLatency );
|
||||
framesPerBuffer = MAX( inputFramesPerBuffer, outputFramesPerBuffer );
|
||||
}
|
||||
else if( outputParameters )
|
||||
{
|
||||
latency = outputParameters->suggestedLatency;
|
||||
framesPerBuffer = outputFramesPerBuffer ;
|
||||
}
|
||||
else /* we have inputParameters */
|
||||
{
|
||||
latency = inputParameters->suggestedLatency;
|
||||
framesPerBuffer = inputFramesPerBuffer ;
|
||||
}
|
||||
|
||||
ringSize = (long) ( latency * sampleRate * 2 + .5);
|
||||
VDBUG( ( "suggested latency : %d\n", (int) (latency*sampleRate) ) );
|
||||
if( ringSize < framesPerBuffer * 3 )
|
||||
ringSize = framesPerBuffer * 3 ;
|
||||
VDBUG(("framesPerBuffer:%d\n",(int)framesPerBuffer));
|
||||
VDBUG(("Ringbuffer size (1): %d\n", (int)ringSize ));
|
||||
|
||||
/* make sure it's at least 4 */
|
||||
ringSize = MAX( ringSize, 4 );
|
||||
|
||||
/* round up to the next power of 2 */
|
||||
index = -1;
|
||||
for( i=0; i<sizeof(long)*8; ++i )
|
||||
if( ringSize >> i & 0x01 )
|
||||
index = i;
|
||||
assert( index > 0 );
|
||||
if( ringSize <= ( 0x01 << index ) )
|
||||
ringSize = 0x01 << index ;
|
||||
else
|
||||
ringSize = 0x01 << ( index + 1 );
|
||||
|
||||
VDBUG(( "Final Ringbuffer size (2): %d\n", (int)ringSize ));
|
||||
return ringSize;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Durring testing of core audio, I found that serious crashes could occur
|
||||
* if properties such as sample rate were changed multiple times in rapid
|
||||
* succession. The function below could be used to with a condition variable.
|
||||
* to prevent propertychanges from happening until the last property
|
||||
* change is acknowledged. Instead, I implemented a busy-wait, which is simpler
|
||||
* to implement b/c in second round of testing (nov '09) property changes occured
|
||||
* quickly and so there was no real way to test the condition variable implementation.
|
||||
* therefore, this function is not used, but it is aluded to in commented code below,
|
||||
* since it represents a theoretically better implementation.
|
||||
*/
|
||||
|
||||
OSStatus propertyProc(
|
||||
AudioDeviceID inDevice,
|
||||
UInt32 inChannel,
|
||||
Boolean isInput,
|
||||
AudioDevicePropertyID inPropertyID,
|
||||
void* inClientData )
|
||||
{
|
||||
// this is where we would set the condition variable
|
||||
return noErr;
|
||||
}
|
||||
|
||||
/* sets the value of the given property and waits for the change to
|
||||
be acknowledged, and returns the final value, which is not guaranteed
|
||||
by this function to be the same as the desired value. Obviously, this
|
||||
function can only be used for data whose input and output are the
|
||||
same size and format, and their size and format are known in advance.
|
||||
whether or not the call succeeds, if the data is successfully read,
|
||||
it is returned in outPropertyData. If it is not read successfully,
|
||||
outPropertyData is zeroed, which may or may not be useful in
|
||||
determining if the property was read. */
|
||||
PaError AudioDeviceSetPropertyNowAndWaitForChange(
|
||||
AudioDeviceID inDevice,
|
||||
UInt32 inChannel,
|
||||
Boolean isInput,
|
||||
AudioDevicePropertyID inPropertyID,
|
||||
UInt32 inPropertyDataSize,
|
||||
const void *inPropertyData,
|
||||
void *outPropertyData )
|
||||
{
|
||||
OSStatus macErr;
|
||||
UInt32 outPropertyDataSize = inPropertyDataSize;
|
||||
|
||||
/* First, see if it already has that value. If so, return. */
|
||||
macErr = AudioDeviceGetProperty( inDevice, inChannel,
|
||||
isInput, inPropertyID,
|
||||
&outPropertyDataSize, outPropertyData );
|
||||
if( macErr ) {
|
||||
memset( outPropertyData, 0, inPropertyDataSize );
|
||||
goto failMac;
|
||||
}
|
||||
if( inPropertyDataSize!=outPropertyDataSize )
|
||||
return paInternalError;
|
||||
if( 0==memcmp( outPropertyData, inPropertyData, outPropertyDataSize ) )
|
||||
return paNoError;
|
||||
|
||||
/* Ideally, we'd use a condition variable to determine changes.
|
||||
we could set that up here. */
|
||||
|
||||
/* If we were using a cond variable, we'd do something useful here,
|
||||
but for now, this is just to make 10.6 happy. */
|
||||
macErr = AudioDeviceAddPropertyListener( inDevice, inChannel, isInput,
|
||||
inPropertyID, propertyProc,
|
||||
NULL );
|
||||
if( macErr )
|
||||
/* we couldn't add a listener. */
|
||||
goto failMac;
|
||||
|
||||
/* set property */
|
||||
macErr = AudioDeviceSetProperty( inDevice, NULL, inChannel,
|
||||
isInput, inPropertyID,
|
||||
inPropertyDataSize, inPropertyData );
|
||||
if( macErr )
|
||||
goto failMac;
|
||||
|
||||
/* busy-wait up to 30 seconds for the property to change */
|
||||
/* busy-wait is justified here only because the correct alternative (condition variable)
|
||||
was hard to test, since most of the waiting ended up being for setting rather than
|
||||
getting in OS X 10.5. This was not the case in earlier OS versions. */
|
||||
struct timeval tv1, tv2;
|
||||
gettimeofday( &tv1, NULL );
|
||||
memcpy( &tv2, &tv1, sizeof( struct timeval ) );
|
||||
while( tv2.tv_sec - tv1.tv_sec < 30 ) {
|
||||
/* now read the property back out */
|
||||
macErr = AudioDeviceGetProperty( inDevice, inChannel,
|
||||
isInput, inPropertyID,
|
||||
&outPropertyDataSize, outPropertyData );
|
||||
if( macErr ) {
|
||||
memset( outPropertyData, 0, inPropertyDataSize );
|
||||
goto failMac;
|
||||
}
|
||||
/* and compare... */
|
||||
if( 0==memcmp( outPropertyData, inPropertyData, outPropertyDataSize ) ) {
|
||||
AudioDeviceRemovePropertyListener( inDevice, inChannel, isInput, inPropertyID, propertyProc );
|
||||
return paNoError;
|
||||
}
|
||||
/* No match yet, so let's sleep and try again. */
|
||||
Pa_Sleep( 100 );
|
||||
gettimeofday( &tv2, NULL );
|
||||
}
|
||||
DBUG( ("Timeout waiting for device setting.\n" ) );
|
||||
|
||||
AudioDeviceRemovePropertyListener( inDevice, inChannel, isInput, inPropertyID, propertyProc );
|
||||
return paNoError;
|
||||
|
||||
failMac:
|
||||
AudioDeviceRemovePropertyListener( inDevice, inChannel, isInput, inPropertyID, propertyProc );
|
||||
return ERR( macErr );
|
||||
}
|
||||
|
||||
/*
|
||||
* Sets the sample rate the HAL device.
|
||||
* if requireExact: set the sample rate or fail.
|
||||
*
|
||||
* otherwise : set the exact sample rate.
|
||||
* If that fails, check for available sample rates, and choose one
|
||||
* higher than the requested rate. If there isn't a higher one,
|
||||
* just use the highest available.
|
||||
*/
|
||||
PaError setBestSampleRateForDevice( const AudioDeviceID device,
|
||||
const bool isOutput,
|
||||
const bool requireExact,
|
||||
const Float64 desiredSrate )
|
||||
{
|
||||
const bool isInput = isOutput ? 0 : 1;
|
||||
Float64 srate;
|
||||
UInt32 propsize = sizeof( Float64 );
|
||||
OSErr err;
|
||||
AudioValueRange *ranges;
|
||||
int i=0;
|
||||
Float64 max = -1; /*the maximum rate available*/
|
||||
Float64 best = -1; /*the lowest sample rate still greater than desired rate*/
|
||||
VDBUG(("Setting sample rate for device %ld to %g.\n",device,(float)desiredSrate));
|
||||
|
||||
/* -- try setting the sample rate -- */
|
||||
srate = 0;
|
||||
err = AudioDeviceSetPropertyNowAndWaitForChange(
|
||||
device, 0, isInput,
|
||||
kAudioDevicePropertyNominalSampleRate,
|
||||
propsize, &desiredSrate, &srate );
|
||||
|
||||
/* -- if the rate agrees, and was changed, we are done -- */
|
||||
if( srate != 0 && srate == desiredSrate )
|
||||
return paNoError;
|
||||
/* -- if the rate agrees, and we got no errors, we are done -- */
|
||||
if( !err && srate == desiredSrate )
|
||||
return paNoError;
|
||||
/* -- we've failed if the rates disagree and we are setting input -- */
|
||||
if( requireExact )
|
||||
return paInvalidSampleRate;
|
||||
|
||||
/* -- generate a list of available sample rates -- */
|
||||
err = AudioDeviceGetPropertyInfo( device, 0, isInput,
|
||||
kAudioDevicePropertyAvailableNominalSampleRates,
|
||||
&propsize, NULL );
|
||||
if( err )
|
||||
return ERR( err );
|
||||
ranges = (AudioValueRange *)calloc( 1, propsize );
|
||||
if( !ranges )
|
||||
return paInsufficientMemory;
|
||||
err = AudioDeviceGetProperty( device, 0, isInput,
|
||||
kAudioDevicePropertyAvailableNominalSampleRates,
|
||||
&propsize, ranges );
|
||||
if( err )
|
||||
{
|
||||
free( ranges );
|
||||
return ERR( err );
|
||||
}
|
||||
VDBUG(("Requested sample rate of %g was not available.\n", (float)desiredSrate));
|
||||
VDBUG(("%lu Available Sample Rates are:\n",propsize/sizeof(AudioValueRange)));
|
||||
#ifdef MAC_CORE_VERBOSE_DEBUG
|
||||
for( i=0; i<propsize/sizeof(AudioValueRange); ++i )
|
||||
VDBUG( ("\t%g-%g\n",
|
||||
(float) ranges[i].mMinimum,
|
||||
(float) ranges[i].mMaximum ) );
|
||||
#endif
|
||||
VDBUG(("-----\n"));
|
||||
|
||||
/* -- now pick the best available sample rate -- */
|
||||
for( i=0; i<propsize/sizeof(AudioValueRange); ++i )
|
||||
{
|
||||
if( ranges[i].mMaximum > max ) max = ranges[i].mMaximum;
|
||||
if( ranges[i].mMinimum > desiredSrate ) {
|
||||
if( best < 0 )
|
||||
best = ranges[i].mMinimum;
|
||||
else if( ranges[i].mMinimum < best )
|
||||
best = ranges[i].mMinimum;
|
||||
}
|
||||
}
|
||||
if( best < 0 )
|
||||
best = max;
|
||||
VDBUG( ("Maximum Rate %g. best is %g.\n", max, best ) );
|
||||
free( ranges );
|
||||
|
||||
/* -- set the sample rate -- */
|
||||
propsize = sizeof( best );
|
||||
srate = 0;
|
||||
err = AudioDeviceSetPropertyNowAndWaitForChange(
|
||||
device, 0, isInput,
|
||||
kAudioDevicePropertyNominalSampleRate,
|
||||
propsize, &best, &srate );
|
||||
|
||||
/* -- if the set rate matches, we are done -- */
|
||||
if( srate != 0 && srate == best )
|
||||
return paNoError;
|
||||
|
||||
if( err )
|
||||
return ERR( err );
|
||||
|
||||
/* -- otherwise, something wierd happened: we didn't set the rate, and we got no errors. Just bail. */
|
||||
return paInternalError;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Attempts to set the requestedFramesPerBuffer. If it can't set the exact
|
||||
value, it settles for something smaller if available. If nothing smaller
|
||||
is available, it uses the smallest available size.
|
||||
actualFramesPerBuffer will be set to the actual value on successful return.
|
||||
OK to pass NULL to actualFramesPerBuffer.
|
||||
The logic is very simmilar too setBestSampleRate only failure here is
|
||||
not usually catastrophic.
|
||||
*/
|
||||
PaError setBestFramesPerBuffer( const AudioDeviceID device,
|
||||
const bool isOutput,
|
||||
UInt32 requestedFramesPerBuffer,
|
||||
UInt32 *actualFramesPerBuffer )
|
||||
{
|
||||
UInt32 afpb;
|
||||
const bool isInput = !isOutput;
|
||||
UInt32 propsize = sizeof(UInt32);
|
||||
OSErr err;
|
||||
AudioValueRange range;
|
||||
|
||||
if( actualFramesPerBuffer == NULL )
|
||||
{
|
||||
actualFramesPerBuffer = &afpb;
|
||||
}
|
||||
|
||||
/* -- try and set exact FPB -- */
|
||||
err = AudioDeviceSetProperty( device, NULL, 0, isInput,
|
||||
kAudioDevicePropertyBufferFrameSize,
|
||||
propsize, &requestedFramesPerBuffer);
|
||||
err = AudioDeviceGetProperty( device, 0, isInput,
|
||||
kAudioDevicePropertyBufferFrameSize,
|
||||
&propsize, actualFramesPerBuffer);
|
||||
if( err )
|
||||
{
|
||||
return ERR( err );
|
||||
}
|
||||
// Did we get the size we asked for?
|
||||
if( *actualFramesPerBuffer == requestedFramesPerBuffer )
|
||||
{
|
||||
return paNoError; /* we are done */
|
||||
}
|
||||
|
||||
// Clip requested value against legal range for the device.
|
||||
propsize = sizeof(AudioValueRange);
|
||||
err = AudioDeviceGetProperty( device, 0, isInput,
|
||||
kAudioDevicePropertyBufferFrameSizeRange,
|
||||
&propsize, &range );
|
||||
if( err )
|
||||
{
|
||||
return ERR( err );
|
||||
}
|
||||
if( requestedFramesPerBuffer < range.mMinimum )
|
||||
{
|
||||
requestedFramesPerBuffer = range.mMinimum;
|
||||
}
|
||||
else if( requestedFramesPerBuffer > range.mMaximum )
|
||||
{
|
||||
requestedFramesPerBuffer = range.mMaximum;
|
||||
}
|
||||
|
||||
/* --- set the buffer size (ignore errors) -- */
|
||||
propsize = sizeof( UInt32 );
|
||||
err = AudioDeviceSetProperty( device, NULL, 0, isInput,
|
||||
kAudioDevicePropertyBufferFrameSize,
|
||||
propsize, &requestedFramesPerBuffer );
|
||||
/* --- read the property to check that it was set -- */
|
||||
err = AudioDeviceGetProperty( device, 0, isInput,
|
||||
kAudioDevicePropertyBufferFrameSize,
|
||||
&propsize, actualFramesPerBuffer );
|
||||
|
||||
if( err )
|
||||
return ERR( err );
|
||||
|
||||
return paNoError;
|
||||
}
|
||||
|
||||
/**********************
|
||||
*
|
||||
* XRun stuff
|
||||
*
|
||||
**********************/
|
||||
|
||||
struct PaMacXRunListNode_s {
|
||||
PaMacCoreStream *stream;
|
||||
struct PaMacXRunListNode_s *next;
|
||||
} ;
|
||||
|
||||
typedef struct PaMacXRunListNode_s PaMacXRunListNode;
|
||||
|
||||
/** Always empty, so that it can always be the one returned by
|
||||
addToXRunListenerList. note that it's not a pointer. */
|
||||
static PaMacXRunListNode firstXRunListNode;
|
||||
static int xRunListSize;
|
||||
static pthread_mutex_t xrunMutex;
|
||||
|
||||
OSStatus xrunCallback(
|
||||
AudioDeviceID inDevice,
|
||||
UInt32 inChannel,
|
||||
Boolean isInput,
|
||||
AudioDevicePropertyID inPropertyID,
|
||||
void* inClientData)
|
||||
{
|
||||
PaMacXRunListNode *node = (PaMacXRunListNode *) inClientData;
|
||||
|
||||
int ret = pthread_mutex_trylock( &xrunMutex ) ;
|
||||
|
||||
if( ret == 0 ) {
|
||||
|
||||
node = node->next ; //skip the first node
|
||||
|
||||
for( ; node; node=node->next ) {
|
||||
PaMacCoreStream *stream = node->stream;
|
||||
|
||||
if( stream->state != ACTIVE )
|
||||
continue; //if the stream isn't active, we don't care if the device is dropping
|
||||
|
||||
if( isInput ) {
|
||||
if( stream->inputDevice == inDevice )
|
||||
OSAtomicOr32( paInputOverflow, &stream->xrunFlags );
|
||||
} else {
|
||||
if( stream->outputDevice == inDevice )
|
||||
OSAtomicOr32( paOutputUnderflow, &stream->xrunFlags );
|
||||
}
|
||||
}
|
||||
|
||||
pthread_mutex_unlock( &xrunMutex );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int initializeXRunListenerList()
|
||||
{
|
||||
xRunListSize = 0;
|
||||
bzero( (void *) &firstXRunListNode, sizeof(firstXRunListNode) );
|
||||
return pthread_mutex_init( &xrunMutex, NULL );
|
||||
}
|
||||
int destroyXRunListenerList()
|
||||
{
|
||||
PaMacXRunListNode *node;
|
||||
node = firstXRunListNode.next;
|
||||
while( node ) {
|
||||
PaMacXRunListNode *tmp = node;
|
||||
node = node->next;
|
||||
free( tmp );
|
||||
}
|
||||
xRunListSize = 0;
|
||||
return pthread_mutex_destroy( &xrunMutex );
|
||||
}
|
||||
|
||||
void *addToXRunListenerList( void *stream )
|
||||
{
|
||||
pthread_mutex_lock( &xrunMutex );
|
||||
PaMacXRunListNode *newNode;
|
||||
// setup new node:
|
||||
newNode = (PaMacXRunListNode *) malloc( sizeof( PaMacXRunListNode ) );
|
||||
newNode->stream = (PaMacCoreStream *) stream;
|
||||
newNode->next = firstXRunListNode.next;
|
||||
// insert:
|
||||
firstXRunListNode.next = newNode;
|
||||
pthread_mutex_unlock( &xrunMutex );
|
||||
|
||||
return &firstXRunListNode;
|
||||
}
|
||||
|
||||
int removeFromXRunListenerList( void *stream )
|
||||
{
|
||||
pthread_mutex_lock( &xrunMutex );
|
||||
PaMacXRunListNode *node, *prev;
|
||||
prev = &firstXRunListNode;
|
||||
node = firstXRunListNode.next;
|
||||
while( node ) {
|
||||
if( node->stream == stream ) {
|
||||
//found it:
|
||||
--xRunListSize;
|
||||
prev->next = node->next;
|
||||
free( node );
|
||||
pthread_mutex_unlock( &xrunMutex );
|
||||
return xRunListSize;
|
||||
}
|
||||
prev = prev->next;
|
||||
node = node->next;
|
||||
}
|
||||
|
||||
pthread_mutex_unlock( &xrunMutex );
|
||||
// failure
|
||||
return xRunListSize;
|
||||
}
|
||||
|
|
@ -0,0 +1,218 @@
|
|||
/*
|
||||
* Helper and utility functions for pa_mac_core.c (Apple AUHAL implementation)
|
||||
*
|
||||
* PortAudio Portable Real-Time Audio Library
|
||||
* Latest Version at: http://www.portaudio.com
|
||||
*
|
||||
* Written by Bjorn Roche of XO Audio LLC, from PA skeleton code.
|
||||
* Portions copied from code by Dominic Mazzoni (who wrote a HAL implementation)
|
||||
*
|
||||
* Dominic's code was based on code by Phil Burk, Darren Gibbs,
|
||||
* Gord Peters, Stephane Letz, and Greg Pfiel.
|
||||
*
|
||||
* The following people also deserve acknowledgements:
|
||||
*
|
||||
* Olivier Tristan for feedback and testing
|
||||
* Glenn Zelniker and Z-Systems engineering for sponsoring the Blocking I/O
|
||||
* interface.
|
||||
*
|
||||
*
|
||||
* Based on the Open Source API proposed by Ross Bencina
|
||||
* Copyright (c) 1999-2002 Ross Bencina, Phil Burk
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
/**
|
||||
@file
|
||||
@ingroup hostapi_src
|
||||
*/
|
||||
|
||||
#ifndef PA_MAC_CORE_UTILITIES_H__
|
||||
#define PA_MAC_CORE_UTILITIES_H__
|
||||
|
||||
#include <pthread.h>
|
||||
#include "portaudio.h"
|
||||
#include "pa_util.h"
|
||||
#include <AudioUnit/AudioUnit.h>
|
||||
#include <AudioToolbox/AudioToolbox.h>
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(a, b) (((a)<(b))?(a):(b))
|
||||
#endif
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(a, b) (((a)<(b))?(b):(a))
|
||||
#endif
|
||||
|
||||
#define ERR(mac_error) PaMacCore_SetError(mac_error, __LINE__, 1 )
|
||||
#define WARNING(mac_error) PaMacCore_SetError(mac_error, __LINE__, 0 )
|
||||
|
||||
|
||||
/* Help keep track of AUHAL element numbers */
|
||||
#define INPUT_ELEMENT (1)
|
||||
#define OUTPUT_ELEMENT (0)
|
||||
|
||||
/* Normal level of debugging: fine for most apps that don't mind the occational warning being printf'ed */
|
||||
/*
|
||||
*/
|
||||
#define MAC_CORE_DEBUG
|
||||
#ifdef MAC_CORE_DEBUG
|
||||
# define DBUG(MSG) do { printf("||PaMacCore (AUHAL)|| "); printf MSG ; fflush(stdout); } while(0)
|
||||
#else
|
||||
# define DBUG(MSG)
|
||||
#endif
|
||||
|
||||
/* Verbose Debugging: useful for developement */
|
||||
/*
|
||||
#define MAC_CORE_VERBOSE_DEBUG
|
||||
*/
|
||||
#ifdef MAC_CORE_VERBOSE_DEBUG
|
||||
# define VDBUG(MSG) do { printf("||PaMacCore (v )|| "); printf MSG ; fflush(stdout); } while(0)
|
||||
#else
|
||||
# define VDBUG(MSG)
|
||||
#endif
|
||||
|
||||
/* Very Verbose Debugging: Traces every call. */
|
||||
/*
|
||||
#define MAC_CORE_VERY_VERBOSE_DEBUG
|
||||
*/
|
||||
#ifdef MAC_CORE_VERY_VERBOSE_DEBUG
|
||||
# define VVDBUG(MSG) do { printf("||PaMacCore (vv)|| "); printf MSG ; fflush(stdout); } while(0)
|
||||
#else
|
||||
# define VVDBUG(MSG)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define UNIX_ERR(err) PaMacCore_SetUnixError( err, __LINE__ )
|
||||
|
||||
PaError PaMacCore_SetUnixError( int err, int line );
|
||||
|
||||
/*
|
||||
* Translates MacOS generated errors into PaErrors
|
||||
*/
|
||||
PaError PaMacCore_SetError(OSStatus error, int line, int isError);
|
||||
|
||||
/*
|
||||
* This function computes an appropriate ring buffer size given
|
||||
* a requested latency (in seconds), sample rate and framesPerBuffer.
|
||||
*
|
||||
* The returned ringBufferSize is computed using the following
|
||||
* constraints:
|
||||
* - it must be at least 4.
|
||||
* - it must be at least 3x framesPerBuffer.
|
||||
* - it must be at least 2x the suggestedLatency.
|
||||
* - it must be a power of 2.
|
||||
* This function attempts to compute the minimum such size.
|
||||
*
|
||||
*/
|
||||
long computeRingBufferSize( const PaStreamParameters *inputParameters,
|
||||
const PaStreamParameters *outputParameters,
|
||||
long inputFramesPerBuffer,
|
||||
long outputFramesPerBuffer,
|
||||
double sampleRate );
|
||||
|
||||
OSStatus propertyProc(
|
||||
AudioDeviceID inDevice,
|
||||
UInt32 inChannel,
|
||||
Boolean isInput,
|
||||
AudioDevicePropertyID inPropertyID,
|
||||
void* inClientData );
|
||||
|
||||
/* sets the value of the given property and waits for the change to
|
||||
be acknowledged, and returns the final value, which is not guaranteed
|
||||
by this function to be the same as the desired value. Obviously, this
|
||||
function can only be used for data whose input and output are the
|
||||
same size and format, and their size and format are known in advance.*/
|
||||
PaError AudioDeviceSetPropertyNowAndWaitForChange(
|
||||
AudioDeviceID inDevice,
|
||||
UInt32 inChannel,
|
||||
Boolean isInput,
|
||||
AudioDevicePropertyID inPropertyID,
|
||||
UInt32 inPropertyDataSize,
|
||||
const void *inPropertyData,
|
||||
void *outPropertyData );
|
||||
|
||||
/*
|
||||
* Sets the sample rate the HAL device.
|
||||
* if requireExact: set the sample rate or fail.
|
||||
*
|
||||
* otherwise : set the exact sample rate.
|
||||
* If that fails, check for available sample rates, and choose one
|
||||
* higher than the requested rate. If there isn't a higher one,
|
||||
* just use the highest available.
|
||||
*/
|
||||
PaError setBestSampleRateForDevice( const AudioDeviceID device,
|
||||
const bool isOutput,
|
||||
const bool requireExact,
|
||||
const Float64 desiredSrate );
|
||||
/*
|
||||
Attempts to set the requestedFramesPerBuffer. If it can't set the exact
|
||||
value, it settles for something smaller if available. If nothing smaller
|
||||
is available, it uses the smallest available size.
|
||||
actualFramesPerBuffer will be set to the actual value on successful return.
|
||||
OK to pass NULL to actualFramesPerBuffer.
|
||||
The logic is very simmilar too setBestSampleRate only failure here is
|
||||
not usually catastrophic.
|
||||
*/
|
||||
PaError setBestFramesPerBuffer( const AudioDeviceID device,
|
||||
const bool isOutput,
|
||||
UInt32 requestedFramesPerBuffer,
|
||||
UInt32 *actualFramesPerBuffer );
|
||||
|
||||
|
||||
/*********************
|
||||
*
|
||||
* xrun handling
|
||||
*
|
||||
*********************/
|
||||
|
||||
OSStatus xrunCallback(
|
||||
AudioDeviceID inDevice,
|
||||
UInt32 inChannel,
|
||||
Boolean isInput,
|
||||
AudioDevicePropertyID inPropertyID,
|
||||
void* inClientData ) ;
|
||||
|
||||
/** returns zero on success or a unix style error code. */
|
||||
int initializeXRunListenerList();
|
||||
/** returns zero on success or a unix style error code. */
|
||||
int destroyXRunListenerList();
|
||||
|
||||
/**Returns the list, so that it can be passed to CorAudio.*/
|
||||
void *addToXRunListenerList( void *stream );
|
||||
/**Returns the number of Listeners in the list remaining.*/
|
||||
int removeFromXRunListenerList( void *stream );
|
||||
|
||||
#endif /* PA_MAC_CORE_UTILITIES_H__*/
|
1765
pd-0.44-2/portaudio/src/hostapi/jack/pa_jack.c
Normal file
1765
pd-0.44-2/portaudio/src/hostapi/jack/pa_jack.c
Normal file
File diff suppressed because it is too large
Load diff
BIN
pd-0.44-2/portaudio/src/hostapi/oss/low_latency_tip.txt
Normal file
BIN
pd-0.44-2/portaudio/src/hostapi/oss/low_latency_tip.txt
Normal file
Binary file not shown.
2030
pd-0.44-2/portaudio/src/hostapi/oss/pa_unix_oss.c
Normal file
2030
pd-0.44-2/portaudio/src/hostapi/oss/pa_unix_oss.c
Normal file
File diff suppressed because it is too large
Load diff
114
pd-0.44-2/portaudio/src/hostapi/oss/recplay.c
Normal file
114
pd-0.44-2/portaudio/src/hostapi/oss/recplay.c
Normal file
|
@ -0,0 +1,114 @@
|
|||
/*
|
||||
* recplay.c
|
||||
* Phil Burk
|
||||
* Minimal record and playback test.
|
||||
*
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#ifndef __STDC__
|
||||
/* #include <getopt.h> */
|
||||
#endif /* __STDC__ */
|
||||
#include <fcntl.h>
|
||||
#ifdef __STDC__
|
||||
#include <string.h>
|
||||
#else /* __STDC__ */
|
||||
#include <strings.h>
|
||||
#endif /* __STDC__ */
|
||||
#include <sys/soundcard.h>
|
||||
|
||||
#define NUM_BYTES (64*1024)
|
||||
#define BLOCK_SIZE (4*1024)
|
||||
|
||||
#define AUDIO "/dev/dsp"
|
||||
|
||||
char buffer[NUM_BYTES];
|
||||
|
||||
int audioDev = 0;
|
||||
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
int numLeft;
|
||||
char *ptr;
|
||||
int num;
|
||||
int samplesize;
|
||||
|
||||
/********** RECORD ********************/
|
||||
/* Open audio device. */
|
||||
audioDev = open (AUDIO, O_RDONLY, 0);
|
||||
if (audioDev == -1)
|
||||
{
|
||||
perror (AUDIO);
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
/* Set to 16 bit samples. */
|
||||
samplesize = 16;
|
||||
ioctl(audioDev, SNDCTL_DSP_SAMPLESIZE, &samplesize);
|
||||
if (samplesize != 16)
|
||||
{
|
||||
perror("Unable to set the sample size.");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
/* Record in blocks */
|
||||
printf("Begin recording.\n");
|
||||
numLeft = NUM_BYTES;
|
||||
ptr = buffer;
|
||||
while( numLeft >= BLOCK_SIZE )
|
||||
{
|
||||
if ( (num = read (audioDev, ptr, BLOCK_SIZE)) < 0 )
|
||||
{
|
||||
perror (AUDIO);
|
||||
exit (-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Read %d bytes\n", num);
|
||||
ptr += num;
|
||||
numLeft -= num;
|
||||
}
|
||||
}
|
||||
|
||||
close( audioDev );
|
||||
|
||||
/********** PLAYBACK ********************/
|
||||
/* Open audio device for writing. */
|
||||
audioDev = open (AUDIO, O_WRONLY, 0);
|
||||
if (audioDev == -1)
|
||||
{
|
||||
perror (AUDIO);
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
/* Set to 16 bit samples. */
|
||||
samplesize = 16;
|
||||
ioctl(audioDev, SNDCTL_DSP_SAMPLESIZE, &samplesize);
|
||||
if (samplesize != 16)
|
||||
{
|
||||
perror("Unable to set the sample size.");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
/* Play in blocks */
|
||||
printf("Begin playing.\n");
|
||||
numLeft = NUM_BYTES;
|
||||
ptr = buffer;
|
||||
while( numLeft >= BLOCK_SIZE )
|
||||
{
|
||||
if ( (num = write (audioDev, ptr, BLOCK_SIZE)) < 0 )
|
||||
{
|
||||
perror (AUDIO);
|
||||
exit (-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Wrote %d bytes\n", num);
|
||||
ptr += num;
|
||||
numLeft -= num;
|
||||
}
|
||||
}
|
||||
|
||||
close( audioDev );
|
||||
}
|
4011
pd-0.44-2/portaudio/src/hostapi/wmme/pa_win_wmme.c
Normal file
4011
pd-0.44-2/portaudio/src/hostapi/wmme/pa_win_wmme.c
Normal file
File diff suppressed because it is too large
Load diff
89
pd-0.44-2/portaudio/src/os/mac_osx/pa_mac_hostapis.c
Normal file
89
pd-0.44-2/portaudio/src/os/mac_osx/pa_mac_hostapis.c
Normal file
|
@ -0,0 +1,89 @@
|
|||
/*
|
||||
* $Id: pa_mac_hostapis.c 1097 2006-08-26 08:27:53Z rossb $
|
||||
* Portable Audio I/O Library Macintosh initialization table
|
||||
*
|
||||
* Based on the Open Source API proposed by Ross Bencina
|
||||
* Copyright (c) 1999-2002 Ross Bencina, Phil Burk
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
@ingroup macosx_src
|
||||
Mac OS host API initialization function table.
|
||||
*/
|
||||
|
||||
|
||||
#include "pa_hostapi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
PaError PaSkeleton_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index );
|
||||
PaError PaMacCore_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index );
|
||||
PaError PaMacSm_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index );
|
||||
PaError PaJack_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index );
|
||||
PaError PaMacAsio_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
PaUtilHostApiInitializer *paHostApiInitializers[] =
|
||||
{
|
||||
#if PA_USE_COREAUDIO
|
||||
PaMacCore_Initialize,
|
||||
#endif
|
||||
|
||||
#if PA_USE_SM
|
||||
PaMacSm_Initialize,
|
||||
#endif
|
||||
|
||||
#if PA_USE_JACK
|
||||
PaJack_Initialize,
|
||||
#endif
|
||||
|
||||
#if PA_USE_ASIO
|
||||
PaMacAsio_Initialize,
|
||||
#endif
|
||||
|
||||
#if PA_USE_SKELETON
|
||||
PaSkeleton_Initialize, /* just for testing */
|
||||
#endif
|
||||
|
||||
0 /* NULL terminated array */
|
||||
};
|
||||
|
||||
|
||||
int paDefaultHostApiIndex = 0;
|
103
pd-0.44-2/portaudio/src/os/unix/pa_unix_hostapis.c
Normal file
103
pd-0.44-2/portaudio/src/os/unix/pa_unix_hostapis.c
Normal file
|
@ -0,0 +1,103 @@
|
|||
/*
|
||||
* $Id: pa_unix_hostapis.c 1740 2011-08-25 07:17:48Z philburk $
|
||||
* Portable Audio I/O Library UNIX initialization table
|
||||
*
|
||||
* Based on the Open Source API proposed by Ross Bencina
|
||||
* Copyright (c) 1999-2002 Ross Bencina, Phil Burk
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
@ingroup unix_src
|
||||
*/
|
||||
|
||||
#include "pa_hostapi.h"
|
||||
|
||||
PaError PaJack_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index );
|
||||
PaError PaAlsa_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index );
|
||||
PaError PaOSS_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index );
|
||||
/* Added for IRIX, Pieter, oct 2, 2003: */
|
||||
PaError PaSGI_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index );
|
||||
/* Linux AudioScience HPI */
|
||||
PaError PaAsiHpi_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index );
|
||||
PaError PaMacCore_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index );
|
||||
PaError PaSkeleton_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index );
|
||||
|
||||
/** Note that on Linux, ALSA is placed before OSS so that the former is preferred over the latter.
|
||||
*/
|
||||
|
||||
PaUtilHostApiInitializer *paHostApiInitializers[] =
|
||||
{
|
||||
#ifdef __linux__
|
||||
|
||||
#if PA_USE_ALSA
|
||||
PaAlsa_Initialize,
|
||||
#endif
|
||||
|
||||
#if PA_USE_OSS
|
||||
PaOSS_Initialize,
|
||||
#endif
|
||||
|
||||
#else /* __linux__ */
|
||||
|
||||
#if PA_USE_OSS
|
||||
PaOSS_Initialize,
|
||||
#endif
|
||||
|
||||
#if PA_USE_ALSA
|
||||
PaAlsa_Initialize,
|
||||
#endif
|
||||
|
||||
#endif /* __linux__ */
|
||||
|
||||
#if PA_USE_JACK
|
||||
PaJack_Initialize,
|
||||
#endif
|
||||
/* Added for IRIX, Pieter, oct 2, 2003: */
|
||||
#if PA_USE_SGI
|
||||
PaSGI_Initialize,
|
||||
#endif
|
||||
|
||||
#if PA_USE_ASIHPI
|
||||
PaAsiHpi_Initialize,
|
||||
#endif
|
||||
|
||||
#if PA_USE_COREAUDIO
|
||||
PaMacCore_Initialize,
|
||||
#endif
|
||||
|
||||
#if PA_USE_SKELETON
|
||||
PaSkeleton_Initialize,
|
||||
#endif
|
||||
|
||||
0 /* NULL terminated array */
|
||||
};
|
710
pd-0.44-2/portaudio/src/os/unix/pa_unix_util.c
Normal file
710
pd-0.44-2/portaudio/src/os/unix/pa_unix_util.c
Normal file
|
@ -0,0 +1,710 @@
|
|||
/*
|
||||
* $Id: pa_unix_util.c 1510 2010-06-10 08:05:29Z dmitrykos $
|
||||
* Portable Audio I/O Library
|
||||
* UNIX platform-specific support functions
|
||||
*
|
||||
* Based on the Open Source API proposed by Ross Bencina
|
||||
* Copyright (c) 1999-2000 Ross Bencina
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
@ingroup unix_src
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <assert.h>
|
||||
#include <string.h> /* For memset */
|
||||
#include <math.h>
|
||||
#include <errno.h>
|
||||
|
||||
#if defined(__APPLE__) && !defined(HAVE_MACH_ABSOLUTE_TIME)
|
||||
#define HAVE_MACH_ABSOLUTE_TIME
|
||||
#endif
|
||||
#ifdef HAVE_MACH_ABSOLUTE_TIME
|
||||
#include <mach/mach_time.h>
|
||||
#endif
|
||||
|
||||
#include "pa_util.h"
|
||||
#include "pa_unix_util.h"
|
||||
#include "pa_debugprint.h"
|
||||
|
||||
/*
|
||||
Track memory allocations to avoid leaks.
|
||||
*/
|
||||
|
||||
#if PA_TRACK_MEMORY
|
||||
static int numAllocations_ = 0;
|
||||
#endif
|
||||
|
||||
|
||||
void *PaUtil_AllocateMemory( long size )
|
||||
{
|
||||
void *result = malloc( size );
|
||||
|
||||
#if PA_TRACK_MEMORY
|
||||
if( result != NULL ) numAllocations_ += 1;
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void PaUtil_FreeMemory( void *block )
|
||||
{
|
||||
if( block != NULL )
|
||||
{
|
||||
free( block );
|
||||
#if PA_TRACK_MEMORY
|
||||
numAllocations_ -= 1;
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int PaUtil_CountCurrentlyAllocatedBlocks( void )
|
||||
{
|
||||
#if PA_TRACK_MEMORY
|
||||
return numAllocations_;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void Pa_Sleep( long msec )
|
||||
{
|
||||
#ifdef HAVE_NANOSLEEP
|
||||
struct timespec req = {0}, rem = {0};
|
||||
PaTime time = msec / 1.e3;
|
||||
req.tv_sec = (time_t)time;
|
||||
assert(time - req.tv_sec < 1.0);
|
||||
req.tv_nsec = (long)((time - req.tv_sec) * 1.e9);
|
||||
nanosleep(&req, &rem);
|
||||
/* XXX: Try sleeping the remaining time (contained in rem) if interrupted by a signal? */
|
||||
#else
|
||||
while( msec > 999 ) /* For OpenBSD and IRIX, argument */
|
||||
{ /* to usleep must be < 1000000. */
|
||||
usleep( 999000 );
|
||||
msec -= 999;
|
||||
}
|
||||
usleep( msec * 1000 );
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAVE_MACH_ABSOLUTE_TIME
|
||||
/*
|
||||
Discussion on the CoreAudio mailing list suggests that calling
|
||||
gettimeofday (or anything else in the BSD layer) is not real-time
|
||||
safe, so we use mach_absolute_time on OSX. This implementation is
|
||||
based on these two links:
|
||||
|
||||
Technical Q&A QA1398 - Mach Absolute Time Units
|
||||
http://developer.apple.com/mac/library/qa/qa2004/qa1398.html
|
||||
|
||||
Tutorial: Performance and Time.
|
||||
http://www.macresearch.org/tutorial_performance_and_time
|
||||
*/
|
||||
|
||||
/* Scaler to convert the result of mach_absolute_time to seconds */
|
||||
static double machSecondsConversionScaler_ = 0.0;
|
||||
#endif
|
||||
|
||||
void PaUtil_InitializeClock( void )
|
||||
{
|
||||
#ifdef HAVE_MACH_ABSOLUTE_TIME
|
||||
mach_timebase_info_data_t info;
|
||||
kern_return_t err = mach_timebase_info( &info );
|
||||
if( err == 0 )
|
||||
machSecondsConversionScaler_ = 1e-9 * (double) info.numer / (double) info.denom;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
PaTime PaUtil_GetTime( void )
|
||||
{
|
||||
#ifdef HAVE_MACH_ABSOLUTE_TIME
|
||||
return mach_absolute_time() * machSecondsConversionScaler_;
|
||||
#elif defined(HAVE_CLOCK_GETTIME)
|
||||
struct timespec tp;
|
||||
clock_gettime(CLOCK_REALTIME, &tp);
|
||||
return (PaTime)(tp.tv_sec + tp.tv_nsec * 1e-9);
|
||||
#else
|
||||
struct timeval tv;
|
||||
gettimeofday( &tv, NULL );
|
||||
return (PaTime) tv.tv_usec * 1e-6 + tv.tv_sec;
|
||||
#endif
|
||||
}
|
||||
|
||||
PaError PaUtil_InitializeThreading( PaUtilThreading *threading )
|
||||
{
|
||||
(void) paUtilErr_;
|
||||
return paNoError;
|
||||
}
|
||||
|
||||
void PaUtil_TerminateThreading( PaUtilThreading *threading )
|
||||
{
|
||||
}
|
||||
|
||||
PaError PaUtil_StartThreading( PaUtilThreading *threading, void *(*threadRoutine)(void *), void *data )
|
||||
{
|
||||
pthread_create( &threading->callbackThread, NULL, threadRoutine, data );
|
||||
return paNoError;
|
||||
}
|
||||
|
||||
PaError PaUtil_CancelThreading( PaUtilThreading *threading, int wait, PaError *exitResult )
|
||||
{
|
||||
PaError result = paNoError;
|
||||
void *pret;
|
||||
|
||||
if( exitResult )
|
||||
*exitResult = paNoError;
|
||||
|
||||
/* If pthread_cancel is not supported (Android platform) whole this function can lead to indefinite waiting if
|
||||
working thread (callbackThread) has'n received any stop signals from outside, please keep
|
||||
this in mind when considering using PaUtil_CancelThreading
|
||||
*/
|
||||
#ifdef PTHREAD_CANCELED
|
||||
/* Only kill the thread if it isn't in the process of stopping (flushing adaptation buffers) */
|
||||
if( !wait )
|
||||
pthread_cancel( threading->callbackThread ); /* XXX: Safe to call this if the thread has exited on its own? */
|
||||
#endif
|
||||
pthread_join( threading->callbackThread, &pret );
|
||||
|
||||
#ifdef PTHREAD_CANCELED
|
||||
if( pret && PTHREAD_CANCELED != pret )
|
||||
#else
|
||||
/* !wait means the thread may have been canceled */
|
||||
if( pret && wait )
|
||||
#endif
|
||||
{
|
||||
if( exitResult )
|
||||
*exitResult = *(PaError *) pret;
|
||||
free( pret );
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Threading */
|
||||
/* paUnixMainThread
|
||||
* We have to be a bit careful with defining this global variable,
|
||||
* as explained below. */
|
||||
#ifdef __APPLE__
|
||||
/* apple/gcc has a "problem" with global vars and dynamic libs.
|
||||
Initializing it seems to fix the problem.
|
||||
Described a bit in this thread:
|
||||
http://gcc.gnu.org/ml/gcc/2005-06/msg00179.html
|
||||
*/
|
||||
pthread_t paUnixMainThread = 0;
|
||||
#else
|
||||
/*pthreads are opaque. We don't know that asigning it an int value
|
||||
always makes sense, so we don't initialize it unless we have to.*/
|
||||
pthread_t paUnixMainThread = 0;
|
||||
#endif
|
||||
|
||||
PaError PaUnixThreading_Initialize()
|
||||
{
|
||||
paUnixMainThread = pthread_self();
|
||||
return paNoError;
|
||||
}
|
||||
|
||||
static PaError BoostPriority( PaUnixThread* self )
|
||||
{
|
||||
PaError result = paNoError;
|
||||
struct sched_param spm = { 0 };
|
||||
/* Priority should only matter between contending FIFO threads? */
|
||||
spm.sched_priority = 1;
|
||||
|
||||
assert( self );
|
||||
|
||||
if( pthread_setschedparam( self->thread, SCHED_FIFO, &spm ) != 0 )
|
||||
{
|
||||
PA_UNLESS( errno == EPERM, paInternalError ); /* Lack permission to raise priority */
|
||||
PA_DEBUG(( "Failed bumping priority\n" ));
|
||||
result = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = 1; /* Success */
|
||||
}
|
||||
error:
|
||||
return result;
|
||||
}
|
||||
|
||||
PaError PaUnixThread_New( PaUnixThread* self, void* (*threadFunc)( void* ), void* threadArg, PaTime waitForChild,
|
||||
int rtSched )
|
||||
{
|
||||
PaError result = paNoError;
|
||||
pthread_attr_t attr;
|
||||
int started = 0;
|
||||
|
||||
memset( self, 0, sizeof (PaUnixThread) );
|
||||
PaUnixMutex_Initialize( &self->mtx );
|
||||
PA_ASSERT_CALL( pthread_cond_init( &self->cond, NULL ), 0 );
|
||||
|
||||
self->parentWaiting = 0 != waitForChild;
|
||||
|
||||
/* Spawn thread */
|
||||
|
||||
/* Temporarily disabled since we should test during configuration for presence of required mman.h header */
|
||||
#if 0
|
||||
#if defined _POSIX_MEMLOCK && (_POSIX_MEMLOCK != -1)
|
||||
if( rtSched )
|
||||
{
|
||||
if( mlockall( MCL_CURRENT | MCL_FUTURE ) < 0 )
|
||||
{
|
||||
int savedErrno = errno; /* In case errno gets overwritten */
|
||||
assert( savedErrno != EINVAL ); /* Most likely a programmer error */
|
||||
PA_UNLESS( (savedErrno == EPERM), paInternalError );
|
||||
PA_DEBUG(( "%s: Failed locking memory\n", __FUNCTION__ ));
|
||||
}
|
||||
else
|
||||
PA_DEBUG(( "%s: Successfully locked memory\n", __FUNCTION__ ));
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
PA_UNLESS( !pthread_attr_init( &attr ), paInternalError );
|
||||
/* Priority relative to other processes */
|
||||
PA_UNLESS( !pthread_attr_setscope( &attr, PTHREAD_SCOPE_SYSTEM ), paInternalError );
|
||||
|
||||
PA_UNLESS( !pthread_create( &self->thread, &attr, threadFunc, threadArg ), paInternalError );
|
||||
started = 1;
|
||||
|
||||
if( rtSched )
|
||||
{
|
||||
#if 0
|
||||
if( self->useWatchdog )
|
||||
{
|
||||
int err;
|
||||
struct sched_param wdSpm = { 0 };
|
||||
/* Launch watchdog, watchdog sets callback thread priority */
|
||||
int prio = PA_MIN( self->rtPrio + 4, sched_get_priority_max( SCHED_FIFO ) );
|
||||
wdSpm.sched_priority = prio;
|
||||
|
||||
PA_UNLESS( !pthread_attr_init( &attr ), paInternalError );
|
||||
PA_UNLESS( !pthread_attr_setinheritsched( &attr, PTHREAD_EXPLICIT_SCHED ), paInternalError );
|
||||
PA_UNLESS( !pthread_attr_setscope( &attr, PTHREAD_SCOPE_SYSTEM ), paInternalError );
|
||||
PA_UNLESS( !pthread_attr_setschedpolicy( &attr, SCHED_FIFO ), paInternalError );
|
||||
PA_UNLESS( !pthread_attr_setschedparam( &attr, &wdSpm ), paInternalError );
|
||||
if( (err = pthread_create( &self->watchdogThread, &attr, &WatchdogFunc, self )) )
|
||||
{
|
||||
PA_UNLESS( err == EPERM, paInternalError );
|
||||
/* Permission error, go on without realtime privileges */
|
||||
PA_DEBUG(( "Failed bumping priority\n" ));
|
||||
}
|
||||
else
|
||||
{
|
||||
int policy;
|
||||
self->watchdogRunning = 1;
|
||||
PA_ENSURE_SYSTEM( pthread_getschedparam( self->watchdogThread, &policy, &wdSpm ), 0 );
|
||||
/* Check if priority is right, policy could potentially differ from SCHED_FIFO (but that's alright) */
|
||||
if( wdSpm.sched_priority != prio )
|
||||
{
|
||||
PA_DEBUG(( "Watchdog priority not set correctly (%d)\n", wdSpm.sched_priority ));
|
||||
PA_ENSURE( paInternalError );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
PA_ENSURE( BoostPriority( self ) );
|
||||
|
||||
{
|
||||
int policy;
|
||||
struct sched_param spm;
|
||||
pthread_getschedparam(self->thread, &policy, &spm);
|
||||
}
|
||||
}
|
||||
|
||||
if( self->parentWaiting )
|
||||
{
|
||||
PaTime till;
|
||||
struct timespec ts;
|
||||
int res = 0;
|
||||
PaTime now;
|
||||
|
||||
PA_ENSURE( PaUnixMutex_Lock( &self->mtx ) );
|
||||
|
||||
/* Wait for stream to be started */
|
||||
now = PaUtil_GetTime();
|
||||
till = now + waitForChild;
|
||||
|
||||
while( self->parentWaiting && !res )
|
||||
{
|
||||
if( waitForChild > 0 )
|
||||
{
|
||||
ts.tv_sec = (time_t) floor( till );
|
||||
ts.tv_nsec = (long) ((till - floor( till )) * 1e9);
|
||||
res = pthread_cond_timedwait( &self->cond, &self->mtx.mtx, &ts );
|
||||
}
|
||||
else
|
||||
{
|
||||
res = pthread_cond_wait( &self->cond, &self->mtx.mtx );
|
||||
}
|
||||
}
|
||||
|
||||
PA_ENSURE( PaUnixMutex_Unlock( &self->mtx ) );
|
||||
|
||||
PA_UNLESS( !res || ETIMEDOUT == res, paInternalError );
|
||||
PA_DEBUG(( "%s: Waited for %g seconds for stream to start\n", __FUNCTION__, PaUtil_GetTime() - now ));
|
||||
if( ETIMEDOUT == res )
|
||||
{
|
||||
PA_ENSURE( paTimedOut );
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
return result;
|
||||
error:
|
||||
if( started )
|
||||
{
|
||||
PaUnixThread_Terminate( self, 0, NULL );
|
||||
}
|
||||
|
||||
goto end;
|
||||
}
|
||||
|
||||
PaError PaUnixThread_Terminate( PaUnixThread* self, int wait, PaError* exitResult )
|
||||
{
|
||||
PaError result = paNoError;
|
||||
void* pret;
|
||||
|
||||
if( exitResult )
|
||||
{
|
||||
*exitResult = paNoError;
|
||||
}
|
||||
#if 0
|
||||
if( watchdogExitResult )
|
||||
*watchdogExitResult = paNoError;
|
||||
|
||||
if( th->watchdogRunning )
|
||||
{
|
||||
pthread_cancel( th->watchdogThread );
|
||||
PA_ENSURE_SYSTEM( pthread_join( th->watchdogThread, &pret ), 0 );
|
||||
|
||||
if( pret && pret != PTHREAD_CANCELED )
|
||||
{
|
||||
if( watchdogExitResult )
|
||||
*watchdogExitResult = *(PaError *) pret;
|
||||
free( pret );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Only kill the thread if it isn't in the process of stopping (flushing adaptation buffers) */
|
||||
/* TODO: Make join time out */
|
||||
self->stopRequested = wait;
|
||||
if( !wait )
|
||||
{
|
||||
PA_DEBUG(( "%s: Canceling thread %d\n", __FUNCTION__, self->thread ));
|
||||
/* XXX: Safe to call this if the thread has exited on its own? */
|
||||
#ifdef PTHREAD_CANCELED
|
||||
pthread_cancel( self->thread );
|
||||
#endif
|
||||
}
|
||||
PA_DEBUG(( "%s: Joining thread %d\n", __FUNCTION__, self->thread ));
|
||||
PA_ENSURE_SYSTEM( pthread_join( self->thread, &pret ), 0 );
|
||||
|
||||
#ifdef PTHREAD_CANCELED
|
||||
if( pret && PTHREAD_CANCELED != pret )
|
||||
#else
|
||||
/* !wait means the thread may have been canceled */
|
||||
if( pret && wait )
|
||||
#endif
|
||||
{
|
||||
if( exitResult )
|
||||
{
|
||||
*exitResult = *(PaError*)pret;
|
||||
}
|
||||
free( pret );
|
||||
}
|
||||
|
||||
error:
|
||||
PA_ASSERT_CALL( PaUnixMutex_Terminate( &self->mtx ), paNoError );
|
||||
PA_ASSERT_CALL( pthread_cond_destroy( &self->cond ), 0 );
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
PaError PaUnixThread_PrepareNotify( PaUnixThread* self )
|
||||
{
|
||||
PaError result = paNoError;
|
||||
PA_UNLESS( self->parentWaiting, paInternalError );
|
||||
|
||||
PA_ENSURE( PaUnixMutex_Lock( &self->mtx ) );
|
||||
self->locked = 1;
|
||||
|
||||
error:
|
||||
return result;
|
||||
}
|
||||
|
||||
PaError PaUnixThread_NotifyParent( PaUnixThread* self )
|
||||
{
|
||||
PaError result = paNoError;
|
||||
PA_UNLESS( self->parentWaiting, paInternalError );
|
||||
|
||||
if( !self->locked )
|
||||
{
|
||||
PA_ENSURE( PaUnixMutex_Lock( &self->mtx ) );
|
||||
self->locked = 1;
|
||||
}
|
||||
self->parentWaiting = 0;
|
||||
pthread_cond_signal( &self->cond );
|
||||
PA_ENSURE( PaUnixMutex_Unlock( &self->mtx ) );
|
||||
self->locked = 0;
|
||||
|
||||
error:
|
||||
return result;
|
||||
}
|
||||
|
||||
int PaUnixThread_StopRequested( PaUnixThread* self )
|
||||
{
|
||||
return self->stopRequested;
|
||||
}
|
||||
|
||||
PaError PaUnixMutex_Initialize( PaUnixMutex* self )
|
||||
{
|
||||
PaError result = paNoError;
|
||||
PA_ASSERT_CALL( pthread_mutex_init( &self->mtx, NULL ), 0 );
|
||||
return result;
|
||||
}
|
||||
|
||||
PaError PaUnixMutex_Terminate( PaUnixMutex* self )
|
||||
{
|
||||
PaError result = paNoError;
|
||||
PA_ASSERT_CALL( pthread_mutex_destroy( &self->mtx ), 0 );
|
||||
return result;
|
||||
}
|
||||
|
||||
/** Lock mutex.
|
||||
*
|
||||
* We're disabling thread cancellation while the thread is holding a lock, so mutexes are
|
||||
* properly unlocked at termination time.
|
||||
*/
|
||||
PaError PaUnixMutex_Lock( PaUnixMutex* self )
|
||||
{
|
||||
PaError result = paNoError;
|
||||
|
||||
#ifdef PTHREAD_CANCEL
|
||||
int oldState;
|
||||
PA_ENSURE_SYSTEM( pthread_setcancelstate( PTHREAD_CANCEL_DISABLE, &oldState ), 0 );
|
||||
#endif
|
||||
PA_ENSURE_SYSTEM( pthread_mutex_lock( &self->mtx ), 0 );
|
||||
|
||||
error:
|
||||
return result;
|
||||
}
|
||||
|
||||
/** Unlock mutex.
|
||||
*
|
||||
* Thread cancellation is enabled again after the mutex is properly unlocked.
|
||||
*/
|
||||
PaError PaUnixMutex_Unlock( PaUnixMutex* self )
|
||||
{
|
||||
PaError result = paNoError;
|
||||
|
||||
PA_ENSURE_SYSTEM( pthread_mutex_unlock( &self->mtx ), 0 );
|
||||
#ifdef PTHREAD_CANCEL
|
||||
int oldState;
|
||||
PA_ENSURE_SYSTEM( pthread_setcancelstate( PTHREAD_CANCEL_ENABLE, &oldState ), 0 );
|
||||
#endif
|
||||
|
||||
error:
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
static void OnWatchdogExit( void *userData )
|
||||
{
|
||||
PaAlsaThreading *th = (PaAlsaThreading *) userData;
|
||||
struct sched_param spm = { 0 };
|
||||
assert( th );
|
||||
|
||||
PA_ASSERT_CALL( pthread_setschedparam( th->callbackThread, SCHED_OTHER, &spm ), 0 ); /* Lower before exiting */
|
||||
PA_DEBUG(( "Watchdog exiting\n" ));
|
||||
}
|
||||
|
||||
static void *WatchdogFunc( void *userData )
|
||||
{
|
||||
PaError result = paNoError, *pres = NULL;
|
||||
int err;
|
||||
PaAlsaThreading *th = (PaAlsaThreading *) userData;
|
||||
unsigned intervalMsec = 500;
|
||||
const PaTime maxSeconds = 3.; /* Max seconds between callbacks */
|
||||
PaTime timeThen = PaUtil_GetTime(), timeNow, timeElapsed, cpuTimeThen, cpuTimeNow, cpuTimeElapsed;
|
||||
double cpuLoad, avgCpuLoad = 0.;
|
||||
int throttled = 0;
|
||||
|
||||
assert( th );
|
||||
|
||||
/* Execute OnWatchdogExit when exiting */
|
||||
pthread_cleanup_push( &OnWatchdogExit, th );
|
||||
|
||||
/* Boost priority of callback thread */
|
||||
PA_ENSURE( result = BoostPriority( th ) );
|
||||
if( !result )
|
||||
{
|
||||
/* Boost failed, might as well exit */
|
||||
pthread_exit( NULL );
|
||||
}
|
||||
|
||||
cpuTimeThen = th->callbackCpuTime;
|
||||
{
|
||||
int policy;
|
||||
struct sched_param spm = { 0 };
|
||||
pthread_getschedparam( pthread_self(), &policy, &spm );
|
||||
PA_DEBUG(( "%s: Watchdog priority is %d\n", __FUNCTION__, spm.sched_priority ));
|
||||
}
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
double lowpassCoeff = 0.9, lowpassCoeff1 = 0.99999 - lowpassCoeff;
|
||||
|
||||
/* Test before and after in case whatever underlying sleep call isn't interrupted by pthread_cancel */
|
||||
pthread_testcancel();
|
||||
Pa_Sleep( intervalMsec );
|
||||
pthread_testcancel();
|
||||
|
||||
if( PaUtil_GetTime() - th->callbackTime > maxSeconds )
|
||||
{
|
||||
PA_DEBUG(( "Watchdog: Terminating callback thread\n" ));
|
||||
/* Tell thread to terminate */
|
||||
err = pthread_kill( th->callbackThread, SIGKILL );
|
||||
pthread_exit( NULL );
|
||||
}
|
||||
|
||||
PA_DEBUG(( "%s: PortAudio reports CPU load: %g\n", __FUNCTION__, PaUtil_GetCpuLoad( th->cpuLoadMeasurer ) ));
|
||||
|
||||
/* Check if we should throttle, or unthrottle :P */
|
||||
cpuTimeNow = th->callbackCpuTime;
|
||||
cpuTimeElapsed = cpuTimeNow - cpuTimeThen;
|
||||
cpuTimeThen = cpuTimeNow;
|
||||
|
||||
timeNow = PaUtil_GetTime();
|
||||
timeElapsed = timeNow - timeThen;
|
||||
timeThen = timeNow;
|
||||
cpuLoad = cpuTimeElapsed / timeElapsed;
|
||||
avgCpuLoad = avgCpuLoad * lowpassCoeff + cpuLoad * lowpassCoeff1;
|
||||
/*
|
||||
if( throttled )
|
||||
PA_DEBUG(( "Watchdog: CPU load: %g, %g\n", avgCpuLoad, cpuTimeElapsed ));
|
||||
*/
|
||||
if( PaUtil_GetCpuLoad( th->cpuLoadMeasurer ) > .925 )
|
||||
{
|
||||
static int policy;
|
||||
static struct sched_param spm = { 0 };
|
||||
static const struct sched_param defaultSpm = { 0 };
|
||||
PA_DEBUG(( "%s: Throttling audio thread, priority %d\n", __FUNCTION__, spm.sched_priority ));
|
||||
|
||||
pthread_getschedparam( th->callbackThread, &policy, &spm );
|
||||
if( !pthread_setschedparam( th->callbackThread, SCHED_OTHER, &defaultSpm ) )
|
||||
{
|
||||
throttled = 1;
|
||||
}
|
||||
else
|
||||
PA_DEBUG(( "Watchdog: Couldn't lower priority of audio thread: %s\n", strerror( errno ) ));
|
||||
|
||||
/* Give other processes a go, before raising priority again */
|
||||
PA_DEBUG(( "%s: Watchdog sleeping for %lu msecs before unthrottling\n", __FUNCTION__, th->throttledSleepTime ));
|
||||
Pa_Sleep( th->throttledSleepTime );
|
||||
|
||||
/* Reset callback priority */
|
||||
if( pthread_setschedparam( th->callbackThread, SCHED_FIFO, &spm ) != 0 )
|
||||
{
|
||||
PA_DEBUG(( "%s: Couldn't raise priority of audio thread: %s\n", __FUNCTION__, strerror( errno ) ));
|
||||
}
|
||||
|
||||
if( PaUtil_GetCpuLoad( th->cpuLoadMeasurer ) >= .99 )
|
||||
intervalMsec = 50;
|
||||
else
|
||||
intervalMsec = 100;
|
||||
|
||||
/*
|
||||
lowpassCoeff = .97;
|
||||
lowpassCoeff1 = .99999 - lowpassCoeff;
|
||||
*/
|
||||
}
|
||||
else if( throttled && avgCpuLoad < .8 )
|
||||
{
|
||||
intervalMsec = 500;
|
||||
throttled = 0;
|
||||
|
||||
/*
|
||||
lowpassCoeff = .9;
|
||||
lowpassCoeff1 = .99999 - lowpassCoeff;
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
pthread_cleanup_pop( 1 ); /* Execute cleanup on exit */
|
||||
|
||||
error:
|
||||
/* Shouldn't get here in the normal case */
|
||||
|
||||
/* Pass on error code */
|
||||
pres = malloc( sizeof (PaError) );
|
||||
*pres = result;
|
||||
|
||||
pthread_exit( pres );
|
||||
}
|
||||
|
||||
static void CallbackUpdate( PaAlsaThreading *th )
|
||||
{
|
||||
th->callbackTime = PaUtil_GetTime();
|
||||
th->callbackCpuTime = PaUtil_GetCpuLoad( th->cpuLoadMeasurer );
|
||||
}
|
||||
|
||||
/*
|
||||
static void *CanaryFunc( void *userData )
|
||||
{
|
||||
const unsigned intervalMsec = 1000;
|
||||
PaUtilThreading *th = (PaUtilThreading *) userData;
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
th->canaryTime = PaUtil_GetTime();
|
||||
|
||||
pthread_testcancel();
|
||||
Pa_Sleep( intervalMsec );
|
||||
}
|
||||
|
||||
pthread_exit( NULL );
|
||||
}
|
||||
*/
|
||||
#endif
|
224
pd-0.44-2/portaudio/src/os/unix/pa_unix_util.h
Normal file
224
pd-0.44-2/portaudio/src/os/unix/pa_unix_util.h
Normal file
|
@ -0,0 +1,224 @@
|
|||
/*
|
||||
* $Id: pa_unix_util.h 1241 2007-07-23 20:08:31Z aknudsen $
|
||||
* Portable Audio I/O Library
|
||||
* UNIX platform-specific support functions
|
||||
*
|
||||
* Based on the Open Source API proposed by Ross Bencina
|
||||
* Copyright (c) 1999-2000 Ross Bencina
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
@ingroup unix_src
|
||||
*/
|
||||
|
||||
#ifndef PA_UNIX_UTIL_H
|
||||
#define PA_UNIX_UTIL_H
|
||||
|
||||
#include "pa_cpuload.h"
|
||||
#include <assert.h>
|
||||
#include <pthread.h>
|
||||
#include <signal.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define PA_MIN(x,y) ( (x) < (y) ? (x) : (y) )
|
||||
#define PA_MAX(x,y) ( (x) > (y) ? (x) : (y) )
|
||||
|
||||
/* Utilize GCC branch prediction for error tests */
|
||||
#if defined __GNUC__ && __GNUC__ >= 3
|
||||
#define UNLIKELY(expr) __builtin_expect( (expr), 0 )
|
||||
#else
|
||||
#define UNLIKELY(expr) (expr)
|
||||
#endif
|
||||
|
||||
#define STRINGIZE_HELPER(expr) #expr
|
||||
#define STRINGIZE(expr) STRINGIZE_HELPER(expr)
|
||||
|
||||
#define PA_UNLESS(expr, code) \
|
||||
do { \
|
||||
if( UNLIKELY( (expr) == 0 ) ) \
|
||||
{ \
|
||||
PaUtil_DebugPrint(( "Expression '" #expr "' failed in '" __FILE__ "', line: " STRINGIZE( __LINE__ ) "\n" )); \
|
||||
result = (code); \
|
||||
goto error; \
|
||||
} \
|
||||
} while (0);
|
||||
|
||||
static PaError paUtilErr_; /* Used with PA_ENSURE */
|
||||
|
||||
/* Check PaError */
|
||||
#define PA_ENSURE(expr) \
|
||||
do { \
|
||||
if( UNLIKELY( (paUtilErr_ = (expr)) < paNoError ) ) \
|
||||
{ \
|
||||
PaUtil_DebugPrint(( "Expression '" #expr "' failed in '" __FILE__ "', line: " STRINGIZE( __LINE__ ) "\n" )); \
|
||||
result = paUtilErr_; \
|
||||
goto error; \
|
||||
} \
|
||||
} while (0);
|
||||
|
||||
#define PA_ASSERT_CALL(expr, success) \
|
||||
paUtilErr_ = (expr); \
|
||||
assert( success == paUtilErr_ );
|
||||
|
||||
#define PA_ENSURE_SYSTEM(expr, success) \
|
||||
do { \
|
||||
if( UNLIKELY( (paUtilErr_ = (expr)) != success ) ) \
|
||||
{ \
|
||||
/* PaUtil_SetLastHostErrorInfo should only be used in the main thread */ \
|
||||
if( pthread_equal(pthread_self(), paUnixMainThread) ) \
|
||||
{ \
|
||||
PaUtil_SetLastHostErrorInfo( paALSA, paUtilErr_, strerror( paUtilErr_ ) ); \
|
||||
} \
|
||||
PaUtil_DebugPrint( "Expression '" #expr "' failed in '" __FILE__ "', line: " STRINGIZE( __LINE__ ) "\n" ); \
|
||||
result = paUnanticipatedHostError; \
|
||||
goto error; \
|
||||
} \
|
||||
} while( 0 );
|
||||
|
||||
typedef struct {
|
||||
pthread_t callbackThread;
|
||||
} PaUtilThreading;
|
||||
|
||||
PaError PaUtil_InitializeThreading( PaUtilThreading *threading );
|
||||
void PaUtil_TerminateThreading( PaUtilThreading *threading );
|
||||
PaError PaUtil_StartThreading( PaUtilThreading *threading, void *(*threadRoutine)(void *), void *data );
|
||||
PaError PaUtil_CancelThreading( PaUtilThreading *threading, int wait, PaError *exitResult );
|
||||
|
||||
/* State accessed by utility functions */
|
||||
|
||||
/*
|
||||
void PaUnix_SetRealtimeScheduling( int rt );
|
||||
|
||||
void PaUtil_InitializeThreading( PaUtilThreading *th, PaUtilCpuLoadMeasurer *clm );
|
||||
|
||||
PaError PaUtil_CreateCallbackThread( PaUtilThreading *th, void *(*CallbackThreadFunc)( void * ), PaStream *s );
|
||||
|
||||
PaError PaUtil_KillCallbackThread( PaUtilThreading *th, PaError *exitResult );
|
||||
|
||||
void PaUtil_CallbackUpdate( PaUtilThreading *th );
|
||||
*/
|
||||
|
||||
extern pthread_t paUnixMainThread;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
pthread_mutex_t mtx;
|
||||
} PaUnixMutex;
|
||||
|
||||
PaError PaUnixMutex_Initialize( PaUnixMutex* self );
|
||||
PaError PaUnixMutex_Terminate( PaUnixMutex* self );
|
||||
PaError PaUnixMutex_Lock( PaUnixMutex* self );
|
||||
PaError PaUnixMutex_Unlock( PaUnixMutex* self );
|
||||
|
||||
typedef struct
|
||||
{
|
||||
pthread_t thread;
|
||||
int parentWaiting;
|
||||
int stopRequested;
|
||||
int locked;
|
||||
PaUnixMutex mtx;
|
||||
pthread_cond_t cond;
|
||||
volatile sig_atomic_t stopRequest;
|
||||
} PaUnixThread;
|
||||
|
||||
/** Initialize global threading state.
|
||||
*/
|
||||
PaError PaUnixThreading_Initialize();
|
||||
|
||||
/** Perish, passing on eventual error code.
|
||||
*
|
||||
* A thin wrapper around pthread_exit, will automatically pass on any error code to the joining thread.
|
||||
* If the result indicates an error, i.e. it is not equal to paNoError, this function will automatically
|
||||
* allocate a pointer so the error is passed on with pthread_exit. If the result indicates that all is
|
||||
* well however, only a NULL pointer will be handed to pthread_exit. Thus, the joining thread should
|
||||
* check whether a non-NULL result pointer is obtained from pthread_join and make sure to free it.
|
||||
* @param result: The error code to pass on to the joining thread.
|
||||
*/
|
||||
#define PaUnixThreading_EXIT(result) \
|
||||
do { \
|
||||
PaError* pres = NULL; \
|
||||
if( paNoError != (result) ) \
|
||||
{ \
|
||||
pres = malloc( sizeof (PaError) ); \
|
||||
*pres = (result); \
|
||||
} \
|
||||
pthread_exit( pres ); \
|
||||
} while (0);
|
||||
|
||||
/** Spawn a thread.
|
||||
*
|
||||
* Intended for spawning the callback thread from the main thread. This function can even block (for a certain
|
||||
* time or indefinitely) untill notified by the callback thread (using PaUnixThread_NotifyParent), which can be
|
||||
* useful in order to make sure that callback has commenced before returning from Pa_StartStream.
|
||||
* @param threadFunc: The function to be executed in the child thread.
|
||||
* @param waitForChild: If not 0, wait for child thread to call PaUnixThread_NotifyParent. Less than 0 means
|
||||
* wait for ever, greater than 0 wait for the specified time.
|
||||
* @param rtSched: Enable realtime scheduling?
|
||||
* @return: If timed out waiting on child, paTimedOut.
|
||||
*/
|
||||
PaError PaUnixThread_New( PaUnixThread* self, void* (*threadFunc)( void* ), void* threadArg, PaTime waitForChild,
|
||||
int rtSched );
|
||||
|
||||
/** Terminate thread.
|
||||
*
|
||||
* @param wait: If true, request that background thread stop and wait untill it does, else cancel it.
|
||||
* @param exitResult: If non-null this will upon return contain the exit status of the thread.
|
||||
*/
|
||||
PaError PaUnixThread_Terminate( PaUnixThread* self, int wait, PaError* exitResult );
|
||||
|
||||
/** Prepare to notify waiting parent thread.
|
||||
*
|
||||
* An internal lock must be held before the parent is notified in PaUnixThread_NotifyParent, call this to
|
||||
* acquire it beforehand.
|
||||
* @return: If parent is not waiting, paInternalError.
|
||||
*/
|
||||
PaError PaUnixThread_PrepareNotify( PaUnixThread* self );
|
||||
|
||||
/** Notify waiting parent thread.
|
||||
*
|
||||
* @return: If parent timed out waiting, paTimedOut. If parent was never waiting, paInternalError.
|
||||
*/
|
||||
PaError PaUnixThread_NotifyParent( PaUnixThread* self );
|
||||
|
||||
/** Has the parent thread requested this thread to stop?
|
||||
*/
|
||||
int PaUnixThread_StopRequested( PaUnixThread* self );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
144
pd-0.44-2/portaudio/src/os/win/pa_win_coinitialize.c
Normal file
144
pd-0.44-2/portaudio/src/os/win/pa_win_coinitialize.c
Normal file
|
@ -0,0 +1,144 @@
|
|||
/*
|
||||
* Microsoft COM initialization routines
|
||||
* Copyright (c) 1999-2011 Ross Bencina, Dmitry Kostjuchenko
|
||||
*
|
||||
* Based on the Open Source API proposed by Ross Bencina
|
||||
* Copyright (c) 1999-2011 Ross Bencina, Phil Burk
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
@ingroup win_src
|
||||
|
||||
@brief Microsoft COM initialization routines.
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <objbase.h>
|
||||
|
||||
#include "portaudio.h"
|
||||
#include "pa_util.h"
|
||||
#include "pa_debugprint.h"
|
||||
|
||||
#include "pa_win_coinitialize.h"
|
||||
|
||||
|
||||
#if (defined(WIN32) && (defined(_MSC_VER) && (_MSC_VER >= 1200))) && !defined(_WIN32_WCE) /* MSC version 6 and above */
|
||||
#pragma comment( lib, "ole32.lib" )
|
||||
#endif
|
||||
|
||||
|
||||
/* use some special bit patterns here to try to guard against uninitialized memory errors */
|
||||
#define PAWINUTIL_COM_INITIALIZED (0xb38f)
|
||||
#define PAWINUTIL_COM_NOT_INITIALIZED (0xf1cd)
|
||||
|
||||
|
||||
PaError PaWinUtil_CoInitialize( PaHostApiTypeId hostApiType, PaWinUtilComInitializationResult *comInitializationResult )
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
comInitializationResult->state = PAWINUTIL_COM_NOT_INITIALIZED;
|
||||
|
||||
/*
|
||||
If COM is already initialized CoInitialize will either return
|
||||
FALSE, or RPC_E_CHANGED_MODE if it was initialised in a different
|
||||
threading mode. In either case we shouldn't consider it an error
|
||||
but we need to be careful to not call CoUninitialize() if
|
||||
RPC_E_CHANGED_MODE was returned.
|
||||
*/
|
||||
|
||||
hr = CoInitialize(0); /* use legacy-safe equivalent to CoInitializeEx(NULL, COINIT_APARTMENTTHREADED) */
|
||||
if( FAILED(hr) && hr != RPC_E_CHANGED_MODE )
|
||||
{
|
||||
PA_DEBUG(("CoInitialize(0) failed. hr=%d\n", hr));
|
||||
|
||||
if( hr == E_OUTOFMEMORY )
|
||||
return paInsufficientMemory;
|
||||
|
||||
{
|
||||
char *lpMsgBuf;
|
||||
FormatMessage(
|
||||
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
NULL,
|
||||
hr,
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||
(LPTSTR) &lpMsgBuf,
|
||||
0,
|
||||
NULL
|
||||
);
|
||||
PaUtil_SetLastHostErrorInfo( hostApiType, hr, lpMsgBuf );
|
||||
LocalFree( lpMsgBuf );
|
||||
}
|
||||
|
||||
return paUnanticipatedHostError;
|
||||
}
|
||||
|
||||
if( hr != RPC_E_CHANGED_MODE )
|
||||
{
|
||||
comInitializationResult->state = PAWINUTIL_COM_INITIALIZED;
|
||||
|
||||
/*
|
||||
Memorize calling thread id and report warning on Uninitialize if
|
||||
calling thread is different as CoInitialize must match CoUninitialize
|
||||
in the same thread.
|
||||
*/
|
||||
comInitializationResult->initializingThreadId = GetCurrentThreadId();
|
||||
}
|
||||
|
||||
return paNoError;
|
||||
}
|
||||
|
||||
|
||||
void PaWinUtil_CoUninitialize( PaHostApiTypeId hostApiType, PaWinUtilComInitializationResult *comInitializationResult )
|
||||
{
|
||||
if( comInitializationResult->state != PAWINUTIL_COM_NOT_INITIALIZED
|
||||
&& comInitializationResult->state != PAWINUTIL_COM_INITIALIZED ){
|
||||
|
||||
PA_DEBUG(("ERROR: PaWinUtil_CoUninitialize called without calling PaWinUtil_CoInitialize\n"));
|
||||
}
|
||||
|
||||
if( comInitializationResult->state == PAWINUTIL_COM_INITIALIZED )
|
||||
{
|
||||
DWORD currentThreadId = GetCurrentThreadId();
|
||||
if( comInitializationResult->initializingThreadId != currentThreadId )
|
||||
{
|
||||
PA_DEBUG(("ERROR: failed PaWinUtil_CoUninitialize calling thread[%d] does not match initializing thread[%d]\n",
|
||||
currentThreadId, comInitializationResult->initializingThreadId));
|
||||
}
|
||||
else
|
||||
{
|
||||
CoUninitialize();
|
||||
|
||||
comInitializationResult->state = PAWINUTIL_COM_NOT_INITIALIZED;
|
||||
}
|
||||
}
|
||||
}
|
94
pd-0.44-2/portaudio/src/os/win/pa_win_coinitialize.h
Normal file
94
pd-0.44-2/portaudio/src/os/win/pa_win_coinitialize.h
Normal file
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
* Microsoft COM initialization routines
|
||||
* Copyright (c) 1999-2011 Ross Bencina, Phil Burk
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
@ingroup win_src
|
||||
|
||||
@brief Microsoft COM initialization routines.
|
||||
*/
|
||||
|
||||
#ifndef PA_WIN_COINITIALIZE_H
|
||||
#define PA_WIN_COINITIALIZE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/**
|
||||
@brief Data type used to hold the result of an attempt to initialize COM
|
||||
using PaWinUtil_CoInitialize. Must be retained between a call to
|
||||
PaWinUtil_CoInitialize and a matching call to PaWinUtil_CoUninitialize.
|
||||
*/
|
||||
typedef struct PaWinUtilComInitializationResult{
|
||||
int state;
|
||||
int initializingThreadId;
|
||||
} PaWinUtilComInitializationResult;
|
||||
|
||||
|
||||
/**
|
||||
@brief Initialize Microsoft COM subsystem on the current thread.
|
||||
|
||||
@param hostApiType the host API type id of the caller. Used for error reporting.
|
||||
|
||||
@param comInitializationResult An output parameter. The value pointed to by
|
||||
this parameter stores information required by PaWinUtil_CoUninitialize
|
||||
to correctly uninitialize COM. The value should be retained and later
|
||||
passed to PaWinUtil_CoUninitialize.
|
||||
|
||||
If PaWinUtil_CoInitialize returns paNoError, the caller must later call
|
||||
PaWinUtil_CoUninitialize once.
|
||||
*/
|
||||
PaError PaWinUtil_CoInitialize( PaHostApiTypeId hostApiType, PaWinUtilComInitializationResult *comInitializationResult );
|
||||
|
||||
|
||||
/**
|
||||
@brief Uninitialize the Microsoft COM subsystem on the current thread using
|
||||
the result of a previous call to PaWinUtil_CoInitialize. Must be called on the same
|
||||
thread as PaWinUtil_CoInitialize.
|
||||
|
||||
@param hostApiType the host API type id of the caller. Used for error reporting.
|
||||
|
||||
@param comInitializationResult An input parameter. A pointer to a value previously
|
||||
initialized by a call to PaWinUtil_CoInitialize.
|
||||
*/
|
||||
void PaWinUtil_CoUninitialize( PaHostApiTypeId hostApiType, PaWinUtilComInitializationResult *comInitializationResult );
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* PA_WIN_COINITIALIZE_H */
|
102
pd-0.44-2/portaudio/src/os/win/pa_win_hostapis.c
Normal file
102
pd-0.44-2/portaudio/src/os/win/pa_win_hostapis.c
Normal file
|
@ -0,0 +1,102 @@
|
|||
/*
|
||||
* $Id: pa_win_hostapis.c 1728 2011-08-18 03:31:51Z rossb $
|
||||
* Portable Audio I/O Library Windows initialization table
|
||||
*
|
||||
* Based on the Open Source API proposed by Ross Bencina
|
||||
* Copyright (c) 1999-2008 Ross Bencina, Phil Burk
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
@ingroup win_src
|
||||
|
||||
@brief Win32 host API initialization function table.
|
||||
*/
|
||||
|
||||
/* This is needed to make this source file depend on CMake option changes
|
||||
and at the same time make it transparent for clients not using CMake.
|
||||
*/
|
||||
#ifdef PORTAUDIO_CMAKE_GENERATED
|
||||
#include "options_cmake.h"
|
||||
#endif
|
||||
|
||||
#include "pa_hostapi.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
PaError PaSkeleton_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index );
|
||||
PaError PaWinMme_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index );
|
||||
PaError PaWinDs_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index );
|
||||
PaError PaAsio_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index );
|
||||
PaError PaWinWdm_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index );
|
||||
PaError PaWasapi_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
PaUtilHostApiInitializer *paHostApiInitializers[] =
|
||||
{
|
||||
|
||||
#if PA_USE_WMME
|
||||
PaWinMme_Initialize,
|
||||
#endif
|
||||
|
||||
#if PA_USE_DS
|
||||
PaWinDs_Initialize,
|
||||
#endif
|
||||
|
||||
#if PA_USE_ASIO
|
||||
PaAsio_Initialize,
|
||||
#endif
|
||||
|
||||
#if PA_USE_WASAPI
|
||||
PaWasapi_Initialize,
|
||||
#endif
|
||||
|
||||
#if PA_USE_WDMKS
|
||||
PaWinWdm_Initialize,
|
||||
#endif
|
||||
|
||||
#if PA_USE_SKELETON
|
||||
PaSkeleton_Initialize, /* just for testing. last in list so it isn't marked as default. */
|
||||
#endif
|
||||
|
||||
0 /* NULL terminated array */
|
||||
};
|
||||
|
||||
|
153
pd-0.44-2/portaudio/src/os/win/pa_win_util.c
Normal file
153
pd-0.44-2/portaudio/src/os/win/pa_win_util.c
Normal file
|
@ -0,0 +1,153 @@
|
|||
/*
|
||||
* $Id: pa_win_util.c 1584 2011-02-02 18:58:17Z rossb $
|
||||
* Portable Audio I/O Library
|
||||
* Win32 platform-specific support functions
|
||||
*
|
||||
* Based on the Open Source API proposed by Ross Bencina
|
||||
* Copyright (c) 1999-2008 Ross Bencina
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
@ingroup win_src
|
||||
|
||||
@brief Win32 implementation of platform-specific PaUtil support functions.
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <mmsystem.h> /* for timeGetTime() */
|
||||
|
||||
#include "pa_util.h"
|
||||
|
||||
#if (defined(WIN32) && (defined(_MSC_VER) && (_MSC_VER >= 1200))) && !defined(_WIN32_WCE) /* MSC version 6 and above */
|
||||
#pragma comment( lib, "winmm.lib" )
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
Track memory allocations to avoid leaks.
|
||||
*/
|
||||
|
||||
#if PA_TRACK_MEMORY
|
||||
static int numAllocations_ = 0;
|
||||
#endif
|
||||
|
||||
|
||||
void *PaUtil_AllocateMemory( long size )
|
||||
{
|
||||
void *result = GlobalAlloc( GPTR, size );
|
||||
|
||||
#if PA_TRACK_MEMORY
|
||||
if( result != NULL ) numAllocations_ += 1;
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void PaUtil_FreeMemory( void *block )
|
||||
{
|
||||
if( block != NULL )
|
||||
{
|
||||
GlobalFree( block );
|
||||
#if PA_TRACK_MEMORY
|
||||
numAllocations_ -= 1;
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int PaUtil_CountCurrentlyAllocatedBlocks( void )
|
||||
{
|
||||
#if PA_TRACK_MEMORY
|
||||
return numAllocations_;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void Pa_Sleep( long msec )
|
||||
{
|
||||
Sleep( msec );
|
||||
}
|
||||
|
||||
static int usePerformanceCounter_;
|
||||
static double secondsPerTick_;
|
||||
|
||||
void PaUtil_InitializeClock( void )
|
||||
{
|
||||
LARGE_INTEGER ticksPerSecond;
|
||||
|
||||
if( QueryPerformanceFrequency( &ticksPerSecond ) != 0 )
|
||||
{
|
||||
usePerformanceCounter_ = 1;
|
||||
secondsPerTick_ = 1.0 / (double)ticksPerSecond.QuadPart;
|
||||
}
|
||||
else
|
||||
{
|
||||
usePerformanceCounter_ = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
double PaUtil_GetTime( void )
|
||||
{
|
||||
LARGE_INTEGER time;
|
||||
|
||||
if( usePerformanceCounter_ )
|
||||
{
|
||||
/*
|
||||
Note: QueryPerformanceCounter has a known issue where it can skip forward
|
||||
by a few seconds (!) due to a hardware bug on some PCI-ISA bridge hardware.
|
||||
This is documented here:
|
||||
http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q274323&
|
||||
|
||||
The work-arounds are not very paletable and involve querying GetTickCount
|
||||
at every time step.
|
||||
|
||||
Using rdtsc is not a good option on multi-core systems.
|
||||
|
||||
For now we just use QueryPerformanceCounter(). It's good, most of the time.
|
||||
*/
|
||||
QueryPerformanceCounter( &time );
|
||||
return time.QuadPart * secondsPerTick_;
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifndef UNDER_CE
|
||||
return timeGetTime() * .001;
|
||||
#else
|
||||
return GetTickCount() * .001;
|
||||
#endif
|
||||
}
|
||||
}
|
154
pd-0.44-2/portaudio/src/os/win/pa_win_waveformat.c
Normal file
154
pd-0.44-2/portaudio/src/os/win/pa_win_waveformat.c
Normal file
|
@ -0,0 +1,154 @@
|
|||
/*
|
||||
* PortAudio Portable Real-Time Audio Library
|
||||
* Windows WAVEFORMAT* data structure utilities
|
||||
* portaudio.h should be included before this file.
|
||||
*
|
||||
* Copyright (c) 2007 Ross Bencina
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <mmsystem.h>
|
||||
|
||||
#include "portaudio.h"
|
||||
#include "pa_win_waveformat.h"
|
||||
|
||||
|
||||
#if !defined(WAVE_FORMAT_EXTENSIBLE)
|
||||
#define WAVE_FORMAT_EXTENSIBLE 0xFFFE
|
||||
#endif
|
||||
|
||||
static GUID pawin_ksDataFormatSubtypeGuidBase =
|
||||
{ (USHORT)(WAVE_FORMAT_PCM), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 };
|
||||
|
||||
|
||||
int PaWin_SampleFormatToLinearWaveFormatTag( PaSampleFormat sampleFormat )
|
||||
{
|
||||
if( sampleFormat == paFloat32 )
|
||||
return PAWIN_WAVE_FORMAT_IEEE_FLOAT;
|
||||
|
||||
return PAWIN_WAVE_FORMAT_PCM;
|
||||
}
|
||||
|
||||
|
||||
void PaWin_InitializeWaveFormatEx( PaWinWaveFormat *waveFormat,
|
||||
int numChannels, PaSampleFormat sampleFormat, int waveFormatTag, double sampleRate )
|
||||
{
|
||||
WAVEFORMATEX *waveFormatEx = (WAVEFORMATEX*)waveFormat;
|
||||
int bytesPerSample = Pa_GetSampleSize(sampleFormat);
|
||||
unsigned long bytesPerFrame = numChannels * bytesPerSample;
|
||||
|
||||
waveFormatEx->wFormatTag = waveFormatTag;
|
||||
waveFormatEx->nChannels = (WORD)numChannels;
|
||||
waveFormatEx->nSamplesPerSec = (DWORD)sampleRate;
|
||||
waveFormatEx->nAvgBytesPerSec = waveFormatEx->nSamplesPerSec * bytesPerFrame;
|
||||
waveFormatEx->nBlockAlign = (WORD)bytesPerFrame;
|
||||
waveFormatEx->wBitsPerSample = bytesPerSample * 8;
|
||||
waveFormatEx->cbSize = 0;
|
||||
}
|
||||
|
||||
|
||||
void PaWin_InitializeWaveFormatExtensible( PaWinWaveFormat *waveFormat,
|
||||
int numChannels, PaSampleFormat sampleFormat, int waveFormatTag, double sampleRate,
|
||||
PaWinWaveFormatChannelMask channelMask )
|
||||
{
|
||||
WAVEFORMATEX *waveFormatEx = (WAVEFORMATEX*)waveFormat;
|
||||
int bytesPerSample = Pa_GetSampleSize(sampleFormat);
|
||||
unsigned long bytesPerFrame = numChannels * bytesPerSample;
|
||||
GUID guid;
|
||||
|
||||
waveFormatEx->wFormatTag = WAVE_FORMAT_EXTENSIBLE;
|
||||
waveFormatEx->nChannels = (WORD)numChannels;
|
||||
waveFormatEx->nSamplesPerSec = (DWORD)sampleRate;
|
||||
waveFormatEx->nAvgBytesPerSec = waveFormatEx->nSamplesPerSec * bytesPerFrame;
|
||||
waveFormatEx->nBlockAlign = (WORD)bytesPerFrame;
|
||||
waveFormatEx->wBitsPerSample = bytesPerSample * 8;
|
||||
waveFormatEx->cbSize = 22;
|
||||
|
||||
*((WORD*)&waveFormat->fields[PAWIN_INDEXOF_WVALIDBITSPERSAMPLE]) =
|
||||
waveFormatEx->wBitsPerSample;
|
||||
|
||||
*((DWORD*)&waveFormat->fields[PAWIN_INDEXOF_DWCHANNELMASK]) = channelMask;
|
||||
|
||||
guid = pawin_ksDataFormatSubtypeGuidBase;
|
||||
guid.Data1 = (USHORT)waveFormatTag;
|
||||
*((GUID*)&waveFormat->fields[PAWIN_INDEXOF_SUBFORMAT]) = guid;
|
||||
}
|
||||
|
||||
|
||||
PaWinWaveFormatChannelMask PaWin_DefaultChannelMask( int numChannels )
|
||||
{
|
||||
switch( numChannels ){
|
||||
case 1:
|
||||
return PAWIN_SPEAKER_MONO;
|
||||
case 2:
|
||||
return PAWIN_SPEAKER_STEREO;
|
||||
case 3:
|
||||
return PAWIN_SPEAKER_FRONT_LEFT | PAWIN_SPEAKER_FRONT_CENTER | PAWIN_SPEAKER_FRONT_RIGHT;
|
||||
case 4:
|
||||
return PAWIN_SPEAKER_QUAD;
|
||||
case 5:
|
||||
return PAWIN_SPEAKER_QUAD | PAWIN_SPEAKER_FRONT_CENTER;
|
||||
case 6:
|
||||
/* The meaning of the PAWIN_SPEAKER_5POINT1 flag has changed over time:
|
||||
http://msdn2.microsoft.com/en-us/library/aa474707.aspx
|
||||
We use PAWIN_SPEAKER_5POINT1 (not PAWIN_SPEAKER_5POINT1_SURROUND)
|
||||
because on some cards (eg Audigy) PAWIN_SPEAKER_5POINT1_SURROUND
|
||||
results in a virtual mixdown placing the rear output in the
|
||||
front _and_ rear speakers.
|
||||
*/
|
||||
return PAWIN_SPEAKER_5POINT1;
|
||||
/* case 7: */
|
||||
case 8:
|
||||
return PAWIN_SPEAKER_7POINT1;
|
||||
}
|
||||
|
||||
/* Apparently some Audigy drivers will output silence
|
||||
if the direct-out constant (0) is used. So this is not ideal.
|
||||
*/
|
||||
return PAWIN_SPEAKER_DIRECTOUT;
|
||||
|
||||
/* Note that Alec Rogers proposed the following as an alternate method to
|
||||
generate the default channel mask, however it doesn't seem to be an improvement
|
||||
over the above, since some drivers will matrix outputs mapping to non-present
|
||||
speakers accross multiple physical speakers.
|
||||
|
||||
if(nChannels==1) {
|
||||
pwfFormat->dwChannelMask = SPEAKER_FRONT_CENTER;
|
||||
}
|
||||
else {
|
||||
pwfFormat->dwChannelMask = 0;
|
||||
for(i=0; i<nChannels; i++)
|
||||
pwfFormat->dwChannelMask = (pwfFormat->dwChannelMask << 1) | 0x1;
|
||||
}
|
||||
*/
|
||||
}
|
308
pd-0.44-2/portaudio/src/os/win/pa_win_wdmks_utils.c
Normal file
308
pd-0.44-2/portaudio/src/os/win/pa_win_wdmks_utils.c
Normal file
|
@ -0,0 +1,308 @@
|
|||
/*
|
||||
* PortAudio Portable Real-Time Audio Library
|
||||
* Windows WDM KS utilities
|
||||
*
|
||||
* Copyright (c) 1999 - 2007 Andrew Baldwin, Ross Bencina
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <mmreg.h>
|
||||
#ifndef WAVE_FORMAT_IEEE_FLOAT
|
||||
#define WAVE_FORMAT_IEEE_FLOAT 0x0003 // MinGW32 does not define this
|
||||
#endif
|
||||
#ifndef _WAVEFORMATEXTENSIBLE_
|
||||
#define _WAVEFORMATEXTENSIBLE_ // MinGW32 does not define this
|
||||
#endif
|
||||
#ifndef _INC_MMREG
|
||||
#define _INC_MMREG // for STATIC_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT
|
||||
#endif
|
||||
#include <winioctl.h> // MinGW32 does not define this automatically
|
||||
|
||||
#if defined(__GNUC__)
|
||||
|
||||
#include "../../hostapi/wasapi/mingw-include/ks.h"
|
||||
#include "../../hostapi/wasapi/mingw-include/ksmedia.h"
|
||||
|
||||
#else
|
||||
|
||||
#include <ks.h>
|
||||
#include <ksmedia.h>
|
||||
|
||||
#endif
|
||||
|
||||
#include <stdio.h> // just for some development printfs
|
||||
|
||||
#include "portaudio.h"
|
||||
#include "pa_util.h"
|
||||
#include "pa_win_wdmks_utils.h"
|
||||
|
||||
#if !defined(PA_WDMKS_NO_KSGUID_LIB) && !defined(PAWIN_WDMKS_NO_KSGUID_LIB) && !defined(__GNUC__)
|
||||
#if (defined(WIN32) && (defined(_MSC_VER) && (_MSC_VER >= 1200))) /* MSC version 6 and above */
|
||||
#pragma comment( lib, "ksguid.lib" )
|
||||
#endif
|
||||
#define pa_KSDATAFORMAT_TYPE_AUDIO KSDATAFORMAT_TYPE_AUDIO
|
||||
#define pa_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT KSDATAFORMAT_SUBTYPE_IEEE_FLOAT
|
||||
#define pa_KSDATAFORMAT_SUBTYPE_PCM KSDATAFORMAT_SUBTYPE_PCM
|
||||
#define pa_KSDATAFORMAT_SUBTYPE_WAVEFORMATEX KSDATAFORMAT_SUBTYPE_WAVEFORMATEX
|
||||
#define pa_KSMEDIUMSETID_Standard KSMEDIUMSETID_Standard
|
||||
#define pa_KSINTERFACESETID_Standard KSINTERFACESETID_Standard
|
||||
#define pa_KSPROPSETID_Pin KSPROPSETID_Pin
|
||||
#else
|
||||
static const GUID pa_KSDATAFORMAT_TYPE_AUDIO = { STATIC_KSDATAFORMAT_TYPE_AUDIO };
|
||||
static const GUID pa_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT = { STATIC_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT };
|
||||
static const GUID pa_KSDATAFORMAT_SUBTYPE_PCM = { STATIC_KSDATAFORMAT_SUBTYPE_PCM };
|
||||
static const GUID pa_KSDATAFORMAT_SUBTYPE_WAVEFORMATEX = { STATIC_KSDATAFORMAT_SUBTYPE_WAVEFORMATEX };
|
||||
static const GUID pa_KSMEDIUMSETID_Standard = { STATIC_KSMEDIUMSETID_Standard };
|
||||
static const GUID pa_KSINTERFACESETID_Standard = { STATIC_KSINTERFACESETID_Standard };
|
||||
static const GUID pa_KSPROPSETID_Pin = { STATIC_KSPROPSETID_Pin };
|
||||
#endif
|
||||
|
||||
|
||||
#define pa_IS_VALID_WAVEFORMATEX_GUID(Guid)\
|
||||
(!memcmp(((PUSHORT)&pa_KSDATAFORMAT_SUBTYPE_WAVEFORMATEX) + 1, ((PUSHORT)(Guid)) + 1, sizeof(GUID) - sizeof(USHORT)))
|
||||
|
||||
|
||||
|
||||
static PaError WdmGetPinPropertySimple(
|
||||
HANDLE handle,
|
||||
unsigned long pinId,
|
||||
unsigned long property,
|
||||
void* value,
|
||||
unsigned long valueSize )
|
||||
{
|
||||
DWORD bytesReturned;
|
||||
KSP_PIN ksPProp;
|
||||
ksPProp.Property.Set = pa_KSPROPSETID_Pin;
|
||||
ksPProp.Property.Id = property;
|
||||
ksPProp.Property.Flags = KSPROPERTY_TYPE_GET;
|
||||
ksPProp.PinId = pinId;
|
||||
ksPProp.Reserved = 0;
|
||||
|
||||
if( DeviceIoControl( handle, IOCTL_KS_PROPERTY, &ksPProp, sizeof(KSP_PIN),
|
||||
value, valueSize, &bytesReturned, NULL ) == 0 || bytesReturned != valueSize )
|
||||
{
|
||||
return paUnanticipatedHostError;
|
||||
}
|
||||
else
|
||||
{
|
||||
return paNoError;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static PaError WdmGetPinPropertyMulti(
|
||||
HANDLE handle,
|
||||
unsigned long pinId,
|
||||
unsigned long property,
|
||||
KSMULTIPLE_ITEM** ksMultipleItem)
|
||||
{
|
||||
unsigned long multipleItemSize = 0;
|
||||
KSP_PIN ksPProp;
|
||||
DWORD bytesReturned;
|
||||
|
||||
*ksMultipleItem = 0;
|
||||
|
||||
ksPProp.Property.Set = pa_KSPROPSETID_Pin;
|
||||
ksPProp.Property.Id = property;
|
||||
ksPProp.Property.Flags = KSPROPERTY_TYPE_GET;
|
||||
ksPProp.PinId = pinId;
|
||||
ksPProp.Reserved = 0;
|
||||
|
||||
if( DeviceIoControl( handle, IOCTL_KS_PROPERTY, &ksPProp.Property,
|
||||
sizeof(KSP_PIN), NULL, 0, &multipleItemSize, NULL ) == 0 && GetLastError() != ERROR_MORE_DATA )
|
||||
{
|
||||
return paUnanticipatedHostError;
|
||||
}
|
||||
|
||||
*ksMultipleItem = (KSMULTIPLE_ITEM*)PaUtil_AllocateMemory( multipleItemSize );
|
||||
if( !*ksMultipleItem )
|
||||
{
|
||||
return paInsufficientMemory;
|
||||
}
|
||||
|
||||
if( DeviceIoControl( handle, IOCTL_KS_PROPERTY, &ksPProp, sizeof(KSP_PIN),
|
||||
(void*)*ksMultipleItem, multipleItemSize, &bytesReturned, NULL ) == 0 || bytesReturned != multipleItemSize )
|
||||
{
|
||||
PaUtil_FreeMemory( ksMultipleItem );
|
||||
return paUnanticipatedHostError;
|
||||
}
|
||||
|
||||
return paNoError;
|
||||
}
|
||||
|
||||
|
||||
static int GetKSFilterPinCount( HANDLE deviceHandle )
|
||||
{
|
||||
DWORD result;
|
||||
|
||||
if( WdmGetPinPropertySimple( deviceHandle, 0, KSPROPERTY_PIN_CTYPES, &result, sizeof(result) ) == paNoError ){
|
||||
return result;
|
||||
}else{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static KSPIN_COMMUNICATION GetKSFilterPinPropertyCommunication( HANDLE deviceHandle, int pinId )
|
||||
{
|
||||
KSPIN_COMMUNICATION result;
|
||||
|
||||
if( WdmGetPinPropertySimple( deviceHandle, pinId, KSPROPERTY_PIN_COMMUNICATION, &result, sizeof(result) ) == paNoError ){
|
||||
return result;
|
||||
}else{
|
||||
return KSPIN_COMMUNICATION_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static KSPIN_DATAFLOW GetKSFilterPinPropertyDataflow( HANDLE deviceHandle, int pinId )
|
||||
{
|
||||
KSPIN_DATAFLOW result;
|
||||
|
||||
if( WdmGetPinPropertySimple( deviceHandle, pinId, KSPROPERTY_PIN_DATAFLOW, &result, sizeof(result) ) == paNoError ){
|
||||
return result;
|
||||
}else{
|
||||
return (KSPIN_DATAFLOW)0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int KSFilterPinPropertyIdentifiersInclude(
|
||||
HANDLE deviceHandle, int pinId, unsigned long property, const GUID *identifierSet, unsigned long identifierId )
|
||||
{
|
||||
KSMULTIPLE_ITEM* item = NULL;
|
||||
KSIDENTIFIER* identifier;
|
||||
int i;
|
||||
int result = 0;
|
||||
|
||||
if( WdmGetPinPropertyMulti( deviceHandle, pinId, property, &item) != paNoError )
|
||||
return 0;
|
||||
|
||||
identifier = (KSIDENTIFIER*)(item+1);
|
||||
|
||||
for( i = 0; i < (int)item->Count; i++ )
|
||||
{
|
||||
if( !memcmp( (void*)&identifier[i].Set, (void*)identifierSet, sizeof( GUID ) ) &&
|
||||
( identifier[i].Id == identifierId ) )
|
||||
{
|
||||
result = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
PaUtil_FreeMemory( item );
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/* return the maximum channel count supported by any pin on the device.
|
||||
if isInput is non-zero we query input pins, otherwise output pins.
|
||||
*/
|
||||
int PaWin_WDMKS_QueryFilterMaximumChannelCount( void *wcharDevicePath, int isInput )
|
||||
{
|
||||
HANDLE deviceHandle;
|
||||
ULONG i;
|
||||
int pinCount, pinId;
|
||||
int result = 0;
|
||||
KSPIN_DATAFLOW requiredDataflowDirection = (isInput ? KSPIN_DATAFLOW_OUT : KSPIN_DATAFLOW_IN );
|
||||
|
||||
if( !wcharDevicePath )
|
||||
return 0;
|
||||
|
||||
deviceHandle = CreateFileW( (LPCWSTR)wcharDevicePath, FILE_SHARE_READ|FILE_SHARE_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL );
|
||||
if( deviceHandle == INVALID_HANDLE_VALUE )
|
||||
return 0;
|
||||
|
||||
pinCount = GetKSFilterPinCount( deviceHandle );
|
||||
for( pinId = 0; pinId < pinCount; ++pinId )
|
||||
{
|
||||
KSPIN_COMMUNICATION communication = GetKSFilterPinPropertyCommunication( deviceHandle, pinId );
|
||||
KSPIN_DATAFLOW dataflow = GetKSFilterPinPropertyDataflow( deviceHandle, pinId );
|
||||
if( ( dataflow == requiredDataflowDirection ) &&
|
||||
(( communication == KSPIN_COMMUNICATION_SINK) ||
|
||||
( communication == KSPIN_COMMUNICATION_BOTH))
|
||||
&& ( KSFilterPinPropertyIdentifiersInclude( deviceHandle, pinId,
|
||||
KSPROPERTY_PIN_INTERFACES, &pa_KSINTERFACESETID_Standard, KSINTERFACE_STANDARD_STREAMING )
|
||||
|| KSFilterPinPropertyIdentifiersInclude( deviceHandle, pinId,
|
||||
KSPROPERTY_PIN_INTERFACES, &pa_KSINTERFACESETID_Standard, KSINTERFACE_STANDARD_LOOPED_STREAMING ) )
|
||||
&& KSFilterPinPropertyIdentifiersInclude( deviceHandle, pinId,
|
||||
KSPROPERTY_PIN_MEDIUMS, &pa_KSMEDIUMSETID_Standard, KSMEDIUM_STANDARD_DEVIO ) )
|
||||
{
|
||||
KSMULTIPLE_ITEM* item = NULL;
|
||||
if( WdmGetPinPropertyMulti( deviceHandle, pinId, KSPROPERTY_PIN_DATARANGES, &item ) == paNoError )
|
||||
{
|
||||
KSDATARANGE *dataRange = (KSDATARANGE*)(item+1);
|
||||
|
||||
for( i=0; i < item->Count; ++i ){
|
||||
|
||||
if( pa_IS_VALID_WAVEFORMATEX_GUID(&dataRange->SubFormat)
|
||||
|| memcmp( (void*)&dataRange->SubFormat, (void*)&pa_KSDATAFORMAT_SUBTYPE_PCM, sizeof(GUID) ) == 0
|
||||
|| memcmp( (void*)&dataRange->SubFormat, (void*)&pa_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, sizeof(GUID) ) == 0
|
||||
|| ( ( memcmp( (void*)&dataRange->MajorFormat, (void*)&pa_KSDATAFORMAT_TYPE_AUDIO, sizeof(GUID) ) == 0 )
|
||||
&& ( memcmp( (void*)&dataRange->SubFormat, (void*)&KSDATAFORMAT_SUBTYPE_WILDCARD, sizeof(GUID) ) == 0 ) ) )
|
||||
{
|
||||
KSDATARANGE_AUDIO *dataRangeAudio = (KSDATARANGE_AUDIO*)dataRange;
|
||||
|
||||
/*
|
||||
printf( ">>> %d %d %d %d %S\n", isInput, dataflow, communication, dataRangeAudio->MaximumChannels, devicePath );
|
||||
|
||||
if( memcmp((void*)&dataRange->Specifier, (void*)&KSDATAFORMAT_SPECIFIER_WAVEFORMATEX, sizeof(GUID) ) == 0 )
|
||||
printf( "\tspecifier: KSDATAFORMAT_SPECIFIER_WAVEFORMATEX\n" );
|
||||
else if( memcmp((void*)&dataRange->Specifier, (void*)&KSDATAFORMAT_SPECIFIER_DSOUND, sizeof(GUID) ) == 0 )
|
||||
printf( "\tspecifier: KSDATAFORMAT_SPECIFIER_DSOUND\n" );
|
||||
else if( memcmp((void*)&dataRange->Specifier, (void*)&KSDATAFORMAT_SPECIFIER_WILDCARD, sizeof(GUID) ) == 0 )
|
||||
printf( "\tspecifier: KSDATAFORMAT_SPECIFIER_WILDCARD\n" );
|
||||
else
|
||||
printf( "\tspecifier: ?\n" );
|
||||
*/
|
||||
|
||||
/*
|
||||
We assume that very high values for MaximumChannels are not useful and indicate
|
||||
that the driver isn't prepared to tell us the real number of channels which it supports.
|
||||
*/
|
||||
if( dataRangeAudio->MaximumChannels < 0xFFFFUL && (int)dataRangeAudio->MaximumChannels > result )
|
||||
result = (int)dataRangeAudio->MaximumChannels;
|
||||
}
|
||||
|
||||
dataRange = (KSDATARANGE*)( ((char*)dataRange) + dataRange->FormatSize);
|
||||
}
|
||||
|
||||
PaUtil_FreeMemory( item );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CloseHandle( deviceHandle );
|
||||
return result;
|
||||
}
|
65
pd-0.44-2/portaudio/src/os/win/pa_win_wdmks_utils.h
Normal file
65
pd-0.44-2/portaudio/src/os/win/pa_win_wdmks_utils.h
Normal file
|
@ -0,0 +1,65 @@
|
|||
#ifndef PA_WIN_WDMKS_UTILS_H
|
||||
#define PA_WIN_WDMKS_UTILS_H
|
||||
|
||||
/*
|
||||
* PortAudio Portable Real-Time Audio Library
|
||||
* Windows WDM KS utilities
|
||||
*
|
||||
* Copyright (c) 1999 - 2007 Ross Bencina, Andrew Baldwin
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
@brief Utilities for working with the Windows WDM KS API
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
Query for the maximum number of channels supported by any pin of the
|
||||
specified device. Returns 0 if the query fails for any reason.
|
||||
|
||||
@param wcharDevicePath A system level PnP interface path, supplied as a WCHAR unicode string.
|
||||
Declard as void* to avoid introducing a dependency on wchar_t here.
|
||||
|
||||
@param isInput A flag specifying whether to query for input (non-zero) or output (zero) channels.
|
||||
*/
|
||||
int PaWin_WDMKS_QueryFilterMaximumChannelCount( void *wcharDevicePath, int isInput );
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* PA_WIN_WDMKS_UTILS_H */
|
1219
pd-0.44-2/portaudio/src/os/win/pa_x86_plain_converters.c
Normal file
1219
pd-0.44-2/portaudio/src/os/win/pa_x86_plain_converters.c
Normal file
File diff suppressed because it is too large
Load diff
60
pd-0.44-2/portaudio/src/os/win/pa_x86_plain_converters.h
Normal file
60
pd-0.44-2/portaudio/src/os/win/pa_x86_plain_converters.h
Normal file
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* Plain Intel IA32 assembly implementations of PortAudio sample converter functions.
|
||||
* Copyright (c) 1999-2002 Ross Bencina, Phil Burk
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The text above constitutes the entire PortAudio license; however,
|
||||
* the PortAudio community also makes the following non-binding requests:
|
||||
*
|
||||
* Any person wishing to distribute modifications to the Software is
|
||||
* requested to send the modifications to the original developer so that
|
||||
* they can be incorporated into the canonical version. It is also
|
||||
* requested that these non-binding requests be included along with the
|
||||
* license above.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
@ingroup win_src
|
||||
*/
|
||||
|
||||
#ifndef PA_X86_PLAIN_CONVERTERS_H
|
||||
#define PA_X86_PLAIN_CONVERTERS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/**
|
||||
@brief Install optimized converter functions suitable for all IA32 processors
|
||||
|
||||
It is recommended to call PaUtil_InitializeX86PlainConverters prior to calling Pa_Initialize
|
||||
*/
|
||||
void PaUtil_InitializeX86PlainConverters( void );
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* PA_X86_PLAIN_CONVERTERS_H */
|
Loading…
Add table
Add a link
Reference in a new issue