53 Commits

Author SHA1 Message Date
Chris Robinson
d5ab883da2 Define MixHrtf directly instead of through a SUFFIX macro 2015-08-15 01:37:46 -07:00
Chris Robinson
6fcaccc964 Don't assert the increment value in the copy32 resampler 2015-02-15 13:15:49 -08:00
Chris Robinson
a606bbc7f1 Use a lookup table to do cubic resampling 2014-12-15 12:23:28 -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
4b433c900e Copy samples if needed in the 'copy' resampler 2014-05-21 15:24:40 -07:00
Chris Robinson
cd983245f1 Return a sample pointer from resamplers
Both resampling and filtering now avoid copying samples when they no-op.
2014-05-19 05:46:01 -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
a5631e05cc Add a ALfilterState method to process multiple samples at once 2014-05-18 06:23:20 -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
e2cb41dc61 Remove the last bits of the predictive sample processing 2014-03-23 17:33:57 -07:00
Chris Robinson
72986882f5 Remove the click removal buffers for auxiliary effect slots 2014-03-23 16:28:55 -07:00
Chris Robinson
a25260ea8a Identity gain step is 1, not 0 2014-03-23 16:13:46 -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
1518895e15 Use an UNUSED macro instead of void-tagging unused parameters 2013-10-07 07:44:09 -07: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
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
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
513c6db0d5 Avoid mixing to a send slot if the gain is too low 2012-10-10 03:52:45 -07:00
Chris Robinson
a6287fd407 Add a special resampler for matching sample rates 2012-10-05 06:03:19 -07:00
Chris Robinson
06a0d1b86e Use an unsigned type for the sample position fraction 2012-09-27 13:52:45 -07:00
Chris Robinson
41b2c2f3bb Remove an unneeded parameter from the resampler 2012-09-27 02:46:15 -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
79b6d89b3f Explicitly give the wet buffer 1 channel 2012-09-16 08:27:50 -07:00
Chris Robinson
a240abb6c8 Avoid building redundant mixers 2012-09-16 08:14:26 -07:00
Chris Robinson
7635afcb52 Use a source param for the resampler and move them to the mixer source 2012-09-14 04:13:18 -07:00
Chris Robinson
7e81918f7b Update HRTF code
This update allows for much more flexibility in the HRTF data. It also allows
for HRTF table file names to include "%r" to represent the device's playback
rate (e.g. if you set hrtf-%r.mhr, then it will try to use hrtf-44100.mhr or
hrtf-48000.mhr depending if the device's output rate is 44100 or 48000,
respectively).

The makehrtf utility has also been updated to support more options and input
file formats, as well as the new mhr format.
2012-09-11 02:11:51 -07:00
Chris Robinson
f56dddfa73 Implement MixDirect_SSE separately from the C and Neon versions 2012-09-09 00:53:54 -07:00
Chris Robinson
1c03025090 Separate the resampling and mixing steps 2012-09-08 21:34:36 -07:00
Chris Robinson
795909c39e Minor cleanups for mixer_inc 2012-08-29 02:43:19 -07:00