aboutsummaryrefslogtreecommitdiffstats
path: root/alc/mixer/mixer_c.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-08-20 08:46:12 -0700
committerChris Robinson <[email protected]>2019-08-20 08:46:12 -0700
commit0961f4eb00782df66e3ada75b4055b44a28240f3 (patch)
treec5dbf85dd50f5ff39c5c4857b24dca4d6582d3e6 /alc/mixer/mixer_c.cpp
parentce76cc144142a065e2702bd57f4358929c38d1bc (diff)
Pass a span to the Resample function
Diffstat (limited to 'alc/mixer/mixer_c.cpp')
-rw-r--r--alc/mixer/mixer_c.cpp32
1 files changed, 15 insertions, 17 deletions
diff --git a/alc/mixer/mixer_c.cpp b/alc/mixer/mixer_c.cpp
index e7ca23d5..743431da 100644
--- a/alc/mixer/mixer_c.cpp
+++ b/alc/mixer/mixer_c.cpp
@@ -44,9 +44,8 @@ inline ALfloat do_bsinc(const InterpState &istate, const ALfloat *RESTRICT vals,
using SamplerT = ALfloat(const InterpState&, const ALfloat*RESTRICT, const ALsizei);
template<SamplerT &Sampler>
const ALfloat *DoResample(const InterpState *state, const ALfloat *RESTRICT src,
- ALsizei frac, ALint increment, ALfloat *RESTRICT dst, ALsizei numsamples)
+ ALsizei frac, ALint increment, const al::span<float> dst)
{
- ASSUME(numsamples > 0);
ASSUME(increment > 0);
ASSUME(frac >= 0);
@@ -61,46 +60,45 @@ const ALfloat *DoResample(const InterpState *state, const ALfloat *RESTRICT src,
return ret;
};
- std::generate_n(dst, numsamples, proc_sample);
+ std::generate(dst.begin(), dst.end(), proc_sample);
- return dst;
+ return dst.begin();
}
} // namespace
template<>
const ALfloat *Resample_<CopyTag,CTag>(const InterpState*, const ALfloat *RESTRICT src, ALsizei,
- ALint, ALfloat *RESTRICT dst, ALsizei dstlen)
+ ALint, const al::span<float> dst)
{
- ASSUME(dstlen > 0);
#if defined(HAVE_SSE) || defined(HAVE_NEON)
/* Avoid copying the source data if it's aligned like the destination. */
- if((reinterpret_cast<intptr_t>(src)&15) == (reinterpret_cast<intptr_t>(dst)&15))
+ if((reinterpret_cast<intptr_t>(src)&15) == (reinterpret_cast<intptr_t>(dst.data())&15))
return src;
#endif
- std::copy_n(src, dstlen, dst);
- return dst;
+ std::copy_n(src, dst.size(), dst.begin());
+ return dst.begin();
}
template<>
const ALfloat *Resample_<PointTag,CTag>(const InterpState *state, const ALfloat *RESTRICT src,
- ALsizei frac, ALint increment, ALfloat *RESTRICT dst, ALsizei dstlen)
-{ return DoResample<do_point>(state, src, frac, increment, dst, dstlen); }
+ ALsizei frac, ALint increment, const al::span<float> dst)
+{ return DoResample<do_point>(state, src, frac, increment, dst); }
template<>
const ALfloat *Resample_<LerpTag,CTag>(const InterpState *state, const ALfloat *RESTRICT src,
- ALsizei frac, ALint increment, ALfloat *RESTRICT dst, ALsizei dstlen)
-{ return DoResample<do_lerp>(state, src, frac, increment, dst, dstlen); }
+ ALsizei frac, ALint increment, const al::span<float> dst)
+{ return DoResample<do_lerp>(state, src, frac, increment, dst); }
template<>
const ALfloat *Resample_<CubicTag,CTag>(const InterpState *state, const ALfloat *RESTRICT src,
- ALsizei frac, ALint increment, ALfloat *RESTRICT dst, ALsizei dstlen)
-{ return DoResample<do_cubic>(state, src-1, frac, increment, dst, dstlen); }
+ ALsizei frac, ALint increment, const al::span<float> dst)
+{ return DoResample<do_cubic>(state, src-1, frac, increment, dst); }
template<>
const ALfloat *Resample_<BSincTag,CTag>(const InterpState *state, const ALfloat *RESTRICT src,
- ALsizei frac, ALint increment, ALfloat *RESTRICT dst, ALsizei dstlen)
-{ return DoResample<do_bsinc>(state, src-state->bsinc.l, frac, increment, dst, dstlen); }
+ ALsizei frac, ALint increment, const al::span<float> dst)
+{ return DoResample<do_bsinc>(state, src-state->bsinc.l, frac, increment, dst); }
static inline void ApplyCoeffs(ALsizei /*Offset*/, float2 *RESTRICT Values, const ALsizei IrSize,