# HG changeset patch # User Chris Cannam # Date 1481972808 0 # Node ID 36076ef960fb86ade2dd2eca13edb1ed154ef55f # Parent be83e81d915603712fb32b434f19945b7694811b A useful simplification in rate handling: don't reset to 0 when last model goes diff -r be83e81d9156 -r 36076ef960fb audio/AudioCallbackPlaySource.cpp --- a/audio/AudioCallbackPlaySource.cpp Thu Dec 15 10:36:41 2016 +0000 +++ b/audio/AudioCallbackPlaySource.cpp Sat Dec 17 11:06:48 2016 +0000 @@ -178,6 +178,9 @@ if (m_sourceSampleRate == 0) { + SVDEBUG << "AudioCallbackPlaySource::addModel: Source rate changing from 0 to " + << model->getSampleRate() << endl; + m_sourceSampleRate = model->getSampleRate(); srChanged = true; @@ -222,6 +225,9 @@ m_sourceSampleRate, false); } else { + SVDEBUG << "AudioCallbackPlaySource::addModel: Source rate changing from " + << m_sourceSampleRate << " to " << model->getSampleRate() << endl; + m_sourceSampleRate = model->getSampleRate(); srChanged = true; } @@ -317,9 +323,15 @@ m_models.erase(model); - if (m_models.empty()) { - m_sourceSampleRate = 0; - } + // I don't think we have to do this any more: if a new model is + // loaded at a different rate, we'll hit the non-conflicting path + // in addModel and the rate will be updated without problems; but + // if a new model is loaded at the rate that we were using for the + // last one, then we save work by not having reset this here + // +// if (m_models.empty()) { +// m_sourceSampleRate = 0; +// } sv_frame_t lastEnd = 0; for (std::set::const_iterator i = m_models.begin();