aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/Include/alu.h
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-11-22 04:20:17 -0800
committerChris Robinson <[email protected]>2014-11-22 04:20:17 -0800
commita27e5e16523e1f6f166410e9992fc40886064eca (patch)
treea53e47af1b8afb1afa6c497247c9c462889d9067 /OpenAL32/Include/alu.h
parent38383671d7d2a4f143f0ac84b48e8a02b91a1ba2 (diff)
Use a different method for HRTF mixing
This new method mixes sources normally into a 14-channel buffer with the channels placed all around the listener. HRTF is then applied to the channels given their positions and written to a 2-channel buffer, which gets written out to the device. This method has the benefit that HRTF processing becomes more scalable. The costly HRTF filters are applied to the 14-channel buffer after the mix is done, turning it into a post-process with a fixed overhead. Mixing sources is done with normal non-HRTF methods, so increasing the number of playing sources only incurs normal mixing costs. Another benefit is that it improves B-Format playback since the soundfield gets mixed into speakers covering all three dimensions, which then get filtered based on their locations. The main downside to this is that the spatial resolution of the HRTF dataset does not play a big role anymore. However, the hope is that with ambisonics- based panning, the perceptual position of panned sounds will still be good. It is also an option to increase the number of virtual channels for systems that can handle it, or maybe even decrease it for weaker systems.
Diffstat (limited to 'OpenAL32/Include/alu.h')
-rw-r--r--OpenAL32/Include/alu.h28
1 files changed, 1 insertions, 27 deletions
diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h
index 6e414633..69452e72 100644
--- a/OpenAL32/Include/alu.h
+++ b/OpenAL32/Include/alu.h
@@ -30,10 +30,6 @@
#define RAD2DEG(x) ((ALfloat)(x) * (180.0f/F_PI))
-#define SRC_HISTORY_BITS (6)
-#define SRC_HISTORY_LENGTH (1<<SRC_HISTORY_BITS)
-#define SRC_HISTORY_MASK (SRC_HISTORY_LENGTH-1)
-
#define MAX_PITCH (10)
@@ -53,19 +49,6 @@ enum ActiveFilters {
};
-typedef struct HrtfState {
- alignas(16) ALfloat History[SRC_HISTORY_LENGTH];
- alignas(16) ALfloat Values[HRIR_LENGTH][2];
-} HrtfState;
-
-typedef struct HrtfParams {
- alignas(16) ALfloat Coeffs[HRIR_LENGTH][2];
- alignas(16) ALfloat CoeffStep[HRIR_LENGTH][2];
- ALuint Delay[2];
- ALint DelayStep[2];
-} HrtfParams;
-
-
typedef struct MixGains {
ALfloat Current;
ALfloat Step;
@@ -88,14 +71,6 @@ typedef struct DirectParams {
} Filters[MAX_INPUT_CHANNELS];
union {
- struct {
- HrtfParams Params[MAX_INPUT_CHANNELS];
- HrtfState State[MAX_INPUT_CHANNELS];
- ALuint IrSize;
- ALfloat Gain;
- ALfloat Dir[3];
- } Hrtf;
-
MixGains Gains[MAX_INPUT_CHANNELS][MAX_OUTPUT_CHANNELS];
} Mix;
} DirectParams;
@@ -125,8 +100,7 @@ typedef void (*MixerFunc)(const ALfloat *data, ALuint OutChans,
ALfloat (*restrict OutBuffer)[BUFFERSIZE], struct MixGains *Gains,
ALuint Counter, ALuint OutPos, ALuint BufferSize);
typedef void (*HrtfMixerFunc)(ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat *data,
- ALuint Counter, ALuint Offset, ALuint OutPos,
- const ALuint IrSize, const HrtfParams *hrtfparams,
+ ALuint Offset, const ALuint IrSize, const HrtfParams *hrtfparams,
HrtfState *hrtfstate, ALuint BufferSize);