Commit Graph

132 Commits

Author SHA1 Message Date
Chris Robinson
8a64f07121 Use a predefined identity matrix 2016-09-05 02:02:14 -07:00
Chris Robinson
0fbf34fb45 Add a ref count to ALeffectState
This is mostly just reorganizing the effects to call the Construct method which
initializes the ref count.
2016-08-25 03:49:57 -07:00
Chris Robinson
8bf4a22876 Combine related members into a struct 2016-08-24 00:25:28 -07:00
Chris Robinson
bff5268ed4 Remove DevFmtBFormat3D, which is covered by DevFmtAmbi1 2016-07-31 08:13:41 -07:00
Chris Robinson
0c5985374a Simplify a format check 2016-07-30 10:16:29 -07:00
Chris Robinson
b5b3ea95f8 Add a config to output first-, second-, or third-order ambisonics
Currently incomplete, as second- and third-order output will not correctly
handle B-Format input buffers. A standalone up-sampler will be needed, similar
to the high-quality decoder.

Also, output is ACN ordering with SN3D normalization. A config option will
eventually be provided to change this if desired.
2016-07-29 21:55:43 -07:00
Chris Robinson
a6f41e4cb0 Remove the last use of ALfilterState_processSingle 2016-07-26 04:09:01 -07:00
Chris Robinson
25d1b7bdba Remove broken autowah effect code
It's been disabled forever, and I have no idea how to make it work properly.
Better to just redo it when making something that works.
2016-07-26 03:45:25 -07:00
Chris Robinson
11b38e1190 Rename input_gain to b0 2016-07-26 00:03:44 -07:00
Chris Robinson
0a693d039a Avoid more uses of ALfilterState_processSingle
It's a horriobly inefficient way to process multiple samples through the
filter.
2016-07-25 23:51:37 -07:00
Chris Robinson
e4bbbe06fa Avoid manual loops for ALfilterState processing 2016-07-25 19:04:54 -07:00
Chris Robinson
2e7ec3979a Avoid using realloc in a number of places 2016-05-21 03:27:51 -07:00
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