236 Commits

Author SHA1 Message Date
Chris Robinson
f1a970e680 Trace the device format after starting playback
Some devices can change it when starting, so it's useful to know what the
device configuration is when that happens.
2021-12-27 14:23:31 -08:00
Chris Robinson
bcd40861f7 Increase the priority of the PipeWire backend 2021-12-25 19:47:09 -08:00
Chris Robinson
0af1b5f721 Don't do direct channels with UHJ output
Directly mixing a non-UHJ stereo signal into a UHJ stereo signal results in a
non-UHJ stereo signal. Such a mix can't be properly decoded anymore.

An option can probably be added for users that intend to listen to UHJ output
undecoded and let a stereo sound come through as-is on their speakers, but it
probably shouldn't be the default for cases where the output may be decoded
back.
2021-12-21 08:18:07 -08:00
Chris Robinson
633c332dee Work around a MinGW thread_local bug
MinGW-w64 generates bad code when accessing extern thread_local objects.
Wrapper functions are used to ensure it only accesses them from the same place
they're defined. This unfortunately adds a bit of overhead for what should be a
relatively simple thing.

These functions are inlined for non-MinGW targets, avoiding the overhead on
non-affected targets.
2021-12-20 10:27:39 -08:00
Chris Robinson
d16b61dffb Move the effects base and effectslot to core 2021-12-17 17:13:59 -08:00
Chris Robinson
c9537abfb1 Allocate voice properties in clusters 2021-12-17 04:07:00 -08:00
Chris Robinson
54c4bea487 Add source properties for Super Stereo
When playing a stereo format, enabling Super Stereo causes the source to behave
as a B-Format source, with a variable width control.
2021-12-15 02:01:22 -08:00
Chris Robinson
5e3fcb3a93 Avoid initializing the NFC filter for every voice channel
It can be initialized once with the device's speaker distance since it won't
change in between resets, then copied into the voice where it can be adjusted
as needed.
2021-12-11 21:42:34 -08:00
Chris Robinson
08a4e8a6b2 Return true from alcReopenDeviceSOFT if the new device opened 2021-11-21 23:22:04 -08:00
Chris Robinson
0c99a6b316 Make the backend pointer part of ALCdevice instead of DeviceBase 2021-11-19 20:04:10 -08:00
Chris Robinson
6e2c1b8431 Consolidate some variable state 2021-11-17 19:08:22 -08:00
Chris Robinson
b43fd6dca7 Always lock the device state when querying device attributes 2021-11-16 16:44:58 -08:00
Chris Robinson
e3168c9112 Add an extension to request stereo UHJ output 2021-11-08 16:56:05 -08:00
Chris Robinson
49a36334bd Use a tri-state optional for the stereo output mode 2021-10-24 11:51:39 -07:00
Chris Robinson
096bed35fa Pass a parameter to aluInitRenderer to specify UHJ output 2021-10-23 11:37:46 -07:00
Chris Robinson
d0e5e138e2 Use a flag to indicate headphone-like output 2021-10-23 07:51:06 -07:00
Chris Robinson
3154684f97 Reduce the JACK and ALSA backend priority
With the increased use of PipeWire, which offers JACK compatibility, the JACK
backend has a higher potential to be auto-selected for users. However, due to
the backend's inability to auto-configure output to the device format, this
creates a less optimal out-of-the-box experience.

