From 64cb0dc2649df03393fdbba186c11bb2567f9e0c Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 17 May 2022 02:28:57 -0700 Subject: Use a member variable to specify the decoder padding --- core/voice.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'core/voice.cpp') diff --git a/core/voice.cpp b/core/voice.cpp index 8e42500e..6001fcac 100644 --- a/core/voice.cpp +++ b/core/voice.cpp @@ -514,8 +514,7 @@ void Voice::mix(const State vstate, ContextBase *Context, const uint SamplesToDo std::transform(Device->mSampleData.end() - mChans.size(), Device->mSampleData.end(), MixingSamples.begin(), offset_bufferline); - const uint PostPadding{MaxResamplerEdge + - (mDecoder ? uint{UhjDecoder::sFilterDelay} : 0u)}; + const uint PostPadding{MaxResamplerEdge + mDecoderPadding}; uint buffers_done{0u}; uint OutPos{0u}; do { @@ -854,11 +853,20 @@ void Voice::prepare(DeviceBase *device) mPrevSamples.resize(num_channels); if(mFmtChannels == FmtSuperStereo) + { mDecoder = std::make_unique(); + mDecoderPadding = UhjStereoDecoder::sFilterDelay; + } else if(IsUHJ(mFmtChannels)) + { mDecoder = std::make_unique(); + mDecoderPadding = UhjDecoder::sFilterDelay; + } else + { mDecoder = nullptr; + mDecoderPadding = 0; + } /* Clear the stepping value explicitly so the mixer knows not to mix this * until the update gets applied. -- cgit v1.2.3