diff options
author | Chris Robinson <[email protected]> | 2016-02-14 03:23:06 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2016-02-14 03:23:06 -0800 |
commit | ecdc93f3ca3b12ab0b226864cf8cd579140f1484 (patch) | |
tree | 9c5d34a6f9caaf163512908af0eb5da11dd90c60 /OpenAL32 | |
parent | 25732d0895cc4d320472fc50cd74302d91b24a0c (diff) |
Calculate HRTF stepping params right before mixing
This means we track the current params and the target params, rather than the
target params and the stepping. This closer matches the non-HRTF mixers.
Diffstat (limited to 'OpenAL32')
-rw-r--r-- | OpenAL32/Include/alMain.h | 2 | ||||
-rw-r--r-- | OpenAL32/Include/alu.h | 18 | ||||
-rw-r--r-- | OpenAL32/alSource.c | 1 |
3 files changed, 11 insertions, 10 deletions
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 8f1fd956..89936f85 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -404,9 +404,7 @@ typedef struct 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; diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index 50ef1f5e..af2ea857 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -138,16 +138,19 @@ typedef struct MixGains { ALfloat Target; } MixGains; +typedef struct MixHrtfParams { + const HrtfParams *Target; + HrtfParams *Current; + struct { + alignas(16) ALfloat Coeffs[HRIR_LENGTH][2]; + ALint Delay[2]; + } Steps; +} MixHrtfParams; typedef struct DirectParams { ALfloat (*OutBuffer)[BUFFERSIZE]; ALuint OutChannels; - /* Last direction (relative to listener) and gain of a moving source. */ - aluVector LastDir; - ALfloat LastGain; - ALuint HrtfCounter; - struct { enum ActiveFilters ActiveType; ALfilterState LowPass; @@ -155,7 +158,8 @@ typedef struct DirectParams { } Filters[MAX_INPUT_CHANNELS]; struct { - HrtfParams Params; + HrtfParams Current; + HrtfParams Target; HrtfState State; } Hrtf[MAX_INPUT_CHANNELS]; @@ -191,7 +195,7 @@ typedef void (*MixerFunc)(const ALfloat *data, ALuint OutChans, 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, + const ALuint IrSize, const MixHrtfParams *hrtfparams, HrtfState *hrtfstate, ALuint BufferSize); diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index f742e1fe..250c9d1e 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -2641,7 +2641,6 @@ ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state) memset(voice->PrevSamples, 0, sizeof(voice->PrevSamples)); voice->Moving = AL_FALSE; - voice->Direct.HrtfCounter = 0; for(i = 0;i < MAX_INPUT_CHANNELS;i++) { ALsizei j; |