Commit Graph

670 Commits

Author SHA1 Message Date
Chris Robinson
186b54aa3d Use a lockless method for updating listener and context properties
This uses a separate container to provide the relevant properties to the
internal update method, using atomic pointer swaps. A free-list is used to
avoid having too many individual containers.

This allows the mixer to update the internal listener properties without
requiring the lock to protect against async updates. It also allows concurrent
read access to the user-facing property values, even the multi-value ones (e.g.
the vectors).
2016-05-11 21:02:11 -07:00
Chris Robinson
182c0cb61a Find a valid source buffer before updating the voice 2016-05-09 14:22:26 -07:00
Chris Robinson
c2611f10ab Store more "active" listener and context properties separately
This helps ensure async listener/context property changes affect all playing
sources at the same time.
2016-05-09 11:26:49 -07:00
Chris Robinson
574ec13e5b Avoid an unnecessary aluVector 2016-04-24 23:35:11 -07:00
Chris Robinson
f0871c8cfc Improve radius behavior with scaling of ambisonic coefficients 2016-04-24 21:42:59 -07:00
Chris Robinson
3b571e03ab Avoid storing channel names for the dry buffer 2016-04-16 17:21:31 -07:00
Chris Robinson
a6c70992b0 More directly map coefficients for ambisonic mixing buffers
Instead of looping over all the coefficients for each channel with multiplies,
when we know only one will have a non-0 factor for ambisonic mixing buffers,
just index the one with a non-0 factor.
2016-04-15 22:05:47 -07:00
Chris Robinson
bd65f64d05 Avoid mixing all coefficients together when only some are used 2016-04-15 17:31:04 -07:00
Chris Robinson
fb97822d8c Avoid unnecessary loops for setting up effect slot b-format buffer mixing 2016-04-14 21:50:36 -07:00
Chris Robinson
d924e3d6c4 Split aluInitPanning into separate functions for HRTF or UHJ 2016-04-14 10:44:57 -07:00
Chris Robinson
e0466766d7 Include any first-order scaling in the FOAOut coefficients 2016-03-25 23:25:13 -07:00
Chris Robinson
3148986184 Implement AL_EXT_STEREO_ANGLES support 2016-03-25 14:40:44 -07:00
Chris Robinson
b0acfa1763 Add a cast and a couple float type fixes 2016-03-24 11:11:17 -07:00
Chris Robinson
147274f165 Up-sample first-order content when using a higher order HQ decoder 2016-03-23 15:10:59 -07:00
Chris Robinson
713ac9e679 Add a specific output for first-order sources 2016-03-22 17:52:20 -07:00
Chris Robinson
ce575718ef Store the effect's output buffer in the effect state 2016-03-17 10:10:26 -07:00
Chris Robinson
53fadf5497 Add a dual-band ambisonic decoder
This uses a virtual B-Format buffer for mixing, and then uses a dual-band
decoder for improved positional quality. This currently only works with first-
order output since first-order input (from the AL_EXT_BFROMAT extension) would
not sound correct when fed through a second- or third-order decoder.

