7958 Commits

Author SHA1 Message Date
Chris Robinson
a271484e7c Pass a span of pointers to the UHJ/SuperStereo decoder 2022-01-01 00:10:21 -08:00
Chris Robinson
1337f050dd Avoid a static-sized char array on the stack 2021-12-31 20:23:30 -08:00
Chris Robinson
ad9c2d77c8 Add a couple more methods to al::optional 2021-12-31 15:28:47 -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
f3aa08aad9 Make sure alffplay properly stops when quiting
The parser thread could be waiting on the threads to join after queueing all
packets, so it wouldn't see mQuit to flush the queue. So make a stop method
that forces a flush when setting mQuit.
2021-12-27 15:26:11 -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
21e2b9aeea Heavily update alffplay packet handling
Avoid deprecated use of raw AVPacket objects, and use a separate thread to send
packets than receives the decoded frames.
2021-12-26 21:24:56 -08:00
Chris Robinson
5381527303 Add the PipeWire config option to alsoft-config 2021-12-25 20:30:57 -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
6bb9912513 Fix non-runtime linking with pipewire 2021-12-25 16:12:10 -08:00
Chris Robinson
a45e02791d Remove unnecessary ifdefs from alffplay
We already assume OpenAL Soft's alext.h, which these are part of now.
2021-12-24 17:50:47 -08:00
Chris Robinson
0886d8efa7 Use the audio clock as the default in alffplay 2021-12-24 14:48:58 -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
a88803f21e Simplify and combine a couple macros 2021-12-18 05:19:22 -08:00
Chris Robinson
0a87828b41 Don't swallow up buffer callback samples when pausing 2021-12-18 03:59:32 -08:00
Chris Robinson
5bfa7c22fd Don't update voice sample histories when stopping/pausing
Since a voice pausing is on a fade-out, and will replay the same samples again
when restarting and fading in.
2021-12-18 03:45:19 -08:00
Chris Robinson
d5740589e5 Set the voice's ambisonic order for playing super stereo 2021-12-17 19:29: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
edea2b2a02 Rename Voice::mNumChannels for clarity 2021-12-15 14:28:26 -08:00
Chris Robinson
a051909c35 Add an option to use Super Stereo in alffplay 2021-12-15 02:54:15 -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
b489705b25 Minor UHJ coefficient scaling precision improvement 2021-12-13 01:09:53 -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
a75d35bbb0 Use a vector in BFormatDec instead of FlexArray
FlexArray would be better since it's not likely to use much memory for the
array, but the std::unique_ptr makes BFormatDec a non-standard layout, causing
GCC and Clang to complain.
2021-12-10 22:07:20 -08:00
Chris Robinson
c005d2c300 Remove unnecessary lines 2021-12-10 00:23:03 -08:00
Chris Robinson
a97dba6f41 Improve the 2-channel UHJ response
This attempts to correct for the differences needed for 2-channel UHJ's shelf
filters given the output shelf filters. It's far from ideal, but better than
nothing.
2021-12-09 22:00:35 -08:00
Chris Robinson
b72402d3e7 Add a function for Super Stereo conversions
a.k.a. Stereo Enhance. A common feature of UHJ decoders to take a plain
stereo signal and generate a B-Format signal with variable width control,
widening (or narrowing) the soundfield while maintaining a sharp central
image.
2021-12-09 21:19:36 -08:00
Chris Robinson
ff539242c6 GitHub CI still doesn't support libpipewire-0.3-dev 2021-12-08 19:06:39 -08:00
Chris Robinson
a8ea3cad22 Adjust the crossover frequency for HRTF ambisonic decoding 2021-12-08 18:17:16 -08:00
Chris Robinson
462a1d3ebd Build with PipeWire with Linux CI 2021-12-08 18:16:19 -08:00
Chris Robinson
ed7075f6b5 Update changelog 2021-12-06 23:09:31 -08:00
Chris Robinson
bfaa28af18 Don't clamp the distance with distance attenuation disabled 2021-11-30 22:55:17 -08:00
Chris Robinson
a73b64ce3c Slight update to the UHJ coefficients
The extended precision of the encoder's 0.6512*X term was guesswork, with no
real basis for it. Switch back to the original value until something better
actually comes up. Also updates the decoder to account for the change in the
encoder.
2021-11-28 05:39:35 -08:00
Chris Robinson
bd254c5426 Recognize PipeWire in alsoft-config 2021-11-26 03:05:05 -08:00
Chris Robinson
f1380d830a Avoid passing spans unnecessarily 2021-11-25 20:29:50 -08:00
Chris Robinson
c5831c92f3 Don't assume the UhjDecoder::decode offset is 16-byte aligned
It's not, it's MaxResamplerEdge which is currently 24.
2021-11-25 20:22:12 -08:00