diff options
author | Chris Robinson <[email protected]> | 2014-03-22 02:39:57 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2014-03-22 02:39:57 -0700 |
commit | 842aeb888b79883a08c672ed12f1f2b87a0fb46e (patch) | |
tree | 8bb3b91961d51f4a82ee1520d1ffc48ed8b7b379 /OpenAL32/Include/alu.h | |
parent | 22f6eb18a24c91e0e8a9c060de5690533e075429 (diff) |
Move some HRTF and mixer structs to alu.h
Diffstat (limited to 'OpenAL32/Include/alu.h')
-rw-r--r-- | OpenAL32/Include/alu.h | 66 |
1 files changed, 60 insertions, 6 deletions
diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index f8174e0e..6b75d96f 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -1,8 +1,6 @@ #ifndef _ALU_H_ #define _ALU_H_ -#include "alMain.h" - #include <limits.h> #include <math.h> #ifdef HAVE_FLOAT_H @@ -12,6 +10,11 @@ #include <ieeefp.h> #endif +#include "alMain.h" +#include "alBuffer.h" +#include "alFilter.h" +#include "hrtf.h" + #define F_PI (3.14159265358979323846f) #define F_PI_2 (1.57079632679489661923f) @@ -25,14 +28,65 @@ #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) + + #ifdef __cplusplus extern "C" { #endif -struct ALsource; -struct ALbuffer; -struct DirectParams; -struct SendParams; +typedef struct HrtfState { + ALboolean Moving; + ALuint Counter; + 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 { + ALfloat Gain; + ALfloat Dir[3]; + ALIGN(16) ALfloat Coeffs[MAX_INPUT_CHANNELS][HRIR_LENGTH][2]; + ALIGN(16) ALfloat CoeffStep[HRIR_LENGTH][2]; + ALuint Delay[MAX_INPUT_CHANNELS][2]; + ALint DelayStep[2]; + ALuint IrSize; +} HrtfParams; + +typedef struct DirectParams { + ALfloat (*OutBuffer)[BUFFERSIZE]; + ALfloat *ClickRemoval; + ALfloat *PendingClicks; + + union { + struct { + HrtfParams Params; + HrtfState *State; + } Hrtf; + + /* 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]; + } Mix; + + ALfilterState LpFilter[MAX_INPUT_CHANNELS]; +} DirectParams; + +typedef struct SendParams { + ALfloat (*OutBuffer)[BUFFERSIZE]; + ALfloat *ClickRemoval; + ALfloat *PendingClicks; + + /* Gain control, which applies to all input channels to a single (mono) + * output buffer. */ + ALfloat Gain; + + ALfilterState LpFilter[MAX_INPUT_CHANNELS]; +} SendParams; + typedef void (*ResamplerFunc)(const ALfloat *src, ALuint frac, ALuint increment, ALfloat *restrict dst, ALuint dstlen); |