diff options
-rw-r--r-- | Alc/ALu.c | 17 | ||||
-rw-r--r-- | Alc/mixer.c | 15 | ||||
-rw-r--r-- | Alc/mixer_defs.h | 24 | ||||
-rw-r--r-- | Alc/mixer_inc.c | 14 | ||||
-rw-r--r-- | OpenAL32/Include/alSource.h | 6 | ||||
-rw-r--r-- | OpenAL32/Include/alu.h | 4 |
6 files changed, 51 insertions, 29 deletions
@@ -99,7 +99,7 @@ static ResamplerFunc SelectResampler(enum Resampler Resampler, ALuint increment) } -static DryMixerFunc SelectHrtfMixer(void) +static HrtfMixerFunc SelectHrtfMixer(void) { #ifdef HAVE_SSE if((CPUCapFlags&CPU_CAP_SSE)) @@ -467,7 +467,8 @@ ALvoid CalcNonAttnSourceParams(ALactivesource *src, const ALCcontext *ALContext) src->Direct.Moving = AL_TRUE; } - src->DryMix = SelectDirectMixer(); + src->IsHrtf = AL_FALSE; + src->Dry.Mix = SelectDirectMixer(); } else if(Device->Hrtf) { @@ -498,7 +499,8 @@ ALvoid CalcNonAttnSourceParams(ALactivesource *src, const ALCcontext *ALContext) src->Direct.Moving = AL_TRUE; src->Direct.Mix.Hrtf.IrSize = GetHrtfIrSize(Device->Hrtf); - src->DryMix = SelectHrtfMixer(); + src->IsHrtf = AL_TRUE; + src->Dry.HrtfMix = SelectHrtfMixer(); } else { @@ -557,7 +559,8 @@ ALvoid CalcNonAttnSourceParams(ALactivesource *src, const ALCcontext *ALContext) src->Direct.Moving = AL_TRUE; } - src->DryMix = SelectDirectMixer(); + src->IsHrtf = AL_FALSE; + src->Dry.Mix = SelectDirectMixer(); } for(i = 0;i < NumSends;i++) { @@ -1020,7 +1023,8 @@ ALvoid CalcSourceParams(ALactivesource *src, const ALCcontext *ALContext) } src->Direct.Mix.Hrtf.IrSize = GetHrtfIrSize(Device->Hrtf); - src->DryMix = SelectHrtfMixer(); + src->IsHrtf = AL_TRUE; + src->Dry.HrtfMix = SelectHrtfMixer(); } else { @@ -1088,7 +1092,8 @@ ALvoid CalcSourceParams(ALactivesource *src, const ALCcontext *ALContext) src->Direct.Moving = AL_TRUE; } - src->DryMix = SelectDirectMixer(); + src->IsHrtf = AL_FALSE; + src->Dry.Mix = SelectDirectMixer(); } for(i = 0;i < NumSends;i++) { diff --git a/Alc/mixer.c b/Alc/mixer.c index b50651c8..e1be5fd9 100644 --- a/Alc/mixer.c +++ b/Alc/mixer.c @@ -350,9 +350,18 @@ ALvoid MixSource(ALactivesource *src, ALCdevice *Device, ALuint SamplesToDo) DoFilters(&directparms->LpFilter[chan], &directparms->HpFilter[chan], SrcData, ResampledData, DstBufferSize, directparms->Filters[chan]); - src->DryMix(directparms, directparms->OutBuffer, SrcData, - maxu(directparms->Counter, OutPos) - OutPos, chan, - OutPos, DstBufferSize); + if(!src->IsHrtf) + src->Dry.Mix(directparms, directparms->OutBuffer, SrcData, + maxu(directparms->Counter, OutPos) - OutPos, chan, + OutPos, DstBufferSize); + else + src->Dry.HrtfMix(directparms->OutBuffer, SrcData, + maxu(directparms->Counter, OutPos) - OutPos, + directparms->Offset + OutPos, + directparms->Mix.Hrtf.IrSize, + &directparms->Mix.Hrtf.Params[chan], + &directparms->Mix.Hrtf.State[chan], + OutPos, DstBufferSize); } for(j = 0;j < Device->NumAuxSends;j++) diff --git a/Alc/mixer_defs.h b/Alc/mixer_defs.h index c0a77f0f..c1d90408 100644 --- a/Alc/mixer_defs.h +++ b/Alc/mixer_defs.h @@ -8,6 +8,9 @@ struct DirectParams; struct SendParams; +struct HrtfParams; +struct HrtfState; + /* C resamplers */ void Resample_copy32_C(const ALfloat *src, ALuint frac, ALuint increment, ALfloat *restrict dst, ALuint dstlen); void Resample_point32_C(const ALfloat *src, ALuint frac, ALuint increment, ALfloat *restrict dst, ALuint dstlen); @@ -16,27 +19,30 @@ void Resample_cubic32_C(const ALfloat *src, ALuint frac, ALuint increment, ALflo /* C mixers */ -void MixDirect_Hrtf_C(struct DirectParams *params, - ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat *restrict data, - ALuint Counter, ALuint srcchan, ALuint OutPos, ALuint BufferSize); +void MixDirect_Hrtf_C(ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat *data, + ALuint Counter, ALuint Offset, const ALuint IrSize, + const struct HrtfParams *hrtfparams, struct HrtfState *hrtfstate, + ALuint OutPos, ALuint BufferSize); void MixDirect_C(struct DirectParams *params, ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat *restrict data, ALuint Counter, ALuint srcchan, ALuint OutPos, ALuint BufferSize); void MixSend_C(struct SendParams*,const ALfloat*restrict,ALuint,ALuint); /* SSE mixers */ -void MixDirect_Hrtf_SSE(struct DirectParams *params, - ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat *restrict data, - ALuint Counter, ALuint srcchan, ALuint OutPos, ALuint BufferSize); +void MixDirect_Hrtf_SSE(ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat *data, + ALuint Counter, ALuint Offset, const ALuint IrSize, + const struct HrtfParams *hrtfparams, struct HrtfState *hrtfstate, + ALuint OutPos, ALuint BufferSize); void MixDirect_SSE(struct DirectParams *params, ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat *restrict data, ALuint Counter, ALuint srcchan, ALuint OutPos, ALuint BufferSize); void MixSend_SSE(struct SendParams*,const ALfloat*restrict,ALuint,ALuint); /* Neon mixers */ -void MixDirect_Hrtf_Neon(struct DirectParams *params, - ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat *restrict data, - ALuint Counter, ALuint srcchan, ALuint OutPos, ALuint BufferSize); +void MixDirect_Hrtf_Neon(ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat *data, + ALuint Counter, ALuint Offset, const ALuint IrSize, + const struct HrtfParams *hrtfparams, struct HrtfState *hrtfstate, + ALuint OutPos, ALuint BufferSize); void MixDirect_Neon(struct DirectParams *params, ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat *restrict data, ALuint Counter, ALuint srcchan, ALuint OutPos, ALuint BufferSize); diff --git a/Alc/mixer_inc.c b/Alc/mixer_inc.c index b75ddad3..f22190d8 100644 --- a/Alc/mixer_inc.c +++ b/Alc/mixer_inc.c @@ -25,14 +25,11 @@ static inline void ApplyCoeffs(ALuint Offset, ALfloat (*restrict Values)[2], ALfloat left, ALfloat right); -void MixDirect_Hrtf(DirectParams *params, - ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat *restrict data, - ALuint Counter, ALuint srcchan, ALuint OutPos, ALuint BufferSize) +void MixDirect_Hrtf(ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat *data, + ALuint Counter, ALuint Offset, const ALuint IrSize, + const HrtfParams *hrtfparams, HrtfState *hrtfstate, + ALuint OutPos, ALuint BufferSize) { - const ALuint IrSize = params->Mix.Hrtf.IrSize; - const HrtfParams *hrtfparams = ¶ms->Mix.Hrtf.Params[srcchan]; - HrtfState *hrtfstate = ¶ms->Mix.Hrtf.State[srcchan]; - ALuint Offset = params->Offset + OutPos; alignas(16) ALfloat Coeffs[HRIR_LENGTH][2]; ALuint Delay[2]; ALfloat left, right; @@ -95,6 +92,3 @@ void MixDirect_Hrtf(DirectParams *params, #undef MERGE2 #undef REAL_MERGE2 - -#undef UNLIKELY -#undef LIKELY diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h index c3513525..0839e5b9 100644 --- a/OpenAL32/Include/alSource.h +++ b/OpenAL32/Include/alSource.h @@ -32,9 +32,13 @@ typedef struct ALactivesource { /** Current target parameters used for mixing. */ ResamplerFunc Resample; - DryMixerFunc DryMix; + union { + DryMixerFunc Mix; + HrtfMixerFunc HrtfMix; + } Dry; WetMixerFunc WetMix; + ALboolean IsHrtf; ALint Step; DirectParams Direct; diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index 4354c76e..7816ee94 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -119,6 +119,10 @@ typedef ALvoid (*DryMixerFunc)(struct DirectParams *params, ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat *restrict data, ALuint Counter, ALuint srcchan, ALuint OutPos, ALuint BufferSize); +typedef void (*HrtfMixerFunc)(ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat *data, + ALuint Counter, ALuint Offset, const ALuint IrSize, + const HrtfParams *hrtfparams, HrtfState *hrtfstate, + ALuint OutPos, ALuint BufferSize); typedef ALvoid (*WetMixerFunc)(struct SendParams *params, const ALfloat *restrict data, ALuint OutPos, ALuint BufferSize); |