diff options
author | Chris Robinson <[email protected]> | 2022-05-17 02:28:57 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2022-05-17 02:28:57 -0700 |
commit | 64cb0dc2649df03393fdbba186c11bb2567f9e0c (patch) | |
tree | 732f8766c03d4017836bdaa3dc5c43e79c57cb26 /core/voice.cpp | |
parent | a5729d1ff6cc5e04d3ee108e553b45eeaa0fec9e (diff) |
Use a member variable to specify the decoder padding
Diffstat (limited to 'core/voice.cpp')
-rw-r--r-- | core/voice.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
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<UhjStereoDecoder>(); + mDecoderPadding = UhjStereoDecoder::sFilterDelay; + } else if(IsUHJ(mFmtChannels)) + { mDecoder = std::make_unique<UhjDecoder>(); + 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. |