Rewrite CMakeLists.txt using CMake targets and modules instead
of building up source files in variables.
Change pkgconfig file generated by CMake to use
Requires.private and Libs.private fields as recommended by the
pkgconfig maintainer:
https://people.freedesktop.org/~dbn/pkg-config-guide.html#faq
Refactor to use standard CMake variables, notably
BUILD_SHARED_LIBS instead of always building both dynamic and
static libraries. Also use CMAKE_FRAMEWORK for building as a
macOS framework.
Remove superfluous PA_ prefixes from option names.
When building with ASIO, automatically download ASIO SDK from
Steinberg if it is not found. The path to the SDK can be
manually specified with ASIO_SDK_ZIP_PATH to facilitate caching
on CI.
Add support for building JACK host API with MSVC and MinGW.
dmitrykos [Thu, 5 Aug 2021 17:23:39 +0000 (20:23 +0300)]
wasapi: Check for the supported Windows version explicitly in PaWasapi_Initialize() and avoid relying on existence on avrt.dll for detecting the compatible platform (user could provide avrt.dll stub that will break initialization of the library if OS version does not support WASAPI backend).
Trent Piepho [Wed, 9 Jun 2021 00:52:32 +0000 (17:52 -0700)]
Have PaUtil_GetTime() use monotonic time on Unix (#559)
The currently used clock, CLOCK_REALTIME, will have discontinuous jumps, forward
and backward, when the system clock is adjusted. This is bad for synchronizing
audio. CLOCK_MONOTONIC does not have jumps, and never moves backward, but does
have the continuous adjustments done by NTP to increase clock accuracy.
Since kernel 2.6.25 ALSA has use CLOCK_MONOTONIC by default for timestamps
(commit b751eef1 from Dec 13 2007). This change means the timestamps provided
in the PA callbacks can be compared to PaUtil_GetTime(), which currently does
not work.
The function used on MacOS, mach_absolute_time(), behaves like CLOCK_MONOTONIC.
If the system does not have CLOCK_MONOTONIC, fallback to CLOCK_REALTIME, which
is what alsa-lib does for such systems. Which at this point would need to be
very old.
* Use clock monotonic for condition variable
This is necessary to match PaUtil_GetTime() also using the monotonic
clock. Otherwise the wait time, derived from that function, will be
completely incorrect.
This will also fix an obscure flaw if the system clock is adjust while
waiting for the stream to open, it might not wait at all and fail or
wait (effectively) forever instead of timing out, depend on the
adjustment direction.
Phil Burk [Wed, 9 Jun 2021 00:19:14 +0000 (17:19 -0700)]
test: time out in patest_sine_time.c (#585)
On ALSA the StreamTime was not advancing so the while()
loop never exited. Now it will time out if it plays for much
longer than expected without the stream time changing.
Also measure timestamp latency from callback info.
Trent Piepho [Thu, 3 Jun 2021 01:03:42 +0000 (18:03 -0700)]
Alsa: Use hires timestamps (#560)
ALSA added nanosecond timestamps in library version 0.9.1. Use these
instead of microsecond timestamps for reporting audio timestamps as well
as underrun/overrun times.
alsa-lib version 0.9.1 was released on Mar 11 2003. I had fallback code
to use non-hires timestamps, but after 18 years it didn't seem
necessary, and I removed it from this commit.
Ross Bencina [Thu, 20 May 2021 02:06:14 +0000 (12:06 +1000)]
Add documentation indicating that Pa_ReadStream, Pa_WriteStream, Pa_GetStreamReadAvailable and Pa_GetStreamWriteAvailable are only valid while the stream is running (between calls to Pa_StartStream and Pa_StopStream.)
alsa: Increase snprintf buffer size to fix warning (#566)
Avoid compiler warning suggesting the buffer is too small:
../PortAudioLib/portaudio/src/hostapi/alsa/pa_linux_alsa.c: In function 'BuildDeviceList.constprop':
../PortAudioLib/portaudio/src/hostapi/alsa/pa_linux_alsa.c:1304:45: warning: '%s' directive output may be truncated writing up to 49 bytes into a region of size between 46 and 50 [-Wformat-truncation=]
snprintf( buf, sizeof (buf), "%s%s,%d", hwPrefix, alsaCardName, devIdx );
^~ ~~~~~~~~~~~~
../PortAudioLib/portaudio/src/hostapi/alsa/pa_linux_alsa.c:1304:42: note: directive argument in the range [0, 2147483647]
snprintf( buf, sizeof (buf), "%s%s,%d", hwPrefix, alsaCardName, devIdx );
^~~~~~~~~
../PortAudioLib/portaudio/src/hostapi/alsa/pa_linux_alsa.c:1304:13: note: 'snprintf' output between 3 and 65 bytes into a destination of size 50
snprintf( buf, sizeof (buf), "%s%s,%d", hwPrefix, alsaCardName, devIdx );
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ross Bencina [Thu, 1 Apr 2021 00:17:30 +0000 (11:17 +1100)]
Improve JACK regex pattern escape code (see ticket #534). Improves previously merged PR #405 master commit eec7bb7 by performing string conversion directly in to the target buffer, thus avoiding one allocation and one strncpy per client/device name. (#536)
Be [Fri, 19 Mar 2021 17:51:31 +0000 (12:51 -0500)]
JACK PipeWire fixes (escape regex chars) (#504)
This patch fixes a problem caused by special regex characters
appearing in the device names when using the Jack interface to PipeWire.
It is uncommon for JACK ports to have any characters that need to
be escaped in a regex. jackd simply calls the audio interface
"system". However PipeWire uses the device name from ALSA for the
JACK port names. If this contains any special regex characters,
BuildDeviceList would find the device but determine it has 0
input channels and 0 output channels. In my case, I have an RME
Babyface Pro which puts its serial number in parentheses:
Ross Bencina [Thu, 18 Feb 2021 01:11:14 +0000 (12:11 +1100)]
Clean up whitespace in src/hostapi/coreaudio in preparation for .editorconfig. (#502)
* Clean up whitespace in src/hostapi/coreaudio in preparation for .editorconfig. Convert tabs to 4 spaces. Indent by 4 spaces. Strip trailing whitespace. Ensure only one EOL at EOF.
dmitrykos [Tue, 16 Feb 2021 10:15:00 +0000 (12:15 +0200)]
wasapi: Fixed glitchy audio in case of Exclusive mode, 24-bit packed format and USB DAC (other audio devices using the same audio format could be affected too).
Peter Ross [Tue, 9 Feb 2021 03:55:41 +0000 (14:55 +1100)]
WASAPI: Add PaWaspi_GetIMMDevice function
The IMMDevice pointer enables access to audio device capabiltiies not exposed by PortAudio.
https://docs.microsoft.com/en-us/windows/win32/api/mmdeviceapi/nn-mmdeviceapi-immdevice
Phil Burk [Fri, 29 Jan 2021 20:15:15 +0000 (12:15 -0800)]
configure: add INCLUDES for mingw build
Previously, only portaudio.h was installed when building under mingw using
make. This behavior differs from CMakeLists.txt PA_PUBLIC_INCLUDES where
pa_win_*.h header files are installed.
To cross-compile using MXE (https://mxe.cc/) we need pa_win_*.h headers.
Add them to configure.in so that they are installed.
John Melas [Thu, 28 Jan 2021 01:29:24 +0000 (03:29 +0200)]
use variadic arguments in DEFINE_GUID also for MSVC (#374)
The fix for DEFINE_GUID that was recently added in pa_win_wdmks.c is also needed for the MSVC compiler.
Latest versions of the compiler support the /Zc:preprocessor option which is conforming to C99 and later standards
https://docs.microsoft.com/en-us/cpp/build/reference/zc-preprocessor?view=msvc-160
so it generates the exact same error as Clang (too many arguments error).
Ross Bencina [Thu, 21 Jan 2021 13:00:40 +0000 (00:00 +1100)]
Clean up whitespace in qa/ in preparation for .editorconfig. (#418)
* Clean up whitespace in qa/ in preparation for .editorconfig. Convert tabs to 4 spaces. Indent by 4 spaces. Strip trailing whitespace. Ensure EOL at EOF.
Ross Bencina [Thu, 21 Jan 2021 12:45:10 +0000 (23:45 +1100)]
Clean up whitespace in test/ in preparation for .editorconfig. (#417)
* Clean up whitespace in test/ in preparation for .editorconfig. Convert tabs to 4 spaces. Indent by 4 spaces. Strip trailing whitespace. Ensure EOL at EOF.
Ross Bencina [Thu, 21 Jan 2021 12:27:43 +0000 (23:27 +1100)]
Clean up whitespace in src/os/unix in preparation for .editorconfig. Convert tabs to 4 spaces. Indent by 4 spaces. Strip trailing whitespace. Ensure EOL at EOF. (#410)
Ross Bencina [Thu, 21 Jan 2021 12:23:00 +0000 (23:23 +1100)]
Clean up whitespace in src/os/win in preparation for .editorconfig. (#409)
* Clean up whitespace in src/os/win in preparation for .editorconfig. Convert tabs to 4 spaces. Indent by 4 spaces. Strip trailing whitespace. Ensure EOL at EOF.
Ross Bencina [Thu, 21 Jan 2021 11:46:49 +0000 (22:46 +1100)]
Clean up whitespace in pa_win_wmme.c in preparation for .editorconfig (#413)
* Clean up whitespace in pa_win_wmme.c in preparation for .editorconfig. Convert tabs to 4 spaces. Indent by 4 spaces. Strip trailing whitespace. Ensure EOL at EOF.
* vertically align trailing comments on 4 space boundary
Ross Bencina [Thu, 21 Jan 2021 11:32:05 +0000 (22:32 +1100)]
Clean up whitespace in src\hostapi\dsound in preparation for .editorconfig. Convert tabs to 4 spaces. Indent by 4 spaces. Strip trailing whitespace. Ensure EOL at EOF. (#412)
Ross Bencina [Thu, 21 Jan 2021 11:23:23 +0000 (22:23 +1100)]
Clean up whitespace in examples/ in preparation for .editorconfig. Convert tabs to 4 spaces. Indent by 4 spaces. Strip trailing whitespace. Ensure EOL at EOF. (#416)
Ross Bencina [Thu, 21 Jan 2021 11:17:17 +0000 (22:17 +1100)]
Clean up whitespace in pa_asio.cpp in preparation for .editorconfig. Convert tabs to 4 spaces. Indent by 4 spaces. Strip trailing whitespace. Ensure EOL at EOF. (#411)
Ross Bencina [Thu, 21 Jan 2021 10:58:54 +0000 (21:58 +1100)]
Clean up whitespace in src/hostapi/{asihpi, jack, oss, skeleton} in preparation for .editorconfig. (#414)
* Clean up whitespace in src/hostapi/{asihpi, jack, oss, skeleton} in preparation for .editorconfig. Convert tabs to 4 spaces. Indent by 4 spaces. Strip trailing whitespace. Ensure EOL at EOF.
Ross Bencina [Thu, 21 Jan 2021 03:19:22 +0000 (14:19 +1100)]
Clean up whitespace in include/ in preparation for .editorconfig. (#415)
* Clean up whitespace in include/ in preparation for .editorconfig. Convert tabs to 4 spaces. Indent by 4 spaces. Strip trailing whitespace. Ensure EOL at EOF.
Ed Maste [Tue, 19 Jan 2021 20:00:09 +0000 (15:00 -0500)]
OSS: correct test for unsupported formats
Previously GetAvailableFormats returned paSampleFormatNotSupported if
AFMT_S16_NE was not supported, regardless of the supported state of any
other formats. Instead, return paSampleFormatNotSupported if no
supported formats are found.