comparison layer/SliceLayer.cpp @ 280:3c402c6052f6

* Pull peak-picker out of SpectrumLayer and into FFTModel; use combined peak-picker and frequency estimator for SpectrogramLayer (makes the peak frequency spectrogram a bit quicker) * Add more information to spectrum and spectrogram crosshairs
author Chris Cannam
date Wed, 04 Jul 2007 15:29:16 +0000
parents b9380f679f70
children 1284955856ab
comparison
equal deleted inserted replaced
279:47fe0352861e 280:3c402c6052f6
131 RealTime rt0 = RealTime::frame2RealTime(f0, sampleRate); 131 RealTime rt0 = RealTime::frame2RealTime(f0, sampleRate);
132 RealTime rt1 = RealTime::frame2RealTime(f1, sampleRate); 132 RealTime rt1 = RealTime::frame2RealTime(f1, sampleRate);
133 133
134 range = f1 - f0 + 1; 134 range = f1 - f0 + 1;
135 135
136 QString rtrangestr = QString("%1 s").arg((rt1 - rt0).toText().c_str());
137
136 if (includeBinDescription) { 138 if (includeBinDescription) {
137 139
138 float minvalue = 0.f; 140 float minvalue = 0.f;
139 if (minbin < int(m_values.size())) minvalue = m_values[minbin]; 141 if (minbin < int(m_values.size())) minvalue = m_values[minbin];
140 142
155 valuestr = tr("%1 - %2").arg(minvalue).arg(maxvalue); 157 valuestr = tr("%1 - %2").arg(minvalue).arg(maxvalue);
156 } else { 158 } else {
157 valuestr = QString("%1").arg(minvalue); 159 valuestr = QString("%1").arg(minvalue);
158 } 160 }
159 161
160 QString description = tr("Time:\t%1 - %2\nRange:\t%3 samples\nBin:\t%4\n%5 value:\t%6") 162 QString description = tr("Time:\t%1 - %2\nRange:\t%3 samples (%4)\nBin:\t%5\n%6 value:\t%7")
161 .arg(QString::fromStdString(rt0.toText(true))) 163 .arg(QString::fromStdString(rt0.toText(true)))
162 .arg(QString::fromStdString(rt1.toText(true))) 164 .arg(QString::fromStdString(rt1.toText(true)))
163 .arg(range) 165 .arg(range)
166 .arg(rtrangestr)
164 .arg(binstr) 167 .arg(binstr)
165 .arg(m_samplingMode == NearestSample ? tr("First") : 168 .arg(m_samplingMode == NearestSample ? tr("First") :
166 m_samplingMode == SampleMean ? tr("Mean") : tr("Peak")) 169 m_samplingMode == SampleMean ? tr("Mean") : tr("Peak"))
167 .arg(valuestr); 170 .arg(valuestr);
168 171
169 return description; 172 return description;
170 173
171 } else { 174 } else {
172 175
173 QString description = tr("Time:\t%1 - %2\nRange:\t%3 samples") 176 QString description = tr("Time:\t%1 - %2\nRange:\t%3 samples (%4)")
174 .arg(QString::fromStdString(rt0.toText(true))) 177 .arg(QString::fromStdString(rt0.toText(true)))
175 .arg(QString::fromStdString(rt1.toText(true))) 178 .arg(QString::fromStdString(rt1.toText(true)))
176 .arg(range); 179 .arg(range)
180 .arg(rtrangestr);
177 181
178 return description; 182 return description;
179 } 183 }
180 } 184 }
181 185