From e52241ba8677322272d1c57f1a2237842ed9036f Mon Sep 17 00:00:00 2001 From: xenakios Date: Tue, 28 Nov 2017 21:10:22 +0200 Subject: [PATCH] Avoid resetting active source play range when changing file. Update xfade cache when changing file. --- Source/PS_Source/Input/AInputS.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Source/PS_Source/Input/AInputS.h b/Source/PS_Source/Input/AInputS.h index bbbf174..ad347b0 100644 --- a/Source/PS_Source/Input/AInputS.h +++ b/Source/PS_Source/Input/AInputS.h @@ -74,7 +74,9 @@ public: std::lock_guard locker(m_mutex); m_using_memory_buffer = false; m_afreader = std::unique_ptr(reader); - m_currentsample = 0; + if (m_activerange.isEmpty()) + m_activerange = { 0.0,1.0 }; + m_currentsample = m_activerange.getStart()*info.nsamples; info.samplerate = (int)m_afreader->sampleRate; info.nchannels = m_afreader->numChannels; info.nsamples = m_afreader->lengthInSamples; @@ -83,6 +85,7 @@ public: m_readbuf.setSize(info.nchannels, m_readbuf.getNumSamples()); m_crossfadebuf.setSize(info.nchannels, m_crossfadebuf.getNumSamples()); } + updateXFadeCache(); m_readbuf.clear(); return true; }