69 Commits

Author SHA1 Message Date
Chris Robinson
cf0ef500ec Rename MatrixMixerFunc to RowMixerFunc 2016-09-02 00:29:46 -07:00
Chris Robinson
770e2ff7ed Use a more specialized mixer function for B-Format to HRTF 2016-08-12 05:26:36 -07:00
Chris Robinson
5e64882be9 Use SSE for applying the HQ B-Format decoder matrices 2016-05-31 10:18:34 -07: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
431c89ece9 Manually inline and condense the bsinc resampler 2015-11-05 21:57:12 -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
90349b384f Use the correct position in the SSE resamplers for left-over processing 2015-10-25 14:07:58 -07:00
Chris Robinson
9b6b084d60 Use the correct realignment size for post-stepping mixing 2015-10-18 13:46:52 -07:00
Chris Robinson
904cdfda32 Avoid double-checks for the stepping mixer loops 2015-09-30 17:25:28 -07:00
Chris Robinson
d5ab883da2 Define MixHrtf directly instead of through a SUFFIX macro 2015-08-15 01:37:46 -07:00
Chris Robinson
4dc9956a12 Remove some IN_IDE_PARSER uses 2014-12-24 17:15:50 -08:00
Chris Robinson
efb5c5eecd Use linear gain stepping 2014-11-25 02:08:48 -08:00
Chris Robinson
8e6c131b36 Use a separate method to set initial HRTF coefficients 2014-11-24 22:26:42 -08:00
Chris Robinson
45d6bb58a4 Partially revert "Use a different method for HRTF mixing"
The sound localization with virtual channel mixing was just too poor, so while
it's more costly to do per-source HRTF mixing, it's unavoidable if you want
good localization.

This is only partially reverted because having the virtual channel is still
beneficial, particularly with B-Format rendering and effect mixing which
otherwise skip HRTF processing. As before, the number of virtual channels can
potentially be customized, specifying more or less channels depending on the
system's needs.
2014-11-23 10:49:54 -08:00
Chris Robinson
a27e5e1652 Use a different method for HRTF mixing
This new method mixes sources normally into a 14-channel buffer with the
channels placed all around the listener. HRTF is then applied to the channels
given their positions and written to a 2-channel buffer, which gets written out
to the device.

This method has the benefit that HRTF processing becomes more scalable. The
costly HRTF filters are applied to the 14-channel buffer after the mix is done,
turning it into a post-process with a fixed overhead. Mixing sources is done
with normal non-HRTF methods, so increasing the number of playing sources only
incurs normal mixing costs.

Another benefit is that it improves B-Format playback since the soundfield gets
mixed into speakers covering all three dimensions, which then get filtered
based on their locations.

The main downside to this is that the spatial resolution of the HRTF dataset
does not play a big role anymore. However, the hope is that with ambisonics-
based panning, the perceptual position of panned sounds will still be good. It
is also an option to increase the number of virtual channels for systems that
can handle it, or maybe even decrease it for weaker systems.
2014-11-22 04:20:17 -08:00
Chris Robinson
1c0596c233 Check the absolute gain value for silence
Future B-Format support will be using negative gains, which still need to be
applied.
2014-10-31 16:55:19 -07:00
Chris Robinson
a8deaf12f4 Combine the direct and send mixers 2014-06-13 13:34:19 -07:00
Chris Robinson
c29eb63489 Combine some dry and wet path types 2014-06-13 11:42:04 -07:00
Chris Robinson
ecdfcdbfa5 The lower value of the gain vector contains the closest target value 2014-05-21 21:20:44 -07:00
Chris Robinson
9317ec59b9 Don't pass the SendParams to the wet-path mixer 2014-05-18 10:35:11 -07:00
Chris Robinson
c9083d04fa Don't pass the DirectParams to the dry-path mixer 2014-05-18 10:24:07 -07:00
Chris Robinson
29b5dae6aa Pass some DirectParams as function parameters 2014-05-18 08:59:10 -07:00
Chris Robinson
bd2721dc7a Use _mm_setr_ps instead of _mm_set_ps
Apparently _mm_set_ps loads in reverse order compared to _mm_load_ps, so
_mm_setr_ps should give what we really want.
2014-05-18 06:35:33 -07:00
Chris Robinson
db90985f6a Remove unnecessary ifdefs
mixer_sse.c and mixer_neon.c are only compiled when the relavent headers are
found anyway.
2014-05-04 00:19:55 -07:00
Chris Robinson
a2bb4c3f13 Always use the current gains when mixing
The current gain gets explicitly set to the target when the stepping is
finished to ensure the target is still used. This way, however, will allow for
asynchronously 'canceling' a fade by setting the counter to 0.
2014-05-04 00:13:19 -07:00
Chris Robinson
34e96aef60 Make sure all gain steps are applied with the SSE and Neon mixers 2014-05-03 17:24:46 -07:00
Chris Robinson
f9d70aa9ef Use _mm_set_ps() to set an __m128 instead of {} 2014-04-26 06:31:31 -07:00
Chris Robinson
72986882f5 Remove the click removal buffers for auxiliary effect slots 2014-03-23 16:28:55 -07:00
Chris Robinson
52deb557d5 Add gain stepping to the send mixers 2014-03-23 16:11:21 -07:00
Chris Robinson
55f851093f Remove the now-unneeded click removal buffers for the device
They are still there for auxiliary sends. However, they should go away soon
enough too, and then we won't have to mess around with calculating extra
"predictive" samples in the mixer.
2014-03-23 07:31:33 -07:00
Chris Robinson
81e049bd47 Step mixing gains per-sample for non-HRTF mixing
This fades the dry mixing gains using a logarithmic curve, which should produce
a smoother transition than a linear one. It functions similarly to a linear
fade except that

