aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-03-23 06:57:00 -0700
committerChris Robinson <[email protected]>2014-03-23 06:57:00 -0700
commit81e049bd47cc2423dc6983c47d9f99e70c3135ac (patch)
tree74424462f69b97dffaebdc04dc263bf5eeb6183c /OpenAL32
parent0ce0a88fd67ddcf7cb5248ac08d36cfa1c0013eb (diff)
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.
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/Include/alu.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h
index 3ec16565..6202c28a 100644
--- a/OpenAL32/Include/alu.h
+++ b/OpenAL32/Include/alu.h
@@ -40,7 +40,6 @@ extern "C" {
typedef struct HrtfState {
ALIGN(16) ALfloat History[MAX_INPUT_CHANNELS][SRC_HISTORY_LENGTH];
ALIGN(16) ALfloat Values[MAX_INPUT_CHANNELS][HRIR_LENGTH][2];
- ALuint Offset;
} HrtfState;
typedef struct HrtfParams {
@@ -67,12 +66,18 @@ typedef struct DirectParams {
/* A mixing matrix. First subscript is the channel number of the input
* data (regardless of channel configuration) and the second is the
* channel target (eg. FrontLeft). Not used with HRTF. */
- ALfloat Gains[MAX_INPUT_CHANNELS][MaxChannels];
+ struct {
+ ALfloat Current[MAX_INPUT_CHANNELS][MaxChannels];
+ ALfloat Step[MAX_INPUT_CHANNELS][MaxChannels];
+ ALfloat Target[MAX_INPUT_CHANNELS][MaxChannels];
+ } Gains;
} Mix;
/* If not 'moving', gain/coefficients are set directly without fading. */
ALboolean Moving;
/* Stepping counter for gain/coefficient fading. */
ALuint Counter;
+ /* History/coefficient offset. */
+ ALuint Offset;
ALfilterState LpFilter[MAX_INPUT_CHANNELS];
} DirectParams;