From a271484e7c5056a868767a344e63f8f3feb9437e Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sat, 1 Jan 2022 00:10:21 -0800 Subject: Pass a span of pointers to the UHJ/SuperStereo decoder --- core/voice.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'core/voice.cpp') diff --git a/core/voice.cpp b/core/voice.cpp index 924a8446..424184af 100644 --- a/core/voice.cpp +++ b/core/voice.cpp @@ -53,6 +53,7 @@ struct CopyTag; static_assert(!(sizeof(DeviceBase::MixerBufferLine)&15), "DeviceBase::MixerBufferLine must be a multiple of 16 bytes"); +static_assert(!(MaxResamplerEdge&3), "MaxResamplerEdge is not a multiple of 4"); Resampler ResamplerDefault{Resampler::Linear}; @@ -627,9 +628,13 @@ void Voice::mix(const State vstate, ContextBase *Context, const uint SamplesToDo if(mDecoder) { + std::array chanptrs; + std::transform(MixingSamples.begin(), MixingSamples.end(), chanptrs.begin(), + [](DeviceBase::MixerBufferLine &bufline) noexcept -> float* + { return bufline.data() + MaxResamplerEdge; }); const size_t srcOffset{(increment*DstBufferSize + DataPosFrac)>>MixerFracBits}; SrcBufferSize = SrcBufferSize - PostPadding + MaxResamplerEdge; - ((*mDecoder).*mDecoderFunc)(MixingSamples, MaxResamplerEdge, SrcBufferSize, + ((*mDecoder).*mDecoderFunc)({chanptrs.data(), MixingSamples.size()}, SrcBufferSize, srcOffset * likely(vstate == Playing)); } } -- cgit v1.2.3