782 Commits

Author SHA1 Message Date
Chris Robinson
6fcbb7c738 Remove an unnecessary variable 2017-06-21 11:34:26 -07:00
Chris Robinson
2b013fc54e Make the dithering depth configurable 2017-06-17 23:09:51 -07:00
Chris Robinson
e3a825b37c Apply dither separately from output 2017-06-17 02:42:01 -07:00
Chris Robinson
e893211b65 Restrict ClampedDist to RefDistance for invalid distance attenuation 2017-05-30 05:13:54 -07:00
Chris Robinson
e9505b164e Fix source sends' initial HF absorption and decay calculation
The HF absorption is applied given the source distance, as relative to the
source's immediate environment, with additional absorption being applied given
the room/reverb environment. This does double up the amount of absorption
compared to the dry path, but it can be assumed the initial reflections travel
a longer distance.
2017-05-27 22:33:40 -07:00
Chris Robinson
c51df897db Use normal air absorption for the sends
Applies just for the normal air absorption which uses the air absorption
factor, not the automated decay applied when WetGainAuto is enabled.
2017-05-27 03:40:52 -07:00
Chris Robinson
c4ef7399f8 Add a new compressor/limiter
This is just for the output limiter right now, but in the future can be used
for the compressor EFX effect. The parameters are also hardcoded, but can be
made configurable after 1.18.
2017-05-27 03:36:34 -07:00
Chris Robinson
9d4f601a8a Apply distance compensation separately 2017-05-25 03:24:35 -07:00
Chris Robinson
e6be113903 Add an option to dither 8- and 16-bit output 2017-05-23 00:35:22 -07:00
Chris Robinson
49e5c53591 Reduce the amount of variables that hold the same value 2017-05-21 03:47:52 -07:00
Chris Robinson
95ea3fdd05 Avoid calculating the filter coefficients multiple times 2017-05-21 03:38:19 -07:00
Chris Robinson
0b2467ed54 Use a macro to specify the decay target gain 2017-05-21 00:01:39 -07:00
Chris Robinson
c234b25ac7 Use more correct doppler shift calculations 2017-05-20 03:28:40 -07:00
Chris Robinson
492050b816 Restore spec-defined cone behavior for auxiliary sends 2017-05-20 02:22:11 -07:00
Chris Robinson
a306407b67 Apply more proper air absorption to the wet path
This properly accounts for the room rolloff factor for normal air absorption
(which makes it none by default, like distance attenuation), and uses the
reverb's decay time, decay hf ratio, decay hf limit, and room air absorption
properties to calculate an initial hf decay with the WetGainAuto flag. This
mirrors the behavior of the initial distance decay.
2017-05-19 23:13:39 -07:00
Chris Robinson
efd797a6f6 Reorganize some code to have fewer temporaries 2017-05-17 22:49:34 -07:00
Chris Robinson
98392fbe90 Limit the dry and wet path filter gains to -60dB 2017-05-15 17:20:09 -07:00
Chris Robinson
fecf26318a Improve distance-related absorption and decay attenuation 2017-05-15 17:13:05 -07:00
Chris Robinson
a2c25378a9 Reduce LIMITER_VALUE_MAX
The previous value couldn't actually be expressed as a float and got rounded up
to the next whole number value, leaving the potential for an overrun in the
squared sum.
2017-05-09 11:56:03 -07:00
Chris Robinson
4a4442ad91 Store the output limiter values as fixed-point integers
This helps keep the squared sum stable over larger updates, also avoiding the
need to keep recalculating it.
2017-05-08 16:23:16 -07:00
Chris Robinson
0dabe6398f Apply attenuation when downmixing multi-channel sounds for panning 2017-05-07 18:28:43 -07:00
Chris Robinson
074e4496ba Calculate the output limiter gain using the RMS 2017-05-05 07:38:26 -07:00
Chris Robinson
db6f14748c Rename RollOff to Rolloff 2017-05-05 04:54:07 -07:00
Chris Robinson
b639bc9913 Add a property to force source spatialization on or off 2017-05-04 12:27:10 -07:00
Chris Robinson
7829ad8fc9 Handle attenuated sources in CalcPanningAndFilters 2017-05-04 11:09:45 -07:00
Chris Robinson
23bf3d3959 Calculate the multi-channel panning in a separate function 2017-05-04 04:35:53 -07:00
Chris Robinson
1e5334176e Rename VOICE_IS_HRTF to VOICE_HAS_HRTF 2017-05-02 04:25:08 -07:00
Chris Robinson
ca5c732261 Implement a limiter on the device output
This reduces the output volume when the mixed samples extend outside of -1,+1,
to prevent excessive clipping. It can reduce the volume by -80dB in 50ms, and
increase it by +80dB in 1s (it will not go below -80dB or above 0dB).
2017-04-26 18:38:09 -07:00
Chris Robinson
a0a41921fc Remove const from _Atomic vars to make Clang happy
Clang does not allow using C11's atomic_load on const _Atomic variables.
Previously it just disabled use of C11 atomics if atomic_load didn't work on a
const _Atomic variable, but I think I'd prefer to have Clang use C11 atomics
for the added features (more explicit memory ordering) even if it means a few
instances of breaking const.
2017-04-21 16:58:55 -07:00
Chris Robinson
26b49c54af Store the resampler as part of the source 2017-04-21 00:06:40 -07:00
Chris Robinson
5dcbb8db38 Make the buffer list next pointer atomic 2017-04-19 19:54:17 -07:00
Chris Robinson
55011d4bfd Use a different way to get the size of structs with flexible array members 2017-04-18 14:11:15 -07:00
Chris Robinson
14bc7baeb7 Store the source prop updates with the mixer voice
Also move its declaration and rename it for consistency.
2017-04-17 21:16:01 -07:00
Chris Robinson
f94fa5d5cf Use separate atomic macros for pointers 2017-04-14 17:47:55 -07:00
Chris Robinson
24c172bb96 Use ALsizei for the fir4 resampler fraction 2017-04-12 22:45:54 -07:00
Chris Robinson
684823ebc4 Select NEON when available before SSE 2017-04-12 22:44:16 -07:00
Chris Robinson
52112b0b8d Constify a variable 2017-04-01 02:38:44 -07:00
Chris Robinson
1ef916a54b Make a pointer restrict and assume aligned 2017-04-01 01:08:18 -07:00
Chris Robinson
90c005bbec Convert float samples to integer using a power-of-2 multiple 2017-03-31 09:11:28 -07:00
Chris Robinson
70aefa75e2 Use an array of pointers for effects instead of a linked list 2017-03-27 23:16:23 -07:00
Chris Robinson
8f5cab5608 Increase the filter slope to -12dB/octave 2017-03-16 11:25:28 -07:00
Chris Robinson
7b4645f5f8 Store the HRIR coeff pointer and delays directly in MixHrtfParams 2017-03-12 06:58:27 -07:00
Chris Robinson
96aaab9366 Rework HRTF coefficient fading
This improves fading between HRIRs as sources pan around. In particular, it
improves the issue with individual coefficients having various rounding errors
in the stepping values, as well as issues with interpolating delay values.

