comparison layer/SpectrogramLayer.cpp @ 111:ab55c427e068

* Split large FFT caches up into several files. Ongoing.
author Chris Cannam
date Wed, 28 Jun 2006 13:41:12 +0000
parents f262aa8973e3
children 43b1ca9647e1
comparison
equal deleted inserted replaced
110:f262aa8973e3 111:ab55c427e068
164 list.push_back("Gain"); 164 list.push_back("Gain");
165 list.push_back("Colour Rotation"); 165 list.push_back("Colour Rotation");
166 list.push_back("Min Frequency"); 166 list.push_back("Min Frequency");
167 list.push_back("Max Frequency"); 167 list.push_back("Max Frequency");
168 list.push_back("Frequency Scale"); 168 list.push_back("Frequency Scale");
169 list.push_back("Zero Padding"); 169 // list.push_back("Zero Padding");
170 return list; 170 return list;
171 } 171 }
172 172
173 QString 173 QString
174 SpectrogramLayer::getPropertyLabel(const PropertyName &name) const 174 SpectrogramLayer::getPropertyLabel(const PropertyName &name) const
1629 size_t bins = m_fftSize / 2; 1629 size_t bins = m_fftSize / 2;
1630 if (m_maxFrequency > 0) { 1630 if (m_maxFrequency > 0) {
1631 bins = int((double(m_maxFrequency) * m_fftSize) / sr + 0.1); 1631 bins = int((double(m_maxFrequency) * m_fftSize) / sr + 0.1);
1632 if (bins > m_fftSize / 2) bins = m_fftSize / 2; 1632 if (bins > m_fftSize / 2) bins = m_fftSize / 2;
1633 } 1633 }
1634 1634
1635 size_t minbin = 1; 1635 size_t minbin = 1;
1636 if (m_minFrequency > 0) { 1636 if (m_minFrequency > 0) {
1637 minbin = int((double(m_minFrequency) * m_fftSize) / sr + 0.1); 1637 minbin = int((double(m_minFrequency) * m_fftSize) / sr + 0.1);
1638 if (minbin < 1) minbin = 1; 1638 if (minbin < 1) minbin = 1;
1639 if (minbin >= bins) minbin = bins - 1; 1639 if (minbin >= bins) minbin = bins - 1;
1640 } 1640 }
1641 1641
1642 //!!! quite wrong and won't work for layers that may be in more than one view
1643 if (v->height() > (bins - minbin) / (m_zeroPadLevel + 1)) {
1644 if (m_zeroPadLevel != 3) {
1645 ((SpectrogramLayer *)this)->setZeroPadLevel(3);
1646 return;
1647 }
1648 } else {
1649 if (m_zeroPadLevel != 0) {
1650 ((SpectrogramLayer *)this)->setZeroPadLevel(0);
1651 return;
1652 }
1653 }
1654
1642 float minFreq = (float(minbin) * sr) / m_fftSize; 1655 float minFreq = (float(minbin) * sr) / m_fftSize;
1643 float maxFreq = (float(bins) * sr) / m_fftSize; 1656 float maxFreq = (float(bins) * sr) / m_fftSize;
1644 1657
1645 float ymag[h]; 1658 float ymag[h];
1646 float ydiv[h]; 1659 float ydiv[h];