Commit Graph

8196 Commits (master)

Author SHA1 Message Date
Chris Robinson f2ff2bb2f6 Use the difference in HF scale for upsampling ambisonics 2022-09-03 21:06:39 -07:00
Chris Robinson d2a2a696a1 Update the second-order upsampler HF scale 2022-09-02 09:44:01 -07:00
Chris Robinson e5c49d019f Revert "Don't apply the HF scaling for "upsampling" ambisonics"
This reverts commit bf3f63fb4c.
2022-09-02 09:41:19 -07:00
Chris Robinson 02cf2bde7b Use an icosahedron for 3D second-order 2022-09-01 15:04:58 -07:00
Chris Robinson bf3f63fb4c Don't apply the HF scaling for "upsampling" ambisonics
Not sure if this is best, but it fixes the issue of upsampling lower orders to
higher orders multiple times (mixing lower order to higher order, cutting back
to lower order by dropping the extra channels, then upsampling again, applying
the HF scale multiple times and messing up the high frequencies/energy vector),
as well as having too-strong high frequencies of upsampled content in general.

As it is, with the new upsampling method, the lower order signal contributes to
some higher order channels, which helps offset the high frequency scaling
difference (except first- to second-order, which adds nothing).
2022-08-31 09:06:53 -07:00
Chris Robinson 042c3d4a42 Use a more precise 3D7.1 decoder 2022-08-30 08:00:55 -07:00
Chris Robinson c9fbb359df Use predefined variables to handle 1/sqrt(3) 2022-08-30 07:33:50 -07:00
Chris Robinson 1c49b7a1c6 Do a simplified update for reverb when not fading 2022-08-29 22:32:49 -07:00
Chris Robinson 42aab714a1 Always fade the main early and late delay taps
These were actually missing from the current check for fading. But the EFX
documentation suggests these (along with the early/late gain and panning) can
be adjusted often without invoking a full change, as dynamically modeling an
environment would continually change these properties as the listener moves
around (changing the direction and distance to the reflective surfaces). So
ensuring they're kept up-to-date would be the way to go.
2022-08-29 07:03:09 -07:00
Chris Robinson 56d7e09cc7 Update reverb processing
Separate the core delay line into early and late input delay lines. This will
be necessary to allow a second late reverb processing loop to decay after a
change.

Also ensure the early reflection delay line is long enough to write in
MAX_UPDATE_SAMPLES first without interfering with the subsequent read. And
ensure the modulation delay doesn't cause an underflow on the feedback offset.

