Chris@133
|
1
|
Chris@133
|
2 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@133
|
3
|
Chris@133
|
4 /*
|
Chris@133
|
5 Sonic Visualiser
|
Chris@133
|
6 An audio file viewer and annotation editor.
|
Chris@133
|
7 Centre for Digital Music, Queen Mary, University of London.
|
Chris@195
|
8 This file copyright 2006-2007 QMUL.
|
Chris@133
|
9
|
Chris@133
|
10 This program is free software; you can redistribute it and/or
|
Chris@133
|
11 modify it under the terms of the GNU General Public License as
|
Chris@133
|
12 published by the Free Software Foundation; either version 2 of the
|
Chris@133
|
13 License, or (at your option) any later version. See the file
|
Chris@133
|
14 COPYING included with this distribution for more information.
|
Chris@133
|
15 */
|
Chris@133
|
16
|
Chris@193
|
17 #include "SliceLayer.h"
|
Chris@133
|
18
|
Chris@133
|
19 #include "view/View.h"
|
Chris@153
|
20 #include "base/AudioLevel.h"
|
Chris@167
|
21 #include "base/RangeMapper.h"
|
Chris@195
|
22 #include "base/RealTime.h"
|
Chris@195
|
23
|
Chris@197
|
24 #include "ColourMapper.h"
|
Chris@195
|
25 #include "PaintAssistant.h"
|
Chris@133
|
26
|
Chris@133
|
27 #include <QPainter>
|
Chris@133
|
28 #include <QPainterPath>
|
Chris@133
|
29
|
Chris@193
|
30 SliceLayer::SliceLayer() :
|
Chris@193
|
31 m_sliceableModel(0),
|
Chris@153
|
32 m_colour(Qt::darkBlue),
|
Chris@197
|
33 m_colourMap(0),
|
Chris@153
|
34 m_energyScale(dBScale),
|
Chris@198
|
35 m_samplingMode(SampleMean),
|
Chris@195
|
36 m_plotStyle(PlotSteps),
|
Chris@193
|
37 m_binScale(LinearBins),
|
Chris@153
|
38 m_normalize(false),
|
Chris@198
|
39 m_gain(1.0),
|
Chris@198
|
40 m_currentf0(0),
|
Chris@198
|
41 m_currentf1(0)
|
Chris@133
|
42 {
|
Chris@133
|
43 }
|
Chris@133
|
44
|
Chris@193
|
45 SliceLayer::~SliceLayer()
|
Chris@133
|
46 {
|
Chris@193
|
47
|
Chris@133
|
48 }
|
Chris@133
|
49
|
Chris@133
|
50 void
|
Chris@193
|
51 SliceLayer::setSliceableModel(const Model *model)
|
Chris@133
|
52 {
|
Chris@193
|
53 const DenseThreeDimensionalModel *sliceable =
|
Chris@193
|
54 dynamic_cast<const DenseThreeDimensionalModel *>(model);
|
Chris@193
|
55
|
Chris@193
|
56 if (model && !sliceable) {
|
Chris@193
|
57 std::cerr << "WARNING: SliceLayer::setSliceableModel(" << model
|
Chris@193
|
58 << "): model is not a DenseThreeDimensionalModel" << std::endl;
|
Chris@193
|
59 }
|
Chris@193
|
60
|
Chris@193
|
61 if (m_sliceableModel == sliceable) return;
|
Chris@193
|
62
|
Chris@193
|
63 m_sliceableModel = sliceable;
|
Chris@193
|
64
|
Chris@193
|
65 connect(m_sliceableModel, SIGNAL(modelChanged()),
|
Chris@193
|
66 this, SIGNAL(modelChanged()));
|
Chris@193
|
67
|
Chris@193
|
68 connect(m_sliceableModel, SIGNAL(modelChanged(size_t, size_t)),
|
Chris@193
|
69 this, SIGNAL(modelChanged(size_t, size_t)));
|
Chris@193
|
70
|
Chris@193
|
71 connect(m_sliceableModel, SIGNAL(completionChanged()),
|
Chris@193
|
72 this, SIGNAL(modelCompletionChanged()));
|
Chris@193
|
73
|
Chris@193
|
74 emit modelReplaced();
|
Chris@153
|
75 }
|
Chris@153
|
76
|
Chris@153
|
77 void
|
Chris@193
|
78 SliceLayer::sliceableModelReplaced(const Model *orig, const Model *replacement)
|
Chris@153
|
79 {
|
Chris@193
|
80 std::cerr << "SliceLayer::sliceableModelReplaced(" << orig << ", " << replacement << ")" << std::endl;
|
Chris@153
|
81
|
Chris@193
|
82 if (orig == m_sliceableModel) {
|
Chris@193
|
83 setSliceableModel
|
Chris@193
|
84 (dynamic_cast<const DenseThreeDimensionalModel *>(replacement));
|
Chris@153
|
85 }
|
Chris@153
|
86 }
|
Chris@153
|
87
|
Chris@153
|
88 void
|
Chris@193
|
89 SliceLayer::modelAboutToBeDeleted(Model *m)
|
Chris@153
|
90 {
|
Chris@193
|
91 std::cerr << "SliceLayer::modelAboutToBeDeleted(" << m << ")" << std::endl;
|
Chris@153
|
92
|
Chris@193
|
93 if (m == m_sliceableModel) {
|
Chris@193
|
94 setSliceableModel(0);
|
Chris@153
|
95 }
|
Chris@133
|
96 }
|
Chris@133
|
97
|
Chris@198
|
98 QString
|
Chris@198
|
99 SliceLayer::getFeatureDescription(View *v, QPoint &p) const
|
Chris@198
|
100 {
|
Chris@199
|
101 int minbin, maxbin, range;
|
Chris@199
|
102 return getFeatureDescription(v, p, true, minbin, maxbin, range);
|
Chris@199
|
103 }
|
Chris@199
|
104
|
Chris@199
|
105 QString
|
Chris@199
|
106 SliceLayer::getFeatureDescription(View *v, QPoint &p,
|
Chris@199
|
107 bool includeBinDescription,
|
Chris@199
|
108 int &minbin, int &maxbin, int &range) const
|
Chris@199
|
109 {
|
Chris@199
|
110 minbin = 0;
|
Chris@199
|
111 maxbin = 0;
|
Chris@198
|
112 if (!m_sliceableModel) return "";
|
Chris@198
|
113
|
Chris@198
|
114 int xorigin = m_xorigins[v];
|
Chris@198
|
115 int w = v->width() - xorigin - 1;
|
Chris@198
|
116
|
Chris@198
|
117 int mh = m_sliceableModel->getHeight();
|
Chris@199
|
118 minbin = getBinForX(p.x() - xorigin, mh, w);
|
Chris@199
|
119 maxbin = getBinForX(p.x() - xorigin + 1, mh, w);
|
Chris@199
|
120
|
Chris@199
|
121 if (minbin >= mh) minbin = mh - 1;
|
Chris@199
|
122 if (maxbin >= mh) maxbin = mh - 1;
|
Chris@199
|
123 if (minbin < 0) minbin = 0;
|
Chris@199
|
124 if (maxbin < 0) maxbin = 0;
|
Chris@198
|
125
|
Chris@198
|
126 int sampleRate = m_sliceableModel->getSampleRate();
|
Chris@198
|
127
|
Chris@198
|
128 size_t f0 = m_currentf0;
|
Chris@198
|
129 size_t f1 = m_currentf1;
|
Chris@198
|
130
|
Chris@198
|
131 RealTime rt0 = RealTime::frame2RealTime(f0, sampleRate);
|
Chris@198
|
132 RealTime rt1 = RealTime::frame2RealTime(f1, sampleRate);
|
Chris@198
|
133
|
Chris@199
|
134 range = f1 - f0 + 1;
|
Chris@198
|
135
|
Chris@199
|
136 if (includeBinDescription) {
|
Chris@198
|
137
|
Chris@199
|
138 float minvalue = 0.f;
|
Chris@248
|
139 if (minbin < int(m_values.size())) minvalue = m_values[minbin];
|
Chris@198
|
140
|
Chris@199
|
141 float maxvalue = minvalue;
|
Chris@248
|
142 if (maxbin < int(m_values.size())) maxvalue = m_values[maxbin];
|
Chris@199
|
143
|
Chris@199
|
144 if (minvalue > maxvalue) std::swap(minvalue, maxvalue);
|
Chris@199
|
145
|
Chris@199
|
146 QString binstr;
|
Chris@199
|
147 if (maxbin != minbin) {
|
Chris@199
|
148 binstr = tr("%1 - %2").arg(minbin+1).arg(maxbin+1);
|
Chris@199
|
149 } else {
|
Chris@199
|
150 binstr = QString("%1").arg(minbin+1);
|
Chris@199
|
151 }
|
Chris@199
|
152
|
Chris@199
|
153 QString valuestr;
|
Chris@199
|
154 if (maxvalue != minvalue) {
|
Chris@199
|
155 valuestr = tr("%1 - %2").arg(minvalue).arg(maxvalue);
|
Chris@199
|
156 } else {
|
Chris@199
|
157 valuestr = QString("%1").arg(minvalue);
|
Chris@199
|
158 }
|
Chris@199
|
159
|
Chris@199
|
160 QString description = tr("Time:\t%1 - %2\nRange:\t%3 samples\nBin:\t%4\n%5 value:\t%6")
|
Chris@199
|
161 .arg(QString::fromStdString(rt0.toText(true)))
|
Chris@199
|
162 .arg(QString::fromStdString(rt1.toText(true)))
|
Chris@199
|
163 .arg(range)
|
Chris@199
|
164 .arg(binstr)
|
Chris@199
|
165 .arg(m_samplingMode == NearestSample ? tr("First") :
|
Chris@199
|
166 m_samplingMode == SampleMean ? tr("Mean") : tr("Peak"))
|
Chris@199
|
167 .arg(valuestr);
|
Chris@199
|
168
|
Chris@199
|
169 return description;
|
Chris@199
|
170
|
Chris@199
|
171 } else {
|
Chris@199
|
172
|
Chris@199
|
173 QString description = tr("Time:\t%1 - %2\nRange:\t%3 samples")
|
Chris@199
|
174 .arg(QString::fromStdString(rt0.toText(true)))
|
Chris@199
|
175 .arg(QString::fromStdString(rt1.toText(true)))
|
Chris@199
|
176 .arg(range);
|
Chris@199
|
177
|
Chris@199
|
178 return description;
|
Chris@199
|
179 }
|
Chris@198
|
180 }
|
Chris@198
|
181
|
Chris@198
|
182 float
|
Chris@198
|
183 SliceLayer::getXForBin(int bin, int count, float w) const
|
Chris@198
|
184 {
|
Chris@198
|
185 float x = 0;
|
Chris@198
|
186
|
Chris@198
|
187 switch (m_binScale) {
|
Chris@198
|
188
|
Chris@198
|
189 case LinearBins:
|
Chris@198
|
190 x = (float(w) * bin) / count;
|
Chris@198
|
191 break;
|
Chris@198
|
192
|
Chris@198
|
193 case LogBins:
|
Chris@198
|
194 x = (float(w) * log10f(bin + 1)) / log10f(count + 1);
|
Chris@198
|
195 break;
|
Chris@198
|
196
|
Chris@198
|
197 case InvertedLogBins:
|
Chris@198
|
198 x = w - (float(w) * log10f(count - bin - 1)) / log10f(count);
|
Chris@198
|
199 break;
|
Chris@198
|
200 }
|
Chris@198
|
201
|
Chris@198
|
202 return x;
|
Chris@198
|
203 }
|
Chris@198
|
204
|
Chris@198
|
205 int
|
Chris@198
|
206 SliceLayer::getBinForX(float x, int count, float w) const
|
Chris@198
|
207 {
|
Chris@198
|
208 int bin = 0;
|
Chris@198
|
209
|
Chris@198
|
210 switch (m_binScale) {
|
Chris@198
|
211
|
Chris@198
|
212 case LinearBins:
|
Chris@198
|
213 bin = int((x * count) / w + 0.0001);
|
Chris@198
|
214 break;
|
Chris@198
|
215
|
Chris@198
|
216 case LogBins:
|
Chris@198
|
217 bin = int(powf(10.f, (x * log10f(count + 1)) / w) - 1 + 0.0001);
|
Chris@198
|
218 break;
|
Chris@198
|
219
|
Chris@198
|
220 case InvertedLogBins:
|
Chris@198
|
221 bin = count + 1 - int(powf(10.f, (log10f(count) * (w - x)) / float(w)) + 0.0001);
|
Chris@198
|
222 break;
|
Chris@198
|
223 }
|
Chris@198
|
224
|
Chris@198
|
225 return bin;
|
Chris@198
|
226 }
|
Chris@198
|
227
|
Chris@274
|
228 float
|
Chris@274
|
229 SliceLayer::getYForValue(float value, const View *v, float &norm) const
|
Chris@274
|
230 {
|
Chris@274
|
231 norm = 0.f;
|
Chris@274
|
232
|
Chris@274
|
233 if (m_yorigins.find(v) == m_yorigins.end()) return 0;
|
Chris@274
|
234
|
Chris@274
|
235 value *= m_gain;
|
Chris@274
|
236
|
Chris@274
|
237 int yorigin = m_yorigins[v];
|
Chris@274
|
238 int h = m_heights[v];
|
Chris@274
|
239 float thresh = -80.f;
|
Chris@274
|
240
|
Chris@274
|
241 float y = 0.f;
|
Chris@274
|
242
|
Chris@274
|
243 if (h <= 0) return y;
|
Chris@274
|
244
|
Chris@274
|
245 switch (m_energyScale) {
|
Chris@274
|
246
|
Chris@274
|
247 case dBScale:
|
Chris@274
|
248 {
|
Chris@274
|
249 float db = thresh;
|
Chris@274
|
250 if (value > 0.f) db = 10.f * log10f(value);
|
Chris@274
|
251 if (db < thresh) db = thresh;
|
Chris@274
|
252 norm = (db - thresh) / -thresh;
|
Chris@274
|
253 y = yorigin - (float(h) * norm);
|
Chris@274
|
254 break;
|
Chris@274
|
255 }
|
Chris@274
|
256
|
Chris@274
|
257 case MeterScale:
|
Chris@274
|
258 y = AudioLevel::multiplier_to_preview(value, h);
|
Chris@274
|
259 norm = float(y) / float(h);
|
Chris@274
|
260 y = yorigin - y;
|
Chris@274
|
261 break;
|
Chris@274
|
262
|
Chris@274
|
263 default:
|
Chris@274
|
264 norm = value;
|
Chris@274
|
265 y = yorigin - (float(h) * value);
|
Chris@274
|
266 break;
|
Chris@274
|
267 }
|
Chris@274
|
268
|
Chris@274
|
269 return y;
|
Chris@274
|
270 }
|
Chris@274
|
271
|
Chris@274
|
272 float
|
Chris@274
|
273 SliceLayer::getValueForY(float y, const View *v) const
|
Chris@274
|
274 {
|
Chris@274
|
275 float value = 0.f;
|
Chris@274
|
276
|
Chris@274
|
277 if (m_yorigins.find(v) == m_yorigins.end()) return value;
|
Chris@274
|
278
|
Chris@274
|
279 int yorigin = m_yorigins[v];
|
Chris@274
|
280 int h = m_heights[v];
|
Chris@274
|
281 float thresh = -80.f;
|
Chris@274
|
282
|
Chris@274
|
283 if (h <= 0) return value;
|
Chris@274
|
284
|
Chris@274
|
285 y = yorigin - y;
|
Chris@274
|
286
|
Chris@274
|
287 switch (m_energyScale) {
|
Chris@274
|
288
|
Chris@274
|
289 case dBScale:
|
Chris@274
|
290 {
|
Chris@274
|
291 float db = ((y / h) * -thresh) + thresh;
|
Chris@274
|
292 value = powf(10.f, db/10.f);
|
Chris@274
|
293 break;
|
Chris@274
|
294 }
|
Chris@274
|
295
|
Chris@274
|
296 case MeterScale:
|
Chris@274
|
297 value = AudioLevel::preview_to_multiplier(lrintf(y), h);
|
Chris@274
|
298 break;
|
Chris@274
|
299
|
Chris@274
|
300 default:
|
Chris@274
|
301 value = y / h;
|
Chris@274
|
302 }
|
Chris@274
|
303
|
Chris@274
|
304 return value / m_gain;
|
Chris@274
|
305 }
|
Chris@274
|
306
|
Chris@133
|
307 void
|
Chris@193
|
308 SliceLayer::paint(View *v, QPainter &paint, QRect rect) const
|
Chris@133
|
309 {
|
Chris@254
|
310 if (!m_sliceableModel || !m_sliceableModel->isOK() ||
|
Chris@254
|
311 !m_sliceableModel->isReady()) return;
|
Chris@133
|
312
|
Chris@195
|
313 paint.save();
|
Chris@195
|
314 paint.setRenderHint(QPainter::Antialiasing, false);
|
Chris@195
|
315
|
Chris@195
|
316 if (v->getViewManager() && v->getViewManager()->shouldShowScaleGuides()) {
|
Chris@195
|
317 if (!m_scalePoints.empty()) {
|
Chris@195
|
318 paint.setPen(QColor(240, 240, 240)); //!!! and dark background?
|
Chris@195
|
319 for (size_t i = 0; i < m_scalePoints.size(); ++i) {
|
Chris@195
|
320 paint.drawLine(0, m_scalePoints[i], rect.width(), m_scalePoints[i]);
|
Chris@195
|
321 }
|
Chris@195
|
322 }
|
Chris@195
|
323 }
|
Chris@195
|
324
|
Chris@195
|
325 paint.setPen(m_colour);
|
Chris@195
|
326
|
Chris@274
|
327 int xorigin = getVerticalScaleWidth(v, paint) + 1;
|
Chris@195
|
328 int w = v->width() - xorigin - 1;
|
Chris@198
|
329
|
Chris@198
|
330 m_xorigins[v] = xorigin; // for use in getFeatureDescription
|
Chris@133
|
331
|
Chris@195
|
332 int yorigin = v->height() - 20 - paint.fontMetrics().height() - 7;
|
Chris@195
|
333 int h = yorigin - paint.fontMetrics().height() - 8;
|
Chris@133
|
334
|
Chris@274
|
335 m_yorigins[v] = yorigin; // for getYForValue etc
|
Chris@274
|
336 m_heights[v] = h;
|
Chris@274
|
337
|
Chris@274
|
338 if (h <= 0) return;
|
Chris@274
|
339
|
Chris@133
|
340 QPainterPath path;
|
Chris@133
|
341
|
Chris@248
|
342 size_t mh = m_sliceableModel->getHeight();
|
Chris@133
|
343
|
Chris@193
|
344 int divisor = 0;
|
Chris@193
|
345
|
Chris@198
|
346 m_values.clear();
|
Chris@193
|
347 for (size_t bin = 0; bin < mh; ++bin) {
|
Chris@198
|
348 m_values.push_back(0.f);
|
Chris@193
|
349 }
|
Chris@193
|
350
|
Chris@193
|
351 size_t f0 = v->getCentreFrame();
|
Chris@193
|
352 int f0x = v->getXForFrame(f0);
|
Chris@195
|
353 f0 = v->getFrameForX(f0x);
|
Chris@193
|
354 size_t f1 = v->getFrameForX(f0x + 1);
|
Chris@195
|
355 if (f1 > f0) --f1;
|
Chris@193
|
356
|
Chris@274
|
357 std::cerr << "centre frame " << v->getCentreFrame() << ", x " << f0x << ", f0 " << f0 << ", f1 " << f1 << std::endl;
|
Chris@274
|
358
|
Chris@274
|
359 size_t res = m_sliceableModel->getResolution();
|
Chris@274
|
360 size_t col0 = f0 / res;
|
Chris@193
|
361 size_t col1 = col0;
|
Chris@274
|
362 if (m_samplingMode != NearestSample) col1 = f1 / res;
|
Chris@274
|
363 f0 = col0 * res;
|
Chris@274
|
364 f1 = (col1 + 1) * res - 1;
|
Chris@274
|
365
|
Chris@274
|
366 std::cerr << "resolution " << res << ", col0 " << col0 << ", col1 " << col1 << ", f0 " << f0 << ", f1 " << f1 << std::endl;
|
Chris@193
|
367
|
Chris@198
|
368 m_currentf0 = f0;
|
Chris@198
|
369 m_currentf1 = f1;
|
Chris@198
|
370
|
Chris@254
|
371 BiasCurve curve;
|
Chris@254
|
372 getBiasCurve(curve);
|
Chris@254
|
373 size_t cs = curve.size();
|
Chris@254
|
374
|
Chris@195
|
375 for (size_t col = col0; col <= col1; ++col) {
|
Chris@193
|
376 for (size_t bin = 0; bin < mh; ++bin) {
|
Chris@193
|
377 float value = m_sliceableModel->getValueAt(col, bin);
|
Chris@254
|
378 if (bin < cs) value *= curve[bin];
|
Chris@193
|
379 if (m_samplingMode == SamplePeak) {
|
Chris@198
|
380 if (value > m_values[bin]) m_values[bin] = value;
|
Chris@193
|
381 } else {
|
Chris@198
|
382 m_values[bin] += value;
|
Chris@193
|
383 }
|
Chris@153
|
384 }
|
Chris@193
|
385 ++divisor;
|
Chris@193
|
386 }
|
Chris@193
|
387
|
Chris@193
|
388 float max = 0.f;
|
Chris@193
|
389 for (size_t bin = 0; bin < mh; ++bin) {
|
Chris@198
|
390 if (m_samplingMode == SampleMean) m_values[bin] /= divisor;
|
Chris@198
|
391 if (m_values[bin] > max) max = m_values[bin];
|
Chris@193
|
392 }
|
Chris@193
|
393 if (max != 0.f && m_normalize) {
|
Chris@193
|
394 for (size_t bin = 0; bin < mh; ++bin) {
|
Chris@198
|
395 m_values[bin] /= max;
|
Chris@193
|
396 }
|
Chris@193
|
397 }
|
Chris@193
|
398
|
Chris@193
|
399 float py = 0;
|
Chris@193
|
400 float nx = xorigin;
|
Chris@193
|
401
|
Chris@197
|
402 ColourMapper mapper(m_colourMap, 0, 1);
|
Chris@197
|
403
|
Chris@193
|
404 for (size_t bin = 0; bin < mh; ++bin) {
|
Chris@193
|
405
|
Chris@198
|
406 float x = nx;
|
Chris@198
|
407 nx = xorigin + getXForBin(bin + 1, mh, w);
|
Chris@193
|
408
|
Chris@198
|
409 float value = m_values[bin];
|
Chris@197
|
410 float norm = 0.f;
|
Chris@274
|
411 float y = getYForValue(value, v, norm);
|
Chris@133
|
412
|
Chris@193
|
413 if (m_plotStyle == PlotLines) {
|
Chris@193
|
414
|
Chris@193
|
415 if (bin == 0) {
|
Chris@193
|
416 path.moveTo(x, y);
|
Chris@193
|
417 } else {
|
Chris@193
|
418 path.lineTo(x, y);
|
Chris@193
|
419 }
|
Chris@193
|
420
|
Chris@193
|
421 } else if (m_plotStyle == PlotSteps) {
|
Chris@193
|
422
|
Chris@193
|
423 if (bin == 0) {
|
Chris@193
|
424 path.moveTo(x, y);
|
Chris@193
|
425 } else {
|
Chris@193
|
426 path.lineTo(x, y);
|
Chris@193
|
427 }
|
Chris@193
|
428 path.lineTo(nx, y);
|
Chris@193
|
429
|
Chris@193
|
430 } else if (m_plotStyle == PlotBlocks) {
|
Chris@193
|
431
|
Chris@193
|
432 path.moveTo(x, yorigin);
|
Chris@133
|
433 path.lineTo(x, y);
|
Chris@193
|
434 path.lineTo(nx, y);
|
Chris@193
|
435 path.lineTo(nx, yorigin);
|
Chris@193
|
436 path.lineTo(x, yorigin);
|
Chris@197
|
437
|
Chris@197
|
438 } else if (m_plotStyle == PlotFilledBlocks) {
|
Chris@197
|
439
|
Chris@197
|
440 paint.fillRect(QRectF(x, y, nx - x, yorigin - y), mapper.map(norm));
|
Chris@133
|
441 }
|
Chris@193
|
442
|
Chris@193
|
443 py = y;
|
Chris@133
|
444 }
|
Chris@133
|
445
|
Chris@197
|
446 if (m_plotStyle != PlotFilledBlocks) {
|
Chris@197
|
447 paint.drawPath(path);
|
Chris@197
|
448 }
|
Chris@133
|
449 paint.restore();
|
Chris@198
|
450 /*
|
Chris@197
|
451 QPoint discard;
|
Chris@197
|
452
|
Chris@197
|
453 if (v->getViewManager() && v->getViewManager()->shouldShowFrameCount() &&
|
Chris@197
|
454 v->shouldIlluminateLocalFeatures(this, discard)) {
|
Chris@195
|
455
|
Chris@195
|
456 int sampleRate = m_sliceableModel->getSampleRate();
|
Chris@195
|
457
|
Chris@195
|
458 QString startText = QString("%1 / %2")
|
Chris@195
|
459 .arg(QString::fromStdString
|
Chris@195
|
460 (RealTime::frame2RealTime
|
Chris@195
|
461 (f0, sampleRate).toText(true)))
|
Chris@195
|
462 .arg(f0);
|
Chris@195
|
463
|
Chris@195
|
464 QString endText = QString(" %1 / %2")
|
Chris@195
|
465 .arg(QString::fromStdString
|
Chris@195
|
466 (RealTime::frame2RealTime
|
Chris@195
|
467 (f1, sampleRate).toText(true)))
|
Chris@195
|
468 .arg(f1);
|
Chris@195
|
469
|
Chris@195
|
470 QString durationText = QString("(%1 / %2) ")
|
Chris@195
|
471 .arg(QString::fromStdString
|
Chris@195
|
472 (RealTime::frame2RealTime
|
Chris@195
|
473 (f1 - f0 + 1, sampleRate).toText(true)))
|
Chris@195
|
474 .arg(f1 - f0 + 1);
|
Chris@195
|
475
|
Chris@195
|
476 v->drawVisibleText
|
Chris@195
|
477 (paint, xorigin + 5,
|
Chris@195
|
478 paint.fontMetrics().ascent() + 5,
|
Chris@195
|
479 startText, View::OutlinedText);
|
Chris@195
|
480
|
Chris@195
|
481 v->drawVisibleText
|
Chris@195
|
482 (paint, xorigin + 5,
|
Chris@195
|
483 paint.fontMetrics().ascent() + paint.fontMetrics().height() + 10,
|
Chris@195
|
484 endText, View::OutlinedText);
|
Chris@195
|
485
|
Chris@195
|
486 v->drawVisibleText
|
Chris@195
|
487 (paint, xorigin + 5,
|
Chris@195
|
488 paint.fontMetrics().ascent() + 2*paint.fontMetrics().height() + 15,
|
Chris@195
|
489 durationText, View::OutlinedText);
|
Chris@195
|
490 }
|
Chris@195
|
491 */
|
Chris@195
|
492 }
|
Chris@195
|
493
|
Chris@195
|
494 int
|
Chris@248
|
495 SliceLayer::getVerticalScaleWidth(View *, QPainter &paint) const
|
Chris@195
|
496 {
|
Chris@195
|
497 if (m_energyScale == LinearScale) {
|
Chris@220
|
498 return std::max(paint.fontMetrics().width("0.0") + 13,
|
Chris@220
|
499 paint.fontMetrics().width("x10-10"));
|
Chris@195
|
500 } else {
|
Chris@195
|
501 return std::max(paint.fontMetrics().width(tr("0dB")),
|
Chris@195
|
502 paint.fontMetrics().width(tr("-Inf"))) + 13;
|
Chris@195
|
503 }
|
Chris@195
|
504 }
|
Chris@195
|
505
|
Chris@195
|
506 void
|
Chris@195
|
507 SliceLayer::paintVerticalScale(View *v, QPainter &paint, QRect rect) const
|
Chris@195
|
508 {
|
Chris@195
|
509 float thresh = 0;
|
Chris@195
|
510 if (m_energyScale != LinearScale) {
|
Chris@195
|
511 thresh = AudioLevel::dB_to_multiplier(-80); //!!! thresh
|
Chris@195
|
512 }
|
Chris@195
|
513
|
Chris@195
|
514 // int h = (rect.height() * 3) / 4;
|
Chris@195
|
515 // int y = (rect.height() / 2) - (h / 2);
|
Chris@195
|
516
|
Chris@195
|
517 int yorigin = v->height() - 20 - paint.fontMetrics().height() - 6;
|
Chris@195
|
518 int h = yorigin - paint.fontMetrics().height() - 8;
|
Chris@195
|
519 if (h < 0) return;
|
Chris@195
|
520
|
Chris@195
|
521 QRect actual(rect.x(), rect.y() + yorigin - h, rect.width(), h);
|
Chris@195
|
522
|
Chris@220
|
523 int mult = 1;
|
Chris@220
|
524
|
Chris@195
|
525 PaintAssistant::paintVerticalLevelScale
|
Chris@195
|
526 (paint, actual, thresh, 1.0 / m_gain,
|
Chris@195
|
527 PaintAssistant::Scale(m_energyScale),
|
Chris@220
|
528 mult,
|
Chris@195
|
529 const_cast<std::vector<int> *>(&m_scalePoints));
|
Chris@220
|
530
|
Chris@220
|
531 if (mult != 1 && mult != 0) {
|
Chris@220
|
532 int log = lrintf(log10f(mult));
|
Chris@220
|
533 QString a = tr("x10");
|
Chris@220
|
534 QString b = QString("%1").arg(-log);
|
Chris@220
|
535 paint.drawText(3, 8 + paint.fontMetrics().ascent(), a);
|
Chris@220
|
536 paint.drawText(3 + paint.fontMetrics().width(a),
|
Chris@220
|
537 3 + paint.fontMetrics().ascent(), b);
|
Chris@220
|
538 }
|
Chris@133
|
539 }
|
Chris@133
|
540
|
Chris@153
|
541 Layer::PropertyList
|
Chris@193
|
542 SliceLayer::getProperties() const
|
Chris@153
|
543 {
|
Chris@153
|
544 PropertyList list;
|
Chris@153
|
545 list.push_back("Colour");
|
Chris@193
|
546 list.push_back("Plot Type");
|
Chris@198
|
547 // list.push_back("Sampling Mode");
|
Chris@153
|
548 list.push_back("Scale");
|
Chris@153
|
549 list.push_back("Normalize");
|
Chris@153
|
550 list.push_back("Gain");
|
Chris@193
|
551 list.push_back("Bin Scale");
|
Chris@153
|
552
|
Chris@153
|
553 return list;
|
Chris@153
|
554 }
|
Chris@153
|
555
|
Chris@153
|
556 QString
|
Chris@193
|
557 SliceLayer::getPropertyLabel(const PropertyName &name) const
|
Chris@153
|
558 {
|
Chris@153
|
559 if (name == "Colour") return tr("Colour");
|
Chris@193
|
560 if (name == "Plot Type") return tr("Plot Type");
|
Chris@153
|
561 if (name == "Energy Scale") return tr("Scale");
|
Chris@153
|
562 if (name == "Normalize") return tr("Normalize");
|
Chris@153
|
563 if (name == "Gain") return tr("Gain");
|
Chris@193
|
564 if (name == "Sampling Mode") return tr("Sampling Mode");
|
Chris@193
|
565 if (name == "Bin Scale") return tr("Plot X Scale");
|
Chris@153
|
566 return "";
|
Chris@153
|
567 }
|
Chris@153
|
568
|
Chris@153
|
569 Layer::PropertyType
|
Chris@193
|
570 SliceLayer::getPropertyType(const PropertyName &name) const
|
Chris@153
|
571 {
|
Chris@153
|
572 if (name == "Gain") return RangeProperty;
|
Chris@153
|
573 if (name == "Normalize") return ToggleProperty;
|
Chris@153
|
574 return ValueProperty;
|
Chris@153
|
575 }
|
Chris@153
|
576
|
Chris@153
|
577 QString
|
Chris@193
|
578 SliceLayer::getPropertyGroupName(const PropertyName &name) const
|
Chris@153
|
579 {
|
Chris@153
|
580 if (name == "Scale" ||
|
Chris@153
|
581 name == "Normalize" ||
|
Chris@193
|
582 name == "Sampling Mode" ||
|
Chris@193
|
583 name == "Gain") return tr("Scale");
|
Chris@193
|
584 if (name == "Plot Type" ||
|
Chris@193
|
585 name == "Bin Scale") return tr("Plot Type");
|
Chris@153
|
586 return QString();
|
Chris@153
|
587 }
|
Chris@153
|
588
|
Chris@153
|
589 int
|
Chris@193
|
590 SliceLayer::getPropertyRangeAndValue(const PropertyName &name,
|
Chris@216
|
591 int *min, int *max, int *deflt) const
|
Chris@153
|
592 {
|
Chris@216
|
593 int val = 0;
|
Chris@153
|
594
|
Chris@216
|
595 int garbage0, garbage1, garbage2;
|
Chris@153
|
596 if (!min) min = &garbage0;
|
Chris@153
|
597 if (!max) max = &garbage1;
|
Chris@248
|
598 if (!deflt) deflt = &garbage2;
|
Chris@153
|
599
|
Chris@153
|
600 if (name == "Gain") {
|
Chris@153
|
601
|
Chris@153
|
602 *min = -50;
|
Chris@153
|
603 *max = 50;
|
Chris@216
|
604 *deflt = 0;
|
Chris@153
|
605
|
Chris@193
|
606 std::cerr << "gain is " << m_gain << ", mode is " << m_samplingMode << std::endl;
|
Chris@193
|
607
|
Chris@216
|
608 val = lrint(log10(m_gain) * 20.0);
|
Chris@216
|
609 if (val < *min) val = *min;
|
Chris@216
|
610 if (val > *max) val = *max;
|
Chris@153
|
611
|
Chris@153
|
612 } else if (name == "Normalize") {
|
Chris@153
|
613
|
Chris@216
|
614 val = (m_normalize ? 1 : 0);
|
Chris@216
|
615 *deflt = 0;
|
Chris@153
|
616
|
Chris@153
|
617 } else if (name == "Colour") {
|
Chris@153
|
618
|
Chris@197
|
619 if (m_plotStyle == PlotFilledBlocks) {
|
Chris@197
|
620
|
Chris@197
|
621 *min = 0;
|
Chris@197
|
622 *max = ColourMapper::getColourMapCount() - 1;
|
Chris@216
|
623 *deflt = 0;
|
Chris@153
|
624
|
Chris@216
|
625 val = m_colourMap;
|
Chris@197
|
626
|
Chris@197
|
627 } else {
|
Chris@197
|
628
|
Chris@197
|
629 *min = 0;
|
Chris@197
|
630 *max = 5;
|
Chris@216
|
631 *deflt = 0;
|
Chris@197
|
632
|
Chris@216
|
633 if (m_colour == Qt::black) val = 0;
|
Chris@216
|
634 else if (m_colour == Qt::darkRed) val = 1;
|
Chris@216
|
635 else if (m_colour == Qt::darkBlue) val = 2;
|
Chris@216
|
636 else if (m_colour == Qt::darkGreen) val = 3;
|
Chris@216
|
637 else if (m_colour == QColor(200, 50, 255)) val = 4;
|
Chris@216
|
638 else if (m_colour == QColor(255, 150, 50)) val = 5;
|
Chris@197
|
639 }
|
Chris@153
|
640
|
Chris@153
|
641 } else if (name == "Scale") {
|
Chris@153
|
642
|
Chris@153
|
643 *min = 0;
|
Chris@153
|
644 *max = 2;
|
Chris@216
|
645 *deflt = (int)dBScale;
|
Chris@153
|
646
|
Chris@216
|
647 val = (int)m_energyScale;
|
Chris@153
|
648
|
Chris@193
|
649 } else if (name == "Sampling Mode") {
|
Chris@153
|
650
|
Chris@153
|
651 *min = 0;
|
Chris@193
|
652 *max = 2;
|
Chris@216
|
653 *deflt = (int)SampleMean;
|
Chris@193
|
654
|
Chris@216
|
655 val = (int)m_samplingMode;
|
Chris@153
|
656
|
Chris@193
|
657 } else if (name == "Plot Type") {
|
Chris@193
|
658
|
Chris@193
|
659 *min = 0;
|
Chris@197
|
660 *max = 3;
|
Chris@216
|
661 *deflt = (int)PlotSteps;
|
Chris@193
|
662
|
Chris@216
|
663 val = (int)m_plotStyle;
|
Chris@193
|
664
|
Chris@193
|
665 } else if (name == "Bin Scale") {
|
Chris@193
|
666
|
Chris@193
|
667 *min = 0;
|
Chris@198
|
668 *max = 2;
|
Chris@216
|
669 *deflt = (int)LinearBins;
|
Chris@198
|
670 // *max = 1; // I don't think we really do want to offer inverted log
|
Chris@193
|
671
|
Chris@216
|
672 val = (int)m_binScale;
|
Chris@193
|
673
|
Chris@153
|
674 } else {
|
Chris@216
|
675 val = Layer::getPropertyRangeAndValue(name, min, max, deflt);
|
Chris@153
|
676 }
|
Chris@153
|
677
|
Chris@216
|
678 return val;
|
Chris@153
|
679 }
|
Chris@153
|
680
|
Chris@153
|
681 QString
|
Chris@193
|
682 SliceLayer::getPropertyValueLabel(const PropertyName &name,
|
Chris@153
|
683 int value) const
|
Chris@153
|
684 {
|
Chris@153
|
685 if (name == "Colour") {
|
Chris@197
|
686 if (m_plotStyle == PlotFilledBlocks) {
|
Chris@197
|
687 return ColourMapper::getColourMapName(value);
|
Chris@197
|
688 } else {
|
Chris@197
|
689 switch (value) {
|
Chris@197
|
690 default:
|
Chris@197
|
691 case 0: return tr("Black");
|
Chris@197
|
692 case 1: return tr("Red");
|
Chris@197
|
693 case 2: return tr("Blue");
|
Chris@197
|
694 case 3: return tr("Green");
|
Chris@197
|
695 case 4: return tr("Purple");
|
Chris@197
|
696 case 5: return tr("Orange");
|
Chris@197
|
697 }
|
Chris@153
|
698 }
|
Chris@153
|
699 }
|
Chris@153
|
700 if (name == "Scale") {
|
Chris@153
|
701 switch (value) {
|
Chris@153
|
702 default:
|
Chris@153
|
703 case 0: return tr("Linear");
|
Chris@153
|
704 case 1: return tr("Meter");
|
Chris@153
|
705 case 2: return tr("dB");
|
Chris@153
|
706 }
|
Chris@153
|
707 }
|
Chris@193
|
708 if (name == "Sampling Mode") {
|
Chris@153
|
709 switch (value) {
|
Chris@153
|
710 default:
|
Chris@193
|
711 case 0: return tr("Any");
|
Chris@193
|
712 case 1: return tr("Mean");
|
Chris@193
|
713 case 2: return tr("Peak");
|
Chris@193
|
714 }
|
Chris@193
|
715 }
|
Chris@193
|
716 if (name == "Plot Type") {
|
Chris@193
|
717 switch (value) {
|
Chris@193
|
718 default:
|
Chris@193
|
719 case 0: return tr("Lines");
|
Chris@193
|
720 case 1: return tr("Steps");
|
Chris@193
|
721 case 2: return tr("Blocks");
|
Chris@197
|
722 case 3: return tr("Colours");
|
Chris@193
|
723 }
|
Chris@193
|
724 }
|
Chris@193
|
725 if (name == "Bin Scale") {
|
Chris@193
|
726 switch (value) {
|
Chris@193
|
727 default:
|
Chris@198
|
728 case 0: return tr("Linear Bins");
|
Chris@198
|
729 case 1: return tr("Log Bins");
|
Chris@198
|
730 case 2: return tr("Rev Log Bins");
|
Chris@153
|
731 }
|
Chris@153
|
732 }
|
Chris@153
|
733 return tr("<unknown>");
|
Chris@153
|
734 }
|
Chris@153
|
735
|
Chris@167
|
736 RangeMapper *
|
Chris@193
|
737 SliceLayer::getNewPropertyRangeMapper(const PropertyName &name) const
|
Chris@167
|
738 {
|
Chris@167
|
739 if (name == "Gain") {
|
Chris@167
|
740 return new LinearRangeMapper(-50, 50, -25, 25, tr("dB"));
|
Chris@167
|
741 }
|
Chris@167
|
742 return 0;
|
Chris@167
|
743 }
|
Chris@167
|
744
|
Chris@133
|
745 void
|
Chris@193
|
746 SliceLayer::setProperty(const PropertyName &name, int value)
|
Chris@133
|
747 {
|
Chris@153
|
748 if (name == "Gain") {
|
Chris@153
|
749 setGain(pow(10, float(value)/20.0));
|
Chris@153
|
750 } else if (name == "Colour") {
|
Chris@197
|
751 if (m_plotStyle == PlotFilledBlocks) {
|
Chris@197
|
752 setFillColourMap(value);
|
Chris@197
|
753 } else {
|
Chris@197
|
754 switch (value) {
|
Chris@197
|
755 default:
|
Chris@197
|
756 case 0: setBaseColour(Qt::black); break;
|
Chris@197
|
757 case 1: setBaseColour(Qt::darkRed); break;
|
Chris@197
|
758 case 2: setBaseColour(Qt::darkBlue); break;
|
Chris@197
|
759 case 3: setBaseColour(Qt::darkGreen); break;
|
Chris@197
|
760 case 4: setBaseColour(QColor(200, 50, 255)); break;
|
Chris@197
|
761 case 5: setBaseColour(QColor(255, 150, 50)); break;
|
Chris@197
|
762 }
|
Chris@153
|
763 }
|
Chris@153
|
764 } else if (name == "Scale") {
|
Chris@153
|
765 switch (value) {
|
Chris@153
|
766 default:
|
Chris@153
|
767 case 0: setEnergyScale(LinearScale); break;
|
Chris@153
|
768 case 1: setEnergyScale(MeterScale); break;
|
Chris@153
|
769 case 2: setEnergyScale(dBScale); break;
|
Chris@153
|
770 }
|
Chris@193
|
771 } else if (name == "Plot Type") {
|
Chris@193
|
772 setPlotStyle(PlotStyle(value));
|
Chris@193
|
773 } else if (name == "Sampling Mode") {
|
Chris@193
|
774 switch (value) {
|
Chris@193
|
775 default:
|
Chris@193
|
776 case 0: setSamplingMode(NearestSample); break;
|
Chris@193
|
777 case 1: setSamplingMode(SampleMean); break;
|
Chris@193
|
778 case 2: setSamplingMode(SamplePeak); break;
|
Chris@193
|
779 }
|
Chris@193
|
780 } else if (name == "Bin Scale") {
|
Chris@193
|
781 switch (value) {
|
Chris@193
|
782 default:
|
Chris@193
|
783 case 0: setBinScale(LinearBins); break;
|
Chris@193
|
784 case 1: setBinScale(LogBins); break;
|
Chris@193
|
785 case 2: setBinScale(InvertedLogBins); break;
|
Chris@193
|
786 }
|
Chris@153
|
787 } else if (name == "Normalize") {
|
Chris@153
|
788 setNormalize(value ? true : false);
|
Chris@153
|
789 }
|
Chris@153
|
790 }
|
Chris@153
|
791
|
Chris@153
|
792 void
|
Chris@193
|
793 SliceLayer::setBaseColour(QColor colour)
|
Chris@153
|
794 {
|
Chris@153
|
795 if (m_colour == colour) return;
|
Chris@153
|
796 m_colour = colour;
|
Chris@153
|
797 emit layerParametersChanged();
|
Chris@153
|
798 }
|
Chris@153
|
799
|
Chris@153
|
800 void
|
Chris@197
|
801 SliceLayer::setFillColourMap(int map)
|
Chris@197
|
802 {
|
Chris@197
|
803 if (m_colourMap == map) return;
|
Chris@197
|
804 m_colourMap = map;
|
Chris@197
|
805 emit layerParametersChanged();
|
Chris@197
|
806 }
|
Chris@197
|
807
|
Chris@197
|
808 void
|
Chris@193
|
809 SliceLayer::setEnergyScale(EnergyScale scale)
|
Chris@153
|
810 {
|
Chris@153
|
811 if (m_energyScale == scale) return;
|
Chris@153
|
812 m_energyScale = scale;
|
Chris@153
|
813 emit layerParametersChanged();
|
Chris@153
|
814 }
|
Chris@153
|
815
|
Chris@153
|
816 void
|
Chris@193
|
817 SliceLayer::setSamplingMode(SamplingMode mode)
|
Chris@153
|
818 {
|
Chris@193
|
819 if (m_samplingMode == mode) return;
|
Chris@193
|
820 m_samplingMode = mode;
|
Chris@153
|
821 emit layerParametersChanged();
|
Chris@153
|
822 }
|
Chris@153
|
823
|
Chris@153
|
824 void
|
Chris@193
|
825 SliceLayer::setPlotStyle(PlotStyle style)
|
Chris@153
|
826 {
|
Chris@193
|
827 if (m_plotStyle == style) return;
|
Chris@197
|
828 bool colourTypeChanged = (style == PlotFilledBlocks ||
|
Chris@197
|
829 m_plotStyle == PlotFilledBlocks);
|
Chris@193
|
830 m_plotStyle = style;
|
Chris@197
|
831 if (colourTypeChanged) {
|
Chris@197
|
832 emit layerParameterRangesChanged();
|
Chris@197
|
833 }
|
Chris@153
|
834 emit layerParametersChanged();
|
Chris@153
|
835 }
|
Chris@153
|
836
|
Chris@153
|
837 void
|
Chris@193
|
838 SliceLayer::setBinScale(BinScale scale)
|
Chris@153
|
839 {
|
Chris@193
|
840 if (m_binScale == scale) return;
|
Chris@193
|
841 m_binScale = scale;
|
Chris@153
|
842 emit layerParametersChanged();
|
Chris@153
|
843 }
|
Chris@153
|
844
|
Chris@153
|
845 void
|
Chris@193
|
846 SliceLayer::setNormalize(bool n)
|
Chris@153
|
847 {
|
Chris@153
|
848 if (m_normalize == n) return;
|
Chris@153
|
849 m_normalize = n;
|
Chris@153
|
850 emit layerParametersChanged();
|
Chris@153
|
851 }
|
Chris@153
|
852
|
Chris@153
|
853 void
|
Chris@193
|
854 SliceLayer::setGain(float gain)
|
Chris@153
|
855 {
|
Chris@153
|
856 if (m_gain == gain) return;
|
Chris@153
|
857 m_gain = gain;
|
Chris@153
|
858 emit layerParametersChanged();
|
Chris@153
|
859 }
|
Chris@153
|
860
|
Chris@153
|
861 QString
|
Chris@193
|
862 SliceLayer::toXmlString(QString indent, QString extraAttributes) const
|
Chris@153
|
863 {
|
Chris@153
|
864 QString s;
|
Chris@153
|
865
|
Chris@153
|
866 s += QString("colour=\"%1\" "
|
Chris@197
|
867 "colourScheme=\"%2\" "
|
Chris@197
|
868 "energyScale=\"%3\" "
|
Chris@197
|
869 "samplingMode=\"%4\" "
|
Chris@197
|
870 "gain=\"%5\" "
|
Chris@197
|
871 "normalize=\"%6\"")
|
Chris@153
|
872 .arg(encodeColour(m_colour))
|
Chris@197
|
873 .arg(m_colourMap)
|
Chris@153
|
874 .arg(m_energyScale)
|
Chris@193
|
875 .arg(m_samplingMode)
|
Chris@153
|
876 .arg(m_gain)
|
Chris@153
|
877 .arg(m_normalize ? "true" : "false");
|
Chris@153
|
878
|
Chris@153
|
879 return Layer::toXmlString(indent, extraAttributes + " " + s);
|
Chris@153
|
880 }
|
Chris@153
|
881
|
Chris@153
|
882 void
|
Chris@193
|
883 SliceLayer::setProperties(const QXmlAttributes &attributes)
|
Chris@153
|
884 {
|
Chris@153
|
885 bool ok = false;
|
Chris@153
|
886
|
Chris@153
|
887 QString colourSpec = attributes.value("colour");
|
Chris@153
|
888 if (colourSpec != "") {
|
Chris@153
|
889 QColor colour(colourSpec);
|
Chris@153
|
890 if (colour.isValid()) {
|
Chris@153
|
891 setBaseColour(QColor(colourSpec));
|
Chris@153
|
892 }
|
Chris@153
|
893 }
|
Chris@153
|
894
|
Chris@153
|
895 EnergyScale scale = (EnergyScale)
|
Chris@153
|
896 attributes.value("energyScale").toInt(&ok);
|
Chris@153
|
897 if (ok) setEnergyScale(scale);
|
Chris@153
|
898
|
Chris@193
|
899 SamplingMode mode = (SamplingMode)
|
Chris@193
|
900 attributes.value("samplingMode").toInt(&ok);
|
Chris@193
|
901 if (ok) setSamplingMode(mode);
|
Chris@153
|
902
|
Chris@197
|
903 int colourMap = attributes.value("colourScheme").toInt(&ok);
|
Chris@197
|
904 if (ok) setFillColourMap(colourMap);
|
Chris@197
|
905
|
Chris@153
|
906 float gain = attributes.value("gain").toFloat(&ok);
|
Chris@153
|
907 if (ok) setGain(gain);
|
Chris@153
|
908
|
Chris@153
|
909 bool normalize = (attributes.value("normalize").trimmed() == "true");
|
Chris@153
|
910 setNormalize(normalize);
|
Chris@133
|
911 }
|
Chris@133
|
912
|
Chris@133
|
913 bool
|
Chris@248
|
914 SliceLayer::getValueExtents(float &, float &, bool &, QString &) const
|
Chris@133
|
915 {
|
Chris@133
|
916 return false;
|
Chris@133
|
917 }
|
Chris@133
|
918
|