1028 Commits

Author SHA1 Message Date
Chris Robinson
843cff0537 Hold mPropLock when deferring updates 2022-02-08 09:39:02 -08:00
Chris Robinson
370f862392 Inline ALCcontext::has_eax 2022-02-08 09:29:00 -08:00
Chris Robinson
98fc1cd97d More accurately detect the EAX speaker config 2022-02-08 08:33:01 -08:00
Chris Robinson
be80e49f1b DisabledEffects won't change so EAX can just check it once 2022-02-08 08:21:06 -08:00
Boris I. Bendovsky
d420776808
EAX various fixes (#657)
* [EAX] Fix effect GUID validation

Only NULL and REVERB was valid.

* [EAX] Fix default FX slot flags

EAX4 and EAX5 both sets to ENVIRONMENT.

* [EAX] Set default values for legacy FX slots in the initialization

* [EAX] Fix FX slot locking policy

Fail on attempt to load an effect or change a lock for EAX4 "set" call.
Unlock legacy FX slots on any EAX5 call.

* [EAX] Allow DEFER flag for "get" calls.

* [EAX] Make speaker configuration read-only

* [EAX] Initialize speaker configuration

* [EAX] Commit EAX source on a 3D source parameter call

Reference: EAX 4.0 Programmer's Guide

* [EAX] Commit EAX source on a 3D listener parameter call

Reference: EAX 4.0 Programmer's Guide

* [EAX] Commit source when it begins to play

Reference: EAX 4.0 Programmer's Guide
2022-02-08 08:20:46 -08:00
Chris Robinson
f23c7fe8ba Avoid a proxy ALfilter object for EAX source properties 2022-02-07 13:53:57 -08:00
Chris Robinson
b09aab8426 Don't pass an ALeffect to ALeffectslot::initEffect 2022-02-07 08:47:55 -08:00
Chris Robinson
f63594d027 Avoid a magic number 2022-02-01 04:04:24 -08:00
Chris Robinson
1c9f791e4f Rename Sqrt1_2 for consistency 2022-02-01 04:04:24 -08:00
Boris I. Bendovsky
195ae4b1d2
[EAX] Add primary extension name for EAX v2.0 (#653) 2022-02-01 04:03:33 -08:00
Chris Robinson
816bd8ab30 Move ALSOFT_EAX definition to config.h
And disable it by default for non-Windows targets
2022-01-30 05:42:44 -08:00
Boris I. Bendovsky
19ed994dc3
Add EAX extensions (EAX 2.0-5.0, X-RAM) (#632)
* Add EAX extensions (EAX 2.0-5.0, X-RAM)

* Comment out C++17 leftovers

* Remove everything related to patching

* Update alsoftrc.sample

* Rewrite integration

* Fix GCC compilation under Linux

* Always reset EAX effect properties when loading it into FX slot
2022-01-30 04:47:32 -08:00
Chris Robinson
619249371a Remove math_defs.h 2022-01-27 04:04:41 -08:00
Chris Robinson
f8ac1ffe80 Get rid of MathDefs 2022-01-27 02:59:07 -08:00
Chris Robinson
1bbea9cd30 Start and use a standard-like numbers header 2022-01-27 01:38:39 -08:00
Chris Robinson
4c322e186e Add some common wrapper methods to ThreadMainloop 2022-01-26 17:02:33 -08:00
Chris Robinson
0409180bb5 Default the PipeWire lock's operator= instead of using the base 2022-01-26 15:07:54 -08:00
Chris Robinson
537aa2f442 Handle 5.1 using rear channels with PulseAudio and PipeWire 2022-01-25 21:18:39 -08:00
Chris Robinson
4967c7f93c Move some definitions to where they're used 2022-01-24 21:57:08 -08:00
Chris Robinson
3a02ba32e8 Avoid a messy while loop to remove from a vector 2022-01-22 23:18:19 -08:00
Chris Robinson
5d6a2d0433 Restructure the PipeWire backend code a bit
Make some functions into class member functions, and move related declarations
closer together.
2022-01-22 22:27:07 -08:00
Chris Robinson
c28ae87bb4 Avoid holding a pw_proxy, hold the type it represents 2022-01-22 20:08:59 -08:00
Chris Robinson
d48042adea Handle duplex devices with PipeWire 2022-01-22 11:07:38 -08:00
Chris Robinson
561f50b3a3 Load the PipeWire real-time configuration
This is apparently needed to ensure RT threads get RT priority, separately from
requesting RT processing.
2022-01-17 17:16:58 -08:00
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