diff options
Diffstat (limited to 'OpenAL32/Include')
-rw-r--r-- | OpenAL32/Include/alMain.h | 33 | ||||
-rw-r--r-- | OpenAL32/Include/alu.h | 28 |
2 files changed, 33 insertions, 28 deletions
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 083d2613..bcb278dd 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -37,6 +37,8 @@ #include "vector.h" #include "alstring.h" +#include "hrtf.h" + #ifndef ALC_SOFT_HRTF #define ALC_SOFT_HRTF 1 #define ALC_HRTF_SOFT 0x1992 @@ -528,6 +530,17 @@ enum Channel { SideLeft, SideRight, + TopCenter, + BottomCenter, + TopFrontLeft, + TopFrontRight, + TopBackLeft, + TopBackRight, + BottomFrontLeft, + BottomFrontRight, + BottomBackLeft, + BottomBackRight, + InvalidChannel }; @@ -557,7 +570,7 @@ enum DevFmtChannels { DevFmtChannelsDefault = DevFmtStereo }; -#define MAX_OUTPUT_CHANNELS (8) +#define MAX_OUTPUT_CHANNELS (14) ALuint BytesFromDevFmt(enum DevFmtType type) DECL_CONST; ALuint ChannelsFromDevFmt(enum DevFmtChannels chans) DECL_CONST; @@ -593,6 +606,21 @@ typedef struct ChannelConfig { } ChannelConfig; +#define HRTF_HISTORY_BITS (6) +#define HRTF_HISTORY_LENGTH (1<<HRTF_HISTORY_BITS) +#define HRTF_HISTORY_MASK (HRTF_HISTORY_LENGTH-1) + +typedef struct HrtfState { + alignas(16) ALfloat History[HRTF_HISTORY_LENGTH]; + alignas(16) ALfloat Values[HRIR_LENGTH][2]; +} HrtfState; + +typedef struct HrtfParams { + alignas(16) ALfloat Coeffs[HRIR_LENGTH][2]; + ALuint Delay[2]; +} HrtfParams; + + /* Size for temporary storage of buffer data, in ALfloats. Larger values need * more memory, while smaller values may need more iterations. The value needs * to be a sensible size, however, as it constrains the max stepping value used @@ -652,6 +680,9 @@ struct ALCdevice_struct /* HRTF filter tables */ const struct Hrtf *Hrtf; + HrtfState Hrtf_State[MAX_OUTPUT_CHANNELS]; + HrtfParams Hrtf_Params[MAX_OUTPUT_CHANNELS]; + ALuint Hrtf_Offset; // Stereo-to-binaural filter struct bs2b *Bs2b; 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); |