comparison layer/Colour3DPlotRenderer.cpp @ 1218:4f1f3e1a4f63

Debug toward tracking down strange peak-frequency spectrogram update problem
author Chris Cannam
date Fri, 13 Jan 2017 15:44:39 +0000
parents 51b6381fc413
children c06861dec245
comparison
equal deleted inserted replaced
1217:51b6381fc413 1218:4f1f3e1a4f63
1045 double maxFreq = 1045 double maxFreq =
1046 (double(minbin + nbins - 1) * fft->getSampleRate()) / fft->getFFTSize(); 1046 (double(minbin + nbins - 1) * fft->getSampleRate()) / fft->getFFTSize();
1047 1047
1048 bool logarithmic = (m_params.binScale == BinScale::Log); 1048 bool logarithmic = (m_params.binScale == BinScale::Log);
1049 1049
1050 #ifdef DEBUG_COLOUR_PLOT_REPAINT
1051 SVDEBUG << "start = " << start << ", finish = " << finish
1052 << ", step = " << step << endl;
1053 #endif
1054
1050 for (int x = start; x != finish; x += step) { 1055 for (int x = start; x != finish; x += step) {
1051 1056
1052 // x is the on-canvas pixel coord; sx (later) will be the 1057 // x is the on-canvas pixel coord; sx (later) will be the
1053 // source column index 1058 // source column index
1054 1059
1089 } 1094 }
1090 } 1095 }
1091 } 1096 }
1092 1097
1093 if (!pixelPeakColumn.empty()) { 1098 if (!pixelPeakColumn.empty()) {
1099
1100 #ifdef DEBUG_COLOUR_PLOT_REPAINT
1101 SVDEBUG << "found " << peakfreqs.size() << " peak freqs at column "
1102 << sx0 << endl;
1103 #endif
1094 1104
1095 for (FFTModel::PeakSet::const_iterator pi = peakfreqs.begin(); 1105 for (FFTModel::PeakSet::const_iterator pi = peakfreqs.begin();
1096 pi != peakfreqs.end(); ++pi) { 1106 pi != peakfreqs.end(); ++pi) {
1097 1107
1098 int bin = pi->first; 1108 int bin = pi->first;
1114 iy, 1124 iy,
1115 m_params.colourScale.getPixel(value)); 1125 m_params.colourScale.getPixel(value));
1116 } 1126 }
1117 1127
1118 m_magRanges.push_back(magRange); 1128 m_magRanges.push_back(magRange);
1129
1130 } else {
1131 #ifdef DEBUG_COLOUR_PLOT_REPAINT
1132 SVDEBUG << "pixel peak column for range " << sx0 << " to " << sx1
1133 << " is empty" << endl;
1134 #endif
1119 } 1135 }
1120 1136
1121 double fractionComplete = double(columnCount) / double(w); 1137 double fractionComplete = double(columnCount) / double(w);
1122 if (timer.outOfTime(fractionComplete)) { 1138 if (timer.outOfTime(fractionComplete)) {
1139 #ifdef DEBUG_COLOUR_PLOT_REPAINT
1140 SVDEBUG << "out of time" << endl;
1141 #endif
1123 return columnCount; 1142 return columnCount;
1124 } 1143 }
1125 } 1144 }
1126 1145
1127 return columnCount; 1146 return columnCount;