comparison layer/SpectrogramLayer.cpp @ 1002:dc8092488005 3.0-integration

Merge from branch "tony-2.0-integration"
author Chris Cannam
date Wed, 14 Oct 2015 10:12:59 +0100
parents 89f44d182d37
children 7347cf34f538 9c890b7dfa83
comparison
equal deleted inserted replaced
996:8588b97f1d1c 1002:dc8092488005
1510 #endif 1510 #endif
1511 return 0; 1511 return 0;
1512 } 1512 }
1513 if (m_fftModels[view]->getHeight() != fftSize / 2 + 1) { 1513 if (m_fftModels[view]->getHeight() != fftSize / 2 + 1) {
1514 #ifdef DEBUG_SPECTROGRAM_REPAINT 1514 #ifdef DEBUG_SPECTROGRAM_REPAINT
1515 cerr << "SpectrogramLayer::getFFTModel(" << v << "): Found a model with the wrong height (" << m_fftModels[view].first->getHeight() << ", wanted " << (fftSize / 2 + 1) << ")" << endl; 1515 cerr << "SpectrogramLayer::getFFTModel(" << v << "): Found a model with the wrong height (" << m_fftModels[view]->getHeight() << ", wanted " << (fftSize / 2 + 1) << ")" << endl;
1516 #endif 1516 #endif
1517 delete m_fftModels[view]; 1517 delete m_fftModels[view];
1518 m_fftModels.erase(view); 1518 m_fftModels.erase(view);
1519 delete m_peakCaches[view]; 1519 delete m_peakCaches[view];
1520 m_peakCaches.erase(view); 1520 m_peakCaches.erase(view);
2569 fft->getNormalizedMagnitudesAt(sx, autoarray, minbin, maxbin - minbin + 1); 2569 fft->getNormalizedMagnitudesAt(sx, autoarray, minbin, maxbin - minbin + 1);
2570 } else if (m_normalization == NormalizeHybrid) { 2570 } else if (m_normalization == NormalizeHybrid) {
2571 fft->getNormalizedMagnitudesAt(sx, autoarray, minbin, maxbin - minbin + 1); 2571 fft->getNormalizedMagnitudesAt(sx, autoarray, minbin, maxbin - minbin + 1);
2572 float max = fft->getMaximumMagnitudeAt(sx); 2572 float max = fft->getMaximumMagnitudeAt(sx);
2573 float scale = log10f(max + 1.f); 2573 float scale = log10f(max + 1.f);
2574 cout << "sx = " << sx << ", max = " << max << ", log10(max) = " << log10(max) << ", scale = " << scale << endl; 2574 // cout << "sx = " << sx << ", max = " << max << ", log10(max) = " << log10(max) << ", scale = " << scale << endl;
2575 for (int i = minbin; i <= maxbin; ++i) { 2575 for (int i = minbin; i <= maxbin; ++i) {
2576 autoarray[i - minbin] *= scale; 2576 autoarray[i - minbin] *= scale;
2577 } 2577 }
2578 } else { 2578 } else {
2579 fft->getMagnitudesAt(sx, autoarray, minbin, maxbin - minbin + 1); 2579 fft->getMagnitudesAt(sx, autoarray, minbin, maxbin - minbin + 1);