1004 Commits

Author SHA1 Message Date
Chris Robinson
481b115b96 Add an ambi-format option for ACN ordering and FuMa scaling 2022-01-12 03:25:59 -08:00
Chris Robinson
5ec7d8cf96 Use a different output matrix for late reverb
This is a slightly reoriented tetrahedron, with responses on the front-left and
front-right, along with upper-back and lower-back. This is a alternative matrix
suggested for converting the A-Format late reverb lines back to B-Format.

Also alter the matrix scaling to be less destructive. x0.5 is just reducing the
floating-point exponent by 1, whereas the previous values would be more likely
to introduce rounding errors just from scaling.
2022-01-11 01:51:12 -08:00
Chris Robinson
43ec687ee9 Add a third-order ambisonic decoder for HRTF
Using the 20-channel dodecahedron, seems to be good enough to handle 16-channel
third-order ambisonics.
2022-01-05 20:32:03 -08:00
Chris Robinson
c77fd6540c Update the HRTF second-order ambisonic decoder
This only needs 14 virtual channels instead of 20.
2022-01-04 19:27:29 -08:00
Chris Robinson
1337f050dd Avoid a static-sized char array on the stack 2021-12-31 20:23:30 -08:00
Chris Robinson
2750571411 Avoid some unnecessary copying 2021-12-31 13:23:10 -08:00
Chris Robinson
e7d312c404 Some more restructuring of the PipeWire backend 2021-12-30 21:35:55 -08:00
Chris Robinson
7c4d263406 Set the node rate for the pipewire capture stream too 2021-12-29 07:51:15 -08:00
Chris Robinson
5f4690a1b0 Move some constexpr variables to where they're used 2021-12-28 21:12:38 -08:00
Chris Robinson
f484782238 C++-ize the PipeWire backend some more
Use unique_ptrs for a few more types to avoid explicit free calls.

Move ThreadMainloop::wait to the unique_lock wrapper that's holding the lock.
Since the mainloop acts as both a lock and condition_variable, passing the lock
to the wait method makes no sense. Also have it optionally take a predicate
functor to dictate when to stop waiting.
2021-12-28 18:53:46 -08:00
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
305201252e Check for audio devices when initializing PipeWire
This isn't great since it can fail when PipeWire is handling audio but no
devices are available at initialization, causing the Pulseaudio or ALSA backend
to be selected instead. Future versions of PipeWire are expected to have a
better way to detect if it's handling audio, but for now this is better than
nothing.

A config option is available for users to have the PipeWire backend be usable
even with no devices at initialization, just in case.
2021-12-25 19:34:12 -08:00
Chris Robinson
f1aa10ff0b Use a bitset instead of a plain uint for flags 2021-12-23 13:43:10 -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
cbbc4dc8fa Move some more context functions to the proper source 2021-12-17 17:34:03 -08:00
Chris Robinson
d16b61dffb Move the effects base and effectslot to core 2021-12-17 17:13:59 -08:00
Chris Robinson
fbc42aad7e Move some ContextBase function definitions to the right place 2021-12-17 04:25:46 -08:00
Chris Robinson
3ed913f6dd Remove an unnecessary parameter 2021-12-17 04:14:39 -08:00
Chris Robinson
c9537abfb1 Allocate voice properties in clusters 2021-12-17 04:07:00 -08:00
Chris Robinson
21bdea776a Set the PipeWire stream rate
When requesting a non-default rate, this may allow the hardware to run at the
requested rate.
2021-12-16 13:03:13 -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
953745d386 Make an inline function to check for 2D ambisonic formats 2021-12-12 15:53:53 -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
01dd34f305 Add an internal Super Stereo format
It's not available as an AL buffer format (yet) since I'm not sure how to
expose it. Internally it seems fine as a separate channel configuration, but
because OpenAL combines the channel configuration and sample type, a flag may
work better there.
2021-12-11 17:50:24 -08:00
Chris Robinson
a8ea3cad22 Adjust the crossover frequency for HRTF ambisonic decoding 2021-12-08 18:17:16 -08:00
Chris Robinson
bfaa28af18 Don't clamp the distance with distance attenuation disabled 2021-11-30 22:55:17 -08:00
Chris Robinson
f1380d830a Avoid passing spans unnecessarily 2021-11-25 20:29:50 -08:00
Chris Robinson
08a4e8a6b2 Return true from alcReopenDeviceSOFT if the new device opened 2021-11-21 23:22:04 -08:00
Chris Robinson
834800c817 Downgrade some ERRs to WARNs 2021-11-21 20:29:20 -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
7062de0337 Handle SPA_CHOICE_None for sample rates from PipeWire 2021-11-14 12:47:06 -08:00
Chris Robinson
eac427dff7 Report unexpected types for the sample rate from PipeWire 2021-11-14 11:43:33 -08:00
Chris Robinson
cf85ffd22f Support "enum" choices for sample rates with PipeWire 2021-11-14 05:58:39 -08:00
Chris Robinson
bbff1efa2a Update some in-progress extension types 2021-11-10 01:21:49 -08:00
Chris Robinson
e3168c9112 Add an extension to request stereo UHJ output 2021-11-08 16:56:05 -08:00
Chris Robinson
b81fa0dc90 Don't trace unused metadata properties and node types
As useful as it may sometimes be to see what's being provided, at least under
kwin_wayland a not-insignificant number of video-related nodes and metadata
properties are sent through normal use of the system (most notably when
hovering over the taskbar to see window thumbnails).
2021-10-26 09:40:10 -07:00
Chris Robinson
4de789ba68 Don't change the requested format when it's usable with WASAPI 2021-10-25 06:37:48 -07: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
1a448b2e92 Fix a double-release 2021-10-23 07:57:17 -07:00
Chris Robinson
d0e5e138e2 Use a flag to indicate headphone-like output 2021-10-23 07:51:06 -07:00
Chris Robinson
0e93fc53f4 Don't reset the ambisonic layout and scale with stereo output 2021-10-23 05:48:47 -07:00
Chris Robinson
d5dc2828bf Don't pass the whole decoder to InitDistanceComp 2021-10-23 03:57:49 -07:00
Chris Robinson
aa92c6c0a8 Fix the ambisonic scaling used by custom decoders 2021-10-23 03:24:51 -07:00
Chris Robinson
f963a2c543 Remove some lingering mentions of surround51rear 2021-10-21 07:38:57 -07:00
Chris Robinson
15827b2887 Don't declare functions outside of where they're used 2021-10-21 06:03:37 -07:00