comparison layer/Colour3DPlotRenderer.cpp @ 1103:d84a0033b305 spectrogram-minor-refactor

Turn BinDisplay and BinScale into enum classes
author Chris Cannam
date Thu, 14 Jul 2016 15:13:37 +0100
parents 102f986ec032
children ea5ae9dd10ba
comparison
equal deleted inserted replaced
1102:36a981a0fa31 1103:d84a0033b305
173 // but we want to ensure the cache is coherent without having to 173 // but we want to ensure the cache is coherent without having to
174 // worry about vertical matching of required and valid areas as 174 // worry about vertical matching of required and valid areas as
175 // well as horizontal. That's why this function didn't take any 175 // well as horizontal. That's why this function didn't take any
176 // y/height parameters. 176 // y/height parameters.
177 177
178 if (bufferIsBinResolution && (m_params.binDisplay != PeakFrequencies)) { 178 if (bufferIsBinResolution && (m_params.binDisplay != BinDisplay::PeakFrequencies)) {
179 renderToCacheBinResolution(v, x0, x1 - x0); 179 renderToCacheBinResolution(v, x0, x1 - x0);
180 } else { 180 } else {
181 renderToCachePixelResolution(v, x0, x1 - x0, rightToLeft, timeConstrained); 181 renderToCachePixelResolution(v, x0, x1 - x0, rightToLeft, timeConstrained);
182 } 182 }
183 183
279 binfory[y] = m_sources.verticalBinLayer->getBinForY(v, h - y - 1); 279 binfory[y] = m_sources.verticalBinLayer->getBinForY(v, h - y - 1);
280 } 280 }
281 281
282 int attainedWidth; 282 int attainedWidth;
283 283
284 if (m_params.binDisplay == PeakFrequencies) { 284 if (m_params.binDisplay == BinDisplay::PeakFrequencies) {
285 attainedWidth = renderDrawBufferPeakFrequencies(v, 285 attainedWidth = renderDrawBufferPeakFrequencies(v,
286 repaintWidth, 286 repaintWidth,
287 h, 287 h,
288 binforx, 288 binforx,
289 binfory, 289 binfory,
545 545
546 // if (m_colourScale != PhaseColourScale) { 546 // if (m_colourScale != PhaseColourScale) {
547 column = ColumnOp::normalize(column, m_params.normalization); 547 column = ColumnOp::normalize(column, m_params.normalization);
548 // } 548 // }
549 549
550 if (m_params.binDisplay == PeakBins) { 550 if (m_params.binDisplay == BinDisplay::PeakBins) {
551 column = ColumnOp::peakPick(column); 551 column = ColumnOp::peakPick(column);
552 } 552 }
553 553
554 preparedColumn = 554 preparedColumn =
555 ColumnOp::distribute(column, //!!! gain? ColumnOp::applyGain(column, m_gain), 555 ColumnOp::distribute(column, //!!! gain? ColumnOp::applyGain(column, m_gain),
634 cerr << "modelWidth " << modelWidth << endl; 634 cerr << "modelWidth " << modelWidth << endl;
635 635
636 double minFreq = (double(minbin) * fft->getSampleRate()) / fft->getFFTSize(); 636 double minFreq = (double(minbin) * fft->getSampleRate()) / fft->getFFTSize();
637 double maxFreq = (double(maxbin) * fft->getSampleRate()) / fft->getFFTSize(); 637 double maxFreq = (double(maxbin) * fft->getSampleRate()) / fft->getFFTSize();
638 638
639 bool logarithmic = (m_params.binScale == LogBinScale); 639 bool logarithmic = (m_params.binScale == BinScale::Log);
640 640
641 for (int x = start; x != finish; x += step) { 641 for (int x = start; x != finish; x += step) {
642 642
643 // x is the on-canvas pixel coord; sx (later) will be the 643 // x is the on-canvas pixel coord; sx (later) will be the
644 // source column index 644 // source column index