Finally, move the loop inside the processing functions to minimize loop
iterations.
2022-08-29 06:10:15 -07:00
Chris Robinson 524f254c3a Use a bind statement instead of a lambda 2022-08-29 01:12:09 -07:00
Chris Robinson 84134d7399 Allow the remix tables to be variable length 2022-08-28 06:11:40 -07:00
Chris Robinson 057a350c1e More updates for making an OSX framework 2022-08-28 04:36:15 -07:00
Chris Robinson 6e94db2401 Fix OSX framework versions 2022-08-28 03:28:55 -07:00
Chris Robinson 0891f1342d Upsample the reverb output as needed 2022-08-27 21:04:51 -07:00
Chris Robinson b8d73a226a Add a 2D fourth-order upsampler
This will be necessary for 2D fourth-order sources with 3D fourth-order output.
2022-08-27 03:43:33 -07:00
Chris Robinson 0ae6955f1c Fix variable name 2022-08-26 02:01:28 -07:00
Chris Robinson 35d7fca52c Don't mark a non-constexpr-able function as constexpr
It can't be constexpr because it needs write access to an std::array, and
because of std::sqrt.
2022-08-26 01:34:04 -07:00
Chris Robinson 1a99ac48f6 Simplify calculating the ambisonic rotator coefficients 2022-08-26 00:49:25 -07:00
Chris Robinson 1ee81ab3f0 Fix W input mixing when non-0 coverage
When upsampling certain ambisonic formats, the W channel may contribute to
other output channels even with full coverage. Make sure they're taken into
account.
2022-08-26 00:11:50 -07:00
Chris Robinson e48c294a69 Create and use 2D upsampling matrices 2022-08-25 23:22:45 -07:00
Chris Robinson 298318bd8a Apply the upsampler before rotation
Although this will necessitate applying a full device-order rotation for all
ambisonic sources, it should be slightly better since it's effectively rotated
after being mixed to higher order. This will also allow using more optimized
upsamplers for 2D ambisonic sources vs 3D (while still allowing the sources to
be rotated in 3D).
2022-08-25 19:56:00 -07:00
Chris Robinson 415815cff7 Don't include the full path for frameworks to link 2022-08-21 17:47:56 -07:00
Chris Robinson 6815926cc5 Update alffplay to support newer ffmpeg versions 2022-08-20 20:59:15 -07:00
Chris Robinson df33746571 Create a proper third-order upsampler matrix
This is just an identity matrix for now, since with third-order mixing, it
results in a matrix being multiplied with it's inverse.
2022-08-19 14:08:29 -07:00
Chris Robinson 1482f0b23d Skip LFE for aux send gains with Direct Channels 2022-08-18 20:40:45 -07:00
Chris Robinson dff86eb783 Fix the channel spread for aux send gains with full HRTF 2022-08-18 20:38:49 -07:00
Chris Robinson ed9408e537 Inline and precompute some CalcDirectionCoeffs calls 2022-08-18 20:37:19 -07:00
Chris Robinson 4f75f9258c Avoid duplicate code 2022-08-18 18:44:37 -07:00
Rosen Penev 2f3acdff4a
rtkit: match includes with code (#752)
These headers are used for __gettid. Match the if with the code.

Fixes compilation under MinGW.

Signed-off-by: Rosen Penev <rosenp@gmail.com>

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2022-08-18 18:44:09 -07:00
Chris Robinson 07928fbb64 Fix the ringbuffer write size 2022-08-18 11:52:59 -07:00
Chris Robinson 19d35a45d7 Use an intermediate buffer for writing to the ringbuffer
It doesn't seem as though AudioUnitRender likes being given two buffers to
render/capture samples into segmented memory.
2022-08-18 10:32:59 -07:00
Chris Robinson 4115df49cf Pass the action flags to AudioUnitRender from the callback 2022-08-17 03:56:53 -07:00
Chris Robinson 90f02176dd Inline a function and remove an unnecessary parameter 2022-08-16 13:00:03 -07:00
Chris Robinson 832ccd7f48 Pass the bus number to AudioUnitRender from the callback 2022-08-16 12:57:21 -07:00
Chris Robinson 82c5b741e5 Use proper array sizes for more gains 2022-08-15 12:56:36 -07:00
Chris Robinson f9e6fbaeff Use amplitude-matching HF scaling for non-FOA HRTF output 2022-08-15 12:54:34 -07:00
Chris Robinson e805c62152 Use the proper type for a global definition
Some compilers don't seem to like auto deduction for defining a declared
variable.
2022-08-15 09:39:45 -07:00
Chris Robinson a8491ae513 Update in incorrect comment 2022-08-15 09:09:52 -07:00
Chris Robinson 6d5580805e Use a decode-encode method for ambisonic upsampling
This should allow for clearer and less diffuse responses. While a cube is in
the blindspots for second-order, resulting in an identify transform for first-
to-second-order, they do start contributing to third-order channels, which
should make for sharper virtual points. The fixed HF scales should also play
nicer with larger order upmixes.
2022-08-15 09:01:03 -07:00
Chris Robinson fbfa8a2686 Use the right array size for the mixing parameters 2022-08-14 10:07:32 -07:00
Chris Robinson 4f346caea3 Update some arrays in preparation for fourth order support 2022-08-14 00:56:38 -07:00
Chris Robinson 5f6b7f9166 Update the default HRTF
The sample rate is now 48khz to match the library's default sample rate, and
increased the FIR length to 64 points from 32.
2022-08-13 22:51:47 -07:00
Chris Robinson dd3f03c148 Move a member variable to the struct it's needed 2022-08-09 22:19:11 -07:00
Chris Robinson 63a82feae6 Rename the UHJ filter config option 2022-08-09 04:01:31 -07:00
Chris Robinson 7e5dd41968 Add an option for higher quality UHJ filters 2022-08-08 03:44:25 -07:00
Chris Robinson 250f162496 Parameterize the UHJ filter length 2022-08-07 13:09:12 -07:00
Chris Robinson b77a556d7b Clear the buffer from X-RAM before updating its size 2022-08-05 12:11:02 -07:00
Chris Robinson 9d296a9c75 Avoid putting a 1KB array on the stack 2022-08-02 23:29:21 -07:00
Chris Robinson b286e6497f Rework multi-channel source radius handling
Rather than applying the calculated spread to each virtual channel, the spread
indicates how much the virtual channels surround the listener. At full spread,
the channels retain their virtual speaker positions, while at no spread, all
channels converge on the source position. This behavior is more consistent with
B-Format sources.
2022-08-02 18:26:49 -07:00