59 Commits

Author SHA1 Message Date
Chris Robinson
de33f4968c Fix CoreAudio audio unit element values for capture 2022-05-02 05:17:22 -07:00
Chris Robinson
593966c8db Handle 3D7.1 as a separate channel configuration
It's treated as 5.1 + 2 aux channels. This allows AL_DIRECT_CHANNELS_SOFT to
behave better, not forwarding rear left/right channel inputs to lower front and
upper rear, and allows reporting a more appropriate output mode to the app
instead of 7.1.
2022-04-26 23:32:15 -07:00
Chris Robinson
357fb467fe Define the CoreAudio default name only when needed 2022-02-23 02:26:25 -08:00
Chris Robinson
29fba79cd5 Avoid 5.1Rear as its own channel configuration
It messes with 5.1 sources using direct channels, and the surround channels are
supposed to map to the side labels. Individual backends can deal with the
channel order/label differences, as they already do to a degree.
2021-07-30 07:38:26 -07:00
Chris Robinson
02a985e70a Set the CoreAudio stream according to the device channel format 2021-07-24 22:01:53 -07:00
Chris Robinson
fb2cb2bd06 Attempt to support capture enumeration with CoreAudio 2021-07-10 00:34:00 -07:00
Chris Robinson
10d782502a Use variables and types when they're defined 2021-07-09 21:25:13 -07:00
Chris Robinson
c8cfdf6ddf Don't define enumeration functions when they're not used 2021-07-09 18:54:23 -07:00
Chris Robinson
1c5a6ad92b Use a unique_ptr to hold raw byte memory 2021-06-21 03:54:49 -07:00
alexey.lysiuk
375838c473 Fix getting of device channel count in CoreAudio backend
AudioBufferList contains a variable length array of mNumberBuffers elements, so it should not be created with the default constructor like usual class instances.
Unfortunately, Apple developer site documentation is literally empty for this API. There is a bunch of comments in framework's header files.
Here is the correct usage of AudioBufferList pointer from Chromium: 008a1abc57/audio/mac/audio_manager_mac.cc (266)
There were occasional crashes because of memory corruption which was confirmed by address sanitizer
2021-06-21 13:24:45 +03:00
Chris Robinson
04a6e418d7 Fix some size types 2021-06-18 21:03:31 -07:00
Chris Robinson
a7d2e2974f Initial attempt at CoreAudio playback enumeration 2021-06-18 20:55:00 -07:00
HALX99
2516fdee66
Handle tvOS case 2021-05-13 19:05:47 +08:00
Chris Robinson
1195bba833 Add back a missing include 2021-04-27 19:46:33 -07:00
Chris Robinson
061148072f Update include headers
Don't add alc/ to the include paths.
2021-04-27 16:04:54 -07:00
Chris Robinson
581174ef98 Use the DeviceBase for the backend 2021-04-24 09:03:14 -07:00
Chris Robinson
519672c8e5 Move some more sources to core 2021-04-24 03:47:23 -07:00
Chris Robinson
e6c7cdc1ba Initialize the new audio unit before disposing the old one 2021-03-09 02:55:01 -08:00
Chris Robinson
730c964029 Allow calling BackendBase::open multiple times on playback devices
It will not be called while the device is running. If the first call succeeds,
a subsequent call that happens to fail must leave the existing device state as
it was so it can be resumed.

This is a rough first pass. It will fail when trying to re-open the same device
which can only be opened once (for instance, with direct hardware access, on
hardware that doesn't do its own mixing). Some backends won't guarantee the new
device is usable until the reset() or start() call.
2021-03-08 22:29:40 -08:00
Chris Robinson
eedc42890f Move alexcpt to core 2020-12-24 22:49:55 -08:00
Chris Robinson
6ae0115bf7 Avoid AL/ALC types in the backends 2020-12-17 23:21:45 -08:00
Chris Robinson
5edd5a11fc Don't use ALC error enums for the backend error code 2020-12-17 21:07:53 -08:00
Chris Robinson
4d1ac95ae2 Don't return an enum from captureSamples
It's always no_error
2020-12-17 03:06:52 -08:00
Chris Robinson
d578bc6cb1 Move logging to core 2020-12-17 02:47:03 -08:00
Chris Robinson
8750810f5c Change a couple macros into constexpr variables 2020-11-28 03:38:20 -08:00
Chris Robinson
28278a9c15 Fix a UInt32 variable type 2020-11-24 16:43:38 -08:00
Chris Robinson
f16692ecf8 Fill all buffers for CoreAudio playback 2020-11-24 14:47:04 -08:00
Chris Robinson
ba39c622ef Disable buffer allocation with CoreAudio capture 2020-11-24 14:44:13 -08:00
Chris Robinson
d08d6b18c4 Ceil the scaled buffer size instead of round
The result has to be large enough to get the original requested size from it.
2020-11-23 10:55:13 -08:00
Chris Robinson
d062c16629 Fix buffer offset for the second conversion 2020-11-23 10:43:20 -08:00
Chris Robinson
31c7eb5c55 Fix capture buffer size scaling in CoreAudio 2020-11-23 10:40:20 -08:00
Chris Robinson
5d82058da7 Use kAudioUnitScope_Global to get the maximum frame size 2020-11-23 10:11:28 -08:00
Chris Robinson
54afcbe113 Use clearer variable names 2020-11-20 22:02:20 -08:00
Chris Robinson
0024ea229b Don't try to override the CoreAudio maximum capture slice 2020-11-19 17:49:25 -08:00
Chris Robinson
aeb7170a8b Add missing include for the CoreAudio backend 2020-11-05 05:42:02 -08:00
Chris Robinson
e8b3e82f96 Change a couple functions into member functions 2020-08-07 06:22:39 -07:00
Chris Robinson
6ce9bf6c94 Move a couple related functions to the backend base 2020-06-12 12:53:47 -07:00
Chris Robinson
4094135ed7 Don't return a bool from the backend start method 2020-04-28 19:25:58 -07:00
Chris Robinson
02d7fbfa0c Use standard attribute declarations 2020-04-13 23:27:56 -07:00
Chris Robinson
662d77159b Get rid of a redundant enum 2020-03-30 16:00:02 -07:00
Chris Robinson
f2ddf971df Return the enumerated device names from the backend
Rather than using an out parameter.
2020-03-30 15:37:41 -07: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
e6e2f509f8 Make CreateRingBuffer a static RingBuffer method 2020-01-10 07:56:43 -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
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
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
52a003e9bb Avoid raw lock/unlock calls 2019-10-07 23:22:06 -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