Mercurial > hg > svcore
diff data/fft/FFTDataServer.cpp @ 272:8bbc9e336475
* avoid trying to calculate fft from incomplete decoded audio file in spectrum
author | Chris Cannam |
---|---|
date | Mon, 02 Jul 2007 14:57:01 +0000 |
parents | 260032c26c4f |
children | f1f47660483d |
line wrap: on
line diff
--- a/data/fft/FFTDataServer.cpp Mon Jul 02 13:53:38 2007 +0000 +++ b/data/fft/FFTDataServer.cpp Mon Jul 02 14:57:01 2007 +0000 @@ -503,6 +503,8 @@ std::cerr << "FFTDataServer(" << this << " [" << (void *)QThread::currentThreadId() << "])::FFTDataServer" << std::endl; #endif + //!!! end is not correct until model finished reading -- what to do??? + size_t start = m_model->getStartFrame(); size_t end = m_model->getEndFrame(); @@ -990,6 +992,12 @@ { Profiler profiler("FFTDataServer::fillColumn", false); + if (!m_model->isReady()) { + std::cerr << "WARNING: FFTDataServer::fillColumn(" + << x << "): model not yet ready" << std::endl; + return; + } + if (!m_fftInput) { std::cerr << "WARNING: FFTDataServer::fillColumn(" << x << "): " << "input has already been completed and discarded?" @@ -1142,6 +1150,11 @@ m_extent = 0; m_completion = 0; + while (!m_server.m_model->isReady() && !m_server.m_exiting) { + sleep(1); + } + if (m_server.m_exiting) return; + size_t start = m_server.m_model->getStartFrame(); size_t end = m_server.m_model->getEndFrame(); size_t remainingEnd = end;