120 Commits

Author SHA1 Message Date
Chris Robinson
82720c4759 Don't assume the "real" output buffer follows the dry buffer 2016-05-17 15:03:56 -07:00
Chris Robinson
2172f974e7 Improve reverb panning gains for "3D" output. 2016-05-17 14:28:30 -07:00
Chris Robinson
93a94d177c Get rid of an unnecessary copy of ALeffectProps 2016-05-13 18:28:01 -07:00
Chris Robinson
9e6d8342de Hold the effect and filter maps while handling effects and filters 2016-05-12 23:12:11 -07:00
Chris Robinson
ef0d4f8210 Provide (mostly) lockless updates for effect slots
Similar to the listener, separate containers are provided atomically for the
mixer thread to apply updates without needing to block, and a free-list is used
to reuse container objects.

A couple things to note. First, the lock is still used when the effect state's
deviceUpdate method is called to prevent asynchronous calls to reset the device
from interfering. This can be fixed by using the list lock in ALc.c instead.

Secondly, old effect states aren't immediately deleted when the effect type
changes (the actual type, not just its properties). This is because the mixer
thread is intended to be real-time safe, and so can't be freeing anything. They
are cleared away when updates reuse the container they were kept in, and they
don't incur any extra processing cost, but there may be cases where the memory
is kept around until the effect slot is deleted.
2016-05-12 18:41:33 -07:00
Chris Robinson
f0871c8cfc Improve radius behavior with scaling of ambisonic coefficients 2016-04-24 21:42:59 -07:00
Chris Robinson
d2e8fae005 Don't look up the dry buffer's FrontCenter in the Dedicated effect
The real FrontCenter output is used if it exists, and if it doesn't, it's
unlikely the dry buffer will have it (and even if it does, it won't be any
better than panning).
2016-04-16 14:11:10 -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
93047e2a7a Use the 3D panned output for reverb with HQ decoding
This is less than ideal, but matching each reverb line to a speaker with
surround sound output is way too loud without the ambient volume scaling
offered by the "direct" panning.
2016-03-31 02:14:13 -07:00
Chris Robinson
e0466766d7 Include any first-order scaling in the FOAOut coefficients 2016-03-25 23:25:13 -07:00
Chris Robinson
05dace6525 Mix Dedicated effects to the real output if possible 2016-03-25 14:47:30 -07:00
Chris Robinson
713ac9e679 Add a specific output for first-order sources 2016-03-22 17:52:20 -07:00
Chris Robinson
3877545d8c Add a workaround for a buggy modff 2016-03-18 14:05:45 -07:00
Chris Robinson
606402fff0 Make sure enough reverb panning gains are defined 2016-03-16 08:51:12 -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
d648486bcd Generalize GetChannelIdxByName 2016-03-10 14:29:44 -08:00
Chris Robinson
da5f75615b Allocate enough reverb panning gains 2016-03-10 01:45:30 -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
4e3fdf9f5d Fix reverb with UHJ encoding 2016-03-03 01:41:42 -08:00
Chris Robinson
ac91083ceb Use 2-channel UHJ for stereo output 2016-02-26 16:09:06 -08:00
Chris Robinson
ee9917fe96 Remove a dead assignment 2016-02-16 02:42:43 -08:00
Chris Robinson
6105d36fd7 Add special HRTF handling for reverb
This is pretty hacky. Since HRTF normally renders to B-Format with two "extra"
channels for the real stereo output, the panning interpolates between a panned
reverb channel on B-Format, and two non-panned reverb channels on stereo
output, given the panning vector length.
2016-02-06 23:00:07 -08:00
Chris Robinson
fd54f4f03d Only apply the +3dB reverb gain boost to the ambient response. 2016-02-06 18:05:27 -08:00
Chris Robinson
3ee42d9826 Avoid an extra sample of delay in the reverb modulator 2016-02-05 15:39:31 -08:00
Chris Robinson
c533060875 Remove an unnecessary variable and move duplicate code to a common spot 2016-02-05 14:21:02 -08:00
Chris Robinson
127c7e3b8c Don't explicitly check for LFE
It's going to be set to 0 gain anyway
2016-02-05 11:06:10 -08:00
Chris Robinson
3cac4dff95 Boost the direct-pan reverb to better match the expected volume
Hopefully. Would be nice to have a reference implementation for this style of
reverb to compare with.
2016-02-05 09:55:08 -08:00
Chris Robinson
301d4c158b Update a couple outdated comments 2016-02-05 09:42:43 -08:00
Chris Robinson
538f2839d1 Apply the early and late reverb gains with the panning gains 2016-02-05 08:43:51 -08:00
Chris Robinson
8627a92ea8 Better organize the reverb code into separate labeled sections 2016-02-05 08:14:41 -08:00
Chris Robinson
b8e74c88cf Separate early and late reverb output for standard reverb too 2016-02-05 07:46:33 -08:00
Chris Robinson
305ef3215d Modify how the four output reverb points are calculated
For HRTF and B-Format output, the points no longer move but instead scale based
on the desired panning direction.
2016-02-05 07:34:31 -08:00
Chris Robinson
d315ca4139 Try to map reverb outputs directly to output channels
HRTF and B-Format output still need to use virtual panning directions, but the
reverb works better when it outputs directly to an output channel. Ambient and
directional panning is used to properly mask and attenuate each output channel.

Note that currently the "direct panning" output is quieter than it should be.
Work is underway to attenuate the early reflections and late reverb better.
2016-02-01 22:24:40 -08:00
Chris Robinson
b4a9b40d68 Apply the main reverb gain with the panning 2016-02-01 01:45:16 -08:00
Chris Robinson
46cae36ef9 Fix an out of date comment 2016-01-31 09:39:07 -08:00
Chris Robinson
7f908d90af Rename ComputeBFormatGains to ComputeFirstOrderGains 2016-01-31 09:00:23 -08:00
Chris Robinson
7111322526 Make the modulator effect multichannel 2016-01-29 23:44:43 -08:00
Chris Robinson
a046a951e9 Use separate modulator functions only for the waveform 2016-01-29 23:28:38 -08:00
Chris Robinson
3ac786c6af Convert the equalizer effect to multichannel 2016-01-29 07:26:19 -08:00
Chris Robinson
210b4c1fcd Make the compressor effect multichannel 2016-01-28 02:49:40 -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
94816d0073 Reorder filterstate properties 2016-01-23 03:38:15 -08:00
Chris Robinson
bce20d1f6b Don't overwrite the output with the dedicated effect 2015-12-12 13:53:17 -08:00
Chris Robinson
91258cc192 Simplify reverb panning rotations 2015-11-07 06:15:29 -08:00
Chris Robinson
8c6d891694 Pan each early/late delay line separately 2015-11-05 23:46:39 -08:00
Chris Robinson
46e72a48ad Remove an unneeded memset that was overwriting memory 2015-11-05 19:45:04 -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