Mercurial > hg > svgui
comparison layer/SpectrogramLayer.cpp @ 491:c74e511a3c96
* Fix overall mag range management in normalise-visible-area mode
author | Chris Cannam |
---|---|
date | Mon, 09 Feb 2009 12:56:16 +0000 |
parents | aa477ddcadb5 |
children | fe134ec37a2a |
comparison
equal
deleted
inserted
replaced
490:aa477ddcadb5 | 491:c74e511a3c96 |
---|---|
2300 binfory[y] = q0; | 2300 binfory[y] = q0; |
2301 // cerr << "binfory[" << y << "] = " << binfory[y] << endl; | 2301 // cerr << "binfory[" << y << "] = " << binfory[y] << endl; |
2302 } | 2302 } |
2303 } | 2303 } |
2304 | 2304 |
2305 paintDrawBuffer(v, bufwid, h, binforx, binfory, usePeaksCache); | 2305 paintDrawBuffer(v, bufwid, h, binforx, binfory, usePeaksCache, |
2306 overallMag, overallMagChanged); | |
2306 | 2307 |
2307 } else { | 2308 } else { |
2308 | 2309 |
2309 paintDrawBufferPeakFrequencies(v, bufwid, h, binforx, | 2310 paintDrawBufferPeakFrequencies(v, bufwid, h, binforx, |
2310 minbin, maxbin, | 2311 minbin, maxbin, |
2311 displayMinFreq, displayMaxFreq, | 2312 displayMinFreq, displayMaxFreq, |
2312 logarithmic); | 2313 logarithmic, |
2314 overallMag, overallMagChanged); | |
2313 } | 2315 } |
2314 | 2316 |
2315 /* | 2317 /* |
2316 for (int x = 0; x < w / xPixelRatio; ++x) { | 2318 for (int x = 0; x < w / xPixelRatio; ++x) { |
2317 | 2319 |
2480 int *binforx, | 2482 int *binforx, |
2481 int minbin, | 2483 int minbin, |
2482 int maxbin, | 2484 int maxbin, |
2483 float displayMinFreq, | 2485 float displayMinFreq, |
2484 float displayMaxFreq, | 2486 float displayMaxFreq, |
2485 bool logarithmic) const | 2487 bool logarithmic, |
2488 MagnitudeRange &overallMag, | |
2489 bool &overallMagChanged) const | |
2486 { | 2490 { |
2487 Profiler profiler("SpectrogramLayer::paintDrawBufferPeakFrequencies"); | 2491 Profiler profiler("SpectrogramLayer::paintDrawBufferPeakFrequencies"); |
2488 | 2492 |
2489 #ifdef DEBUG_SPECTROGRAM_REPAINT | 2493 #ifdef DEBUG_SPECTROGRAM_REPAINT |
2490 cerr << "minbin " << minbin << ", maxbin " << maxbin << "; w " << w << ", h " << h << endl; | 2494 cerr << "minbin " << minbin << ", maxbin " << maxbin << "; w " << w << ", h " << h << endl; |
2575 << m_columnMags.size() | 2579 << m_columnMags.size() |
2576 << " at SpectrogramLayer.cpp::paintDrawBuffer" | 2580 << " at SpectrogramLayer.cpp::paintDrawBuffer" |
2577 << std::endl; | 2581 << std::endl; |
2578 } else { | 2582 } else { |
2579 m_columnMags[sx].sample(mag); | 2583 m_columnMags[sx].sample(mag); |
2584 if (overallMag.sample(mag)) overallMagChanged = true; | |
2580 } | 2585 } |
2581 } | 2586 } |
2582 } | 2587 } |
2583 } | 2588 } |
2584 | 2589 |
2589 SpectrogramLayer::paintDrawBuffer(View *v, | 2594 SpectrogramLayer::paintDrawBuffer(View *v, |
2590 int w, | 2595 int w, |
2591 int h, | 2596 int h, |
2592 int *binforx, | 2597 int *binforx, |
2593 float *binfory, | 2598 float *binfory, |
2594 bool usePeaksCache) const | 2599 bool usePeaksCache, |
2600 MagnitudeRange &overallMag, | |
2601 bool &overallMagChanged) const | |
2595 { | 2602 { |
2596 Profiler profiler("SpectrogramLayer::paintDrawBuffer"); | 2603 Profiler profiler("SpectrogramLayer::paintDrawBuffer"); |
2597 | 2604 |
2598 int minbin = int(binfory[0] + 0.0001); | 2605 int minbin = int(binfory[0] + 0.0001); |
2599 int maxbin = binfory[h-1]; | 2606 int maxbin = binfory[h-1]; |
2772 << m_columnMags.size() | 2779 << m_columnMags.size() |
2773 << " at SpectrogramLayer.cpp::paintDrawBuffer" | 2780 << " at SpectrogramLayer.cpp::paintDrawBuffer" |
2774 << std::endl; | 2781 << std::endl; |
2775 } else { | 2782 } else { |
2776 m_columnMags[sx].sample(mag); | 2783 m_columnMags[sx].sample(mag); |
2784 if (overallMag.sample(mag)) overallMagChanged = true; | |
2777 } | 2785 } |
2778 } | 2786 } |
2779 } | 2787 } |
2780 | 2788 |
2781 for (int y = 0; y < h; ++y) { | 2789 for (int y = 0; y < h; ++y) { |