73 Commits

Author SHA1 Message Date
Chris Robinson
d2664e2192 Remove a duplicate index array 2019-02-24 18:00:49 -08:00
Chris Robinson
317206e8f3 Remove the FOAOut mixing buffer and associated post-processes 2019-02-22 22:35:37 -08:00
Chris Robinson
8ac2d34706 Allow processing some effects in higher order ambisonics
Reverb notably is still only first-order (any higher order channels are
dropped, and it writes to FOAOut). But others, like the equalizer, work on all
available channels.
2019-02-21 04:23:01 -08:00
Chris Robinson
a964890537 Add helpers to get the channel count from an ambisonic order 2019-02-21 04:05:49 -08:00
Chris Robinson
615446d6d5 Ensure the device's mAmbiOrder is always set appropriately
The Dry target is always ambisonic, so set its order correctly.
2019-02-21 01:23:11 -08:00
Chris Robinson
c43381d811 Allocate the effect slot wet buffer dynamically 2019-02-20 21:01:08 -08:00
Chris Robinson
194fcb6bb7 Rename MAX_AMBI_COEFFS and MAX_AMBI2D_COEFFS 2019-02-19 15:39:33 -08:00
Chris Robinson
d713f5f828 Clean up some AmbiUpsampler initialization 2019-02-19 01:59:30 -08:00
Chris Robinson
2d93a9cdb1 Collect HRTF field info into a struct 2019-01-28 20:43:34 -08:00
Chris Robinson
98be1d1bf5 Make IncRef and DecRef member functions 2019-01-24 10:05:37 -08:00
Filip Gawin
4169c6f37d Use c++ headers 2019-01-09 19:42:40 +01:00
Chris Robinson
673983dc5d Make Create methods for structs with flexible array members ...
... that are used with unique_ptr.
2019-01-08 23:44:08 -08:00
Chris Robinson
bc1eeb5df0 Avoid calling unique_ptr::reset with a raw pointer 2019-01-08 23:15:58 -08:00
Filip Gawin
0d3a0635d9 Avoid using old style casts
To think about:
examples/alffplay.cpp:600
OpenAL32/Include/alMain.h:295
2019-01-08 19:42:44 +01:00
Chris Robinson
fababe76c4 Don't use the dual-band upsampler for basic ambisonic decoding 2019-01-06 17:45:44 -08:00
Chris Robinson
da3a916042 Replace macros with constexpr inline functions 2019-01-06 04:16:51 -08:00
Chris Robinson
3b91010e21 Pass the normalized crossover frequency to the reset method 2019-01-05 22:31:13 -08:00
Chris Robinson
3f35fcc4b5 Simplify MixParams and AmbiUpsampler
Since the dry buffer is always an ambisonic target now
2019-01-05 21:59:04 -08:00
Chris Robinson
cff20c2fe8 Use BFormatDec for custom and built-in ambisonic decoding 2019-01-05 19:21:25 -08:00
Chris Robinson
2f1566e0b4 Add and use a make_unique function 2019-01-01 14:33:01 -08:00
Chris Robinson
fbae41020d Remove extraneous typedef, struct, and enum keywords 2018-12-24 19:29:01 -08:00
Chris Robinson
3fe38fed7c Mix effect slot output to the effect target if it's set 2018-12-23 08:51:28 -08:00
Chris Robinson
87724db6e3 Rename a couple HRTF structs 2018-12-22 09:20:50 -08:00
Chris Robinson
3553ce1f67 Don't convert the HRTF decoder virtual speaker positions to radians 2018-12-21 08:55:22 -08:00
Chris Robinson
b785d80526 Use a dodecahedron for the ambisonic HRTF decode
Also uses full second-order for "basic" HRTF rendering. Note that the supplied
matrix is full third-order, but only the first- and second-order coefficients
are used. The base matrices are the identical, only differing by the high-
frequency scalars.
2018-12-21 06:32:18 -08:00
Chris Robinson
7744e4ff72 Pass RealMixParams by reference instead of pointer 2018-12-20 13:26:39 -08:00
Chris Robinson
49ac268334 Add index maps from 2D and 3D 2018-12-20 04:19:35 -08:00
Chris Robinson
8d3f7651c9 Use std::array in place of some C-style arrays 2018-12-20 03:26:46 -08:00
Chris Robinson
d18140391a Rename some conversion arrays 2018-12-20 02:46:59 -08:00
Chris Robinson
0214a11024 Use inline methods for the device format sizes 2018-12-19 05:57:36 -08:00
Chris Robinson
5243516149 Use the AmbiUpsampler with higher order basic and custom panning
Also allocate the BFormatDec and AmbiUpsampler where they're (re)set.
2018-12-17 07:29:55 -08:00
Chris Robinson
3b0fd20bee Always use the transcode method with the AmbiUpsampler 2018-12-16 21:03:24 -08:00
Chris Robinson
741861eaa6 Put the ACN index map in a header
Also put it and the Ambisonic scales in a more appropriate header.
2018-12-15 23:28:49 -08:00
Chris Robinson
a6a5634adb Reorder some math terms to help optimizations
Because floating-point math is not associative ((a*b)*c does not necessarily
give the same result as a*(b*c)), the ordering of terms can inhibit reuse of
temporary values. For example, both

