Mercurial > hg > svgui
comparison layer/SpectrogramLayer.cpp @ 93:05c41701dc6c
* a bit of tidying, and another improvement to cache hit ratio in FFTCache
for peak-frequency spectra
author | Chris Cannam |
---|---|
date | Tue, 09 May 2006 12:13:35 +0000 |
parents | 23d1e37bbfb4 |
children | 1b3996a86cfa |
comparison
equal
deleted
inserted
replaced
92:23d1e37bbfb4 | 93:05c41701dc6c |
---|---|
1926 | 1926 |
1927 if (!m_cache->haveColumnAt(s)) continue; | 1927 if (!m_cache->haveColumnAt(s)) continue; |
1928 | 1928 |
1929 for (size_t q = minbin; q < bins; ++q) { | 1929 for (size_t q = minbin; q < bins; ++q) { |
1930 | 1930 |
1931 // float f0 = (float(q) * sr) / m_windowSize; | |
1932 // float f1 = (float(q + 1) * sr) / m_windowSize; | |
1933 | |
1934 // float y0 = 0, y1 = 0; | |
1935 | |
1936 float y0 = yval[q + 1]; | 1931 float y0 = yval[q + 1]; |
1937 float y1 = yval[q]; | 1932 float y1 = yval[q]; |
1938 | 1933 |
1939 | |
1940 /* | |
1941 if (m_binDisplay != PeakFrequencies) { | |
1942 y0 = v->getYForFrequency(f1, minFreq, maxFreq, logarithmic); | |
1943 y1 = v->getYForFrequency(f0, minFreq, maxFreq, logarithmic); | |
1944 } | |
1945 */ | |
1946 if (m_binDisplay == PeakBins || | 1934 if (m_binDisplay == PeakBins || |
1947 m_binDisplay == PeakFrequencies) { | 1935 m_binDisplay == PeakFrequencies) { |
1948 if (!m_cache->isLocalPeak(s, q)) continue; | 1936 if (!m_cache->isLocalPeak(s, q)) continue; |
1949 } | 1937 } |
1950 | 1938 |
1956 | 1944 |
1957 if (m_binDisplay == PeakFrequencies && | 1945 if (m_binDisplay == PeakFrequencies && |
1958 s < int(m_cache->getWidth()) - 1) { | 1946 s < int(m_cache->getWidth()) - 1) { |
1959 | 1947 |
1960 bool steady = false; | 1948 bool steady = false; |
1961 // f0 = f1 = calculateFrequency(q, | |
1962 float f = calculateFrequency(q, | 1949 float f = calculateFrequency(q, |
1963 m_windowSize, | 1950 m_windowSize, |
1964 increment, | 1951 increment, |
1965 sr, | 1952 sr, |
1966 m_cache->getPhaseAt(s, q), | 1953 m_cache->getPhaseAt(s, q), |
1967 m_cache->getPhaseAt(s+1, q), | 1954 m_cache->getPhaseAt(s+1, q), |
1968 steady); | 1955 steady); |
1969 | 1956 |
1970 y0 = y1 = v->getYForFrequency | 1957 y0 = y1 = v->getYForFrequency |
1971 // (f0, minFreq, maxFreq, logarithmic); | |
1972 (f, minFreq, maxFreq, logarithmic); | 1958 (f, minFreq, maxFreq, logarithmic); |
1973 } | 1959 } |
1974 | 1960 |
1975 int y0i = int(y0 + 0.001); | 1961 int y0i = int(y0 + 0.001); |
1976 int y1i = int(y1); | 1962 int y1i = int(y1); |