3030 Commits

Author SHA1 Message Date
Chris Robinson
9fb07101dc Load HRTF coefficients as pre-normalized floats 2017-03-31 04:59:09 -07:00
Chris Robinson
2a8970368f Combine some HRTF loading code 2017-03-31 03:45:26 -07:00
Chris Robinson
7dc3fb98ab Use the correct types' sizes for HRTF storage 2017-03-31 02:15:24 -07:00
Chris Robinson
facd8ab109 Make ReleaseContext return if any contexts still remain 2017-03-28 05:33:43 -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
9f4e47d7be Fix HRTF interpolated gain calculation 2017-03-26 02:44:34 -07:00
Chris Robinson
56428cdb74 Use a loop to apply NFC filters 2017-03-25 23:55:44 -07:00
Chris Robinson
5c37eca2c5 Use ALsizei for more index lookups 2017-03-24 14:35:25 -07:00
Chris Robinson
9ca92be0b8 Properly calculate the echo damping 2017-03-24 14:08:04 -07:00
Chris Robinson
b062d50bf1 Fix setting Ambi formats for loopback devices 2017-03-21 16:40:23 -07:00
Chris Robinson
cdfe0d8f5a Use an atomic flag to test if a source needs to update 2017-03-20 21:25:39 -07:00
Chris Robinson
42bcf0870d Make DataPosInt an ALsizei 2017-03-20 19:22:41 -07:00
Chris Robinson
d7d9ad806a Use proper bools for boolean states 2017-03-20 16:53:41 -07:00
Chris Robinson
ecfa1dcb6f Don't defer source state or offset changes 2017-03-19 13:48:40 -07:00
Chris Robinson
66b86d43be Fix alcGetInteger64vSOFT to handle ambisonic attributes 2017-03-18 14:33:40 -07:00
Chris Robinson
7bf7cda467 Replace a couple ALuint with ALsizei 2017-03-17 15:45:39 -07:00
Chris Robinson
a209edb5ee Fix NFC filter to set the correct center frequency 2017-03-16 19:58:21 -07:00
Chris Robinson
8f5cab5608 Increase the filter slope to -12dB/octave 2017-03-16 11:25:28 -07:00
Chris Robinson
32d521d79c Check usability of MixHrtf_Neon before MixHrtf_SSE 2017-03-14 19:16:59 -07:00
Chris Robinson
6d565ff1fd Remove a couple unneeded typedefs 2017-03-14 13:10:34 -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
feffe1e81a Make the voice's 'moving' state a bitflag 2017-03-11 06:26:05 -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
51cb969446 Fix building on MSVC 2017-03-10 05:05:25 -08:00
Chris Robinson
b878769ee0 Fix building without C11 2017-03-10 04:59:22 -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
d9b1995e95 Add an NFC filter implementation 2017-03-09 15:41:20 -08:00
Chris Robinson
ae22d742dc Remove an unnecessary variable 2017-03-09 07:15:06 -08:00
Chris Robinson
5ffb0842ac Remove unnecessary atomic members 2017-03-08 04:59:22 -08:00
Chris Robinson
190120dfd7 Store the channel count and sample size in the voice 2017-03-07 00:19:40 -08:00
Chris Robinson
bc0096365e Don't modify the source state in the mixer 2017-03-07 00:19:40 -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
d1833c7b94 Increment MixCount in UpdateClockBase
This is to protect clocktime reads since the backend lock won't protect it.
2017-02-28 23:18:51 -08:00
Chris Robinson
521abf2e07 Dynamically allocate the channel delay buffers 2017-02-28 21:01:13 -08:00
Chris Robinson
6f2a30dea2 Remove an unneeded function 2017-02-28 19:48:44 -08:00
Chris Robinson
d3365f1b5b Start a ALC_SOFT_loopback2 extension
This extends the base ALC_SOFT_loopback extension with support for B-Format.
When ALC_FORMAT_CHANNELS_SOFT is set to ALC_BFORMAT3D_SOFT, then additional
attributes must be specified. ALC_AMBISONIC_LAYOUT_SOFT must be set to
ALC_ACN_SOFT or ALC_FUMA_SOFT for the desired channel layout,
ALC_AMBISONIC_SCALING_SOFT must be set to ALC_N3D_SOFT, ALC_SN3D_SOFT, or
ALC_FUMA_SOFT for the desired channel scaling/normalization scheme, and
ALC_AMBISONIC_ORDER_SOFT must be set to an integer value greater than 0 for the
ambisonic order (maximum allowed is implementation-dependent).

