Commit graph

779 commits

Author SHA1 Message Date
John Melas
16884fc201
Unify all stringizing macros to new PA_STRINGIZE macro in pa_util.h (#605) 2021-07-01 10:19:21 +10:00
John Melas
038a696aec
pa_win_wmme.c: replace LPCTSTR with LPCWSTR (#597) 2021-06-23 10:15:57 +10:00
Trent Piepho
d859f7d5df
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.
2021-06-08 17:52:32 -07:00
John Melas
52a78c72f3
Unify windows error processing into a single PaWinUtil_SetLastSystemErrorInfo function (#495) 2021-06-09 10:43:40 +10:00
Phil Burk
8124f82f5c
alsa: init stream variable in pa_linux_alsa.c (#584)
Prevent compiler warnings.

Alternative to #567
2021-06-08 17:19:44 -07:00
Phil Burk
8ef5021a9d
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.
2021-06-08 17:19:14 -07:00
Phil Burk
2bd663ca75
pa_mac_core.c: init streamLatency and others (#591)
Prevent compiler warnings.
2021-06-08 17:06:48 -07:00
Trent Piepho
9413fa051f
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.
2021-06-02 18:03:42 -07:00
Ross Bencina
9faca9b95b 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.) 2021-05-26 17:10:56 -07:00
Mirko Rajkovaca
15dfd46b33
Added Pa_GetVersionInfo to portaudio.def (#574)
* - added Pa_GetVersionInfo to portaudio.def

* - added Pa_GetVersionInfo to `cmake_support/template_portaudio.def`

Co-authored-by: Mirko Rajkovaca <mirko@mrcode.dev>
2021-05-27 10:07:27 +10:00
MonkeybreadSoftware
840489460f
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 );
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2021-05-13 10:36:10 +10:00
Be
febd58ebba
MME: fix comparison of IO buffer sizes in CalculateBufferSettings() (#571)
Pull in fix from Audacity: https://bugzilla.audacityteam.org/show_bug.cgi?id=1969

The problem was some kind of typo, comparing pointers instead of the values of pointers.
2021-05-13 10:17:10 +10:00
Dmitry Kostjuchenko
39bfe6c63d
Merge pull request #552 from PortAudio/winrt
wasapi: Fixed compilation with MinGW (W64)
2021-04-29 09:27:50 +03:00
John Melas
aa053464eb
[macOS] drop support for 10.5 (#511)
* drop support for 10.5

* more documentation fixes

Co-authored-by: John Melas <john@jmelas.gr>
2021-04-28 17:38:18 -07:00
Be
b184fe82ed
remove deprecated pablio (#437)
This is deprecated code from 1999.
2021-04-28 17:35:03 -07:00
MichalPetryka
a563f2d39d
Whitespace cleanup in Java and C++ bindings#458) 2021-04-28 17:23:52 -07:00
Be
3e782f2494 CMake: clean up including headers for examples 2021-04-28 17:13:32 -07:00
Be
640d26cdea CMake: build qa executables 2021-04-28 17:13:32 -07:00
Be
ee2c707495 CMake: build all tests 2021-04-28 17:13:32 -07:00
Be
dfa969b3d9 GH Actions: add separate workflow for CMake testing every OS 2021-04-28 17:13:32 -07:00
Be
c5d6563d1c CMake: bump minimum version to 3.0.0 to fix deprecation warning 2021-04-28 17:13:32 -07:00
Phil Burk
32f5cbda7e
paqa_devs.c: define _USE_MATH_DEFINES (#554)
before including math.h

Fixes #551
2021-04-17 13:00:18 -07:00
Phil Burk
df2be4e048
patest_unplug.c: change int32_t to int (#553)
To prevent compiler errors and to avoid controversy over
stdint.h vs inttypes.h.

Fixes #550
2021-04-17 12:56:16 -07:00
dmitrykos
c6178e8592 wasapi: Fixed compilation with MinGW (W64) when targeting 32-bit platform 2021-04-15 11:39:02 +03:00
Phil Burk
67caa13f19
fix patest_converters.c argc argv order (#544)
They were reversed.
Also added void casts to prevent unused parameter warnings.
2021-04-12 06:29:03 -07:00
Ross Bencina
147dd72254
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) v19.7.0-RC2 v19.7.0 2021-03-31 17:17:30 -07:00
Be
eec7bb7397
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:

$ aplay -l
card 0: Pro70785713 [Babyface Pro (70785713)], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
2021-03-19 10:51:31 -07:00
Phil Burk
3f7bee79a6 Bump version to 19.7.0 2021-03-07 07:33:41 -08:00
Phil Burk
b14e866b27 configure: better test for Mac OS arch
Use AC_COMPILE_IFELSE because AC_TRY_COMPILE is deprecated.
Include cdefs.h because it has checks for architcture.
2021-02-25 07:06:33 -08:00
petris
793c7ffc18 WASAPI final whitespace fix 2021-02-24 17:34:47 -08:00
MichalPetryka
78415a838a
Add .editorconfig (#394) 2021-02-18 12:49:18 +11:00
Ross Bencina
79932a5919
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.
2021-02-18 12:11:14 +11:00
Dmitry Kostjuchenko
078fc760c5
Merge pull request #510 from alienpenguin/fix-vs2010-compilation
wasapi: Fix compilation for VS2010.
2021-02-17 09:13:45 +02:00
Francesco Lamonica
9ef2c28bb8 fixed VS2010 compilation 2021-02-16 23:15:53 +01:00
Dmitry Kostjuchenko
8ccd53fe7c
Merge pull request #509 from PortAudio/winrt
wasapi: Fixed compilation for UWP platform, minor cleanup and refactoring.
2021-02-16 12:54:24 +02:00
dmitrykos
712685c71a wasapi: Fixed compilation for UWP platform, minor cleanup and refactoring. 2021-02-16 12:43:58 +02:00
Dmitry Kostjuchenko
c47aa44c1c
Merge pull request #508 from PortAudio/winrt
wasapi: Fixed glitchy audio in case of Exclusive polling mode and 24-bit packed format.
2021-02-16 12:34:26 +02:00
dmitrykos
7926e3a8ee 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). 2021-02-16 12:15:00 +02:00
Phil Burk
0ac93f8634 coreaudio: remove pa_mac_core_old.c
It has not been used for years.

Fixes #493
2021-02-12 08:13:07 -08:00
MichalPetryka
73291bb1f5
Cleanup newlines at EOF in oss (#491) 2021-02-11 14:02:46 +11:00
MichalPetryka
94e4cf69c3
Cleanup newlines at EOF in dsound (#490) 2021-02-11 14:02:22 +11:00
Peter Ross
b2a4d5cb80
configure/make: export PaWasapi_* and PaWasapiWinrt_* symbols (#500) 2021-02-11 12:37:23 +11:00
Phil Burk
fa42d1284e macos: consider major version 11
Change version logic to allow for major 11 or later.

Partial fix for #492
2021-02-10 17:11:52 -08:00
Dmitry Kostjuchenko
0b73f1589c
Merge pull request #496 from rouseabout/master
wasapi: add PaWasapi_GetIMMDevice function
2021-02-09 23:39:33 +02:00
Peter Ross
38eba25bcc 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
2021-02-10 08:10:21 +11:00
Dmitry Kostjuchenko
ec3dd05855
Merge pull request #499 from rouseabout/consistent-export-symbol-numbers
cmake_support/template_portaudio.def: make symbol numbers consistent …
2021-02-09 23:03:29 +02:00
Peter Ross
0f26679b88 cmake_support/template_portaudio.def: make symbol numbers consistent with build/msvc/portaudio.def 2021-02-10 07:29:15 +11:00
orbea
4932b488c5 build: Fix builds with parallel make. 2021-02-05 15:40:33 -08:00
John Melas
dd857f6108 replace Carbon with CoreFoundation and CoreServices 2021-02-05 11:06:09 -08:00
Ed Maste
607b7d94d0
OSS: support 32-bit signed format AFMT_S32_NE (#462)
It may not be provided by all OSS implementations, so wrap the cases in
`#ifdef AFMT_S32_NE`.
2021-02-04 13:11:03 +11:00