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).
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.
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.
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.
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).
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>
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.
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.