aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-05-28 22:44:50 -0700
committerChris Robinson <[email protected]>2019-05-28 22:44:50 -0700
commitb923eb187991a8db56fd23cffa70f946ce24c1ff (patch)
tree7e2dfb885cc0eb73ae1d5c48b8768bf6acfff45f
parent838e2bae801fec73258c4b8332b4d95a34d0aff2 (diff)
Use FloatBufferLine with the HRTF mixer functions
-rw-r--r--Alc/alu.cpp5
-rw-r--r--Alc/mixer/defs.h6
-rw-r--r--Alc/mixer/hrtfbase.h31
-rw-r--r--Alc/mixer/mixer_c.cpp22
-rw-r--r--Alc/mixer/mixer_neon.cpp22
-rw-r--r--Alc/mixer/mixer_sse.cpp22
-rw-r--r--Alc/mixvoice.cpp10
-rw-r--r--OpenAL32/Include/alu.h12
8 files changed, 65 insertions, 65 deletions
diff --git a/Alc/alu.cpp b/Alc/alu.cpp
index 2ce74537..2a43cd88 100644
--- a/Alc/alu.cpp
+++ b/Alc/alu.cpp
@@ -133,9 +133,8 @@ void ProcessHrtf(ALCdevice *device, const ALsizei SamplesToDo)
ASSUME(lidx >= 0 && ridx >= 0);
DirectHrtfState *state{device->mHrtfState.get()};
- MixDirectHrtf(device->RealOut.Buffer[lidx].data(), device->RealOut.Buffer[ridx].data(),
- &reinterpret_cast<float(&)[BUFFERSIZE]>(device->Dry.Buffer[0]), device->HrtfAccumData,
- state, device->Dry.NumChannels, SamplesToDo);
+ MixDirectHrtf(device->RealOut.Buffer[lidx], device->RealOut.Buffer[ridx],
+ device->Dry.Buffer, device->HrtfAccumData, state, device->Dry.NumChannels, SamplesToDo);
}
void ProcessAmbiDec(ALCdevice *device, const ALsizei SamplesToDo)
diff --git a/Alc/mixer/defs.h b/Alc/mixer/defs.h
index cd301833..a6131958 100644
--- a/Alc/mixer/defs.h
+++ b/Alc/mixer/defs.h
@@ -35,11 +35,11 @@ template<typename InstTag>
void MixRow_(ALfloat *OutBuffer, const ALfloat *Gains, const ALfloat (*data)[BUFFERSIZE], const ALsizei InChans, const ALsizei InPos, const ALsizei BufferSize);
template<typename InstTag>
-void MixHrtf_(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut, const ALfloat *data, float2 *RESTRICT AccumSamples, const ALsizei OutPos, const ALsizei IrSize, MixHrtfParams *hrtfparams, const ALsizei BufferSize);
+void MixHrtf_(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, const ALfloat *InSamples, float2 *AccumSamples, const ALsizei OutPos, const ALsizei IrSize, MixHrtfParams *hrtfparams, const ALsizei BufferSize);
template<typename InstTag>
-void MixHrtfBlend_(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut, const ALfloat *data, float2 *RESTRICT AccumSamples, const ALsizei OutPos, const ALsizei IrSize, const HrtfParams *oldparams, MixHrtfParams *newparams, const ALsizei BufferSize);
+void MixHrtfBlend_(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, const ALfloat *InSamples, float2 *AccumSamples, const ALsizei OutPos, const ALsizei IrSize, const HrtfParams *oldparams, MixHrtfParams *newparams, const ALsizei BufferSize);
template<typename InstTag>
-void MixDirectHrtf_(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut, const ALfloat (*data)[BUFFERSIZE], float2 *RESTRICT AccumSamples, DirectHrtfState *State, const ALsizei NumChans, const ALsizei BufferSize);
+void MixDirectHrtf_(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, const FloatBufferLine *InSamples, float2 *AccumSamples, DirectHrtfState *State, const ALsizei NumChans, const ALsizei BufferSize);
/* Vectorized resampler helpers */
inline void InitiatePositionArrays(ALsizei frac, ALint increment, ALsizei *RESTRICT frac_arr, ALsizei *RESTRICT pos_arr, ALsizei size)
diff --git a/Alc/mixer/hrtfbase.h b/Alc/mixer/hrtfbase.h
index 162d7289..8549f6ba 100644
--- a/Alc/mixer/hrtfbase.h
+++ b/Alc/mixer/hrtfbase.h
@@ -12,9 +12,9 @@ using ApplyCoeffsT = void(ALsizei Offset, float2 *RESTRICT Values, const ALsizei
const HrirArray<ALfloat> &Coeffs, const ALfloat left, const ALfloat right);
template<ApplyCoeffsT &ApplyCoeffs>
-inline void MixHrtfBase(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut, const ALfloat *data,
- float2 *RESTRICT AccumSamples, const ALsizei OutPos, const ALsizei IrSize,
- MixHrtfParams *hrtfparams, const ALsizei BufferSize)
+inline void MixHrtfBase(FloatBufferLine &LeftOut, FloatBufferLine &RightOut,
+ const ALfloat *InSamples, float2 *RESTRICT AccumSamples, const ALsizei OutPos,
+ const ALsizei IrSize, MixHrtfParams *hrtfparams, const ALsizei BufferSize)
{
ASSUME(OutPos >= 0);
ASSUME(IrSize >= 4);
@@ -33,8 +33,8 @@ inline void MixHrtfBase(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut, c
for(ALsizei i{0};i < BufferSize;++i)
{
const ALfloat g{gain + gainstep*stepcount};
- const ALfloat left{data[Delay[0]++] * g};
- const ALfloat right{data[Delay[1]++] * g};
+ const ALfloat left{InSamples[Delay[0]++] * g};
+ const ALfloat right{InSamples[Delay[1]++] * g};
ApplyCoeffs(i, AccumSamples+i, IrSize, Coeffs, left, right);
stepcount += 1.0f;
@@ -48,9 +48,10 @@ inline void MixHrtfBase(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut, c
}
template<ApplyCoeffsT &ApplyCoeffs>
-inline void MixHrtfBlendBase(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
- const ALfloat *data, float2 *RESTRICT AccumSamples, const ALsizei OutPos, const ALsizei IrSize,
- const HrtfParams *oldparams, MixHrtfParams *newparams, const ALsizei BufferSize)
+inline void MixHrtfBlendBase(FloatBufferLine &LeftOut, FloatBufferLine &RightOut,
+ const ALfloat *InSamples, float2 *RESTRICT AccumSamples, const ALsizei OutPos,
+ const ALsizei IrSize, const HrtfParams *oldparams, MixHrtfParams *newparams,
+ const ALsizei BufferSize)
{
const auto &OldCoeffs = oldparams->Coeffs;
const ALfloat oldGain{oldparams->Gain};
@@ -75,13 +76,13 @@ inline void MixHrtfBlendBase(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightO
for(ALsizei i{0};i < BufferSize;++i)
{
ALfloat g{oldGain + oldGainStep*stepcount};
- ALfloat left{data[OldDelay[0]++] * g};
- ALfloat right{data[OldDelay[1]++] * g};
+ ALfloat left{InSamples[OldDelay[0]++] * g};
+ ALfloat right{InSamples[OldDelay[1]++] * g};
ApplyCoeffs(i, AccumSamples+i, IrSize, OldCoeffs, left, right);
g = newGainStep*stepcount;
- left = data[NewDelay[0]++] * g;
- right = data[NewDelay[1]++] * g;
+ left = InSamples[NewDelay[0]++] * g;
+ right = InSamples[NewDelay[1]++] * g;
ApplyCoeffs(i, AccumSamples+i, IrSize, NewCoeffs, left, right);
stepcount += 1.0f;
@@ -95,8 +96,8 @@ inline void MixHrtfBlendBase(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightO
}
template<ApplyCoeffsT &ApplyCoeffs>
-inline void MixDirectHrtfBase(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
- const ALfloat (*data)[BUFFERSIZE], float2 *RESTRICT AccumSamples, DirectHrtfState *State,
+inline void MixDirectHrtfBase(FloatBufferLine &LeftOut, FloatBufferLine &RightOut,
+ const FloatBufferLine *InSamples, float2 *RESTRICT AccumSamples, DirectHrtfState *State,
const ALsizei NumChans, const ALsizei BufferSize)
{
ASSUME(NumChans > 0);
@@ -107,7 +108,7 @@ inline void MixDirectHrtfBase(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT Right
for(ALsizei c{0};c < NumChans;++c)
{
- const ALfloat (&input)[BUFFERSIZE] = data[c];
+ const FloatBufferLine &input = InSamples[c];
const auto &Coeffs = State->Chan[c].Coeffs;
auto accum_iter = std::copy_n(State->Chan[c].Values.begin(),
diff --git a/Alc/mixer/mixer_c.cpp b/Alc/mixer/mixer_c.cpp
index 6ee5df88..79ee305b 100644
--- a/Alc/mixer/mixer_c.cpp
+++ b/Alc/mixer/mixer_c.cpp
@@ -117,29 +117,29 @@ static inline void ApplyCoeffs(ALsizei /*Offset*/, float2 *RESTRICT Values, cons
}
template<>
-void MixHrtf_<CTag>(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut, const ALfloat *data,
- float2 *RESTRICT AccumSamples, const ALsizei OutPos, const ALsizei IrSize,
+void MixHrtf_<CTag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut,
+ const ALfloat *InSamples, float2 *AccumSamples, const ALsizei OutPos, const ALsizei IrSize,
MixHrtfParams *hrtfparams, const ALsizei BufferSize)
{
- MixHrtfBase<ApplyCoeffs>(LeftOut, RightOut, data, AccumSamples, OutPos, IrSize, hrtfparams,
- BufferSize);
+ MixHrtfBase<ApplyCoeffs>(LeftOut, RightOut, InSamples, AccumSamples, OutPos, IrSize,
+ hrtfparams, BufferSize);
}
template<>
-void MixHrtfBlend_<CTag>(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
- const ALfloat *data, float2 *RESTRICT AccumSamples, const ALsizei OutPos, const ALsizei IrSize,
+void MixHrtfBlend_<CTag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut,
+ const ALfloat *InSamples, float2 *AccumSamples, const ALsizei OutPos, const ALsizei IrSize,
const HrtfParams *oldparams, MixHrtfParams *newparams, const ALsizei BufferSize)
{
- MixHrtfBlendBase<ApplyCoeffs>(LeftOut, RightOut, data, AccumSamples, OutPos, IrSize, oldparams,
- newparams, BufferSize);
+ MixHrtfBlendBase<ApplyCoeffs>(LeftOut, RightOut, InSamples, AccumSamples, OutPos, IrSize,
+ oldparams, newparams, BufferSize);
}
template<>
-void MixDirectHrtf_<CTag>(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
- const ALfloat (*data)[BUFFERSIZE], float2 *RESTRICT AccumSamples, DirectHrtfState *State,
+void MixDirectHrtf_<CTag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut,
+ const FloatBufferLine *InSamples, float2 *AccumSamples, DirectHrtfState *State,
const ALsizei NumChans, const ALsizei BufferSize)
{
- MixDirectHrtfBase<ApplyCoeffs>(LeftOut, RightOut, data, AccumSamples, State, NumChans,
+ MixDirectHrtfBase<ApplyCoeffs>(LeftOut, RightOut, InSamples, AccumSamples, State, NumChans,
BufferSize);
}
diff --git a/Alc/mixer/mixer_neon.cpp b/Alc/mixer/mixer_neon.cpp
index cdd96296..e6f257fd 100644
--- a/Alc/mixer/mixer_neon.cpp
+++ b/Alc/mixer/mixer_neon.cpp
@@ -163,29 +163,29 @@ static inline void ApplyCoeffs(ALsizei /*Offset*/, float2 *RESTRICT Values, cons
}
template<>
-void MixHrtf_<NEONTag>(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut, const ALfloat *data,
- float2 *RESTRICT AccumSamples, const ALsizei OutPos, const ALsizei IrSize,
+void MixHrtf_<NEONTag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut,
+ const ALfloat *InSamples, float2 *AccumSamples, const ALsizei OutPos, const ALsizei IrSize,
MixHrtfParams *hrtfparams, const ALsizei BufferSize)
{
- MixHrtfBase<ApplyCoeffs>(LeftOut, RightOut, data, AccumSamples, OutPos, IrSize, hrtfparams,
- BufferSize);
+ MixHrtfBase<ApplyCoeffs>(LeftOut, RightOut, InSamples, AccumSamples, OutPos, IrSize,
+ hrtfparams, BufferSize);
}
template<>
-void MixHrtfBlend_<NEONTag>(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
- const ALfloat *data, float2 *RESTRICT AccumSamples, const ALsizei OutPos, const ALsizei IrSize,
+void MixHrtfBlend_<NEONTag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut,
+ const ALfloat *InSamples, float2 *AccumSamples, const ALsizei OutPos, const ALsizei IrSize,
const HrtfParams *oldparams, MixHrtfParams *newparams, const ALsizei BufferSize)
{
- MixHrtfBlendBase<ApplyCoeffs>(LeftOut, RightOut, data, AccumSamples, OutPos, IrSize, oldparams,
- newparams, BufferSize);
+ MixHrtfBlendBase<ApplyCoeffs>(LeftOut, RightOut, InSamples, AccumSamples, OutPos, IrSize,
+ oldparams, newparams, BufferSize);
}
template<>
-void MixDirectHrtf_<NEONTag>(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
- const ALfloat (*data)[BUFFERSIZE], float2 *RESTRICT AccumSamples, DirectHrtfState *State,
+void MixDirectHrtf_<NEONTag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut,
+ const FloatBufferLine *InSamples, float2 *AccumSamples, DirectHrtfState *State,
const ALsizei NumChans, const ALsizei BufferSize)
{
- MixDirectHrtfBase<ApplyCoeffs>(LeftOut, RightOut, data, AccumSamples, State, NumChans,
+ MixDirectHrtfBase<ApplyCoeffs>(LeftOut, RightOut, InSamples, AccumSamples, State, NumChans,
BufferSize);
}
diff --git a/Alc/mixer/mixer_sse.cpp b/Alc/mixer/mixer_sse.cpp
index 629fa428..a4e80256 100644
--- a/Alc/mixer/mixer_sse.cpp
+++ b/Alc/mixer/mixer_sse.cpp
@@ -120,29 +120,29 @@ static inline void ApplyCoeffs(ALsizei Offset, float2 *RESTRICT Values, const AL
}
template<>
-void MixHrtf_<SSETag>(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut, const ALfloat *data,
- float2 *RESTRICT AccumSamples, const ALsizei OutPos, const ALsizei IrSize,
+void MixHrtf_<SSETag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut,
+ const ALfloat *InSamples, float2 *AccumSamples, const ALsizei OutPos, const ALsizei IrSize,
MixHrtfParams *hrtfparams, const ALsizei BufferSize)
{
- MixHrtfBase<ApplyCoeffs>(LeftOut, RightOut, data, AccumSamples, OutPos, IrSize, hrtfparams,
- BufferSize);
+ MixHrtfBase<ApplyCoeffs>(LeftOut, RightOut, InSamples, AccumSamples, OutPos, IrSize,
+ hrtfparams, BufferSize);
}
template<>
-void MixHrtfBlend_<SSETag>(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
- const ALfloat *data, float2 *RESTRICT AccumSamples, const ALsizei OutPos, const ALsizei IrSize,
+void MixHrtfBlend_<SSETag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut,
+ const ALfloat *InSamples, float2 *AccumSamples, const ALsizei OutPos, const ALsizei IrSize,
const HrtfParams *oldparams, MixHrtfParams *newparams, const ALsizei BufferSize)
{
- MixHrtfBlendBase<ApplyCoeffs>(LeftOut, RightOut, data, AccumSamples, OutPos, IrSize, oldparams,
- newparams, BufferSize);
+ MixHrtfBlendBase<ApplyCoeffs>(LeftOut, RightOut, InSamples, AccumSamples, OutPos, IrSize,
+ oldparams, newparams, BufferSize);
}
template<>
-void MixDirectHrtf_<SSETag>(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
- const ALfloat (*data)[BUFFERSIZE], float2 *RESTRICT AccumSamples, DirectHrtfState *State,
+void MixDirectHrtf_<SSETag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut,
+ const FloatBufferLine *InSamples, float2 *AccumSamples, DirectHrtfState *State,
const ALsizei NumChans, const ALsizei BufferSize)
{
- MixDirectHrtfBase<ApplyCoeffs>(LeftOut, RightOut, data, AccumSamples, State, NumChans,
+ MixDirectHrtfBase<ApplyCoeffs>(LeftOut, RightOut, InSamples, AccumSamples, State, NumChans,
BufferSize);
}
diff --git a/Alc/mixvoice.cpp b/Alc/mixvoice.cpp
index 6df9f430..c9227919 100644
--- a/Alc/mixvoice.cpp
+++ b/Alc/mixvoice.cpp
@@ -744,9 +744,9 @@ void MixVoice(ALvoice *voice, ALvoice::State vstate, const ALuint SourceID, ALCc
hrtfparams.Gain = 0.0f;
hrtfparams.GainStep = gain / static_cast<ALfloat>(fademix);
- MixHrtfBlendSamples(voice->mDirect.Buffer[OutLIdx].data(),
- voice->mDirect.Buffer[OutRIdx].data(), HrtfSamples, AccumSamples,
- OutPos, IrSize, &parms.Hrtf.Old, &hrtfparams, fademix);
+ MixHrtfBlendSamples(voice->mDirect.Buffer[OutLIdx],
+ voice->mDirect.Buffer[OutRIdx], HrtfSamples, AccumSamples, OutPos,
+ IrSize, &parms.Hrtf.Old, &hrtfparams, fademix);
/* Update the old parameters with the result. */
parms.Hrtf.Old = parms.Hrtf.Target;
if(fademix < Counter)
@@ -777,8 +777,8 @@ void MixVoice(ALvoice *voice, ALvoice::State vstate, const ALuint SourceID, ALCc
hrtfparams.Gain = parms.Hrtf.Old.Gain;
hrtfparams.GainStep = (gain - parms.Hrtf.Old.Gain) /
static_cast<ALfloat>(todo);
- MixHrtfSamples(voice->mDirect.Buffer[OutLIdx].data(),
- voice->mDirect.Buffer[OutRIdx].data(), HrtfSamples+fademix,
+ MixHrtfSamples(voice->mDirect.Buffer[OutLIdx],
+ voice->mDirect.Buffer[OutRIdx], HrtfSamples+fademix,
AccumSamples+fademix, OutPos+fademix, IrSize, &hrtfparams, todo);
/* Store the interpolated gain or the final target gain
* depending if the fade is done.
diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h
index 327adfc0..8653b96c 100644
--- a/OpenAL32/Include/alu.h
+++ b/OpenAL32/Include/alu.h
@@ -297,14 +297,14 @@ using MixerFunc = void(*)(const ALfloat *data, const ALsizei OutChans,
using RowMixerFunc = void(*)(ALfloat *OutBuffer, const ALfloat *gains,
const ALfloat (*data)[BUFFERSIZE], const ALsizei InChans, const ALsizei InPos,
const ALsizei BufferSize);
-using HrtfMixerFunc = void(*)(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
- const ALfloat *data, float2 *RESTRICT AccumSamples, const ALsizei OutPos, const ALsizei IrSize,
+using HrtfMixerFunc = void(*)(FloatBufferLine &LeftOut, FloatBufferLine &RightOut,
+ const ALfloat *InSamples, float2 *AccumSamples, const ALsizei OutPos, const ALsizei IrSize,
MixHrtfParams *hrtfparams, const ALsizei BufferSize);
-using HrtfMixerBlendFunc = void(*)(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
- const ALfloat *data, float2 *RESTRICT AccumSamples, const ALsizei OutPos, const ALsizei IrSize,
+using HrtfMixerBlendFunc = void(*)(FloatBufferLine &LeftOut, FloatBufferLine &RightOut,
+ const ALfloat *InSamples, float2 *AccumSamples, const ALsizei OutPos, const ALsizei IrSize,
const HrtfParams *oldparams, MixHrtfParams *newparams, const ALsizei BufferSize);
-using HrtfDirectMixerFunc = void(*)(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
- const ALfloat (*data)[BUFFERSIZE], float2 *RESTRICT AccumSamples, DirectHrtfState *State,
+using HrtfDirectMixerFunc = void(*)(FloatBufferLine &LeftOut, FloatBufferLine &RightOut,
+ const FloatBufferLine *InSamples, float2 *RESTRICT AccumSamples, DirectHrtfState *State,
const ALsizei NumChans, const ALsizei BufferSize);