269 Commits

Author SHA1 Message Date
Chris Robinson
8731accd3f Make sure prebuf is filled when starting pulseaudio playback 2020-03-27 01:03:01 -07:00
Chris Robinson
e73c0979a1 Use "zero-copy" writes with pulseaudio playback 2020-03-26 22:50:54 -07:00
Chris Robinson
cc27bbb680 Clear the WASAPI device list when enumerating 2020-03-24 11:48:25 -07:00
Chris Robinson
62f17d8763 Don't send close messages for unopened WASAPI devices 2020-03-24 11:40:34 -07:00
Chris Robinson
9ce182228d Avoid some pre-C++14 workarounds 2020-03-22 08:51:06 -07:00
Chris Robinson
adf28d87aa Remove the check for stat()
It's POSIX-2001 standard
2020-03-21 08:39:45 -07:00
Chris Robinson
ad98895876 Avoid a function call to get the channel count 2020-03-18 04:08:26 -07:00
Chris Robinson
7805179313 Rename a method to be clearer 2020-03-18 03:17:14 -07:00
Chris Robinson
54e2eafcc9 Make the pulseaudio enumeration functions class methods 2020-03-18 03:07:54 -07:00
Chris Robinson
9f077d5f41 Remove a couple unused methods 2020-03-18 02:35:31 -07:00
Chris Robinson
accc1ec1c8 Add a helper to wait for the device mix 2020-03-03 20:32:44 -08:00
Chris Robinson
eb49290dab Remove unnecessary locks now that the mixer doesn't require one 2020-02-26 04:58:02 -08:00
Chris Robinson
6044e0d7ca Remove a couple unnecessary type aliases 2020-02-22 00:08:55 -08:00
Chris Robinson
af08f68448 Fix JACK process callback handling
The callback apparently can't be set after activation, but we can't allocate
the ring buffer until after activation when the callback is already getting
called. An ugly flag it is, then, I guess.
2020-01-12 07:48:11 -08:00
Chris Robinson
6f1c853397 Don't allocate the ring buffer for JACK before activation
It seems the JACK server can send buffer size change events during device reset
and wait on it, which causes a failure since the change event can't be
processed during a reset. It's otherwise impossible to safely disable the
change event callback during a reset since the lock is already held and the
callback can be waiting to acquire it. The only guarantee we seem to have is
the event callback won't be invoked after jack_activate succeeds.

So instead, the buffer size can be queried after jack_activate and the ring
buffer allocated then, instead of using an event callback. This does mean the
buffer size can change with a start() call, but it's better than a failure to
start.
2020-01-11 15:10:54 -08:00
Chris Robinson
e6e2f509f8 Make CreateRingBuffer a static RingBuffer method 2020-01-10 07:56:43 -08:00
Chris Robinson
16220be86e Make a duration type to handle WASAPI reference times 2019-12-22 22:05:47 -08:00
Chris Robinson
8807d373b0 Print the unhandled subformat 2019-12-22 16:38:52 -08:00
Chris Robinson
a671c02b0b Try harder to find a matching WASAPI configuration
As long as the lowest channel bits match the enabled bits for a given
configuration, higher bits from any extra channels can be ignored since they
can be skipped.
2019-12-22 02:52:50 -08:00
Chris Robinson
2e6a55a87c Handle padding between device sample frames
The padding must be constant and sample type aligned (e.g. some fixed multiple
of two bytes between the start of two consecutive frames for 16-bit output).
The intent is to always have the ability for stereo output with WASAPI even if
the device has some other unsupported configuration, as long as front-left and
front-right exist.
2019-12-21 20:43:46 -08:00
Chris Robinson
d37a294d4c Add a config option for custom ALSA capture devices 2019-10-27 19:20:26 -07:00
Chris Robinson
630d4d573d Gracefully drain the OpenSL capture buffer on disconnect 2019-10-10 13:33:27 -07:00
Chris Robinson
d2053e6784 Use one PulseAudio mainloop per device
To help avoid devices blocking on each other when handling asynchronous
messages.
2019-10-09 23:25:56 -07:00
Chris Robinson
8bf3da0cd2 Remove a useless prebuf check with PulseAudio 2019-10-09 09:45:02 -07:00
Chris Robinson
57cdac3368 Create the initial PulseAudio stream corked 2019-10-09 09:42:35 -07:00
Chris Robinson
404f3e2d08 Don't track the PulseAudio context state in devices 2019-10-09 05:01:30 -07:00
Chris Robinson
b687e952ef Make C callbacks noexcept
No telling what would happen if exceptions managed to get back into presumably
C-based callers.
2019-10-09 03:29:25 -07:00
Chris Robinson
a7c1245360 Use smart pointers for ALSA param handles
And simplify some related error handling
2019-10-09 02:16:08 -07:00
Chris Robinson
963580c2d5 Never return null from CreateRingBuffer
Allocation failure would already throw a bad_alloc anyway, now a size overflow
throws an exception too.
2019-10-08 21:55:03 -07:00
Chris Robinson
7726a06d26 Clean up some exception messages and avoid duplicate log messages 2019-10-08 05:44:38 -07:00
Chris Robinson
360330b2ad Define some simple wrapper methods inline 2019-10-08 03:41:49 -07:00
Chris Robinson
52a003e9bb Avoid raw lock/unlock calls 2019-10-07 23:22:06 -07:00
Chris Robinson
f0fa6c6baf Fix BackendVase typo 2019-10-07 22:42:54 -07:00
Chris Robinson
9b411cfcbe Reduce some indentation 2019-10-07 22:25:45 -07:00
Chris Robinson
02d80cd74d Use exceptions for backend open failures 2019-10-07 21:37:56 -07:00
Chris Robinson
4b746b8d37 Make MAX_RESAMPLER_PADDING specify the total padding 2019-09-28 14:35:42 -07:00
Chris Robinson
2d2e5539c0 Use FastBSinc24 for WASAPI and CoreAudio capture
Given a fixed rate, there's no downside to the fast version.
2019-09-28 03:44:13 -07:00
Chris Robinson
61ffa23e44 Fix a couple more conversion warnings 2019-09-22 21:27:10 -07:00
Chris Robinson
24db8a3f4b Make the resampler type an enum class 2019-09-22 21:19:19 -07:00
Chris Robinson
a092624ed3 Fix some Windows warnings 2019-09-18 18:20:11 -07:00
Chris Robinson
fcf850c1dd Clean up some more conversion warnings 2019-09-16 07:32:13 -07:00
Chris Robinson
bf2c865d39 Clean up some more shadowing warnings 2019-09-16 07:16:31 -07:00
Chris Robinson
e16e2269b6 Add a fallback if SLAndroidDataFormat_PCM_EX isn't available 2019-09-15 20:46:37 -07:00
Chris Robinson
47f0d301dc Make the BackendFactory base destructor protected 2019-09-15 10:22:56 -07:00
Chris Robinson
c5a3c52822 Return and pass more appropriate types for backends 2019-09-15 09:50:28 -07:00
Chris Robinson
4b8f78a8d6 Fix a few more GCC warnings 2019-09-14 19:42:54 -07:00
Chris Robinson
807d3b64ca Enable and fix more warnings 2019-09-14 18:35:23 -07:00
Chris Robinson
d75de6ee4d Don't hold the pulse lock while not necessary 2019-09-14 18:35:23 -07:00
Chris Robinson
2c348cecb6 Fix some more implicit conversions noted by GCC 2019-09-14 18:35:23 -07:00
Chris Robinson
532197a650 Clean up (most) implicit conversions in the backends 2019-09-14 12:44:35 -07:00