Mercurial > hg > svgui
comparison layer/SpectrumLayer.cpp @ 1256:5a10e9d924d4
Make some corrections to crosshair (measure cursor) positioning and feature descriptions. Needs review.
author | Chris Cannam |
---|---|
date | Tue, 07 Mar 2017 18:54:15 +0000 |
parents | 9e1559b08f0d |
children | 14dcdc596baf |
comparison
equal
deleted
inserted
replaced
1255:bbdfe9b57857 | 1256:5a10e9d924d4 |
---|---|
300 double | 300 double |
301 SpectrumLayer::getFrequencyForX(const LayerGeometryProvider *v, double x) const | 301 SpectrumLayer::getFrequencyForX(const LayerGeometryProvider *v, double x) const |
302 { | 302 { |
303 if (!m_sliceableModel) return 0; | 303 if (!m_sliceableModel) return 0; |
304 double bin = getBinForX(v, x); | 304 double bin = getBinForX(v, x); |
305 cerr << "bin = " << bin << endl; | |
305 return (m_sliceableModel->getSampleRate() * bin) / | 306 return (m_sliceableModel->getSampleRate() * bin) / |
306 (m_sliceableModel->getHeight() * 2); | 307 (m_sliceableModel->getHeight() * 2); |
307 } | 308 } |
308 | 309 |
309 double | 310 double |
460 int harmonic = 2; | 461 int harmonic = 2; |
461 | 462 |
462 while (harmonic < 100) { | 463 while (harmonic < 100) { |
463 | 464 |
464 int hx = int(lrint(getXForFrequency(v, fundamental * harmonic))); | 465 int hx = int(lrint(getXForFrequency(v, fundamental * harmonic))); |
465 hx += xorigin; | |
466 | 466 |
467 if (hx < xorigin || hx > v->getPaintWidth()) break; | 467 if (hx < xorigin || hx > v->getPaintWidth()) break; |
468 | 468 |
469 int len = 7; | 469 int len = 7; |
470 | 470 |
511 | 511 |
512 QString binstr; | 512 QString binstr; |
513 QString hzstr; | 513 QString hzstr; |
514 int minfreq = int(lrint((minbin * m_sliceableModel->getSampleRate()) / | 514 int minfreq = int(lrint((minbin * m_sliceableModel->getSampleRate()) / |
515 m_windowSize)); | 515 m_windowSize)); |
516 int maxfreq = int(lrint((std::max(maxbin, minbin+1) | 516 int maxfreq = int(lrint((std::max(maxbin, minbin) |
517 * m_sliceableModel->getSampleRate()) / | 517 * m_sliceableModel->getSampleRate()) / |
518 m_windowSize)); | 518 m_windowSize)); |
519 | 519 |
520 if (maxbin != minbin) { | 520 if (maxbin != minbin) { |
521 binstr = tr("%1 - %2").arg(minbin+1).arg(maxbin+1); | 521 binstr = tr("%1 - %2").arg(minbin+1).arg(maxbin+1); |