aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--alc/mixer/defs.h4
-rw-r--r--alc/mixer/hrtfbase.h8
-rw-r--r--alc/mixer/mixer_c.cpp4
-rw-r--r--alc/mixer/mixer_neon.cpp4
-rw-r--r--alc/mixer/mixer_sse.cpp4
-rw-r--r--alc/voice.cpp18
6 files changed, 15 insertions, 27 deletions
diff --git a/alc/mixer/defs.h b/alc/mixer/defs.h
index 1e5b40d8..a3b49ad3 100644
--- a/alc/mixer/defs.h
+++ b/alc/mixer/defs.h
@@ -42,10 +42,10 @@ void MixRow_(const al::span<float> OutBuffer, const al::span<const float> Gains,
template<InstSetType InstTag>
void MixHrtf_(const float *InSamples, float2 *AccumSamples, const ALuint IrSize,
- MixHrtfFilter *hrtfparams, const size_t BufferSize);
+ const MixHrtfFilter *hrtfparams, const size_t BufferSize);
template<InstSetType InstTag>
void MixHrtfBlend_(const float *InSamples, float2 *AccumSamples, const ALuint IrSize,
- const HrtfFilter *oldparams, MixHrtfFilter *newparams, const size_t BufferSize);
+ const HrtfFilter *oldparams, const MixHrtfFilter *newparams, const size_t BufferSize);
template<InstSetType InstTag>
void MixDirectHrtf_(FloatBufferLine &LeftOut, FloatBufferLine &RightOut,
const al::span<const FloatBufferLine> InSamples, float2 *AccumSamples, DirectHrtfState *State,
diff --git a/alc/mixer/hrtfbase.h b/alc/mixer/hrtfbase.h
index 942c56c3..ed40328c 100644
--- a/alc/mixer/hrtfbase.h
+++ b/alc/mixer/hrtfbase.h
@@ -14,7 +14,7 @@ using ApplyCoeffsT = void(&)(float2 *RESTRICT Values, const ALuint irSize, const
template<ApplyCoeffsT ApplyCoeffs>
inline void MixHrtfBase(const float *InSamples, float2 *RESTRICT AccumSamples, const ALuint IrSize,
- MixHrtfFilter *hrtfparams, const size_t BufferSize)
+ const MixHrtfFilter *hrtfparams, const size_t BufferSize)
{
ASSUME(BufferSize > 0);
@@ -35,13 +35,11 @@ inline void MixHrtfBase(const float *InSamples, float2 *RESTRICT AccumSamples, c
stepcount += 1.0f;
}
-
- hrtfparams->Gain = gain + gainstep*stepcount;
}
template<ApplyCoeffsT ApplyCoeffs>
inline void MixHrtfBlendBase(const float *InSamples, float2 *RESTRICT AccumSamples,
- const ALuint IrSize, const HrtfFilter *oldparams, MixHrtfFilter *newparams,
+ const ALuint IrSize, const HrtfFilter *oldparams, const MixHrtfFilter *newparams,
const size_t BufferSize)
{
const auto &OldCoeffs = oldparams->Coeffs;
@@ -78,8 +76,6 @@ inline void MixHrtfBlendBase(const float *InSamples, float2 *RESTRICT AccumSampl
stepcount += 1.0f;
}
-
- newparams->Gain = newGainStep*stepcount;
}
template<ApplyCoeffsT ApplyCoeffs>
diff --git a/alc/mixer/mixer_c.cpp b/alc/mixer/mixer_c.cpp
index 64d12ef7..c086dd8d 100644
--- a/alc/mixer/mixer_c.cpp
+++ b/alc/mixer/mixer_c.cpp
@@ -137,12 +137,12 @@ const ALfloat *Resample_<FastBSincTag,CTag>(const InterpState *state, const ALfl
template<>
void MixHrtf_<CTag>(const float *InSamples, float2 *AccumSamples, const ALuint IrSize,
- MixHrtfFilter *hrtfparams, const size_t BufferSize)
+ const MixHrtfFilter *hrtfparams, const size_t BufferSize)
{ MixHrtfBase<ApplyCoeffs>(InSamples, AccumSamples, IrSize, hrtfparams, BufferSize); }
template<>
void MixHrtfBlend_<CTag>(const float *InSamples, float2 *AccumSamples, const ALuint IrSize,
- const HrtfFilter *oldparams, MixHrtfFilter *newparams, const size_t BufferSize)
+ const HrtfFilter *oldparams, const MixHrtfFilter *newparams, const size_t BufferSize)
{
MixHrtfBlendBase<ApplyCoeffs>(InSamples, AccumSamples, IrSize, oldparams, newparams,
BufferSize);
diff --git a/alc/mixer/mixer_neon.cpp b/alc/mixer/mixer_neon.cpp
index ccfc5761..afc9768a 100644
--- a/alc/mixer/mixer_neon.cpp
+++ b/alc/mixer/mixer_neon.cpp
@@ -191,12 +191,12 @@ const ALfloat *Resample_<FastBSincTag,NEONTag>(const InterpState *state,
template<>
void MixHrtf_<NEONTag>(const float *InSamples, float2 *AccumSamples, const ALuint IrSize,
- MixHrtfFilter *hrtfparams, const size_t BufferSize)
+ const MixHrtfFilter *hrtfparams, const size_t BufferSize)
{ MixHrtfBase<ApplyCoeffs>(InSamples, AccumSamples, IrSize, hrtfparams, BufferSize); }
template<>
void MixHrtfBlend_<NEONTag>(const float *InSamples, float2 *AccumSamples, const ALuint IrSize,
- const HrtfFilter *oldparams, MixHrtfFilter *newparams, const size_t BufferSize)
+ const HrtfFilter *oldparams, const MixHrtfFilter *newparams, const size_t BufferSize)
{
MixHrtfBlendBase<ApplyCoeffs>(InSamples, AccumSamples, IrSize, oldparams, newparams,
BufferSize);
diff --git a/alc/mixer/mixer_sse.cpp b/alc/mixer/mixer_sse.cpp
index 2fb856e1..3bc7b30f 100644
--- a/alc/mixer/mixer_sse.cpp
+++ b/alc/mixer/mixer_sse.cpp
@@ -167,12 +167,12 @@ const ALfloat *Resample_<FastBSincTag,SSETag>(const InterpState *state,
template<>
void MixHrtf_<SSETag>(const float *InSamples, float2 *AccumSamples, const ALuint IrSize,
- MixHrtfFilter *hrtfparams, const size_t BufferSize)
+ const MixHrtfFilter *hrtfparams, const size_t BufferSize)
{ MixHrtfBase<ApplyCoeffs>(InSamples, AccumSamples, IrSize, hrtfparams, BufferSize); }
template<>
void MixHrtfBlend_<SSETag>(const float *InSamples, float2 *AccumSamples, const ALuint IrSize,
- const HrtfFilter *oldparams, MixHrtfFilter *newparams, const size_t BufferSize)
+ const HrtfFilter *oldparams, const MixHrtfFilter *newparams, const size_t BufferSize)
{
MixHrtfBlendBase<ApplyCoeffs>(InSamples, AccumSamples, IrSize, oldparams, newparams,
BufferSize);
diff --git a/alc/voice.cpp b/alc/voice.cpp
index ef26b630..42d9021f 100644
--- a/alc/voice.cpp
+++ b/alc/voice.cpp
@@ -73,9 +73,9 @@ Resampler ResamplerDefault{Resampler::Linear};
namespace {
using HrtfMixerFunc = void(*)(const ALfloat *InSamples, float2 *AccumSamples, const ALuint IrSize,
- MixHrtfFilter *hrtfparams, const size_t BufferSize);
+ const MixHrtfFilter *hrtfparams, const size_t BufferSize);
using HrtfMixerBlendFunc = void(*)(const ALfloat *InSamples, float2 *AccumSamples,
- const ALuint IrSize, const HrtfFilter *oldparams, MixHrtfFilter *newparams,
+ const ALuint IrSize, const HrtfFilter *oldparams, const MixHrtfFilter *newparams,
const size_t BufferSize);
HrtfMixerFunc MixHrtfSamples = MixHrtf_<CTag>;
@@ -468,10 +468,7 @@ void DoHrtfMix(const float *samples, const ALuint DstBufferSize, DirectParams &p
fademix);
/* Update the old parameters with the result. */
parms.Hrtf.Old = parms.Hrtf.Target;
- if(fademix < Counter)
- parms.Hrtf.Old.Gain = hrtfparams.Gain;
- else
- parms.Hrtf.Old.Gain = TargetGain;
+ parms.Hrtf.Old.Gain = gain;
OutPos += fademix;
}
@@ -496,13 +493,8 @@ void DoHrtfMix(const float *samples, const ALuint DstBufferSize, DirectParams &p
hrtfparams.Gain = parms.Hrtf.Old.Gain;
hrtfparams.GainStep = (gain - parms.Hrtf.Old.Gain) / static_cast<float>(todo);
MixHrtfSamples(HrtfSamples+fademix, AccumSamples+OutPos, IrSize, &hrtfparams, todo);
- /* Store the interpolated gain or the final target gain depending if
- * the fade is done.
- */
- if(DstBufferSize < Counter)
- parms.Hrtf.Old.Gain = gain;
- else
- parms.Hrtf.Old.Gain = TargetGain;
+ /* Store the now-current gain for next time. */
+ parms.Hrtf.Old.Gain = gain;
}
}