diff options
author | Chris Robinson <[email protected]> | 2014-05-18 09:31:08 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2014-05-18 09:31:08 -0700 |
commit | 5a1abf69189463312787921f5a3cf5fd35bf65c2 (patch) | |
tree | e48f2cd51f7aa4bfe2a92489bf82445f2d9d98d3 /Alc | |
parent | 29b5dae6aa010224b2fd428530e1cd67d6d92e1a (diff) |
Use different parameters for HRTF mixers
Diffstat (limited to 'Alc')
-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 |
4 files changed, 42 insertions, 28 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 |