450 Commits

Author SHA1 Message Date
Chris Robinson
aa66ed0ea5 Convert modulator.c to C++ 2018-11-17 01:53:39 -08:00
Chris Robinson
a7d3c24b51 Convert null.c to C++ 2018-11-17 01:49:26 -08:00
Chris Robinson
557048afa2 Convert pshifter.c to C++ 2018-11-17 01:36:47 -08:00
Chris Robinson
8410e71a34 Convert the reverb effect to C++ 2018-11-16 21:31:52 -08:00
Chris Robinson
5482efc921 Make the polymorphic allocators allocate cleared memory 2018-11-02 18:48:08 -07:00
Chris Robinson
662e1c5cc2 Fix some uses of RESTRICT 2018-10-29 11:50:41 -07:00
Chris Robinson
903d878460 Replace restrict with RESTRICT 2018-10-29 11:32:50 -07:00
Chris Robinson
ed8f44d102 Don't scale the reverb fade counter so much 2018-09-30 16:34:00 -07:00
Chris Robinson
39c3314d00 Only compare the reverb params that induce a need for fading
The offsets and coefficients are controlled by a relatively small set of input
parameters, just with different base constants or different calculations. This
lead to numerous redundant checks since if one value didn't change, others that
use the same inputs wouldn't have either.
2018-09-23 22:59:16 -07:00
Chris Robinson
db6905bf57 Clear reverb gain coefficients when doing a device update 2018-09-23 02:22:23 -07:00
Chris Robinson
800326d37a Rename ALreverbState to ReverbState 2018-09-23 01:11:58 -07:00
Chris Robinson
5c6b8eda4f Remove another duplicate function 2018-09-19 22:18:46 -07:00
Chris Robinson
48b7745a49 Add macros for commonly used square roots 2018-09-19 19:53:25 -07:00
Chris Robinson
db452a19da The last reverb loop update doesn't need an aligned count. 2018-09-11 19:05:49 -07:00
Chris Robinson
99737469e2 Ensure the max reverb update size is a multiple of 4
It's not an issue for the final mix, but if one loop has an unaligned count,
the next loop will have unaligned input and output buffer targets which can
crash the SSE mixers.
2018-09-11 18:39:50 -07:00
Chris Robinson
b13396cce2 Separate the delay line feeding from reading
Since it feeds a different line than it reads, the feeding could overwrite
what's subsequently read.
2018-09-10 13:30:20 -07:00
Chris Robinson
d1f8b78dd4 Avoid a couple line count assumptions 2018-09-10 03:19:41 -07:00
Chris Robinson
4bdab0051f Combine identical loops into a separate function 2018-09-10 03:17:14 -07:00
Chris Robinson
634b13a630 Handle the early reflection delay separate from late refeed 2018-09-10 02:10:35 -07:00
Chris Robinson
0d4b68239a Include the mid-band decay with the density gain 2018-08-31 08:30:57 -07:00
Chris Robinson
68a8c42176 Calcualte and use the maximum reverb update size
Instead of requiring it to be at least as big as MAX_UPDATE_SAMPLES, which may
not be true in some situations.
2018-08-31 07:20:46 -07:00
Chris Robinson
8b733728af Apply the decay gain when reading from the late line 2018-08-31 06:31:58 -07:00
Chris Robinson
1fa464ec3e Don't modify the late reverb density with the echo parameters 2018-08-30 18:40:53 -07:00
Chris Robinson
072ca731e2 Avoid making extraneous calls 2018-08-26 19:14:17 -07:00
Chris Robinson
a3010f50be Pack two arrays into one 2018-08-26 19:08:50 -07:00
Chris Robinson
4be6584850 Further limit the upper frequency range for autowah 2018-08-26 19:04:49 -07:00
Chris Robinson
7d76cbddd6 Use second-order biquad filters for the reverb's T60 decay 2018-08-12 18:02:39 -07:00
Chris Robinson
90ca9b9ff4 Store the reverb state offset locally while processing 2018-08-11 01:29:15 -07:00
Chris Robinson
2b9c213f89 Correctly apply reverb coefficient fading over the entire fade length 2018-08-09 21:10:17 -07:00
Chris Robinson
adfbe0d6cd Crossfade the early reflections delay coefficients 2018-08-08 22:47:07 -07:00
Chris Robinson
125ac166d1 Apply late reverb density gain on late reverb input
This also uses gain stepping for changes in density or decay, so that the
late reverb tap fades smoothly between delay offsets and density gain levels
simultaneously. Now with these changes, it's preferrable to apply density gain
adjustments on late reverb input instead of output so that samples currently in
the feedback loop won't see a sudden increase or decrease in amplitude.

