118 Commits

Author SHA1 Message Date
Chris Robinson
b2760baa64 Make the reverb's early and late feedback lines interleaved 2017-05-14 23:28:22 -07:00
Chris Robinson
7cbce6806b Update a couple comments about the reverb modulation 2017-05-13 16:08:45 -07:00
Chris Robinson
0b66b2bbe7 Replace 4 separate all-passes with one vector all-pass
Each 4 related all-passes now share a structure with one delay line, which uses
an interleaved sample history. Also fixes some potential rounding problems for
delay lines with interleaved samples.
2017-05-13 15:45:05 -07:00
Chris Robinson
87d4710bc4 Apply reverb modulation to the late feedback lines
This seems to be more in-line with the intended behavior, to allow build-up and
overlap within the reverb decay, rather than a pitch-shift on input.
Unfortunately there's no readily available implementation of this reverb model
that includes modulation to compare with, so a low depth coefficient is used to
keep it very subtle.
2017-05-12 20:53:14 -07:00
Chris Robinson
d456c799fd Remove the 0.5 gain on the reverb output
Turns out to be unnecessary, as it reduced the volume below what other reverb
implementations provide with the same presets.
2017-05-11 23:26:29 -07:00
Chris Robinson
685dc24299 Restore the previous reverb B2A and A2B matrices
Also, untranspose the A2B matrix.
2017-05-11 21:48:47 -07:00
Chris Robinson
f880f67049 Update reverb conversion matrices and output gain 2017-05-08 13:57:31 -07:00
Chris Robinson
4e5c4b8e01 Add a slight bit of attenuation to the reverb output 2017-05-02 15:55:58 -07:00
Chris Robinson
53c3d48fe0 Change some ALuint parameters to ALsizei 2017-05-02 04:54:59 -07:00
Chris Robinson
9767f4f9c3 Don't do more reverb samples than there are to fade.
This avoids having to clamp the fade value when incrementing it.
2017-04-28 10:25:22 -07:00
Chris Robinson
bf138fb4ea Combine mostly duplicate functions 2017-04-27 19:23:42 -07:00
Chris Robinson
5dc7265ad3 Properly update the delay line offsets when fading is done 2017-04-27 18:54:33 -07:00
Chris Robinson
12fb0404c1 Reverb code update
This update modifies the reverb in numerous ways. The 3-series, 4-parallel
all-pass is replaced with a Gerzon vector all-pass. The vector all-pass is also
applied to the early reflections, to help with the initial diffusion in the
late reverb. The late reverb filter and feedback attenuation has been replaced
with a dual first-order equalization filter, which controls the low and high
frequencies with individual low-pass/high-shelf and high-pass/low-shelf filters
with gain control.

Additionally, delay lines now have the ability to blend the output between two
offsets, to help smooth out the transition for when the delay changes (without
such, it could result in undesirable clicks and pops).
2017-04-26 02:07:51 -07:00
Chris Robinson
d04cc28f33 Limit filter gains to -24dB 2017-02-22 18:07:41 -08:00
Chris Robinson
55a2474d7e Fix late reverb low-pass filtering 2017-01-29 13:06:40 -08:00
Chris Robinson
3cc88b0aab Use an all-pass series on each late reverb line
This attempts to improve the smoothness of the late reverb decay by passing
each line through multiple all-pass filters. Some work is still needed to work
better in high-density and not-so-high-diffusion environments.

This also removes the decay from the early reflections, since it's no longer
continuous feedback.
2017-01-28 17:15:47 -08:00
Chris Robinson
2668da696c Round the early and late delay tap sample offsets 2016-10-26 22:12:48 -07:00
Chris Robinson
16ed117d71 Restore a comment that was accidentally deleted 2016-10-10 01:33:33 -07:00
Chris Robinson
698eddbb0c Better sort the main delay line taps 2016-10-06 20:05:16 -07:00
Chris Robinson
f826f86842 Decorrelate the early reflection inputs 2016-10-06 19:45:48 -07:00
Chris Robinson
9b8f36b758 Pass current and target gains directly for mixing 2016-10-05 20:33:45 -07:00
Chris Robinson
1e1a8837f8 Update a comment about using row mixers 2016-10-05 15:09:14 -07:00
Chris Robinson
06639b8250 Better pack the late reverb low- and all-pass variables 2016-10-05 13:31:53 -07:00
Chris Robinson
422f065809 Use the row mixer functions for the B-to-A-Format conversion 2016-10-04 16:42:28 -07:00
Chris Robinson
1e4d9cfa7e Enhance reverb using B-Format processing
Technically it uses A-Format processing from the B-Format input and output. But
this attempts to provide better spatial definition to the reverberation so that
it can be used in a more generic fashion, allowing it to be decoded as any
other B-Format signal to whatever output is needed, and also allowing for a bit
of height information when the output is capable of such.

There may still be some kinks to work out, such as properly decorrelating the
early reflection taps and tweaking the late reverb density. But it seems to be
a good enough start.
2016-10-03 12:20:13 -07:00
Chris Robinson
bb48a7e520 Fix EAX reverb effect output for HRTF and UHJ 2016-09-13 16:55:39 -07:00
Chris Robinson
efaa09dc23 Write to the correct outputs for extra reverb channels 2016-09-11 17:11:19 -07:00
Chris Robinson
651715abc9 Combine the reverb decorrelator delay line with the main delay line
Since it was merely acting as an extension of it anyway, with the second delay
line tap (for late reverb) copying attenuated samples to the decorrelator line
that was being tapped off of. Just extend the delay line and offset the
decorrelator taps to be relative to the late reverb tap.
2016-09-11 12:25:06 -07:00
Chris Robinson
1d9d1958db Make the SelectMixer function sharable 2016-09-06 13:21:11 -07:00
Chris Robinson
9cbe02fd85 Use the optimized mixing functions for reverb output 2016-09-06 12:16:49 -07:00
Chris Robinson
0558869d94 Use deinterlaced buffers for the intermediate reverb storage 2016-09-06 11:07:45 -07:00
Chris Robinson
1541ff24b8 Do reverb modulation before band-pass filtering
Ideally the band-pass should probably happen closer to output, like gain is.
However, doing that would require 16 filters (4 early + 4 late channels, each
with a low-pass and high-pass filter), compared to the two needed to do it on
input.
2016-09-06 07:02:17 -07:00
Chris Robinson
a20576bbd7 Do multiple samples at once for reverb modulation 2016-09-05 06:08:01 -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
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
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
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
3877545d8c Add a workaround for a buggy modff 2016-03-18 14:05:45 -07:00