coeffs[9]  =  2.091650066f * y * (3.0f*x*x - y*y);
and
coeffs[15] =  2.091650066f * x * (x*x - 3.0f*y*y);

contain x*x and y*y terms that could be calculated once, stored in temporary
registers, and reused to multiply with 3. But since 3.0f*(x*x) would produce
different results, the compiler is not allowed to make that optimization. If,
however, the multiply with 3 is moved to the right side:

coeffs[9]  =  2.091650066f * y * (x*x*3.0f - y*y);
and
coeffs[15] =  2.091650066f * x * (x*x - y*y*3.0f);

in both cases x*x and y*y are calculated first in their respective groups,
guaranteeing the same results for both instances prior to the multiply with 3
and allowing the compiler to reuse those intermediate values.
2018-12-15 20:28:52 -08:00
Chris Robinson
dea077cbae Add encoding calculations for fourth-order ambisonics 2018-12-15 19:23:42 -08:00
Chris Robinson
0dd13a9dfe Make the AmbDec speaker and matrix arrays dynamic 2018-12-15 02:56:19 -08:00
Chris Robinson
4d36730baa Clean up panning.cpp a bit 2018-12-15 00:38:38 -08:00
Chris Robinson
2d13e0af29 Add macros for the ambisonic order masks 2018-12-14 23:26:44 -08:00
Chris Robinson
b779ebb512 Fix some MSVC conversion warnings 2018-12-12 21:18:31 -08:00
Chris Robinson
0d36ba0fbb Use helpers to get the Ambisonic scales and layout maps 2018-12-10 22:35:32 -08:00
Chris Robinson
e87eb07db4 A bit more cleanup 2018-12-10 21:30:22 -08:00
Chris Robinson
ed18fd76c5 Clean up a few more loops 2018-12-10 14:49:57 -08:00
Chris Robinson
d91ada2e02 Add missing header 2018-12-10 02:13:57 -08:00
Chris Robinson
9bb7ed0129 Put static methods into an anonymous namespace 2018-12-10 02:08:54 -08:00
Chris Robinson
0d56c59f14 Avoid some more explicit loops 2018-12-10 00:01:13 -08:00
Chris Robinson
0a805727db Use std::accumulate to find the max channel count 2018-12-09 18:16:00 -08:00
Chris Robinson
b1beb7dfdc Avoid some more explicit loops 2018-12-09 17:24:00 -08:00
Chris Robinson
efb8e076c7 Pass a reference to an array for a function parameter 2018-12-09 15:21:24 -08:00
Chris Robinson
c9f5617f06 Avoid several uses of memset 2018-12-08 14:22:20 -08:00
Chris Robinson
5ea3c8fb60 Use member functions for BFormatDec and AmbiUpsampler 2018-12-08 02:50:34 -08:00