Mercurial > hg > svgui
comparison layer/SpectrogramLayer.cpp @ 906:12ab113ca2b1 cxx11
A few more fixes
author | Chris Cannam |
---|---|
date | Mon, 09 Mar 2015 15:59:04 +0000 |
parents | b66fb15de477 |
children | 28d05ae8741c |
comparison
equal
deleted
inserted
replaced
905:b66fb15de477 | 906:12ab113ca2b1 |
---|---|
139 if (!m_model || !m_model->isOK()) return; | 139 if (!m_model || !m_model->isOK()) return; |
140 | 140 |
141 connectSignals(m_model); | 141 connectSignals(m_model); |
142 | 142 |
143 connect(m_model, SIGNAL(modelChanged()), this, SLOT(cacheInvalid())); | 143 connect(m_model, SIGNAL(modelChanged()), this, SLOT(cacheInvalid())); |
144 connect(m_model, SIGNAL(modelChangedWithin(int, int)), | 144 connect(m_model, SIGNAL(modelChangedWithin(sv_frame_t, sv_frame_t)), |
145 this, SLOT(cacheInvalid(int, int))); | 145 this, SLOT(cacheInvalid(sv_frame_t, sv_frame_t))); |
146 | 146 |
147 emit modelReplaced(); | 147 emit modelReplaced(); |
148 } | 148 } |
149 | 149 |
150 Layer::PropertyList | 150 Layer::PropertyList |
240 if (name == "Gain") { | 240 if (name == "Gain") { |
241 | 241 |
242 *min = -50; | 242 *min = -50; |
243 *max = 50; | 243 *max = 50; |
244 | 244 |
245 *deflt = lrintf(log10(m_initialGain) * 20.0);; | 245 *deflt = int(lrint(log10(m_initialGain) * 20.0)); |
246 if (*deflt < *min) *deflt = *min; | 246 if (*deflt < *min) *deflt = *min; |
247 if (*deflt > *max) *deflt = *max; | 247 if (*deflt > *max) *deflt = *max; |
248 | 248 |
249 val = lrintf(log10(m_gain) * 20.0); | 249 val = int(lrint(log10(m_gain) * 20.0)); |
250 if (val < *min) val = *min; | 250 if (val < *min) val = *min; |
251 if (val > *max) val = *max; | 251 if (val > *max) val = *max; |
252 | 252 |
253 } else if (name == "Threshold") { | 253 } else if (name == "Threshold") { |
254 | 254 |
255 *min = -50; | 255 *min = -50; |
256 *max = 0; | 256 *max = 0; |
257 | 257 |
258 *deflt = lrintf(AudioLevel::multiplier_to_dB(m_initialThreshold)); | 258 *deflt = int(lrint(AudioLevel::multiplier_to_dB(m_initialThreshold))); |
259 if (*deflt < *min) *deflt = *min; | 259 if (*deflt < *min) *deflt = *min; |
260 if (*deflt > *max) *deflt = *max; | 260 if (*deflt > *max) *deflt = *max; |
261 | 261 |
262 val = lrintf(AudioLevel::multiplier_to_dB(m_threshold)); | 262 val = int(lrint(AudioLevel::multiplier_to_dB(m_threshold))); |
263 if (val < *min) val = *min; | 263 if (val < *min) val = *min; |
264 if (val > *max) val = *max; | 264 if (val > *max) val = *max; |
265 | 265 |
266 } else if (name == "Colour Rotation") { | 266 } else if (name == "Colour Rotation") { |
267 | 267 |
479 | 479 |
480 void | 480 void |
481 SpectrogramLayer::setProperty(const PropertyName &name, int value) | 481 SpectrogramLayer::setProperty(const PropertyName &name, int value) |
482 { | 482 { |
483 if (name == "Gain") { | 483 if (name == "Gain") { |
484 setGain(pow(10, float(value)/20.0)); | 484 setGain(float(pow(10, float(value)/20.0))); |
485 } else if (name == "Threshold") { | 485 } else if (name == "Threshold") { |
486 if (value == -50) setThreshold(0.0); | 486 if (value == -50) setThreshold(0.0); |
487 else setThreshold(AudioLevel::dB_to_multiplier(value)); | 487 else setThreshold(float(AudioLevel::dB_to_multiplier(value))); |
488 } else if (name == "Colour Rotation") { | 488 } else if (name == "Colour Rotation") { |
489 setColourRotation(value); | 489 setColourRotation(value); |
490 } else if (name == "Colour") { | 490 } else if (name == "Colour") { |
491 setColourMap(value); | 491 setColourMap(value); |
492 } else if (name == "Window Size") { | 492 } else if (name == "Window Size") { |
570 i->second.validArea = QRect(); | 570 i->second.validArea = QRect(); |
571 } | 571 } |
572 } | 572 } |
573 | 573 |
574 void | 574 void |
575 SpectrogramLayer::invalidateImageCaches(int startFrame, int endFrame) | 575 SpectrogramLayer::invalidateImageCaches(sv_frame_t startFrame, sv_frame_t endFrame) |
576 { | 576 { |
577 for (ViewImageCache::iterator i = m_imageCaches.begin(); | 577 for (ViewImageCache::iterator i = m_imageCaches.begin(); |
578 i != m_imageCaches.end(); ++i) { | 578 i != m_imageCaches.end(); ++i) { |
579 | 579 |
580 //!!! when are views removed from the map? on setLayerDormant? | 580 //!!! when are views removed from the map? on setLayerDormant? |
1047 invalidateImageCaches(); | 1047 invalidateImageCaches(); |
1048 invalidateMagnitudes(); | 1048 invalidateMagnitudes(); |
1049 } | 1049 } |
1050 | 1050 |
1051 void | 1051 void |
1052 SpectrogramLayer::cacheInvalid(int from, int to) | 1052 SpectrogramLayer::cacheInvalid(sv_frame_t from, sv_frame_t to) |
1053 { | 1053 { |
1054 #ifdef DEBUG_SPECTROGRAM_REPAINT | 1054 #ifdef DEBUG_SPECTROGRAM_REPAINT |
1055 SVDEBUG << "SpectrogramLayer::cacheInvalid(" << from << ", " << to << ")" << endl; | 1055 SVDEBUG << "SpectrogramLayer::cacheInvalid(" << from << ", " << to << ")" << endl; |
1056 #endif | 1056 #endif |
1057 | 1057 |
1072 | 1072 |
1073 for (ViewFFTMap::iterator i = m_fftModels.begin(); | 1073 for (ViewFFTMap::iterator i = m_fftModels.begin(); |
1074 i != m_fftModels.end(); ++i) { | 1074 i != m_fftModels.end(); ++i) { |
1075 | 1075 |
1076 const FFTModel *model = i->second.first; | 1076 const FFTModel *model = i->second.first; |
1077 int lastFill = i->second.second; | 1077 sv_frame_t lastFill = i->second.second; |
1078 | 1078 |
1079 if (model) { | 1079 if (model) { |
1080 | 1080 |
1081 int fill = model->getFillExtent(); | 1081 sv_frame_t fill = model->getFillExtent(); |
1082 | 1082 |
1083 #ifdef DEBUG_SPECTROGRAM_REPAINT | 1083 #ifdef DEBUG_SPECTROGRAM_REPAINT |
1084 SVDEBUG << "SpectrogramLayer::fillTimerTimedOut: extent for " << model << ": " << fill << ", last " << lastFill << ", total " << m_model->getEndFrame() << endl; | 1084 SVDEBUG << "SpectrogramLayer::fillTimerTimedOut: extent for " << model << ": " << fill << ", last " << lastFill << ", total " << m_model->getEndFrame() << endl; |
1085 #endif | 1085 #endif |
1086 | 1086 |