diff options
-rw-r--r-- | Alc/ALu.c | 15 | ||||
-rw-r--r-- | Alc/mixer.c | 8 | ||||
-rw-r--r-- | Alc/mixer_c.c | 4 | ||||
-rw-r--r-- | Alc/mixer_defs.h | 18 | ||||
-rw-r--r-- | Alc/mixer_inc.c | 10 | ||||
-rw-r--r-- | Alc/mixer_neon.c | 4 | ||||
-rw-r--r-- | Alc/mixer_sse.c | 4 | ||||
-rw-r--r-- | OpenAL32/Include/alSource.h | 3 | ||||
-rw-r--r-- | OpenAL32/Include/alu.h | 6 | ||||
-rw-r--r-- | OpenAL32/alSource.c | 40 |
10 files changed, 49 insertions, 63 deletions
@@ -465,10 +465,9 @@ ALvoid CalcNonAttnSourceParams(ALactivesource *src, const ALCcontext *ALContext) src->Direct.Mix.Hrtf.Params.Delay[c]); } } - ALSource->Hrtf.Counter = 0; + src->Direct.Mix.Hrtf.State.Counter = 0; src->Direct.Mix.Hrtf.Params.IrSize = GetHrtfIrSize(Device->Hrtf); - src->Direct.Mix.Hrtf.State = &ALSource->Hrtf; src->DryMix = SelectHrtfMixer(); } else @@ -873,7 +872,7 @@ ALvoid CalcSourceParams(ALactivesource *src, const ALCcontext *ALContext) } /* Check to see if the HRIR is already moving. */ - if(ALSource->Hrtf.Moving) + if(src->Direct.Mix.Hrtf.State.Moving) { /* Calculate the normalized HRTF transition factor (delta). */ delta = CalcHrtfDelta(src->Direct.Mix.Hrtf.Params.Gain, DryGain, @@ -882,13 +881,14 @@ ALvoid CalcSourceParams(ALactivesource *src, const ALCcontext *ALContext) * coefficients, target delays, steppping values, and counter. */ if(delta > 0.001f) { - ALSource->Hrtf.Counter = GetMovingHrtfCoeffs(Device->Hrtf, + ALuint counter = GetMovingHrtfCoeffs(Device->Hrtf, ev, az, DryGain, delta, - ALSource->Hrtf.Counter, + src->Direct.Mix.Hrtf.State.Counter, src->Direct.Mix.Hrtf.Params.Coeffs[0], src->Direct.Mix.Hrtf.Params.Delay[0], src->Direct.Mix.Hrtf.Params.CoeffStep, src->Direct.Mix.Hrtf.Params.DelayStep); + src->Direct.Mix.Hrtf.State.Counter = counter; src->Direct.Mix.Hrtf.Params.Gain = DryGain; src->Direct.Mix.Hrtf.Params.Dir[0] = Position[0]; src->Direct.Mix.Hrtf.Params.Dir[1] = Position[1]; @@ -901,8 +901,8 @@ ALvoid CalcSourceParams(ALactivesource *src, const ALCcontext *ALContext) GetLerpedHrtfCoeffs(Device->Hrtf, ev, az, DryGain, src->Direct.Mix.Hrtf.Params.Coeffs[0], src->Direct.Mix.Hrtf.Params.Delay[0]); - ALSource->Hrtf.Counter = 0; - ALSource->Hrtf.Moving = AL_TRUE; + src->Direct.Mix.Hrtf.State.Counter = 0; + src->Direct.Mix.Hrtf.State.Moving = AL_TRUE; src->Direct.Mix.Hrtf.Params.Gain = DryGain; src->Direct.Mix.Hrtf.Params.Dir[0] = Position[0]; src->Direct.Mix.Hrtf.Params.Dir[1] = Position[1]; @@ -910,7 +910,6 @@ ALvoid CalcSourceParams(ALactivesource *src, const ALCcontext *ALContext) } src->Direct.Mix.Hrtf.Params.IrSize = GetHrtfIrSize(Device->Hrtf); - src->Direct.Mix.Hrtf.State = &ALSource->Hrtf; src->DryMix = SelectHrtfMixer(); } else diff --git a/Alc/mixer.c b/Alc/mixer.c index 36a08ccd..22c5aad7 100644 --- a/Alc/mixer.c +++ b/Alc/mixer.c @@ -411,12 +411,12 @@ ALvoid MixSource(ALactivesource *src, ALCdevice *Device, ALuint SamplesToDo) Source->BuffersPlayed = BuffersPlayed; Source->position = DataPosInt; Source->position_fraction = DataPosFrac; - Source->Hrtf.Offset += OutPos; + src->Direct.Mix.Hrtf.State.Offset += OutPos; if(State == AL_PLAYING) - Source->Hrtf.Counter = maxu(Source->Hrtf.Counter, OutPos) - OutPos; + src->Direct.Mix.Hrtf.State.Counter = maxu(src->Direct.Mix.Hrtf.State.Counter, OutPos) - OutPos; else { - Source->Hrtf.Counter = 0; - Source->Hrtf.Moving = AL_FALSE; + src->Direct.Mix.Hrtf.State.Counter = 0; + src->Direct.Mix.Hrtf.State.Moving = AL_FALSE; } } diff --git a/Alc/mixer_c.c b/Alc/mixer_c.c index 393096db..6b21e67a 100644 --- a/Alc/mixer_c.c +++ b/Alc/mixer_c.c @@ -82,7 +82,7 @@ static inline void ApplyCoeffs(ALuint Offset, ALfloat (*restrict Values)[2], #undef SUFFIX -void MixDirect_C(const DirectParams *params, const ALfloat *restrict data, ALuint srcchan, +void MixDirect_C(DirectParams *params, const ALfloat *restrict data, ALuint srcchan, ALuint OutPos, ALuint SamplesToDo, ALuint BufferSize) { ALfloat (*restrict OutBuffer)[BUFFERSIZE] = params->OutBuffer; @@ -108,7 +108,7 @@ void MixDirect_C(const DirectParams *params, const ALfloat *restrict data, ALuin } -void MixSend_C(const SendParams *params, const ALfloat *restrict data, +void MixSend_C(SendParams *params, const ALfloat *restrict data, ALuint OutPos, ALuint SamplesToDo, ALuint BufferSize) { ALfloat (*restrict OutBuffer)[BUFFERSIZE] = params->OutBuffer; diff --git a/Alc/mixer_defs.h b/Alc/mixer_defs.h index f8968a0a..878db968 100644 --- a/Alc/mixer_defs.h +++ b/Alc/mixer_defs.h @@ -16,18 +16,18 @@ void Resample_cubic32_C(const ALfloat *src, ALuint frac, ALuint increment, ALflo /* C mixers */ -void MixDirect_Hrtf_C(const struct DirectParams*,const ALfloat*restrict,ALuint,ALuint,ALuint,ALuint); -void MixDirect_C(const struct DirectParams*,const ALfloat*restrict,ALuint,ALuint,ALuint,ALuint); -void MixSend_C(const struct SendParams*,const ALfloat*restrict,ALuint,ALuint,ALuint); +void MixDirect_Hrtf_C(struct DirectParams*,const ALfloat*restrict,ALuint,ALuint,ALuint,ALuint); +void MixDirect_C(struct DirectParams*,const ALfloat*restrict,ALuint,ALuint,ALuint,ALuint); +void MixSend_C(struct SendParams*,const ALfloat*restrict,ALuint,ALuint,ALuint); /* SSE mixers */ -void MixDirect_Hrtf_SSE(const struct DirectParams*,const ALfloat*restrict,ALuint,ALuint,ALuint,ALuint); -void MixDirect_SSE(const struct DirectParams*,const ALfloat*restrict,ALuint,ALuint,ALuint,ALuint); -void MixSend_SSE(const struct SendParams*,const ALfloat*restrict,ALuint,ALuint,ALuint); +void MixDirect_Hrtf_SSE(struct DirectParams*,const ALfloat*restrict,ALuint,ALuint,ALuint,ALuint); +void MixDirect_SSE(struct DirectParams*,const ALfloat*restrict,ALuint,ALuint,ALuint,ALuint); +void MixSend_SSE(struct SendParams*,const ALfloat*restrict,ALuint,ALuint,ALuint); /* Neon mixers */ -void MixDirect_Hrtf_Neon(const struct DirectParams*,const ALfloat*restrict,ALuint,ALuint,ALuint,ALuint); -void MixDirect_Neon(const struct DirectParams*,const ALfloat*restrict,ALuint,ALuint,ALuint,ALuint); -void MixSend_Neon(const struct SendParams*,const ALfloat*restrict,ALuint,ALuint,ALuint); +void MixDirect_Hrtf_Neon(struct DirectParams*,const ALfloat*restrict,ALuint,ALuint,ALuint,ALuint); +void MixDirect_Neon(struct DirectParams*,const ALfloat*restrict,ALuint,ALuint,ALuint,ALuint); +void MixSend_Neon(struct SendParams*,const ALfloat*restrict,ALuint,ALuint,ALuint); #endif /* MIXER_DEFS_H */ diff --git a/Alc/mixer_inc.c b/Alc/mixer_inc.c index 7f70d247..c9c9bd6b 100644 --- a/Alc/mixer_inc.c +++ b/Alc/mixer_inc.c @@ -30,7 +30,7 @@ static inline void ApplyCoeffs(ALuint Offset, ALfloat (*restrict Values)[2], ALfloat left, ALfloat right); -void MixDirect_Hrtf(const DirectParams *params, const ALfloat *restrict data, ALuint srcchan, +void MixDirect_Hrtf(DirectParams *params, const ALfloat *restrict data, ALuint srcchan, ALuint OutPos, ALuint SamplesToDo, ALuint BufferSize) { ALfloat (*restrict DryBuffer)[BUFFERSIZE] = params->OutBuffer; @@ -41,10 +41,10 @@ void MixDirect_Hrtf(const DirectParams *params, const ALfloat *restrict data, AL const ALfloat (*restrict CoeffStep)[2] = params->Mix.Hrtf.Params.CoeffStep; const ALfloat (*restrict TargetCoeffs)[2] = params->Mix.Hrtf.Params.Coeffs[srcchan]; const ALuint *restrict TargetDelay = params->Mix.Hrtf.Params.Delay[srcchan]; - ALfloat *restrict History = params->Mix.Hrtf.State->History[srcchan]; - ALfloat (*restrict Values)[2] = params->Mix.Hrtf.State->Values[srcchan]; - ALint Counter = maxu(params->Mix.Hrtf.State->Counter, OutPos) - OutPos; - ALuint Offset = params->Mix.Hrtf.State->Offset + OutPos; + ALfloat *restrict History = params->Mix.Hrtf.State.History[srcchan]; + ALfloat (*restrict Values)[2] = params->Mix.Hrtf.State.Values[srcchan]; + ALint Counter = maxu(params->Mix.Hrtf.State.Counter, OutPos) - OutPos; + ALuint Offset = params->Mix.Hrtf.State.Offset + OutPos; ALIGN(16) ALfloat Coeffs[HRIR_LENGTH][2]; ALuint Delay[2]; ALfloat left, right; diff --git a/Alc/mixer_neon.c b/Alc/mixer_neon.c index 674181df..448eadd3 100644 --- a/Alc/mixer_neon.c +++ b/Alc/mixer_neon.c @@ -77,7 +77,7 @@ static inline void ApplyCoeffs(ALuint Offset, ALfloat (*restrict Values)[2], #undef SUFFIX -void MixDirect_Neon(const DirectParams *params, const ALfloat *restrict data, ALuint srcchan, +void MixDirect_Neon(DirectParams *params, const ALfloat *restrict data, ALuint srcchan, ALuint OutPos, ALuint SamplesToDo, ALuint BufferSize) { ALfloat (*restrict OutBuffer)[BUFFERSIZE] = params->OutBuffer; @@ -114,7 +114,7 @@ void MixDirect_Neon(const DirectParams *params, const ALfloat *restrict data, AL } -void MixSend_Neon(const SendParams *params, const ALfloat *restrict data, +void MixSend_Neon(SendParams *params, const ALfloat *restrict data, ALuint OutPos, ALuint SamplesToDo, ALuint BufferSize) { ALfloat (*restrict OutBuffer)[BUFFERSIZE] = params->OutBuffer; diff --git a/Alc/mixer_sse.c b/Alc/mixer_sse.c index 9b04e8b5..c9296d3d 100644 --- a/Alc/mixer_sse.c +++ b/Alc/mixer_sse.c @@ -140,7 +140,7 @@ static inline void ApplyCoeffs(ALuint Offset, ALfloat (*restrict Values)[2], #undef SUFFIX -void MixDirect_SSE(const DirectParams *params, const ALfloat *restrict data, ALuint srcchan, +void MixDirect_SSE(DirectParams *params, const ALfloat *restrict data, ALuint srcchan, ALuint OutPos, ALuint SamplesToDo, ALuint BufferSize) { ALfloat (*restrict OutBuffer)[BUFFERSIZE] = params->OutBuffer; @@ -177,7 +177,7 @@ void MixDirect_SSE(const DirectParams *params, const ALfloat *restrict data, ALu } -void MixSend_SSE(const SendParams *params, const ALfloat *restrict data, +void MixSend_SSE(SendParams *params, const ALfloat *restrict data, ALuint OutPos, ALuint SamplesToDo, ALuint BufferSize) { ALfloat (*restrict OutBuffer)[BUFFERSIZE] = params->OutBuffer; diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h index 3d3f3029..7a337a89 100644 --- a/OpenAL32/Include/alSource.h +++ b/OpenAL32/Include/alSource.h @@ -114,9 +114,6 @@ typedef struct ALsource { ALfloat GainHF; } Send[MAX_SENDS]; - /** HRTF info. */ - HrtfState Hrtf; - /** Source needs to update its mixing parameters. */ volatile ALenum NeedsUpdate; diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index 6b75d96f..c4baed83 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -63,7 +63,7 @@ typedef struct DirectParams { union { struct { HrtfParams Params; - HrtfState *State; + HrtfState State; } Hrtf; /* A mixing matrix. First subscript is the channel number of the input @@ -91,11 +91,11 @@ typedef struct SendParams { typedef void (*ResamplerFunc)(const ALfloat *src, ALuint frac, ALuint increment, ALfloat *restrict dst, ALuint dstlen); -typedef ALvoid (*DryMixerFunc)(const struct DirectParams *params, +typedef ALvoid (*DryMixerFunc)(struct DirectParams *params, const ALfloat *restrict data, ALuint srcchan, ALuint OutPos, ALuint SamplesToDo, ALuint BufferSize); -typedef ALvoid (*WetMixerFunc)(const struct SendParams *params, +typedef ALvoid (*WetMixerFunc)(struct SendParams *params, const ALfloat *restrict data, ALuint OutPos, ALuint SamplesToDo, ALuint BufferSize); diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index 7a1d42e5..e12c9b35 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -2265,9 +2265,6 @@ static ALvoid InitSourceParams(ALsource *Source) } Source->NeedsUpdate = AL_TRUE; - - Source->Hrtf.Moving = AL_FALSE; - Source->Hrtf.Counter = 0; } @@ -2293,20 +2290,6 @@ ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state) BufferList = BufferList->next; } - if(Source->state != AL_PLAYING) - { - for(j = 0;j < MAX_INPUT_CHANNELS;j++) - { - for(k = 0;k < SRC_HISTORY_LENGTH;k++) - Source->Hrtf.History[j][k] = 0.0f; - for(k = 0;k < HRIR_LENGTH;k++) - { - Source->Hrtf.Values[j][k][0] = 0.0f; - Source->Hrtf.Values[j][k][1] = 0.0f; - } - } - } - if(Source->state != AL_PAUSED) { Source->state = AL_PLAYING; @@ -2354,16 +2337,27 @@ ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state) src->Update = CalcNonAttnSourceParams; Context->ActiveSourceCount++; } + else + { + src->Direct.Mix.Hrtf.State.Moving = AL_FALSE; + src->Direct.Mix.Hrtf.State.Counter = 0; + for(j = 0;j < MAX_INPUT_CHANNELS;j++) + { + for(k = 0;k < SRC_HISTORY_LENGTH;k++) + src->Direct.Mix.Hrtf.State.History[j][k] = 0.0f; + for(k = 0;k < HRIR_LENGTH;k++) + { + src->Direct.Mix.Hrtf.State.Values[j][k][0] = 0.0f; + src->Direct.Mix.Hrtf.State.Values[j][k][1] = 0.0f; + } + } + } Source->NeedsUpdate = AL_TRUE; } else if(state == AL_PAUSED) { if(Source->state == AL_PLAYING) - { Source->state = AL_PAUSED; - Source->Hrtf.Moving = AL_FALSE; - Source->Hrtf.Counter = 0; - } } else if(state == AL_STOPPED) { @@ -2371,8 +2365,6 @@ ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state) { Source->state = AL_STOPPED; Source->BuffersPlayed = Source->BuffersInQueue; - Source->Hrtf.Moving = AL_FALSE; - Source->Hrtf.Counter = 0; } Source->Offset = -1.0; } @@ -2384,8 +2376,6 @@ ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state) Source->position = 0; Source->position_fraction = 0; Source->BuffersPlayed = 0; - Source->Hrtf.Moving = AL_FALSE; - Source->Hrtf.Counter = 0; } Source->Offset = -1.0; } |