diff options
author | Chris Robinson <[email protected]> | 2023-02-11 04:49:30 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-02-11 04:49:30 -0800 |
commit | 31a94ca564f8de584f338da3ca7221060683a927 (patch) | |
tree | 3d07c0f19553a6469af26e6a9bfd3d4286b4a990 /core/converter.cpp | |
parent | 38a4f3a45d6416a7992644f317094d3a2e933fe6 (diff) |
Always write samples to the destination when resampling
Diffstat (limited to 'core/converter.cpp')
-rw-r--r-- | core/converter.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/core/converter.cpp b/core/converter.cpp index 35b1f289..132859f4 100644 --- a/core/converter.cpp +++ b/core/converter.cpp @@ -16,7 +16,6 @@ #include "fpu_ctrl.h" struct CTag; -struct CopyTag; namespace { @@ -182,7 +181,8 @@ SampleConverterPtr SampleConverter::Create(DevFmtType srcType, DevFmtType dstTyp mind(srcRate*double{MixerFracOne}/dstRate + 0.5, MaxPitch*MixerFracOne)); converter->mIncrement = maxu(step, 1); if(converter->mIncrement == MixerFracOne) - converter->mResample = Resample_<CopyTag,CTag>; + converter->mResample = [](const InterpState*, const float *RESTRICT src, uint, const uint, + const al::span<float> dst) { std::copy_n(src, dst.size(), dst.begin()); }; else converter->mResample = PrepareResampler(resampler, converter->mIncrement, &converter->mState); @@ -284,10 +284,10 @@ uint SampleConverter::convert(const void **src, uint *srcframes, void *dst, uint std::end(mChan[chan].PrevSamples), 0.0f); /* Now resample, and store the result in the output buffer. */ - const float *ResampledData{mResample(&mState, SrcData+(MaxResamplerPadding>>1), - DataPosFrac, increment, {DstData, DstSize})}; + mResample(&mState, SrcData+MaxResamplerEdge, DataPosFrac, increment, + {DstData, DstSize}); - StoreSamples(DstSamples, ResampledData, mChan.size(), mDstType, DstSize); + StoreSamples(DstSamples, DstData, mChan.size(), mDstType, DstSize); } /* Update the number of prep samples still available, as well as the |