Note that the number of channels required for ALC_BFORMAT3D_SOFT is dependent
on the ambisonic order. The number of channels can be calculated by:
num_channels = (order+1) * (order+1); /* or pow(order+1, 2); */

In addition, a new alcIsAmbisonicFormatSupportedSOFT function allows apps to
determine which layout/scaling/order combinations are supported by the loopback
device. For example,
alcIsAmbisonicFormatSupported(device, ALC_ACN_SOFT, ALC_SN3D_SOFT, 2) will
check if 2nd order AmbiX (ACN layout and SN3D scaling) rendering is supported
for ALC_BFORMAT3D_SOFT output.
2017-02-28 19:01:48 -08:00
Chris Robinson
f8558ed2b7 Use a variable counter for an array size limit 2017-02-28 04:21:16 -08:00
Chris Robinson
1cd6617ff6 Don't use the mutex in the base getClockLatency implementation 2017-02-28 03:50:42 -08:00
Chris Robinson
52d1f7883b Print WARNs when a device or context error is generated 2017-02-27 20:59:52 -08:00
Chris Robinson
a9610b3607 Use separate enums for the ambisonic channel order and normalization 2017-02-27 16:11:45 -08:00
Chris Robinson
5c859af24e Move the current buffer queue entry and play position to the voice
This has a couple behavioral changes. First and biggest is that querying
AL_BUFFERS_PROCESSED from a source will always return all buffers processed
when in an AL_STOPPED state. Previously all buffers would be set as processed
when first becoming stopped, but newly queued buffers would *not* be indicated
as processed. That old behavior was not compliant with the spec, which
unequivocally states "On a source in the AL_STOPPED state, all buffers are
processed."

Secondly, querying AL_BUFFER on an AL_STREAMING source will now always return
0. Previously it would return the current "active" buffer in the queue, but
there's no basis for that in the spec.
2017-02-27 15:35:15 -08:00
Chris Robinson
513c18fdc4 Ensure a non-playing or -paused source does not use a mixing voice 2017-02-25 18:10:09 -08:00
Chris Robinson
652ef2b7fd Remove an unused function 2017-02-23 20:40:16 -08:00
Chris Robinson
c2a79f0f7b Remove CalcXYZCoeffs and inline CalcAngleCoeffs 2017-02-23 16:44:59 -08:00
Chris Robinson
08948079e9 Alter how panpot/pair-wise panning works
This change allows pair-wise panning to mostly go through the normal ambisonic
panning methods, with one special-case. First, a term is added to the stereo
decoder matrix's X coefficient so that a centered sound is reduced by -3dB on
each output channel. Panning in front creates a similar gain response to the
typical
L = sqrt(1-pan)
R = sqrt(pan)
for pan = [0,1]. Panning behind the listener can reduce (up to) an additional
-10dB, creating a audible difference between front and back sounds as if
simulating head obstruction.

Secondly, as a special-case, the source positions are warped when calculating
the ambisonic coefficients so that full left panning is reached at -30 degrees
and full right at +30 degrees. This is to retain the expected 60-degree stereo
width. This warping does not apply to B-Format buffer input, although it
otherwise has the same gain responses.
2017-02-23 01:32:44 -08:00
Chris Robinson
0ce4c9b8fa Rename stereo-panning option to stereo-encoding
Also rename the 'paired' value to 'panpot', and make it the default.
2017-02-22 19:18:01 -08:00
Chris Robinson
d04cc28f33 Limit filter gains to -24dB 2017-02-22 18:07:41 -08:00