comparison layer/SpectrogramLayer.cpp @ 160:f4be20ebdfa4

* Some dull work to continue unifying the fft model and editable dense 3d model interfaces
author Chris Cannam
date Mon, 09 Oct 2006 10:49:46 +0000
parents 9c3a4b42d8f8
children dc2fe023a14f
comparison
equal deleted inserted replaced
159:c1fb771b7646 160:f4be20ebdfa4
19 #include "base/Profiler.h" 19 #include "base/Profiler.h"
20 #include "base/AudioLevel.h" 20 #include "base/AudioLevel.h"
21 #include "base/Window.h" 21 #include "base/Window.h"
22 #include "base/Pitch.h" 22 #include "base/Pitch.h"
23 #include "base/Preferences.h" 23 #include "base/Preferences.h"
24 #include "data/fft/FFTDataServer.h"
25 24
26 #include <QPainter> 25 #include <QPainter>
27 #include <QImage> 26 #include <QImage>
28 #include <QPixmap> 27 #include <QPixmap>
29 #include <QRect> 28 #include <QRect>
1408 1407
1409 for (int q = q0i; q <= q1i; ++q) { 1408 for (int q = q0i; q <= q1i; ++q) {
1410 1409
1411 for (int s = s0i; s <= s1i; ++s) { 1410 for (int s = s0i; s <= s1i; ++s) {
1412 1411
1413 if (!fft->isColumnReady(s)) continue; 1412 if (!fft->isColumnAvailable(s)) continue;
1414 1413
1415 float binfreq = (sr * q) / m_windowSize; 1414 float binfreq = (sr * q) / m_windowSize;
1416 if (q == q0i) freqMin = binfreq; 1415 if (q == q0i) freqMin = binfreq;
1417 if (q == q1i) freqMax = binfreq; 1416 if (q == q1i) freqMax = binfreq;
1418 1417
1486 1485
1487 for (int q = q0i; q <= q1i; ++q) { 1486 for (int q = q0i; q <= q1i; ++q) {
1488 for (int s = s0i; s <= s1i; ++s) { 1487 for (int s = s0i; s <= s1i; ++s) {
1489 if (s >= 0 && q >= 0 && s < cw && q < ch) { 1488 if (s >= 0 && q >= 0 && s < cw && q < ch) {
1490 1489
1491 if (!fft->isColumnReady(s)) continue; 1490 if (!fft->isColumnAvailable(s)) continue;
1492 1491
1493 float value; 1492 float value;
1494 1493
1495 value = fft->getPhaseAt(s, q); 1494 value = fft->getPhaseAt(s, q);
1496 if (!have || value < phaseMin) { phaseMin = value; } 1495 if (!have || value < phaseMin) { phaseMin = value; }
1990 } 1989 }
1991 } 1990 }
1992 1991
1993 for (int s = s0i; s <= s1i; ++s) { 1992 for (int s = s0i; s <= s1i; ++s) {
1994 1993
1995 if (!fft->isColumnReady(s)) continue; 1994 if (!fft->isColumnAvailable(s)) continue;
1996 MagnitudeRange mag; 1995 MagnitudeRange mag;
1997 1996
1998 for (size_t q = minbin; q < bins; ++q) { 1997 for (size_t q = minbin; q < bins; ++q) {
1999 1998
2000 float y0 = yval[q + 1]; 1999 float y0 = yval[q + 1];