A similar change can probably be made for the early reflection delays to
further smooth out delay changes.
2018-08-08 19:30:58 -07:00
Chris Robinson
1e33c4a922 Specify both scale values to FadedDelayLineOut 2018-08-08 06:24:12 -07:00
Chris Robinson
a8250db2bb Use the correct input channel for the compressor effect 2018-08-08 04:05:07 -07:00
Chris Robinson
04921dd727 Properly set early reflection all-pass coefficient 2018-08-06 23:45:32 -07:00
Chris Robinson
06da60c555 Make the all-pass coefficient part of the all-pass structure 2018-08-06 21:57:08 -07:00
Chris Robinson
32edc7f33f Prevent the autowah filter frequency from reaching nyquist 2018-08-06 14:14:31 -07:00
Chris Robinson
4f92bd5938 Apply the vector all-pass separate on uninterleaved samples
With the vector all-pass applied in a self-contained function, the individual
steps of the early and late reverb stages can be better optimized with tighter
loops. That allows for more data to be held local, resulting in less thrashing
from reloading the same values multiple times.

There is room for further improvement, depending on the length of the early
delay lines and all-pass delay lines allowing for bulk reads.
2018-08-05 20:29:03 -07:00
Chris Robinson
4aa029183b Apply the reverb's T60 filter in groups of samples
The late reverb line lengths are long enough to ensure a single process loop
won't rely on reading samples it wrote in the same call. So we can safely read
in all samples we need from the feedback buffer up front, then more efficiently
filter them.
2018-08-05 00:45:13 -07:00
Chris Robinson
3f165040e2 Mix reverb samples right after generating them
Instead of generating both the early and late reverb samples first, then mixing
them both to output, this now generates and mixes the early reflections then
generates and mixes the late reverb. There's no reason to hold both at the same
time so this reduces the amount of temporary storage needed.
2018-08-04 22:52:36 -07:00
Chris Robinson
754a32fa16 Scale the reverb decay weights to cover up to 20khz
Otherwise, using the device's maximum frequency will cause the weighting
factors to shift for different sample rates, irrespective of the content being
processed. 20khz is the maximum allowed reference frequency, and also acts as
the upper limit of human hearing.
2018-08-03 20:04:08 -07:00
Chris Robinson
0c67429a38 Apply late reverb density gain adjustment on output
Because density/late line length changes start affecting late reverb output
right away, with samples that are still going through feedback decay and not
just new input samples, it makes more sense to correct for it on output instead
of input. This has the additional benefit of working with the output mixer's
gain fading, avoiding discontinuities from significant density gain changes.
2018-08-01 16:08:27 -07:00
Chris Robinson
aa58a5d208 Fix late reverb density gain blend weights
Now it only accounts for the representable frequency range (0.5 normalized, or
 0...pi radians instead of tau). Previously, the bulk of the weighting factors
was given to the HF decay (nearly 90%, given a 44.1khz sample rate and the
default 5khz reference), with low- and mid-frequency decays splitting the
remaining 10%. Now it's closer to 75%, matching the range of representable
frequencies above the reference.

This could probably be improved further due to human hearing being less
sensitive to higher frequencies, but that is much more complicated.
2018-08-01 02:48:31 -07:00
Chris Robinson
3894c580bf Use just the omnidirectional response for the compressor effect
This is not the output compressor/limiter, but the EFX effect. Consequently, it
simply compresses the dynamic range around 1.0 (boosting samples below it by up
to double, reducing samples above it by as much as half). This is not intended
to prevent clipping on the output, but to instead reduce the range between
quiet sounds and loud sounds.
2018-07-29 00:18:46 -07:00
Chris Robinson
8ab448b119 Inline the autowah peaking filter processing 2018-07-28 14:03:28 -07:00
Chris Robinson
39a5d0cb94 Mark a couple parameters as unused 2018-07-25 13:15:47 -07:00
Raulshc
7d68eeac88 EFX: Enable 3D processing
Use channel 0 envelope for calculate the frequency in all channels.
2018-07-25 12:51:09 -07:00
Raulshc
92fd59fe6a EFX: Add 3D processing for autowah
Add 3D processing code. It can be activated at compilation time.
2018-07-25 12:51:09 -07:00
Raulshc
83dba26ea6 EFX: Autowah implementation
Add autowah effect using biquad peaking filter and envelope follower
2018-07-25 12:51:09 -07:00
Chris Robinson
809f709ba6 Limit the normalized filter frequency to under half
Nearing half, weird things can start happening with the filters' generated sine
and cosine values.
2018-07-21 14:22:52 -07:00
Chris Robinson
6fe1ffa3bb Improve handling of 0hz ring modulator frequency 2018-07-21 14:21:00 -07:00