It does this by doing two mixing passes for each source. First using the last
coefficients that fade to silence, and then again using the new coefficients
that fade from silence. When added together, it creates a linear fade from one
to the other. Additionally, the gain is applied separately so the individual
coefficients don't step with rounding errors. Although this does increase CPU
cost since it's doing two mixes per source, each mix is a bit cheaper now since
the stepping is simplified to a single gain value, and the overall quality is
improved.
2017-03-11 18:04:06 -08:00
Chris Robinson
98e8f941b7 Allocate as many channels for DirectHrtfState as needed 2017-03-11 06:20:04 -08:00
Chris Robinson
6b4b00e462 Dynamically allocate the device's HRTF state 2017-03-10 10:47:43 -08:00
Chris Robinson
583d431947 Implement NFC filters for Ambisonic rendering
NFC filters currently only work when rendering to ambisonic buffers, which
includes HQ rendering and ambisonic output. There are two new config options:
'decoder/nfc' (default on) enables or disables use of NFC filters globally, and
'decoder/nfc-ref-delay' (default 0) specifies the reference delay parameter for
NFC-HOA rendering with ambisonic output (a value of 0 disables NFC).

Currently, NFC filters rely on having an appropriate value set for
AL_METERS_PER_UNIT to get the correct scaling. HQ rendering uses the averaged
speaker distances as a control/reference, and currently doesn't correct for
individual speaker distances (if the speakers are all equidistant, this is
fine, otherwise per-speaker correction should be done as well).
2017-03-10 04:35:32 -08:00
Chris Robinson
5ffb0842ac Remove unnecessary atomic members 2017-03-08 04:59:22 -08:00
Chris Robinson
073829f26a Make the voice's source pointer atomic 2017-03-05 04:50:27 -08:00
Chris Robinson
6d7a790183 Add a boolean to specify if a voice should be playing 2017-03-02 01:02:40 -08:00
Chris Robinson
521abf2e07 Dynamically allocate the channel delay buffers 2017-02-28 21:01:13 -08:00