Mercurial > hg > svgui
comparison layer/SpectrogramLayer.cpp @ 117:782142eaaa84
* towards optimising spectrogram refresh with new file cache
author | Chris Cannam |
---|---|
date | Fri, 07 Jul 2006 11:22:32 +0000 |
parents | 47cb32bb35ab |
children | 853a7fc542d0 |
comparison
equal
deleted
inserted
replaced
116:4a6e6aedf632 | 117:782142eaaa84 |
---|---|
1283 | 1283 |
1284 for (int q = q0i; q <= q1i; ++q) { | 1284 for (int q = q0i; q <= q1i; ++q) { |
1285 | 1285 |
1286 for (int s = s0i; s <= s1i; ++s) { | 1286 for (int s = s0i; s <= s1i; ++s) { |
1287 | 1287 |
1288 if (!fft->isColumnReady(s)) continue; | |
1289 | |
1288 float binfreq = (sr * q) / m_windowSize; | 1290 float binfreq = (sr * q) / m_windowSize; |
1289 if (q == q0i) freqMin = binfreq; | 1291 if (q == q0i) freqMin = binfreq; |
1290 if (q == q1i) freqMax = binfreq; | 1292 if (q == q1i) freqMax = binfreq; |
1291 | 1293 |
1292 if (peaksOnly && !fft->isLocalPeak(s, q)) continue; | 1294 if (peaksOnly && !fft->isLocalPeak(s, q)) continue; |
1354 bool have = false; | 1356 bool have = false; |
1355 | 1357 |
1356 for (int q = q0i; q <= q1i; ++q) { | 1358 for (int q = q0i; q <= q1i; ++q) { |
1357 for (int s = s0i; s <= s1i; ++s) { | 1359 for (int s = s0i; s <= s1i; ++s) { |
1358 if (s >= 0 && q >= 0 && s < cw && q < ch) { | 1360 if (s >= 0 && q >= 0 && s < cw && q < ch) { |
1361 | |
1362 if (!fft->isColumnReady(s)) continue; | |
1359 | 1363 |
1360 float value; | 1364 float value; |
1361 | 1365 |
1362 value = fft->getPhaseAt(s, q); | 1366 value = fft->getPhaseAt(s, q); |
1363 if (!have || value < phaseMin) { phaseMin = value; } | 1367 if (!have || value < phaseMin) { phaseMin = value; } |
1470 v->setLightBackground(true); | 1474 v->setLightBackground(true); |
1471 } else { | 1475 } else { |
1472 v->setLightBackground(false); | 1476 v->setLightBackground(false); |
1473 } | 1477 } |
1474 | 1478 |
1475 // Profiler profiler("SpectrogramLayer::paint", true); | 1479 Profiler profiler("SpectrogramLayer::paint", true); |
1476 #ifdef DEBUG_SPECTROGRAM_REPAINT | 1480 #ifdef DEBUG_SPECTROGRAM_REPAINT |
1477 std::cerr << "SpectrogramLayer::paint(): m_model is " << m_model << ", zoom level is " << v->getZoomLevel() << ", m_updateTimer " << m_updateTimer << std::endl; | 1481 std::cerr << "SpectrogramLayer::paint(): m_model is " << m_model << ", zoom level is " << v->getZoomLevel() << ", m_updateTimer " << m_updateTimer << std::endl; |
1478 | 1482 |
1479 std::cerr << "rect is " << rect.x() << "," << rect.y() << " " << rect.width() << "x" << rect.height() << std::endl; | 1483 std::cerr << "rect is " << rect.x() << "," << rect.y() << " " << rect.width() << "x" << rect.height() << std::endl; |
1480 #endif | 1484 #endif |