This also does not currently implement near-field compensation since near-field
rendering effects are not implemented.
2016-03-15 05:08:05 -07:00
Chris Robinson
066df88a2c Always mix to the real output for DirectChannels 2016-03-14 20:25:36 -07:00
Chris Robinson
22abaa287d Use the real output's left and right channels with HRTF 2016-03-11 20:59:12 -08:00
Chris Robinson
859cc703e7 Use the proper left and right channels for UHJ output 2016-03-10 22:56:44 -08:00
Chris Robinson
d648486bcd Generalize GetChannelIdxByName 2016-03-10 14:29:44 -08:00
Chris Robinson
effb9d1e35 Keep track of the real output's channel names 2016-03-10 01:04:28 -08:00
Chris Robinson
a457157516 Organize the dry buffer properties into a struct 2016-03-09 23:43:57 -08:00
Chris Robinson
3e2672ec9f Track the virtual and real output buffers ecplicitly 2016-03-09 22:57:38 -08:00
Chris Robinson
99f685d20d Add an option for pair-wise stereo panning 2016-02-26 21:48:03 -08:00
Chris Robinson
ac91083ceb Use 2-channel UHJ for stereo output 2016-02-26 16:09:06 -08:00
Chris Robinson
e1ce7f9180 Use an 8-channel cube for HRTF's virtual format.
There were phase issues caused by applying HRTF directly to the B-Format
channels, since the HRIR delays were all averaged which removed the inter-aural
time-delay, which in turn removed significant spatial information.
2016-02-20 00:53:01 -08:00
Chris Robinson
ecdc93f3ca Calculate HRTF stepping params right before mixing
This means we track the current params and the target params, rather than the
target params and the stepping. This closer matches the non-HRTF mixers.
2016-02-14 03:23:06 -08:00
Chris Robinson
25732d0895 Calculate channel gain stepping just before mixing 2016-02-14 01:22:01 -08:00
Chris Robinson
7f908d90af Rename ComputeBFormatGains to ComputeFirstOrderGains 2016-01-31 09:00:23 -08:00
Chris Robinson
063ef9c2fc Properly silence the LFE input channel gain on the source sends 2016-01-30 07:13:07 -08:00
Chris Robinson
729f213c09 Fix scaling for effect sends of B-Format sources 2016-01-30 07:10:36 -08:00
Chris Robinson
c1f87414c5 Mix to multichannel for effects
This mixes to a 4-channel first-order ambisonics buffer. With ACN ordering and
N3D scaling, this makes it easy to remain compatible with effects that only
care about mono input since channel 0 is an unattenuated mono signal.
2016-01-28 00:02:46 -08:00
Chris Robinson
2fa3ae85c9 Pass a pointer to the input samples array for effect processing 2016-01-27 08:16:47 -08:00
Chris Robinson
f547ef6d39 Separate calculating ambisonic coefficients from the panning gains 2016-01-25 06:11:51 -08:00
Chris Robinson
5d039309b3 Use doubles for the constructed listener matrix
This helps the stability of transforms to local space for sources that are at
or near the listener. With a single-precision matrix, even FLT_EPSILON might
not be enough to detect matching positions.
2015-11-11 08:19:33 -08:00
Chris Robinson
ffcdcbd5fa Update the bsinc table
Precision is increased to cover the full 32-bit float range.
2015-11-10 18:40:33 -08:00
Chris Robinson
ec7b21cd14 Remove a const to silence some warnings 2015-11-06 22:17:15 -08:00
Chris Robinson
de74498cd9 Use more accurate floating point literals 2015-11-06 10:27:28 -08:00
Chris Robinson
b9e192b78a Implement a band-limited sinc resampler
This is essentially a 12-point sinc resampler, unless it's resampling to a rate
higher than the output, at which point it will vary between 12 and 24 points
and do anti-aliasing to avoid/reduce frequencies going over nyquist.

Code provided by Christopher Fitzgerald.
2015-11-05 09:42:08 -08:00
Chris Robinson
c57f571920 Pass in the Q parameter for setting the filter parameters
Also better handle the peaking filter gain.
2015-11-01 05:41:06 -08:00
Chris Robinson
45f11d7b64 Set the current gain immediately if the target is close enough 2015-10-26 01:48:12 -07:00
Chris Robinson
714354caee Set XYZ channel gains for source sends to 0
It's cleaner to just set the gains to 0 rather than to special-case B-Format in
the mixer.
2015-10-23 20:16:11 -07:00
Chris Robinson
bca854baac Use one send gain per buffer channel 2015-10-23 15:11:34 -07:00
Chris Robinson
4813125d31 Return the new vector result from aluMatrixVector 2015-10-22 23:39:56 -07:00
Chris Robinson
6689c61ff4 Remove the MIDI code
The extension's not going anywhere, and it can't do anything fluidsynth can't.
The code maintenance and bloat is not worth keeping around, and ideally the AL
API would be able to facilitate MIDI-like behavior anyway (envelopes, start-at-
time, etc).
2015-10-20 18:01:27 -07:00
Chris Robinson
2730d8e76f Round the calculated stepping value 2015-10-15 15:38:07 -07:00
Chris Robinson
67455c66a1 Replace the resample_fir6 declaration with resample_fir8 2015-10-12 06:34:55 -07:00
Chris Robinson
dc10e56bab Implement a 6-point sinc-lanczos filter 2015-09-29 20:39:12 -07:00
Aaron Jacobs
a7084b1051 Fix resample_fir4 link error 2015-09-29 12:34:03 -07:00