mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-09-30 00:56:38 -04:00
- old imports no longer needed
- Makefile should be generated from configure git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/trunk@252 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
5cb60958c3
commit
85babab2e1
@ -1,197 +0,0 @@
|
|||||||
#
|
|
||||||
# PortAudio V19 Makefile.in
|
|
||||||
#
|
|
||||||
# Dominic Mazzoni
|
|
||||||
# Modifications by Mikael Magnusson
|
|
||||||
#
|
|
||||||
|
|
||||||
top_srcdir = .
|
|
||||||
srcdir = .
|
|
||||||
|
|
||||||
top_builddir = .
|
|
||||||
PREFIX = /usr/local
|
|
||||||
prefix = $(PREFIX)
|
|
||||||
exec_prefix = ${prefix}
|
|
||||||
bindir = ${exec_prefix}/bin
|
|
||||||
libdir = ${exec_prefix}/lib
|
|
||||||
includedir = ${prefix}/include
|
|
||||||
CC = gcc
|
|
||||||
CFLAGS = -g -O2 -DPA_LITTLE_ENDIAN -pthread -I$(top_srcdir)/include -I$(top_srcdir)/src/common -I$(top_srcdir)/src/os/unix -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DSIZEOF_SHORT=2 -DSIZEOF_INT=4 -DSIZEOF_LONG=4 -DHAVE_CLOCK_GETTIME=1 -DHAVE_NANOSLEEP=1 -DPA_USE_OSS=1
|
|
||||||
LIBS = -lm -lpthread
|
|
||||||
AR = /usr/bin/ar
|
|
||||||
RANLIB = ranlib
|
|
||||||
LIBTOOL = $(SHELL) $(top_builddir)/libtool
|
|
||||||
INSTALL = /usr/bin/install -c
|
|
||||||
INSTALL_DATA = ${INSTALL} -m 644
|
|
||||||
SHARED_FLAGS = -shared -fPIC
|
|
||||||
LDFLAGS =
|
|
||||||
DLL_LIBS = -lrt -lm -lpthread
|
|
||||||
CXXFLAGS = -g -O2
|
|
||||||
NASM =
|
|
||||||
NASMOPT =
|
|
||||||
LN_S = ln -s
|
|
||||||
LT_RELEASE=@LT_RELEASE@
|
|
||||||
LT_CURRENT=2
|
|
||||||
LT_REVISION=0
|
|
||||||
LT_AGE=0
|
|
||||||
|
|
||||||
OTHER_OBJS = src/hostapi/oss/pa_unix_oss.o src/os/unix/pa_unix_hostapis.o src/os/unix/pa_unix_util.o
|
|
||||||
|
|
||||||
PALIB = libportaudio.la
|
|
||||||
PAINC = include/portaudio.h
|
|
||||||
|
|
||||||
PA_LDFLAGS = $(LDFLAGS) $(SHARED_FLAGS) -rpath $(libdir) -no-undefined -export-symbols-regex "Pa_.*" -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
|
|
||||||
#MAKEFILE = Makefile
|
|
||||||
|
|
||||||
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_front.o \
|
|
||||||
src/common/pa_process.o \
|
|
||||||
src/common/pa_skeleton.o \
|
|
||||||
src/common/pa_stream.o \
|
|
||||||
src/common/pa_trace.o
|
|
||||||
|
|
||||||
TESTS = \
|
|
||||||
bin/paqa_devs \
|
|
||||||
bin/paqa_errs \
|
|
||||||
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_multi_sine \
|
|
||||||
bin/patest_out_underflow \
|
|
||||||
bin/patest_pink \
|
|
||||||
bin/patest_prime \
|
|
||||||
bin/patest_read_record \
|
|
||||||
bin/patest_read_write_wire \
|
|
||||||
bin/patest_record \
|
|
||||||
bin/patest_ringmix \
|
|
||||||
bin/patest_saw \
|
|
||||||
bin/patest_sine8 \
|
|
||||||
bin/patest_sine \
|
|
||||||
bin/patest_sine_formats \
|
|
||||||
bin/patest_sine_time \
|
|
||||||
bin/patest_start_stop \
|
|
||||||
bin/patest_stop \
|
|
||||||
bin/patest_toomanysines \
|
|
||||||
bin/patest_underflow \
|
|
||||||
bin/patest_wire \
|
|
||||||
bin/patest_write_sine \
|
|
||||||
bin/pa_devs \
|
|
||||||
bin/pa_fuzz \
|
|
||||||
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)
|
|
||||||
|
|
||||||
SUBDIRS =
|
|
||||||
#SUBDIRS += bindings/cpp
|
|
||||||
|
|
||||||
all: lib/$(PALIB) all-recursive tests
|
|
||||||
|
|
||||||
tests: bin-stamp $(TESTS)
|
|
||||||
|
|
||||||
|
|
||||||
lib/$(PALIB): lib-stamp $(LTOBJS) $(MAKEFILE) $(PAINC)
|
|
||||||
$(LIBTOOL) --mode=link $(CC) $(PA_LDFLAGS) -o lib/$(PALIB) $(LTOBJS) $(DLL_LIBS)
|
|
||||||
|
|
||||||
$(ALL_TESTS): bin/%: lib/$(PALIB) $(MAKEFILE) $(PAINC) test/%.c
|
|
||||||
$(LIBTOOL) --mode=link $(CC) -o $@ $(CFLAGS) $(top_srcdir)/test/$*.c lib/$(PALIB) $(LIBS)
|
|
||||||
|
|
||||||
|
|
||||||
install: lib/$(PALIB) portaudio-2.0.pc
|
|
||||||
$(INSTALL) -d $(DESTDIR)$(libdir)
|
|
||||||
$(LIBTOOL) --mode=install $(INSTALL) lib/$(PALIB) $(DESTDIR)$(libdir)
|
|
||||||
$(INSTALL) -d $(DESTDIR)$(includedir)
|
|
||||||
$(INSTALL_DATA) -m 644 $(top_srcdir)/$(PAINC) $(DESTDIR)$(includedir)/portaudio.h
|
|
||||||
$(INSTALL) -d $(DESTDIR)$(libdir)/pkgconfig
|
|
||||||
$(INSTALL) -m 644 portaudio-2.0.pc $(DESTDIR)$(libdir)/pkgconfig/portaudio-2.0.pc
|
|
||||||
@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)
|
|
||||||
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(includedir)/portaudio.h
|
|
||||||
$(MAKE) uninstall-recursive
|
|
||||||
|
|
||||||
clean:
|
|
||||||
$(LIBTOOL) --mode=clean rm -f $(LTOBJS) $(ALL_TESTS) lib/$(PALIB)
|
|
||||||
rm -f bin-stamp lib-stamp
|
|
||||||
-rm -rf bin lib
|
|
||||||
|
|
||||||
distclean: clean
|
|
||||||
rm -f config.log config.status Makefile libtool portaudio-2.0.pc
|
|
||||||
|
|
||||||
%.o: %.c $(MAKEFILE) $(PAINC)
|
|
||||||
$(CC) -c $(CFLAGS) $< -o $@
|
|
||||||
|
|
||||||
%.lo: %.c $(MAKEFILE) $(PAINC)
|
|
||||||
$(LIBTOOL) --mode=compile $(CC) -c $(CFLAGS) $< -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/os/win src/os/unix src/os/mac_osx src/common \
|
|
||||||
src/hostapi/oss src/hostapi/alsa src/hostapi/jack src/hostapi/asihpi \
|
|
||||||
src/hostapi/wmme src/hostapi/wdmks src/hostapi/dsound src/hostapi/wasapi
|
|
||||||
touch $@
|
|
||||||
|
|
||||||
Makefile: Makefile.in config.status
|
|
||||||
$(SHELL) config.status
|
|
||||||
|
|
||||||
all-recursive:
|
|
||||||
for dir in $(SUBDIRS); do make -C $$dir all; done
|
|
||||||
|
|
||||||
install-recursive:
|
|
||||||
for dir in $(SUBDIRS); do make -C $$dir install; done
|
|
||||||
|
|
||||||
uninstall-recursive:
|
|
||||||
for dir in $(SUBDIRS); do make -C $$dir uninstall; done
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,64 +0,0 @@
|
|||||||
#ifndef PA_LINUX_ALSA_H
|
|
||||||
#define PA_LINUX_ALSA_H
|
|
||||||
|
|
||||||
/*
|
|
||||||
* $Id$
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* Any person wishing to distribute modifications to the Software is
|
|
||||||
* requested to send the modifications to the original developer so that
|
|
||||||
* they can be incorporated into the canonical version.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
||||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
|
||||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
||||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @file
|
|
||||||
* ALSA-specific PortAudio API extension header file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct PaAlsaStreamInfo
|
|
||||||
{
|
|
||||||
unsigned long size;
|
|
||||||
PaHostApiTypeId hostApiType;
|
|
||||||
unsigned long version;
|
|
||||||
|
|
||||||
const char *deviceString;
|
|
||||||
}
|
|
||||||
PaAlsaStreamInfo;
|
|
||||||
|
|
||||||
void PaAlsa_InitializeStreamInfo( PaAlsaStreamInfo *info );
|
|
||||||
|
|
||||||
void PaAlsa_EnableRealtimeScheduling( PaStream *s, int enable );
|
|
||||||
|
|
||||||
void PaAlsa_EnableWatchdog( PaStream *s, int enable );
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,124 +0,0 @@
|
|||||||
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 one is in pa_mac_core_auhal.c.
|
|
||||||
Only pa_mac_core_auhal.c is currently developed and supported as it uses apple's
|
|
||||||
current core audio technology. To select one of the implementations, copy the
|
|
||||||
appropriate file to pa_mac_core.c, (eg. "cp pa_mac_core_auhal.c pa_mac_core.c")
|
|
||||||
then run configure and make as usual.
|
|
||||||
|
|
||||||
----------------------------------------
|
|
||||||
|
|
||||||
Notes on Original/Default implementation:
|
|
||||||
|
|
||||||
by Phil Burk and Darren Gibbs
|
|
||||||
|
|
||||||
Last updated March 20, 2002
|
|
||||||
|
|
||||||
WHAT WORKS
|
|
||||||
|
|
||||||
Output with very low latency, <10 msec.
|
|
||||||
Half duplex input or output.
|
|
||||||
Full duplex on the same CoreAudio device.
|
|
||||||
The paFLoat32, paInt16, paInt8, paUInt8 sample formats.
|
|
||||||
Pa_GetCPULoad()
|
|
||||||
Pa_StreamTime()
|
|
||||||
|
|
||||||
KNOWN BUGS OR LIMITATIONS
|
|
||||||
|
|
||||||
We do not yet support simultaneous input and output on different
|
|
||||||
devices. Note that some CoreAudio devices like the Roland UH30 look
|
|
||||||
like one device but are actually two different CoreAudio devices. The
|
|
||||||
Built-In audio is typically one CoreAudio device.
|
|
||||||
|
|
||||||
Mono doesn't work.
|
|
||||||
|
|
||||||
DEVICE MAPPING
|
|
||||||
|
|
||||||
CoreAudio devices can support both input and output. But the sample
|
|
||||||
rates supported may be different. So we have map one or two PortAudio
|
|
||||||
device to each CoreAudio device depending on whether it supports
|
|
||||||
input, output or both.
|
|
||||||
|
|
||||||
When we query devices, we first get a list of CoreAudio devices. Then
|
|
||||||
we scan the list and add a PortAudio device for each CoreAudio device
|
|
||||||
that supports input. Then we make a scan for output devices.
|
|
||||||
|
|
||||||
-------------------------------------------
|
|
||||||
|
|
||||||
Notes on Newer 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.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Known issues:
|
|
||||||
|
|
||||||
- Latency: Latency settings are ignored except when doing I/O between different
|
|
||||||
devices. Still, latency should be very low.
|
|
||||||
|
|
||||||
- Timing info. It reports on stream time, but I'm probably doing something
|
|
||||||
wrong since patest_sine_time often reports negative latency numbers.
|
|
||||||
|
|
||||||
- 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: Not implemented.
|
|
||||||
|
|
||||||
- multichannel: I don't have a multichannel IO box, so I didn't test it.
|
|
||||||
It should work though ;) I haven't done anything with "channel maps"
|
|
||||||
yet, so it's possible that more needs to be done.
|
|
||||||
|
|
||||||
- sample rate conversion quality: the input audio converter is set to
|
|
||||||
the highest quality. I don't do anything about the output converter, and
|
|
||||||
I am not sure how AUHAL manages quality.
|
|
||||||
|
|
||||||
- x86: I haven't tested it on an x86 Mac, but I tried to be aware of it, so
|
|
||||||
it should work without too much trouble.
|
|
@ -1,64 +0,0 @@
|
|||||||
/*
|
|
||||||
* Mac spcific flags for PA.
|
|
||||||
* portaudio.h should be included before this file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* A pointer to a paMacCoreStreamInfo may be passed as
|
|
||||||
* the hostApiSpecificStreamInfo in the PaStreamParameters struct
|
|
||||||
* when opening a stream. Use NULL, for the defaults. Note that for
|
|
||||||
* duplex streams, both infos should be the same or behaviour
|
|
||||||
* is undefined.
|
|
||||||
*/
|
|
||||||
typedef struct paMacCoreStreamInfo
|
|
||||||
{
|
|
||||||
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 */
|
|
||||||
} paMacCoreStreamInfo;
|
|
||||||
|
|
||||||
/* Use this function to initialize a paMacCoreStreamInfo struct
|
|
||||||
using the requested flags. */
|
|
||||||
void paSetupMacCoreStreamInfo( paMacCoreStreamInfo *data, unsigned long flags )
|
|
||||||
{
|
|
||||||
bzero( data, sizeof( paMacCoreStreamInfo ) );
|
|
||||||
data->size = sizeof( paMacCoreStreamInfo );
|
|
||||||
data->hostApiType = paCoreAudio;
|
|
||||||
data->version = 0x01;
|
|
||||||
data->flags = flags;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Here is the struct that shoul
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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. */
|
|
||||||
const unsigned long paMacCore_ChangeDeviceParameters = 0x01;
|
|
||||||
|
|
||||||
/* In combination with the above flag,
|
|
||||||
* causes the stream opening to fail, unless the exact sample rates
|
|
||||||
* are supported by the device. */
|
|
||||||
const unsigned long paMacCore_FailIfConversionRequired = 0x02;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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. */
|
|
||||||
const unsigned long 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.*/
|
|
||||||
const unsigned long paMacCorePro = 0x01;
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
@ -1,907 +0,0 @@
|
|||||||
/*
|
|
||||||
* $Id$
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* Any person wishing to distribute modifications to the Software is
|
|
||||||
* requested to send the modifications to the original developer so that
|
|
||||||
* they can be incorporated into the canonical version.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
||||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
|
||||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
||||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#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;
|
|
||||||
}
|
|
@ -1,466 +0,0 @@
|
|||||||
/*
|
|
||||||
*
|
|
||||||
* pa_mac_core_utilities.c
|
|
||||||
*
|
|
||||||
* utilitiy functions for pa_mac_core.c
|
|
||||||
*
|
|
||||||
* This functions are more like helper functions than part of the core,
|
|
||||||
* so I moved them to a separate file so the core code would be cleaner.
|
|
||||||
*
|
|
||||||
* by Bjorn Roche.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Translates MacOS generated errors into PaErrors
|
|
||||||
*/
|
|
||||||
static 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";
|
|
||||||
|
|
||||||
if ((int)error < -99999 || (int)error > 99999)
|
|
||||||
DBUG(("%s on line %d: err='%4s', msg='%s'\n", errorType, line, (const char *)&error, errorText));
|
|
||||||
else
|
|
||||||
DBUG(("%s on line %d: err=%d, 0x%x, msg='%s'\n", errorType, line, (int)error, (unsigned)error, errorText));
|
|
||||||
|
|
||||||
PaUtil_SetLastHostErrorInfo( paCoreAudio, error, errorText );
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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 has some fancy logic to make sure that changes
|
|
||||||
* are acknowledged before another is requested. That seems to help a lot.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <pthread.h>
|
|
||||||
typedef struct {
|
|
||||||
bool once; /* I didn't end up using this. bdr */
|
|
||||||
pthread_mutex_t mutex;
|
|
||||||
} MutexAndBool ;
|
|
||||||
|
|
||||||
static OSStatus propertyProc(
|
|
||||||
AudioDeviceID inDevice,
|
|
||||||
UInt32 inChannel,
|
|
||||||
Boolean isInput,
|
|
||||||
AudioDevicePropertyID inPropertyID,
|
|
||||||
void* inClientData )
|
|
||||||
{
|
|
||||||
MutexAndBool *mab = (MutexAndBool *) inClientData;
|
|
||||||
mab->once = TRUE;
|
|
||||||
pthread_mutex_unlock( &(mab->mutex) );
|
|
||||||
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.*/
|
|
||||||
PaError AudioDeviceSetPropertyNowAndWaitForChange(
|
|
||||||
AudioDeviceID inDevice,
|
|
||||||
UInt32 inChannel,
|
|
||||||
Boolean isInput,
|
|
||||||
AudioDevicePropertyID inPropertyID,
|
|
||||||
UInt32 inPropertyDataSize,
|
|
||||||
const void *inPropertyData,
|
|
||||||
void *outPropertyData )
|
|
||||||
{
|
|
||||||
OSStatus macErr;
|
|
||||||
int unixErr;
|
|
||||||
MutexAndBool mab;
|
|
||||||
UInt32 outPropertyDataSize = inPropertyDataSize;
|
|
||||||
|
|
||||||
/* First, see if it already has that value. If so, return. */
|
|
||||||
macErr = AudioDeviceGetProperty( inDevice, inChannel,
|
|
||||||
isInput, inPropertyID,
|
|
||||||
&outPropertyDataSize, outPropertyData );
|
|
||||||
if( macErr )
|
|
||||||
goto failMac2;
|
|
||||||
if( inPropertyDataSize!=outPropertyDataSize )
|
|
||||||
return paInternalError;
|
|
||||||
if( 0==memcmp( outPropertyData, inPropertyData, outPropertyDataSize ) )
|
|
||||||
return paNoError;
|
|
||||||
|
|
||||||
/* setup and lock mutex */
|
|
||||||
mab.once = FALSE;
|
|
||||||
unixErr = pthread_mutex_init( &mab.mutex, NULL );
|
|
||||||
if( unixErr )
|
|
||||||
goto failUnix2;
|
|
||||||
unixErr = pthread_mutex_lock( &mab.mutex );
|
|
||||||
if( unixErr )
|
|
||||||
goto failUnix;
|
|
||||||
|
|
||||||
/* add property listener */
|
|
||||||
macErr = AudioDeviceAddPropertyListener( inDevice, inChannel, isInput,
|
|
||||||
inPropertyID, propertyProc,
|
|
||||||
&mab );
|
|
||||||
if( macErr )
|
|
||||||
goto failMac;
|
|
||||||
/* set property */
|
|
||||||
macErr = AudioDeviceSetProperty( inDevice, NULL, inChannel,
|
|
||||||
isInput, inPropertyID,
|
|
||||||
inPropertyDataSize, inPropertyData );
|
|
||||||
if( macErr ) {
|
|
||||||
/* we couldn't set the property, so we'll just unlock the mutex
|
|
||||||
and move on. */
|
|
||||||
pthread_mutex_unlock( &mab.mutex );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* wait for property to change */
|
|
||||||
unixErr = pthread_mutex_lock( &mab.mutex );
|
|
||||||
if( unixErr )
|
|
||||||
goto failUnix;
|
|
||||||
|
|
||||||
/* now read the property back out */
|
|
||||||
macErr = AudioDeviceGetProperty( inDevice, inChannel,
|
|
||||||
isInput, inPropertyID,
|
|
||||||
&outPropertyDataSize, outPropertyData );
|
|
||||||
if( macErr )
|
|
||||||
goto failMac;
|
|
||||||
/* cleanup */
|
|
||||||
AudioDeviceRemovePropertyListener( inDevice, inChannel, isInput,
|
|
||||||
inPropertyID, propertyProc );
|
|
||||||
unixErr = pthread_mutex_unlock( &mab.mutex );
|
|
||||||
if( unixErr )
|
|
||||||
goto failUnix2;
|
|
||||||
unixErr = pthread_mutex_destroy( &mab.mutex );
|
|
||||||
if( unixErr )
|
|
||||||
goto failUnix2;
|
|
||||||
|
|
||||||
return paNoError;
|
|
||||||
|
|
||||||
failUnix:
|
|
||||||
pthread_mutex_destroy( &mab.mutex );
|
|
||||||
AudioDeviceRemovePropertyListener( inDevice, inChannel, isInput,
|
|
||||||
inPropertyID, propertyProc );
|
|
||||||
|
|
||||||
failUnix2:
|
|
||||||
DBUG( ("Error #%d while setting a device property: %s\n", unixErr, strerror( unixErr ) ) );
|
|
||||||
return paUnanticipatedHostError;
|
|
||||||
|
|
||||||
failMac:
|
|
||||||
pthread_mutex_destroy( &mab.mutex );
|
|
||||||
AudioDeviceRemovePropertyListener( inDevice, inChannel, isInput,
|
|
||||||
inPropertyID, propertyProc );
|
|
||||||
failMac2:
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
static PaError setBestSampleRateForDevice( const AudioDeviceID device,
|
|
||||||
const bool isOutput,
|
|
||||||
const bool requireExact,
|
|
||||||
const Float64 desiredSrate )
|
|
||||||
{
|
|
||||||
/*FIXME: changing the sample rate is disruptive to other programs using the
|
|
||||||
device, so it might be good to offer a custom flag to not change the
|
|
||||||
sample rate and just do conversion. (in my casual tests, there is
|
|
||||||
no disruption unless the sample rate really does need to change) */
|
|
||||||
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 -- */
|
|
||||||
err = AudioDeviceSetPropertyNowAndWaitForChange(
|
|
||||||
device, 0, isInput,
|
|
||||||
kAudioDevicePropertyNominalSampleRate,
|
|
||||||
propsize, &desiredSrate, &srate );
|
|
||||||
if( err )
|
|
||||||
return err;
|
|
||||||
|
|
||||||
/* -- 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 );
|
|
||||||
err = AudioDeviceSetPropertyNowAndWaitForChange(
|
|
||||||
device, 0, isInput,
|
|
||||||
kAudioDevicePropertyNominalSampleRate,
|
|
||||||
propsize, &best, &srate );
|
|
||||||
if( err )
|
|
||||||
return err;
|
|
||||||
|
|
||||||
if( err )
|
|
||||||
return ERR( err );
|
|
||||||
/* -- if the set rate matches, we are done -- */
|
|
||||||
if( srate == best )
|
|
||||||
return paNoError;
|
|
||||||
|
|
||||||
/* -- 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.
|
|
||||||
*/
|
|
||||||
static PaError setBestFramesPerBuffer( const AudioDeviceID device,
|
|
||||||
const bool isOutput,
|
|
||||||
unsigned long requestedFramesPerBuffer,
|
|
||||||
unsigned long *actualFramesPerBuffer )
|
|
||||||
{
|
|
||||||
UInt32 afpb;
|
|
||||||
const bool isInput = !isOutput;
|
|
||||||
UInt32 propsize = sizeof(UInt32);
|
|
||||||
OSErr err;
|
|
||||||
Float64 min = -1; /*the min blocksize*/
|
|
||||||
Float64 best = -1; /*the best blocksize*/
|
|
||||||
int i=0;
|
|
||||||
AudioValueRange *ranges;
|
|
||||||
|
|
||||||
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 );
|
|
||||||
if( *actualFramesPerBuffer == requestedFramesPerBuffer )
|
|
||||||
return paNoError; /* we are done */
|
|
||||||
|
|
||||||
/* -- fetch available block sizes -- */
|
|
||||||
err = AudioDeviceGetPropertyInfo( device, 0, isInput,
|
|
||||||
kAudioDevicePropertyBufferSizeRange,
|
|
||||||
&propsize, NULL );
|
|
||||||
if( err )
|
|
||||||
return ERR( err );
|
|
||||||
ranges = (AudioValueRange *)calloc( 1, propsize );
|
|
||||||
if( !ranges )
|
|
||||||
return paInsufficientMemory;
|
|
||||||
err = AudioDeviceGetProperty( device, 0, isInput,
|
|
||||||
kAudioDevicePropertyBufferSizeRange,
|
|
||||||
&propsize, ranges );
|
|
||||||
if( err )
|
|
||||||
{
|
|
||||||
free( ranges );
|
|
||||||
return ERR( err );
|
|
||||||
}
|
|
||||||
VDBUG(("Requested block size of %lu was not available.\n",
|
|
||||||
requestedFramesPerBuffer ));
|
|
||||||
VDBUG(("%lu Available block sizes 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 framesPerBuffer -- */
|
|
||||||
for( i=0; i<propsize/sizeof(AudioValueRange); ++i )
|
|
||||||
{
|
|
||||||
if( min == -1 || ranges[i].mMinimum < min ) min = ranges[i].mMinimum;
|
|
||||||
if( ranges[i].mMaximum < requestedFramesPerBuffer ) {
|
|
||||||
if( best < 0 )
|
|
||||||
best = ranges[i].mMaximum;
|
|
||||||
else if( ranges[i].mMaximum > best )
|
|
||||||
best = ranges[i].mMaximum;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if( best == -1 )
|
|
||||||
best = min;
|
|
||||||
VDBUG( ("Minimum FPB %g. best is %g.\n", min, best ) );
|
|
||||||
free( ranges );
|
|
||||||
|
|
||||||
/* --- set the buffer size (ignore errors) -- */
|
|
||||||
requestedFramesPerBuffer = (UInt32) best ;
|
|
||||||
propsize = sizeof( UInt32 );
|
|
||||||
err = AudioDeviceSetProperty( device, NULL, 0, isInput,
|
|
||||||
kAudioDevicePropertyBufferSize,
|
|
||||||
propsize, &requestedFramesPerBuffer );
|
|
||||||
/* --- read the property to check that it was set -- */
|
|
||||||
err = AudioDeviceGetProperty( device, 0, isInput,
|
|
||||||
kAudioDevicePropertyBufferSize,
|
|
||||||
&propsize, actualFramesPerBuffer );
|
|
||||||
|
|
||||||
if( err )
|
|
||||||
return ERR( err );
|
|
||||||
|
|
||||||
return paNoError;
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,64 +0,0 @@
|
|||||||
/*
|
|
||||||
* $Id$
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* Any person wishing to distribute modifications to the Software is
|
|
||||||
* requested to send the modifications to the original developer so that
|
|
||||||
* they can be incorporated into the canonical version.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
||||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
|
||||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
||||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#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 );
|
|
||||||
|
|
||||||
|
|
||||||
PaUtilHostApiInitializer *paHostApiInitializers[] =
|
|
||||||
{
|
|
||||||
#ifdef PA_USE_OSS
|
|
||||||
PaOSS_Initialize,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PA_USE_ALSA
|
|
||||||
PaAlsa_Initialize,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PA_USE_JACK
|
|
||||||
PaJack_Initialize,
|
|
||||||
#endif
|
|
||||||
/* Added for IRIX, Pieter, oct 2, 2003: */
|
|
||||||
#ifdef PA_USE_SGI
|
|
||||||
PaSGI_Initialize,
|
|
||||||
#endif
|
|
||||||
0 /* NULL terminated array */
|
|
||||||
};
|
|
||||||
|
|
||||||
int paDefaultHostApiIndex = 0;
|
|
||||||
|
|
||||||
|
|
@ -1,192 +0,0 @@
|
|||||||
/*
|
|
||||||
* $Id$
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* Any person wishing to distribute modifications to the Software is
|
|
||||||
* requested to send the modifications to the original developer so that
|
|
||||||
* they can be incorporated into the canonical version.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
||||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
|
||||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
||||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#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 "pa_util.h"
|
|
||||||
#include "pa_unix_util.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
|
|
||||||
}
|
|
||||||
|
|
||||||
/* *** NOT USED YET: ***
|
|
||||||
static int usePerformanceCounter_;
|
|
||||||
static double microsecondsPerTick_;
|
|
||||||
*/
|
|
||||||
|
|
||||||
void PaUtil_InitializeClock( void )
|
|
||||||
{
|
|
||||||
/* TODO */
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
PaTime PaUtil_GetTime( void )
|
|
||||||
{
|
|
||||||
#ifdef HAVE_CLOCK_GETTIME
|
|
||||||
struct timespec tp;
|
|
||||||
clock_gettime(CLOCK_REALTIME, &tp);
|
|
||||||
return (PaTime)(tp.tv_sec + tp.tv_nsec / 1.e9);
|
|
||||||
#else
|
|
||||||
struct timeval tv;
|
|
||||||
gettimeofday( &tv, NULL );
|
|
||||||
return (PaTime) tv.tv_usec / 1000000. + 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;
|
|
||||||
|
|
||||||
/* 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? */
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
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 );
|
|
||||||
}
|
|
||||||
*/
|
|
@ -1,73 +0,0 @@
|
|||||||
#ifndef PA_UNIX_UTIL_H
|
|
||||||
#define PA_UNIX_UTIL_H
|
|
||||||
|
|
||||||
#include "pa_cpuload.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);
|
|
||||||
|
|
||||||
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 );
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
#endif
|
|
@ -1,78 +0,0 @@
|
|||||||
# Project: portaudio-dll
|
|
||||||
# Makefile created by Dev-C++ 4.9.8.2
|
|
||||||
|
|
||||||
CPP = g++.exe
|
|
||||||
CC = gcc.exe
|
|
||||||
WINDRES = windres.exe
|
|
||||||
RES =
|
|
||||||
OBJ = ./pa_skeleton.o ./pa_stream.o ./pa_trace.o ./pa_allocation.o ./pa_converters.o ./pa_cpuload.o ./pa_dither.o ./pa_front.o ./pa_process.o ./pa_asio.o ./pa_win_util.o ./pa_win_hostapis.o ./pa_win_ds.o ./dsound_wrapper.o ./pa_win_wmme.o ./iasiothiscallresolver.o $(RES)
|
|
||||||
LINKOBJ = ./pa_skeleton.o ./pa_stream.o ./pa_trace.o ./pa_allocation.o ./pa_converters.o ./pa_cpuload.o ./pa_dither.o ./pa_front.o ./pa_process.o ./pa_asio.o ./pa_win_util.o ./pa_win_hostapis.o ./pa_win_ds.o ./dsound_wrapper.o ./pa_win_wmme.o ./iasiothiscallresolver.o $(RES)
|
|
||||||
LIBS = -L"C:/Dev-CPP/lib" -fmessage-length=0 --no-export-all-symbols --add-stdcall-alias ../../../asiosdk2/asiosdk2.a -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32 -lwinmm -O3 -s
|
|
||||||
INCS = -I"C:/Dev-CPP/include" -I"../../../asiosdk2" -I"../../../asiosdk2/common" -I"../../../asiosdk2/host" -I"../../../asiosdk2/host/pc" -I"../../pa_common"
|
|
||||||
CXXINCS = -I"C:/Dev-CPP/include/c++" -I"C:/Dev-CPP/include/c++/mingw32" -I"C:/Dev-CPP/include/c++/backward" -I"C:/Dev-CPP/include" -I"../../../asiosdk2" -I"../../../asiosdk2/common" -I"../../../asiosdk2/host" -I"../../../asiosdk2/host/pc" -I"../../pa_common"
|
|
||||||
BIN = portaudio-dll.dll
|
|
||||||
CXXFLAGS = $(CXXINCS)-O3 -fmessage-length=0 -Wall
|
|
||||||
CFLAGS = $(INCS)-DBUILDING_DLL=1 -O3 -fmessage-length=0 -Wall
|
|
||||||
|
|
||||||
.PHONY: all all-before all-after clean clean-custom
|
|
||||||
|
|
||||||
all: all-before portaudio-dll.dll all-after
|
|
||||||
|
|
||||||
|
|
||||||
clean: clean-custom
|
|
||||||
rm -f $(OBJ) $(BIN)
|
|
||||||
|
|
||||||
DLLWRAP=dllwrap.exe
|
|
||||||
DEFFILE=libportaudio-dll.def
|
|
||||||
STATICLIB=libportaudio-dll.a
|
|
||||||
|
|
||||||
$(BIN): $(LINKOBJ)
|
|
||||||
$(DLLWRAP) --output-def $(DEFFILE) --driver-name c++ --implib $(STATICLIB) $(LINKOBJ) $(LIBS) -o $(BIN)
|
|
||||||
|
|
||||||
./pa_skeleton.o: ../../pa_common/pa_skeleton.c
|
|
||||||
$(CPP) -c ../../pa_common/pa_skeleton.c -o ./pa_skeleton.o $(CXXFLAGS)
|
|
||||||
|
|
||||||
./pa_stream.o: ../../pa_common/pa_stream.c
|
|
||||||
$(CPP) -c ../../pa_common/pa_stream.c -o ./pa_stream.o $(CXXFLAGS)
|
|
||||||
|
|
||||||
./pa_trace.o: ../../pa_common/pa_trace.c
|
|
||||||
$(CPP) -c ../../pa_common/pa_trace.c -o ./pa_trace.o $(CXXFLAGS)
|
|
||||||
|
|
||||||
./pa_allocation.o: ../../pa_common/pa_allocation.c
|
|
||||||
$(CPP) -c ../../pa_common/pa_allocation.c -o ./pa_allocation.o $(CXXFLAGS)
|
|
||||||
|
|
||||||
./pa_converters.o: ../../pa_common/pa_converters.c
|
|
||||||
$(CPP) -c ../../pa_common/pa_converters.c -o ./pa_converters.o $(CXXFLAGS)
|
|
||||||
|
|
||||||
./pa_cpuload.o: ../../pa_common/pa_cpuload.c
|
|
||||||
$(CPP) -c ../../pa_common/pa_cpuload.c -o ./pa_cpuload.o $(CXXFLAGS)
|
|
||||||
|
|
||||||
./pa_dither.o: ../../pa_common/pa_dither.c
|
|
||||||
$(CPP) -c ../../pa_common/pa_dither.c -o ./pa_dither.o $(CXXFLAGS)
|
|
||||||
|
|
||||||
./pa_front.o: ../../pa_common/pa_front.c
|
|
||||||
$(CPP) -c ../../pa_common/pa_front.c -o ./pa_front.o $(CXXFLAGS)
|
|
||||||
|
|
||||||
./pa_process.o: ../../pa_common/pa_process.c
|
|
||||||
$(CPP) -c ../../pa_common/pa_process.c -o ./pa_process.o $(CXXFLAGS)
|
|
||||||
|
|
||||||
./pa_asio.o: ../../pa_asio/pa_asio.cpp
|
|
||||||
$(CPP) -c ../../pa_asio/pa_asio.cpp -o ./pa_asio.o $(CXXFLAGS)
|
|
||||||
|
|
||||||
./pa_win_util.o: ../pa_win_util.c
|
|
||||||
$(CPP) -c ../pa_win_util.c -o ./pa_win_util.o $(CXXFLAGS)
|
|
||||||
|
|
||||||
./pa_win_hostapis.o: ../pa_win_hostapis.c
|
|
||||||
$(CPP) -c ../pa_win_hostapis.c -o ./pa_win_hostapis.o $(CXXFLAGS)
|
|
||||||
|
|
||||||
./pa_win_ds.o: ../../pa_win_ds/pa_win_ds.c
|
|
||||||
$(CPP) -c ../../pa_win_ds/pa_win_ds.c -o ./pa_win_ds.o $(CXXFLAGS)
|
|
||||||
|
|
||||||
./dsound_wrapper.o: ../../pa_win_ds/dsound_wrapper.c
|
|
||||||
$(CPP) -c ../../pa_win_ds/dsound_wrapper.c -o ./dsound_wrapper.o $(CXXFLAGS)
|
|
||||||
|
|
||||||
./pa_win_wmme.o: ../../pa_win_wmme/pa_win_wmme.c
|
|
||||||
$(CPP) -c ../../pa_win_wmme/pa_win_wmme.c -o ./pa_win_wmme.o $(CXXFLAGS)
|
|
||||||
|
|
||||||
./iasiothiscallresolver.o: ../../pa_asio/iasiothiscallresolver.cpp
|
|
||||||
$(CPP) -c ../../pa_asio/iasiothiscallresolver.cpp -o ./iasiothiscallresolver.o $(CXXFLAGS)
|
|
@ -1,75 +0,0 @@
|
|||||||
# Project: portaudio-static
|
|
||||||
# Makefile created by Dev-C++ 4.9.8.2
|
|
||||||
|
|
||||||
CPP = g++.exe
|
|
||||||
CC = gcc.exe
|
|
||||||
WINDRES = windres.exe
|
|
||||||
RES =
|
|
||||||
OBJ = ./pa_skeleton.o ./pa_stream.o ./pa_trace.o ./pa_allocation.o ./pa_converters.o ./pa_cpuload.o ./pa_dither.o ./pa_front.o ./pa_process.o ./pa_asio.o ./pa_win_util.o ./pa_win_hostapis.o ./pa_win_ds.o ./dsound_wrapper.o ./pa_win_wmme.o ./iasiothiscallresolver.o $(RES)
|
|
||||||
LINKOBJ = ./pa_skeleton.o ./pa_stream.o ./pa_trace.o ./pa_allocation.o ./pa_converters.o ./pa_cpuload.o ./pa_dither.o ./pa_front.o ./pa_process.o ./pa_asio.o ./pa_win_util.o ./pa_win_hostapis.o ./pa_win_ds.o ./dsound_wrapper.o ./pa_win_wmme.o ./iasiothiscallresolver.o $(RES)
|
|
||||||
LIBS = -L"C:/Dev-CPP/lib" -fmessage-length=0 -O3 -s
|
|
||||||
INCS = -I"C:/Dev-CPP/include" -I"../../../asiosdk2" -I"../../../asiosdk2/common" -I"../../../asiosdk2/host" -I"../../../asiosdk2/host/pc" -I"../../pa_common"
|
|
||||||
CXXINCS = -I"C:/Dev-CPP/include/c++" -I"C:/Dev-CPP/include/c++/mingw32" -I"C:/Dev-CPP/include/c++/backward" -I"C:/Dev-CPP/include" -I"../../../asiosdk2" -I"../../../asiosdk2/common" -I"../../../asiosdk2/host" -I"../../../asiosdk2/host/pc" -I"../../pa_common"
|
|
||||||
BIN = portaudio-static.a
|
|
||||||
CXXFLAGS = $(CXXINCS)-O3 -fmessage-length=0 -Wall
|
|
||||||
CFLAGS = $(INCS)-O3 -fmessage-length=0 -Wall
|
|
||||||
|
|
||||||
.PHONY: all all-before all-after clean clean-custom
|
|
||||||
|
|
||||||
all: all-before portaudio-static.a all-after
|
|
||||||
|
|
||||||
|
|
||||||
clean: clean-custom
|
|
||||||
rm -f $(OBJ) $(BIN)
|
|
||||||
|
|
||||||
$(BIN): $(LINKOBJ)
|
|
||||||
ar r $(BIN) $(LINKOBJ)
|
|
||||||
ranlib $(BIN)
|
|
||||||
|
|
||||||
./pa_skeleton.o: ../../pa_common/pa_skeleton.c
|
|
||||||
$(CPP) -c ../../pa_common/pa_skeleton.c -o ./pa_skeleton.o $(CXXFLAGS)
|
|
||||||
|
|
||||||
./pa_stream.o: ../../pa_common/pa_stream.c
|
|
||||||
$(CPP) -c ../../pa_common/pa_stream.c -o ./pa_stream.o $(CXXFLAGS)
|
|
||||||
|
|
||||||
./pa_trace.o: ../../pa_common/pa_trace.c
|
|
||||||
$(CPP) -c ../../pa_common/pa_trace.c -o ./pa_trace.o $(CXXFLAGS)
|
|
||||||
|
|
||||||
./pa_allocation.o: ../../pa_common/pa_allocation.c
|
|
||||||
$(CPP) -c ../../pa_common/pa_allocation.c -o ./pa_allocation.o $(CXXFLAGS)
|
|
||||||
|
|
||||||
./pa_converters.o: ../../pa_common/pa_converters.c
|
|
||||||
$(CPP) -c ../../pa_common/pa_converters.c -o ./pa_converters.o $(CXXFLAGS)
|
|
||||||
|
|
||||||
./pa_cpuload.o: ../../pa_common/pa_cpuload.c
|
|
||||||
$(CPP) -c ../../pa_common/pa_cpuload.c -o ./pa_cpuload.o $(CXXFLAGS)
|
|
||||||
|
|
||||||
./pa_dither.o: ../../pa_common/pa_dither.c
|
|
||||||
$(CPP) -c ../../pa_common/pa_dither.c -o ./pa_dither.o $(CXXFLAGS)
|
|
||||||
|
|
||||||
./pa_front.o: ../../pa_common/pa_front.c
|
|
||||||
$(CPP) -c ../../pa_common/pa_front.c -o ./pa_front.o $(CXXFLAGS)
|
|
||||||
|
|
||||||
./pa_process.o: ../../pa_common/pa_process.c
|
|
||||||
$(CPP) -c ../../pa_common/pa_process.c -o ./pa_process.o $(CXXFLAGS)
|
|
||||||
|
|
||||||
./pa_asio.o: ../../pa_asio/pa_asio.cpp
|
|
||||||
$(CPP) -c ../../pa_asio/pa_asio.cpp -o ./pa_asio.o $(CXXFLAGS)
|
|
||||||
|
|
||||||
./pa_win_util.o: ../pa_win_util.c
|
|
||||||
$(CPP) -c ../pa_win_util.c -o ./pa_win_util.o $(CXXFLAGS)
|
|
||||||
|
|
||||||
./pa_win_hostapis.o: ../pa_win_hostapis.c
|
|
||||||
$(CPP) -c ../pa_win_hostapis.c -o ./pa_win_hostapis.o $(CXXFLAGS)
|
|
||||||
|
|
||||||
./pa_win_ds.o: ../../pa_win_ds/pa_win_ds.c
|
|
||||||
$(CPP) -c ../../pa_win_ds/pa_win_ds.c -o ./pa_win_ds.o $(CXXFLAGS)
|
|
||||||
|
|
||||||
./dsound_wrapper.o: ../../pa_win_ds/dsound_wrapper.c
|
|
||||||
$(CPP) -c ../../pa_win_ds/dsound_wrapper.c -o ./dsound_wrapper.o $(CXXFLAGS)
|
|
||||||
|
|
||||||
./pa_win_wmme.o: ../../pa_win_wmme/pa_win_wmme.c
|
|
||||||
$(CPP) -c ../../pa_win_wmme/pa_win_wmme.c -o ./pa_win_wmme.o $(CXXFLAGS)
|
|
||||||
|
|
||||||
./iasiothiscallresolver.o: ../../pa_asio/iasiothiscallresolver.cpp
|
|
||||||
$(CPP) -c ../../pa_asio/iasiothiscallresolver.cpp -o ./iasiothiscallresolver.o $(CXXFLAGS)
|
|
@ -1,209 +0,0 @@
|
|||||||
[Project]
|
|
||||||
FileName=portaudio-dll.dev
|
|
||||||
Name=portaudio-dll
|
|
||||||
UnitCount=16
|
|
||||||
Type=3
|
|
||||||
Ver=1
|
|
||||||
ObjFiles=
|
|
||||||
Includes=..\..\..\asiosdk2;..\..\..\asiosdk2\common;..\..\..\asiosdk2\host;..\..\..\asiosdk2\host\pc;..\..\pa_common
|
|
||||||
Libs=
|
|
||||||
PrivateResource=
|
|
||||||
ResourceIncludes=
|
|
||||||
MakeIncludes=
|
|
||||||
Compiler=-DBUILDING_DLL=1_@@_-O3_@@_
|
|
||||||
CppCompiler=-O3_@@_
|
|
||||||
Linker=--no-export-all-symbols --add-stdcall-alias_@@_../../../asiosdk2/asiosdk2.a_@@_-lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32 -lwinmm_@@_-O3 -s_@@_
|
|
||||||
IsCpp=1
|
|
||||||
Icon=
|
|
||||||
ExeOutput=.
|
|
||||||
ObjectOutput=.
|
|
||||||
OverrideOutput=0
|
|
||||||
OverrideOutputName=portaudio.a
|
|
||||||
HostApplication=
|
|
||||||
Folders=
|
|
||||||
CommandLine=
|
|
||||||
IncludeVersionInfo=0
|
|
||||||
SupportXPThemes=0
|
|
||||||
CompilerSet=0
|
|
||||||
CompilerSettings=0000000000000000000
|
|
||||||
UseCustomMakefile=0
|
|
||||||
CustomMakefile=
|
|
||||||
|
|
||||||
[Unit1]
|
|
||||||
FileName=..\..\pa_common\pa_skeleton.c
|
|
||||||
CompileCpp=1
|
|
||||||
Folder=portaudio
|
|
||||||
Compile=1
|
|
||||||
Link=1
|
|
||||||
Priority=1000
|
|
||||||
OverrideBuildCmd=0
|
|
||||||
BuildCmd=$(CC) -c pa_skeleton.c -o ./pa_skeleton.o $(CFLAGS)
|
|
||||||
|
|
||||||
[Unit2]
|
|
||||||
FileName=..\..\pa_common\pa_stream.c
|
|
||||||
CompileCpp=1
|
|
||||||
Folder=portaudio
|
|
||||||
Compile=1
|
|
||||||
Link=1
|
|
||||||
Priority=1000
|
|
||||||
OverrideBuildCmd=0
|
|
||||||
BuildCmd=$(CC) -c pa_stream.c -o ./pa_stream.o $(CFLAGS)
|
|
||||||
|
|
||||||
[Unit3]
|
|
||||||
FileName=..\..\pa_common\pa_trace.c
|
|
||||||
CompileCpp=1
|
|
||||||
Folder=portaudio
|
|
||||||
Compile=1
|
|
||||||
Link=1
|
|
||||||
Priority=1000
|
|
||||||
OverrideBuildCmd=0
|
|
||||||
BuildCmd=$(CC) -c pa_trace.c -o ./pa_trace.o $(CFLAGS)
|
|
||||||
|
|
||||||
[Unit4]
|
|
||||||
FileName=..\..\pa_common\pa_allocation.c
|
|
||||||
CompileCpp=1
|
|
||||||
Folder=portaudio
|
|
||||||
Compile=1
|
|
||||||
Link=1
|
|
||||||
Priority=1000
|
|
||||||
OverrideBuildCmd=0
|
|
||||||
BuildCmd=$(CC) -c pa_allocation.c -o ./pa_allocation.o $(CFLAGS)
|
|
||||||
|
|
||||||
[Unit5]
|
|
||||||
FileName=..\..\pa_common\pa_converters.c
|
|
||||||
CompileCpp=1
|
|
||||||
Folder=portaudio
|
|
||||||
Compile=1
|
|
||||||
Link=1
|
|
||||||
Priority=1000
|
|
||||||
OverrideBuildCmd=0
|
|
||||||
BuildCmd=$(CC) -c pa_converters.c -o ./pa_converters.o $(CFLAGS)
|
|
||||||
|
|
||||||
[Unit6]
|
|
||||||
FileName=..\..\pa_common\pa_cpuload.c
|
|
||||||
CompileCpp=1
|
|
||||||
Folder=portaudio
|
|
||||||
Compile=1
|
|
||||||
Link=1
|
|
||||||
Priority=1000
|
|
||||||
OverrideBuildCmd=0
|
|
||||||
BuildCmd=$(CC) -c pa_cpuload.c -o ./pa_cpuload.o $(CFLAGS)
|
|
||||||
|
|
||||||
[Unit7]
|
|
||||||
FileName=..\..\pa_common\pa_dither.c
|
|
||||||
CompileCpp=1
|
|
||||||
Folder=portaudio
|
|
||||||
Compile=1
|
|
||||||
Link=1
|
|
||||||
Priority=1000
|
|
||||||
OverrideBuildCmd=0
|
|
||||||
BuildCmd=$(CC) -c pa_dither.c -o ./pa_dither.o $(CFLAGS)
|
|
||||||
|
|
||||||
[Unit8]
|
|
||||||
FileName=..\..\pa_common\pa_front.c
|
|
||||||
CompileCpp=1
|
|
||||||
Folder=portaudio
|
|
||||||
Compile=1
|
|
||||||
Link=1
|
|
||||||
Priority=1000
|
|
||||||
OverrideBuildCmd=0
|
|
||||||
BuildCmd=$(CC) -c pa_front.c -o ./pa_front.o $(CFLAGS)
|
|
||||||
|
|
||||||
[Unit9]
|
|
||||||
FileName=..\..\pa_common\pa_process.c
|
|
||||||
CompileCpp=1
|
|
||||||
Folder=portaudio
|
|
||||||
Compile=1
|
|
||||||
Link=1
|
|
||||||
Priority=1000
|
|
||||||
OverrideBuildCmd=0
|
|
||||||
BuildCmd=$(CC) -c pa_process.c -o ./pa_process.o $(CFLAGS)
|
|
||||||
|
|
||||||
[VersionInfo]
|
|
||||||
Major=0
|
|
||||||
Minor=1
|
|
||||||
Release=1
|
|
||||||
Build=1
|
|
||||||
LanguageID=1033
|
|
||||||
CharsetID=1252
|
|
||||||
CompanyName=
|
|
||||||
FileVersion=
|
|
||||||
FileDescription=Developed using the Dev-C++ IDE
|
|
||||||
InternalName=
|
|
||||||
LegalCopyright=
|
|
||||||
LegalTrademarks=
|
|
||||||
OriginalFilename=
|
|
||||||
ProductName=
|
|
||||||
ProductVersion=
|
|
||||||
AutoIncBuildNr=0
|
|
||||||
|
|
||||||
[Unit10]
|
|
||||||
FileName=..\..\pa_asio\pa_asio.cpp
|
|
||||||
CompileCpp=1
|
|
||||||
Folder=portaudio
|
|
||||||
Compile=1
|
|
||||||
Link=1
|
|
||||||
Priority=1000
|
|
||||||
OverrideBuildCmd=0
|
|
||||||
BuildCmd=$(CPP) -c pa_asio.cpp -o ./pa_asio.o $(CXXFLAGS)
|
|
||||||
|
|
||||||
[Unit11]
|
|
||||||
FileName=..\pa_win_util.c
|
|
||||||
CompileCpp=1
|
|
||||||
Folder=portaudio
|
|
||||||
Compile=1
|
|
||||||
Link=1
|
|
||||||
Priority=1000
|
|
||||||
OverrideBuildCmd=0
|
|
||||||
BuildCmd=$(CC) -c pa_win_util.c -o ./pa_win_util.o $(CFLAGS)
|
|
||||||
|
|
||||||
[Unit12]
|
|
||||||
FileName=..\pa_win_hostapis.c
|
|
||||||
CompileCpp=1
|
|
||||||
Folder=portaudio
|
|
||||||
Compile=1
|
|
||||||
Link=1
|
|
||||||
Priority=1000
|
|
||||||
OverrideBuildCmd=0
|
|
||||||
BuildCmd=$(CC) -c pa_win_hostapis.c -o ./pa_win_hostapis.o $(CFLAGS)
|
|
||||||
|
|
||||||
[Unit13]
|
|
||||||
FileName=..\..\pa_win_ds\pa_win_ds.c
|
|
||||||
CompileCpp=1
|
|
||||||
Folder=portaudio
|
|
||||||
Compile=1
|
|
||||||
Link=1
|
|
||||||
Priority=1000
|
|
||||||
OverrideBuildCmd=0
|
|
||||||
BuildCmd=$(CC) -c pa_win_ds.c -o ./pa_win_ds.o $(CFLAGS)
|
|
||||||
|
|
||||||
[Unit14]
|
|
||||||
FileName=..\..\pa_win_ds\dsound_wrapper.c
|
|
||||||
CompileCpp=1
|
|
||||||
Folder=portaudio
|
|
||||||
Compile=1
|
|
||||||
Link=1
|
|
||||||
Priority=1000
|
|
||||||
OverrideBuildCmd=0
|
|
||||||
BuildCmd=$(CC) -c dsound_wrapper.c -o ./dsound_wrapper.o $(CFLAGS)
|
|
||||||
|
|
||||||
[Unit15]
|
|
||||||
FileName=..\..\pa_win_wmme\pa_win_wmme.c
|
|
||||||
CompileCpp=1
|
|
||||||
Folder=portaudio
|
|
||||||
Compile=1
|
|
||||||
Link=1
|
|
||||||
Priority=1000
|
|
||||||
OverrideBuildCmd=0
|
|
||||||
BuildCmd=$(CC) -c pa_win_wmme.c -o ./pa_win_wmme.o $(CFLAGS)
|
|
||||||
|
|
||||||
[Unit16]
|
|
||||||
FileName=..\..\pa_asio\iasiothiscallresolver.cpp
|
|
||||||
CompileCpp=1
|
|
||||||
Folder=portaudio
|
|
||||||
Compile=1
|
|
||||||
Link=1
|
|
||||||
Priority=1000
|
|
||||||
OverrideBuildCmd=0
|
|
||||||
BuildCmd=
|
|
||||||
|
|
@ -1,209 +0,0 @@
|
|||||||
[Project]
|
|
||||||
FileName=portaudio-static.dev
|
|
||||||
Name=portaudio-static
|
|
||||||
UnitCount=16
|
|
||||||
Type=2
|
|
||||||
Ver=1
|
|
||||||
ObjFiles=
|
|
||||||
Includes=..\..\..\asiosdk2;..\..\..\asiosdk2\common;..\..\..\asiosdk2\host;..\..\..\asiosdk2\host\pc;..\..\pa_common
|
|
||||||
Libs=
|
|
||||||
PrivateResource=
|
|
||||||
ResourceIncludes=
|
|
||||||
MakeIncludes=
|
|
||||||
Compiler=-O3_@@_
|
|
||||||
CppCompiler=-O3_@@_
|
|
||||||
Linker=-O3 -s_@@_
|
|
||||||
IsCpp=1
|
|
||||||
Icon=
|
|
||||||
ExeOutput=.
|
|
||||||
ObjectOutput=.
|
|
||||||
OverrideOutput=0
|
|
||||||
OverrideOutputName=portaudio.a
|
|
||||||
HostApplication=
|
|
||||||
Folders=
|
|
||||||
CommandLine=
|
|
||||||
IncludeVersionInfo=0
|
|
||||||
SupportXPThemes=0
|
|
||||||
CompilerSet=0
|
|
||||||
CompilerSettings=0000000000000000000
|
|
||||||
UseCustomMakefile=0
|
|
||||||
CustomMakefile=
|
|
||||||
|
|
||||||
[Unit1]
|
|
||||||
FileName=..\..\pa_common\pa_skeleton.c
|
|
||||||
CompileCpp=1
|
|
||||||
Folder=portaudio
|
|
||||||
Compile=1
|
|
||||||
Link=1
|
|
||||||
Priority=1000
|
|
||||||
OverrideBuildCmd=0
|
|
||||||
BuildCmd=$(CC) -c pa_skeleton.c -o ./pa_skeleton.o $(CFLAGS)
|
|
||||||
|
|
||||||
[Unit2]
|
|
||||||
FileName=..\..\pa_common\pa_stream.c
|
|
||||||
CompileCpp=1
|
|
||||||
Folder=portaudio
|
|
||||||
Compile=1
|
|
||||||
Link=1
|
|
||||||
Priority=1000
|
|
||||||
OverrideBuildCmd=0
|
|
||||||
BuildCmd=$(CC) -c pa_stream.c -o ./pa_stream.o $(CFLAGS)
|
|
||||||
|
|
||||||
[Unit3]
|
|
||||||
FileName=..\..\pa_common\pa_trace.c
|
|
||||||
CompileCpp=1
|
|
||||||
Folder=portaudio
|
|
||||||
Compile=1
|
|
||||||
Link=1
|
|
||||||
Priority=1000
|
|
||||||
OverrideBuildCmd=0
|
|
||||||
BuildCmd=$(CC) -c pa_trace.c -o ./pa_trace.o $(CFLAGS)
|
|
||||||
|
|
||||||
[Unit4]
|
|
||||||
FileName=..\..\pa_common\pa_allocation.c
|
|
||||||
CompileCpp=1
|
|
||||||
Folder=portaudio
|
|
||||||
Compile=1
|
|
||||||
Link=1
|
|
||||||
Priority=1000
|
|
||||||
OverrideBuildCmd=0
|
|
||||||
BuildCmd=$(CC) -c pa_allocation.c -o ./pa_allocation.o $(CFLAGS)
|
|
||||||
|
|
||||||
[Unit5]
|
|
||||||
FileName=..\..\pa_common\pa_converters.c
|
|
||||||
CompileCpp=1
|
|
||||||
Folder=portaudio
|
|
||||||
Compile=1
|
|
||||||
Link=1
|
|
||||||
Priority=1000
|
|
||||||
OverrideBuildCmd=0
|
|
||||||
BuildCmd=$(CC) -c pa_converters.c -o ./pa_converters.o $(CFLAGS)
|
|
||||||
|
|
||||||
[Unit6]
|
|
||||||
FileName=..\..\pa_common\pa_cpuload.c
|
|
||||||
CompileCpp=1
|
|
||||||
Folder=portaudio
|
|
||||||
Compile=1
|
|
||||||
Link=1
|
|
||||||
Priority=1000
|
|
||||||
OverrideBuildCmd=0
|
|
||||||
BuildCmd=$(CC) -c pa_cpuload.c -o ./pa_cpuload.o $(CFLAGS)
|
|
||||||
|
|
||||||
[Unit7]
|
|
||||||
FileName=..\..\pa_common\pa_dither.c
|
|
||||||
CompileCpp=1
|
|
||||||
Folder=portaudio
|
|
||||||
Compile=1
|
|
||||||
Link=1
|
|
||||||
Priority=1000
|
|
||||||
OverrideBuildCmd=0
|
|
||||||
BuildCmd=$(CC) -c pa_dither.c -o ./pa_dither.o $(CFLAGS)
|
|
||||||
|
|
||||||
[Unit8]
|
|
||||||
FileName=..\..\pa_common\pa_front.c
|
|
||||||
CompileCpp=1
|
|
||||||
Folder=portaudio
|
|
||||||
Compile=1
|
|
||||||
Link=1
|
|
||||||
Priority=1000
|
|
||||||
OverrideBuildCmd=0
|
|
||||||
BuildCmd=$(CC) -c pa_front.c -o ./pa_front.o $(CFLAGS)
|
|
||||||
|
|
||||||
[Unit9]
|
|
||||||
FileName=..\..\pa_common\pa_process.c
|
|
||||||
CompileCpp=1
|
|
||||||
Folder=portaudio
|
|
||||||
Compile=1
|
|
||||||
Link=1
|
|
||||||
Priority=1000
|
|
||||||
OverrideBuildCmd=0
|
|
||||||
BuildCmd=$(CC) -c pa_process.c -o ./pa_process.o $(CFLAGS)
|
|
||||||
|
|
||||||
[VersionInfo]
|
|
||||||
Major=0
|
|
||||||
Minor=1
|
|
||||||
Release=1
|
|
||||||
Build=1
|
|
||||||
LanguageID=1033
|
|
||||||
CharsetID=1252
|
|
||||||
CompanyName=
|
|
||||||
FileVersion=
|
|
||||||
FileDescription=Developed using the Dev-C++ IDE
|
|
||||||
InternalName=
|
|
||||||
LegalCopyright=
|
|
||||||
LegalTrademarks=
|
|
||||||
OriginalFilename=
|
|
||||||
ProductName=
|
|
||||||
ProductVersion=
|
|
||||||
AutoIncBuildNr=0
|
|
||||||
|
|
||||||
[Unit10]
|
|
||||||
FileName=..\..\pa_asio\pa_asio.cpp
|
|
||||||
CompileCpp=1
|
|
||||||
Folder=portaudio
|
|
||||||
Compile=1
|
|
||||||
Link=1
|
|
||||||
Priority=1000
|
|
||||||
OverrideBuildCmd=0
|
|
||||||
BuildCmd=$(CPP) -c pa_asio.cpp -o ./pa_asio.o $(CXXFLAGS)
|
|
||||||
|
|
||||||
[Unit11]
|
|
||||||
FileName=..\..\pa_win\pa_win_util.c
|
|
||||||
CompileCpp=1
|
|
||||||
Folder=portaudio
|
|
||||||
Compile=1
|
|
||||||
Link=1
|
|
||||||
Priority=1000
|
|
||||||
OverrideBuildCmd=0
|
|
||||||
BuildCmd=$(CC) -c pa_win_util.c -o ./pa_win_util.o $(CFLAGS)
|
|
||||||
|
|
||||||
[Unit12]
|
|
||||||
FileName=..\..\pa_win\pa_win_hostapis.c
|
|
||||||
CompileCpp=1
|
|
||||||
Folder=portaudio
|
|
||||||
Compile=1
|
|
||||||
Link=1
|
|
||||||
Priority=1000
|
|
||||||
OverrideBuildCmd=0
|
|
||||||
BuildCmd=$(CC) -c pa_win_hostapis.c -o ./pa_win_hostapis.o $(CFLAGS)
|
|
||||||
|
|
||||||
[Unit13]
|
|
||||||
FileName=..\..\pa_win_ds\pa_win_ds.c
|
|
||||||
CompileCpp=1
|
|
||||||
Folder=portaudio
|
|
||||||
Compile=1
|
|
||||||
Link=1
|
|
||||||
Priority=1000
|
|
||||||
OverrideBuildCmd=0
|
|
||||||
BuildCmd=$(CC) -c pa_win_ds.c -o ./pa_win_ds.o $(CFLAGS)
|
|
||||||
|
|
||||||
[Unit14]
|
|
||||||
FileName=..\..\pa_win_ds\dsound_wrapper.c
|
|
||||||
CompileCpp=1
|
|
||||||
Folder=portaudio
|
|
||||||
Compile=1
|
|
||||||
Link=1
|
|
||||||
Priority=1000
|
|
||||||
OverrideBuildCmd=0
|
|
||||||
BuildCmd=$(CC) -c dsound_wrapper.c -o ./dsound_wrapper.o $(CFLAGS)
|
|
||||||
|
|
||||||
[Unit15]
|
|
||||||
FileName=..\..\pa_win_wmme\pa_win_wmme.c
|
|
||||||
CompileCpp=1
|
|
||||||
Folder=portaudio
|
|
||||||
Compile=1
|
|
||||||
Link=1
|
|
||||||
Priority=1000
|
|
||||||
OverrideBuildCmd=0
|
|
||||||
BuildCmd=$(CC) -c pa_win_wmme.c -o ./pa_win_wmme.o $(CFLAGS)
|
|
||||||
|
|
||||||
[Unit16]
|
|
||||||
FileName=..\..\pa_asio\iasiothiscallresolver.cpp
|
|
||||||
CompileCpp=1
|
|
||||||
Folder=portaudio
|
|
||||||
Compile=1
|
|
||||||
Link=1
|
|
||||||
Priority=1000
|
|
||||||
OverrideBuildCmd=0
|
|
||||||
BuildCmd=
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
|||||||
From: "Peter L Jones"
|
|
||||||
Sent: Wednesday, September 17, 2003 5:18 AM
|
|
||||||
Subject: Dev-C++ project files
|
|
||||||
|
|
||||||
I attach two project files intended for portaudio/pa_win/dev-cpp (i.e. in
|
|
||||||
parallel with the msvc directory), if you want them. One is for a static
|
|
||||||
library build and one for a DLL. I've used the static library (in building
|
|
||||||
a single monolithic DLL) but I can't guarantee the DLL version will build a
|
|
||||||
working library (I think it's mostly there, though!).
|
|
||||||
|
|
||||||
I also attach the resulting makefiles, which may be of use to other MinGW
|
|
||||||
users.
|
|
||||||
|
|
||||||
They're rooted in the directory given above and drop their object and
|
|
||||||
library files in the same place. They assume the asiosdk2 files are in the
|
|
||||||
same directory as portaudio/ in a sub-directory called asiosdk2/. Oh! The
|
|
||||||
DLL is built against a static asiosdk2.a library... maybe not the best way
|
|
||||||
to do it... I ought to figure out how to link against a "home made" dll in
|
|
||||||
Dev-C++, I guess ;-)
|
|
||||||
|
|
||||||
Cheers,
|
|
||||||
|
|
||||||
-- Peter
|
|
@ -1,159 +0,0 @@
|
|||||||
# Portaudio v1.9-devel VC6 DLL makefile 1.0
|
|
||||||
#
|
|
||||||
# David Viens, davidv@plogue.com
|
|
||||||
# (im far from a VC6 makefile expert, so please bear with me :)
|
|
||||||
#
|
|
||||||
# For more info, look at readme.txt
|
|
||||||
#
|
|
||||||
#if you keep the ASIODIR as ".", it will use the SDK files that direclty in "pa_win/msvc" dir
|
|
||||||
ASIODIR=.
|
|
||||||
ASIOINC=/I ".\host" /I ".\host\pc" /I ".\common"
|
|
||||||
#
|
|
||||||
|
|
||||||
LIBZ=kernel32.lib user32.lib gdi32.lib wininet.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib dsound.lib dxguid.lib
|
|
||||||
|
|
||||||
CPP=cl.exe
|
|
||||||
LINK32=link.exe
|
|
||||||
|
|
||||||
#release
|
|
||||||
CFLAGS=/nologo /MD /W3 /GX /O2 /Ob2 /I "src" /I "Win32" /I "$(MSVCDir)\Include" /D "WIN32" /D "NDEBUG" /D "_USRDLL" /YX /FD
|
|
||||||
DLL_LINK_FLAGS= /nologo /dll /incremental:no /libpath:"$(MSVCDir)\Lib" $(LIBZ) /pdb:"portaudio.pdb" /implib:".\portaudio.lib" /machine:I386 /out:"portaudio.dll"
|
|
||||||
|
|
||||||
|
|
||||||
COMMONINC=/I "..\..\pa_common" /I "."
|
|
||||||
|
|
||||||
#====================================================================
|
|
||||||
# Targets
|
|
||||||
|
|
||||||
ALL : portaudio.dll
|
|
||||||
|
|
||||||
CLEAN :
|
|
||||||
-@erase "*.obj"
|
|
||||||
|
|
||||||
#====================================================================
|
|
||||||
|
|
||||||
|
|
||||||
LINK32_OBJS= \
|
|
||||||
".\pa_allocation.obj" \
|
|
||||||
".\pa_converters.obj" \
|
|
||||||
".\pa_x86_plain_converters.obj" \
|
|
||||||
# ".\pa_cppHelp.obj" \
|
|
||||||
".\pa_cpuload.obj" \
|
|
||||||
".\pa_dither.obj" \
|
|
||||||
".\pa_front.obj" \
|
|
||||||
".\pa_process.obj" \
|
|
||||||
".\pa_skeleton.obj" \
|
|
||||||
".\pa_stream.obj" \
|
|
||||||
".\pa_trace.obj" \
|
|
||||||
#
|
|
||||||
".\pa_win_hostapis.obj" \
|
|
||||||
".\pa_win_util.obj" \
|
|
||||||
#
|
|
||||||
".\pa_win_wmme.obj" \
|
|
||||||
#
|
|
||||||
".\pa_win_ds.obj" \
|
|
||||||
".\dsound_wrapper.obj" \
|
|
||||||
#
|
|
||||||
".\pa_asio.obj" \
|
|
||||||
#
|
|
||||||
".\asio.obj" \
|
|
||||||
".\ASIOConvertSamples.obj" \
|
|
||||||
".\asiodrivers.obj" \
|
|
||||||
".\asiolist.obj" \
|
|
||||||
".\combase.obj" \
|
|
||||||
".\debugmessage.obj" \
|
|
||||||
# ".\dllentry.obj" \
|
|
||||||
".\register.obj"
|
|
||||||
|
|
||||||
|
|
||||||
portaudio.dll : $(LINK32_OBJS) ".\portaudio.def"
|
|
||||||
$(LINK32) $(DLL_LINK_FLAGS) /def:".\portaudio.def" $(LINK32_OBJS)
|
|
||||||
|
|
||||||
#====================================================================
|
|
||||||
# asio files (need to agree to steinberg agreement)
|
|
||||||
# this makefile assumes all files have being copied in the pa_win/msvc dir (for now)
|
|
||||||
# see readme.txt for details
|
|
||||||
|
|
||||||
".\asio.obj" : ".\common\asio.cpp"
|
|
||||||
$(CPP) $(CFLAGS) $(ASIOINC) /Fo".\asio.obj" /c ".\common\asio.cpp"
|
|
||||||
|
|
||||||
".\ASIOConvertSamples.obj" : ".\host\ASIOConvertSamples.cpp"
|
|
||||||
$(CPP) $(CFLAGS) $(ASIOINC) /Fo".\ASIOConvertSamples.obj" /c ".\host\ASIOConvertSamples.cpp"
|
|
||||||
|
|
||||||
".\asiodrivers.obj" : ".\host\asiodrivers.cpp"
|
|
||||||
$(CPP) $(CFLAGS) $(ASIOINC) /Fo".\asiodrivers.obj" /c ".\host\asiodrivers.cpp"
|
|
||||||
|
|
||||||
".\asiolist.obj" : ".\host\pc\asiolist.cpp"
|
|
||||||
$(CPP) $(CFLAGS) $(ASIOINC) /Fo".\asiolist.obj" /c ".\host\pc\asiolist.cpp"
|
|
||||||
|
|
||||||
".\combase.obj" : ".\common\combase.cpp"
|
|
||||||
$(CPP) $(CFLAGS) $(ASIOINC) /Fo".\combase.obj" /c ".\common\combase.cpp"
|
|
||||||
|
|
||||||
".\debugmessage.obj" : ".\common\debugmessage.cpp"
|
|
||||||
$(CPP) $(CFLAGS) $(ASIOINC) /Fo".\debugmessage.obj" /c ".\common\debugmessage.cpp"
|
|
||||||
|
|
||||||
".\register.obj" : ".\common\register.cpp"
|
|
||||||
$(CPP) $(CFLAGS) $(ASIOINC) /Fo".\register.obj" /c ".\common\register.cpp"
|
|
||||||
|
|
||||||
#====================================================================
|
|
||||||
# Portaudio Common
|
|
||||||
#
|
|
||||||
".\pa_allocation.obj" : "..\..\pa_common\pa_allocation.c"
|
|
||||||
$(CPP) $(CFLAGS) $(COMMONINC) /Fo".\pa_allocation.obj" /c "..\..\pa_common\pa_allocation.c"
|
|
||||||
|
|
||||||
".\pa_converters.obj" : "..\..\pa_common\pa_converters.c"
|
|
||||||
$(CPP) $(CFLAGS) $(COMMONINC) /Fo".\pa_converters.obj" /c "..\..\pa_common\pa_converters.c"
|
|
||||||
|
|
||||||
".\pa_cppHelp.obj" : "..\..\pa_common\pa_cppHelp.cpp"
|
|
||||||
$(CPP) $(CFLAGS) $(COMMONINC) /Fo".\pa_cppHelp.obj" /c "..\..\pa_common\pa_cppHelp.cpp"
|
|
||||||
|
|
||||||
".\pa_cpuload.obj" : "..\..\pa_common\pa_cpuload.c"
|
|
||||||
$(CPP) $(CFLAGS) $(COMMONINC) /Fo".\pa_cpuload.obj" /c "..\..\pa_common\pa_cpuload.c"
|
|
||||||
|
|
||||||
".\pa_dither.obj" : "..\..\pa_common\pa_dither.c"
|
|
||||||
$(CPP) $(CFLAGS) $(COMMONINC) /Fo".\pa_dither.obj" /c "..\..\pa_common\pa_dither.c"
|
|
||||||
|
|
||||||
".\pa_front.obj" : "..\..\pa_common\pa_front.c"
|
|
||||||
$(CPP) $(CFLAGS) $(COMMONINC) /Fo".\pa_front.obj" /c "..\..\pa_common\pa_front.c"
|
|
||||||
|
|
||||||
".\pa_process.obj" : "..\..\pa_common\pa_process.c"
|
|
||||||
$(CPP) $(CFLAGS) $(COMMONINC) /Fo".\pa_process.obj" /c "..\..\pa_common\pa_process.c"
|
|
||||||
|
|
||||||
".\pa_skeleton.obj" : "..\..\pa_common\pa_skeleton.c"
|
|
||||||
$(CPP) $(CFLAGS) $(COMMONINC) /Fo".\pa_skeleton.obj" /c "..\..\pa_common\pa_skeleton.c"
|
|
||||||
|
|
||||||
".\pa_stream.obj" : "..\..\pa_common\pa_stream.c"
|
|
||||||
$(CPP) $(CFLAGS) $(COMMONINC) /Fo".\pa_stream.obj" /c "..\..\pa_common\pa_stream.c"
|
|
||||||
|
|
||||||
".\pa_trace.obj" : "..\..\pa_common\pa_trace.c"
|
|
||||||
$(CPP) $(CFLAGS) $(COMMONINC) /Fo".\pa_trace.obj" /c "..\..\pa_common\pa_trace.c"
|
|
||||||
|
|
||||||
#====================================================================
|
|
||||||
# Portaudio implementations
|
|
||||||
#
|
|
||||||
|
|
||||||
".\pa_win_hostapis.obj" : "..\..\pa_win\pa_win_hostapis.c"
|
|
||||||
$(CPP) $(CFLAGS) $(COMMONINC) /Fo".\pa_win_hostapis.obj" /c "..\..\pa_win\pa_win_hostapis.c"
|
|
||||||
|
|
||||||
".\pa_win_util.obj" : "..\..\pa_win\pa_win_util.c"
|
|
||||||
$(CPP) $(CFLAGS) $(COMMONINC) /Fo".\pa_win_util.obj" /c "..\..\pa_win\pa_win_util.c"
|
|
||||||
|
|
||||||
".\pa_x86_plain_converters.obj" : "..\..\pa_win\pa_x86_plain_converters.c"
|
|
||||||
$(CPP) $(CFLAGS) $(COMMONINC) /Fo".\pa_x86_plain_converters.obj" /c "..\..\pa_win\pa_x86_plain_converters.c"
|
|
||||||
|
|
||||||
".\pa_asio.obj" : "..\..\pa_asio\pa_asio.cpp"
|
|
||||||
$(CPP) $(CFLAGS) $(ASIOINC) $(COMMONINC) /Fo".\pa_asio.obj" /c "..\..\pa_asio\pa_asio.cpp"
|
|
||||||
|
|
||||||
".\pa_win_wmme.obj" : "..\..\pa_win_wmme\pa_win_wmme.c"
|
|
||||||
$(CPP) $(CFLAGS) $(COMMONINC) /Fo".\pa_win_wmme.obj" /c "..\..\pa_win_wmme\pa_win_wmme.c"
|
|
||||||
|
|
||||||
".\pa_win_ds.obj" : "..\..\pa_win_ds\pa_win_ds.c"
|
|
||||||
$(CPP) $(CFLAGS) $(COMMONINC) /Fo".\pa_win_ds.obj" /c "..\..\pa_win_ds\pa_win_ds.c"
|
|
||||||
|
|
||||||
".\dsound_wrapper.obj" : "..\..\pa_win_ds\dsound_wrapper.c"
|
|
||||||
$(CPP) $(CFLAGS) $(COMMONINC) /Fo".\dsound_wrapper.obj" /c "..\..\pa_win_ds\dsound_wrapper.c"
|
|
||||||
|
|
||||||
|
|
||||||
# End of Makefile
|
|
||||||
#====================================================================
|
|
||||||
#
|
|
@ -1,7 +0,0 @@
|
|||||||
del *.obj
|
|
||||||
del *.dll
|
|
||||||
del *.lib
|
|
||||||
del *.exp
|
|
||||||
del *.pch
|
|
||||||
del *.idb
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
|||||||
CALL C:\progra~1\micros~2\VC98\bin\vcvars32
|
|
||||||
del *.dll
|
|
||||||
del *.lib
|
|
||||||
nmake Makefile.msvc
|
|
||||||
del *.obj
|
|
||||||
del *.exp
|
|
||||||
del *.pch
|
|
||||||
del *.idb
|
|
@ -1,43 +0,0 @@
|
|||||||
LIBRARY portaudio.dll
|
|
||||||
EXPORTS
|
|
||||||
|
|
||||||
;
|
|
||||||
Pa_GetVersion @1
|
|
||||||
Pa_GetVersionText @2
|
|
||||||
Pa_GetErrorText @3
|
|
||||||
Pa_Initialize @4
|
|
||||||
Pa_Terminate @5
|
|
||||||
Pa_GetHostApiCount @6
|
|
||||||
Pa_GetDefaultHostApi @7
|
|
||||||
Pa_GetHostApiInfo @8
|
|
||||||
Pa_HostApiTypeIdToHostApiIndex @9
|
|
||||||
Pa_HostApiDeviceIndexToDeviceIndex @10
|
|
||||||
Pa_GetLastHostErrorInfo @11
|
|
||||||
Pa_GetDeviceCount @12
|
|
||||||
Pa_GetDefaultInputDevice @13
|
|
||||||
Pa_GetDefaultOutputDevice @14
|
|
||||||
Pa_GetDeviceInfo @15
|
|
||||||
Pa_IsFormatSupported @16
|
|
||||||
Pa_OpenStream @17
|
|
||||||
Pa_OpenDefaultStream @18
|
|
||||||
Pa_CloseStream @19
|
|
||||||
Pa_SetStreamFinishedCallback @20
|
|
||||||
Pa_StartStream @21
|
|
||||||
Pa_StopStream @22
|
|
||||||
Pa_AbortStream @23
|
|
||||||
Pa_IsStreamStopped @24
|
|
||||||
Pa_IsStreamActive @25
|
|
||||||
Pa_GetStreamInfo @26
|
|
||||||
Pa_GetStreamTime @27
|
|
||||||
Pa_GetStreamCpuLoad @28
|
|
||||||
Pa_ReadStream @29
|
|
||||||
Pa_WriteStream @30
|
|
||||||
Pa_GetStreamReadAvailable @31
|
|
||||||
Pa_GetStreamWriteAvailable @32
|
|
||||||
Pa_GetSampleSize @33
|
|
||||||
Pa_Sleep @34
|
|
||||||
PaAsio_GetAvailableLatencyValues @50
|
|
||||||
PaAsio_ShowControlPanel @51
|
|
||||||
PaUtil_InitializeX86PlainConverters @52
|
|
||||||
PaAsio_GetInputChannelName @53
|
|
||||||
PaAsio_GetOutputChannelName @54
|
|
@ -1,56 +0,0 @@
|
|||||||
Hello
|
|
||||||
|
|
||||||
This is a small list of steps in order to build portaudio
|
|
||||||
(Currently v19-devel) into a VC6 DLL and lib file.
|
|
||||||
This DLL contains all 3 current win32 PA APIS (MM/DS/ASIO)
|
|
||||||
|
|
||||||
1)Copy the source dirs that comes with the ASIO SDK inside pa_win\msvc
|
|
||||||
so you should now have:
|
|
||||||
|
|
||||||
pa_win\msvc\common
|
|
||||||
pa_win\msvc\host
|
|
||||||
pa_win\msvc\host\sample
|
|
||||||
pa_win\msvc\host\pc
|
|
||||||
pa_win\msvc\host\mac (not needed)
|
|
||||||
|
|
||||||
You dont need "driver"
|
|
||||||
|
|
||||||
|
|
||||||
2)execure "make.bat", this assumes VC6 is installed in
|
|
||||||
C:\Program Files\Microsoft Visual Studio\
|
|
||||||
|
|
||||||
if its not,
|
|
||||||
|
|
||||||
Open a command Prompt and execute "vcvars32.bat" which sets the environment
|
|
||||||
so that you can use Microsoft's "nmake"
|
|
||||||
EX: C:\Program Files\Microsoft Visual Studio\VC98\Bin\vcvars32.bat
|
|
||||||
or (C:\progra~1\micros~2\VC98\bin\vcvars32) dumb de dumb
|
|
||||||
|
|
||||||
You should now have seen a line that said:
|
|
||||||
"Setting environment for using Microsoft Visual C++ tools."
|
|
||||||
While in pa_win\msvc , type "nmake makefile.msvc"
|
|
||||||
this _should_ create portaudio.dll and portaudio.lib
|
|
||||||
|
|
||||||
3)Now in any VC6 project, in which you require portaudio,
|
|
||||||
you can just link with portaudio.lib, and of course include the
|
|
||||||
relevant headers
|
|
||||||
(portaudio.h, and/or pa_asio.h , pa_x86_plain_converters.h) See (*)
|
|
||||||
|
|
||||||
4) Your new exe should now use portaudio.dll.
|
|
||||||
|
|
||||||
|
|
||||||
Have fun!
|
|
||||||
|
|
||||||
(*): you may want to add/remove some DLL entry points.
|
|
||||||
Right now those 3 entries are _not_ from portaudio.h
|
|
||||||
|
|
||||||
(from portaudio.def)
|
|
||||||
(...)
|
|
||||||
PaAsio_GetAvailableLatencyValues @50
|
|
||||||
PaAsio_ShowControlPanel @51
|
|
||||||
PaUtil_InitializeX86PlainConverters @52
|
|
||||||
|
|
||||||
|
|
||||||
-----
|
|
||||||
last update April 16th 2003
|
|
||||||
David Viens, davidv@plogue.com
|
|
@ -1 +0,0 @@
|
|||||||
C:\progra~1\micros~2\VC98\bin\vcvars32
|
|
@ -1,86 +0,0 @@
|
|||||||
/*
|
|
||||||
* $Id$
|
|
||||||
* Portable Audio I/O Library Windows 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.
|
|
||||||
*
|
|
||||||
* Any person wishing to distribute modifications to the Software is
|
|
||||||
* requested to send the modifications to the original developer so that
|
|
||||||
* they can be incorporated into the canonical version.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
||||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
|
||||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
||||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @file
|
|
||||||
Win32 host API initialization function table.
|
|
||||||
|
|
||||||
@todo Consider using PA_USE_WMME etc instead of PA_NO_WMME. This is what
|
|
||||||
the Unix version does, we should consider being consistent.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#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 );
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
|
|
||||||
PaUtilHostApiInitializer *paHostApiInitializers[] =
|
|
||||||
{
|
|
||||||
|
|
||||||
#ifndef PA_NO_WMME
|
|
||||||
PaWinMme_Initialize,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PA_NO_DS
|
|
||||||
PaWinDs_Initialize,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PA_NO_ASIO
|
|
||||||
PaAsio_Initialize,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
#ifndef PA_NO_WDMKS
|
|
||||||
PaWinWdm_Initialize,
|
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
|
|
||||||
PaSkeleton_Initialize, /* just for testing */
|
|
||||||
|
|
||||||
0 /* NULL terminated array */
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
int paDefaultHostApiIndex = 0;
|
|
||||||
|
|
@ -1,134 +0,0 @@
|
|||||||
/*
|
|
||||||
* $Id$
|
|
||||||
* Portable Audio I/O Library
|
|
||||||
* Win32 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.
|
|
||||||
*
|
|
||||||
* Any person wishing to distribute modifications to the Software is
|
|
||||||
* requested to send the modifications to the original developer so that
|
|
||||||
* they can be incorporated into the canonical version.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
||||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
|
||||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
||||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @file
|
|
||||||
Win32 platform-specific support functions.
|
|
||||||
|
|
||||||
@todo Implement workaround for QueryPerformanceCounter() skipping forward
|
|
||||||
bug. (see msdn kb Q274323).
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <windows.h>
|
|
||||||
#include <mmsystem.h> /* for timeGetTime() */
|
|
||||||
|
|
||||||
#include "pa_util.h"
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
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_ )
|
|
||||||
{
|
|
||||||
/* FIXME:
|
|
||||||
according to this knowledge-base article, QueryPerformanceCounter
|
|
||||||
can skip forward by seconds!
|
|
||||||
http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q274323&
|
|
||||||
|
|
||||||
it may be better to use the rtdsc instruction using inline asm,
|
|
||||||
however then a method is needed to calculate a ticks/seconds ratio.
|
|
||||||
*/
|
|
||||||
QueryPerformanceCounter( &time );
|
|
||||||
return time.QuadPart * secondsPerTick_;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return timeGetTime() * .001;
|
|
||||||
}
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
@ -1,19 +0,0 @@
|
|||||||
#ifndef PA_X86_PLAIN_CONVERTERS_H
|
|
||||||
#define PA_X86_PLAIN_CONVERTERS_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
@brief Install optimised converter functions suitable for all IA32 processors
|
|
||||||
*/
|
|
||||||
void PaUtil_InitializeX86PlainConverters( void );
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
#endif /* PA_X86_PLAIN_CONVERTERS_H */
|
|
Loading…
Reference in New Issue
Block a user