Unfortunately this also means the JACK backend won't be used automatically when
a real JACK server is running along with PulseAudio. While not ideal, this is
probably the better of the two options, to have the user explicitly configure
the library to use JACK when they really want to use it, instead of unwantingly
selecting JACK because of PipeWire.
2021-08-14 20:14:12 -07:00
Chris Robinson
dc9b39f419 Implement PipeWire playback
Not yet an auto-selected backend. This doesn't yet support enumeration, or
matching the AL device format to the output.
2021-08-06 21:38:23 -07:00
Chris Robinson
4cc820bb5c Start a PipeWire backend
It's just a copy of the Null backend to start with
2021-08-02 21:03:18 -07:00
Chris Robinson
0a0849db99 Use an optional bool instead of two tri-state enums 2021-07-31 14:24:49 -07: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
9a7bca1116 Add wrapper methods for getting device config values 2021-06-23 10:45:24 -07:00
Chris Robinson
d28cf80b6f Allow querying ALC_ALL_DEVICES_SPECIFIER from loopback devices
They only return the default/driver name, since loopback devices don't have a
canonical name.
2021-06-22 03:25:31 -07:00
Chris Robinson
e3c0b60cc6 Rename alcontext.h and move some functions to context.cpp 2021-04-27 19:04:45 -07:00
Chris Robinson
3d8e705107 Move some functions to a more appropriate place 2021-04-27 17:01:27 -07:00
Chris Robinson
06dcfc3fcf Rename alcmain.h to device.h 2021-04-27 16:40:22 -07:00
Chris Robinson
ff380298e4 Move BufferStorage and Voice to core 2021-04-27 08:26:42 -07:00
Chris Robinson
99157f149f Move ContextBase and VoiceChange to core 2021-04-27 08:04:09 -07:00
Chris Robinson
26c8c50c26 Partially implement an extension to hold sources on disconnect
Rather than stopping voices/sources when the device becomes disconnected, the
context can be set to leave them alone. As a consequence, their state will
remain as playing and they'll keep their last known sample offset indefinately.
For applications mindful of this behavior, it will allow resetting or reopening
the device to reconnect and automatically resume where it left off.
2021-04-26 20:25:24 -07:00
Chris Robinson
2479483645 Move bformatdec to core 2021-04-25 18:08:08 -07:00
Chris Robinson
8d09d03ed3 Move async_event.h to core 2021-04-25 14:29:21 -07:00
Chris Robinson
9b65ca4556 More include cleanup 2021-04-24 15:52:53 -07:00
Chris Robinson
fc7d55be4b Don't bother with al string types 2021-04-24 11:50:49 -07:00
Chris Robinson
6d5dfbd09b Move the DeviceBase declaraction to core 2021-04-24 10:46:32 -07:00
Chris Robinson
b54bb388a3 Create a base the ALCdevice and ALCcontext structs
A base that contains the API-agnostic data, with ALCdevice and ALCcontext being
for AL-specific data.
2021-04-24 08:28:13 -07:00
Chris Robinson
65b85f7cb9 Move hrtf.cpp/h to core 2021-04-22 10:26:20 -07:00
Chris Robinson
d6d6fd7378 Avoid using config methods in hrtf.cpp 2021-04-22 10:13:49 -07:00
Chris Robinson
d2f587ee23 Move helpers.cpp to core 2021-04-22 03:15:26 -07:00
Chris Robinson
f0154c4366 Move declarations to a more appropriate header 2021-04-22 03:00:05 -07:00
Chris Robinson
8f8e9aa913 Print an error when starting the backend fails 2021-04-20 22:03:56 -07:00
Chris Robinson
37730927ef Lower RLIMIT_RTTIME to allow RTKit to give RT priority 2021-04-20 07:35:42 -07:00
Chris Robinson
29cf7ebb75 Make an inverted atomic flag type and use it
The inverted atomic flag replaces test_and_set+clear with test_and_clear+set,
essentially inverting the flag status. This makes more logical sense for
flagging dirty state, which is less confusing than flagging clean state. The
one caveat is ATOMIC_FLAG_INIT (or default construction in C++20) initializes
the state to true rather than false.
2021-04-15 15:17:04 -07:00
Chris Robinson
f8299c60ec Log the reset exception error 2021-04-07 16:17:03 -07:00
Chris Robinson
a2c45f8928 Advertise the in-progress AL_SOFT_UHJ extension 2021-04-01 08:20:47 -07:00
Chris Robinson
c6dbc487b3 Rename Uhj2Encoder to UhjEncoder 2021-04-01 05:37:54 -07:00
Chris Robinson
051d6fb243 Combine some duplicate code 2021-03-30 07:04:06 -07:00
Chris Robinson
8ab5e5dba2 Move the UHJ phase shifter to a common header 2021-03-28 06:09:11 -07:00
Chris Robinson
063da94bd8 Load/convert samples from all channels at once for mixing
This uses a bit more memory (each voice needs to hold buffers for the
deinterleaved samples of each channel, instead of just one buffer for the
current channel being mixed on the device), but it will allow for handling
formats that need or prefer their channels decoded together.
2021-03-19 23:15:27 -07:00
Chris Robinson
ca0a6024a3 Avoid shadowing variable names 2021-03-11 04:59:58 -08:00
Chris Robinson
e43bbbd3b8 Declare the attribute counts closer to where they are 2021-03-10 02:46:01 -08:00