step = (target - current) / numsteps;
...
gain += step;

becomes

step = powf(target / current, 1.0f / numsteps);
...
gain *= step;

where 'target' and 'current' are clamped to a lower bound that is greater than
0 (which makes no sense on a logarithmic scale).

Consequently, the non-HRTF direct mixers do not do not feed into the click
removal and pending click buffers, as this per-sample fading would do an
adequate job of stopping clicks and pops caused by extreme gain changes. These
buffers should be removed shortly.
2014-03-23 06:57:00 -07:00
Chris Robinson
b0d511a860 Store the HrtfState directly in the DirectParams 2014-03-23 02:45:50 -07:00
Chris Robinson
0c5cbafcd8 Use a union to combine HRTF and non-HRTF mixer params 2014-03-19 17:55:09 -07:00
Chris Robinson
9a4ded2491 Revert "Apply HRTF coefficient stepping separately"
This reverts commit 25b9c3d0c15e959d544f5d0ac7ea507ea5f6d69f.

Conflicts:
	Alc/mixer_neon.c

Unfortunately this also undoes the Neon-enhanced ApplyCoeffsStep method.
2014-02-23 21:17:09 -08:00
Chris Robinson
25b9c3d0c1 Apply HRTF coefficient stepping separately 2013-11-10 05:52:22 -08:00
Chris Robinson
79edd2cf3b Use a macro for the silence threshold 2013-10-06 17:25:47 -07:00
Chris Robinson
6425480d40 Don't store the effect slot in SendParams
This makes it much more like DirectParams.
2013-10-06 10:11:01 -07:00
Chris Robinson
94884ed04b Use a separate value for the maximum buffer channels
Unlike the device, input buffers are accessed based on channel numbers
instead of enums. This means the maximum number of channels they hold
depends on the number of channels any one format can have, rather than
the total number of recognized channels. Currently, this is 8 for 7.1.
2013-07-23 00:13:15 -07:00
Chris Robinson
a9fac12969 Work around some problems with KDevelop's parser 2013-06-18 14:33:39 -07:00
Chris Robinson
e96cc656e9 Use C99's inline instead of __inline 2013-05-28 22:27:07 -07:00
Chris Robinson
52efb8d7f4 Use restrict instead of RESTRICT 2013-05-22 15:11:39 -07:00
Chris Robinson
564a182259 Avoid an underflow in the SSE mixers if BufferSize is less than 4 2012-12-24 05:49:44 -08:00
Chris Robinson
a14383d6cc Constify the direct and send parameters given to the mixer 2012-10-15 01:31:58 -07:00
Chris Robinson
f0d27e5f91 Remove the unused Device parameter 2012-10-14 11:29:28 -07:00
Chris Robinson
a852669dce Store the output buffers in the DirectParams struct 2012-10-14 11:21:52 -07:00
Chris Robinson
3240894cd5 Remove the now-unused Source parameter from the DryMix methods 2012-10-14 11:04:36 -07:00
Chris Robinson
d4e82d441e Combine multiple loops into one 2012-09-24 19:07:07 -07:00
Chris Robinson
2ceea21f76 Avoid mixing silence to output
"Silence" being less than -100dB.
2012-09-24 15:33:44 -07:00
Chris Robinson
12327da4fe Remove SSE resamplers. They aren't gaining us much this way. 2012-09-24 14:47:06 -07:00
Chris Robinson
d1c93525ed Fix matrix multiply used by the SSE cubic resampler
Also remove the 4-sample loop. It's not terribly effective.
2012-09-18 18:09:43 -07:00