comparison src/Analyser.cpp @ 314:2a2fd6eb8fa8

If user asks to save before initial analysis is complete, wait for it
author Chris Cannam
date Fri, 13 Jun 2014 12:12:27 +0100
parents 29005aa146e2
children ef75afbe4c67
comparison
equal deleted inserted replaced
313:eef5c50e7e34 314:2a2fd6eb8fa8
136 if (!m_layers[Spectrogram]) return false; 136 if (!m_layers[Spectrogram]) return false;
137 m_layers[Spectrogram]->setDisplayExtents(min, max); 137 m_layers[Spectrogram]->setDisplayExtents(min, max);
138 return true; 138 return true;
139 } 139 }
140 140
141 int
142 Analyser::getInitialAnalysisCompletion()
143 {
144 int completion = 0;
145
146 if (m_layers[PitchTrack]) {
147 completion = m_layers[PitchTrack]->getCompletion(m_pane);
148 }
149
150 if (m_layers[Notes]) {
151 int c = m_layers[Notes]->getCompletion(m_pane);
152 if (c < completion) completion = c;
153 }
154
155 return completion;
156 }
157
158 void
159 Analyser::layerCompletionChanged()
160 {
161 if (getInitialAnalysisCompletion() == 100) {
162 emit initialAnalysisCompleted();
163 }
164 }
165
141 QString 166 QString
142 Analyser::addVisualisations() 167 Analyser::addVisualisations()
143 { 168 {
144 // A spectrogram, off by default. Must go at the back because it's 169 // A spectrogram, off by default. Must go at the back because it's
145 // opaque 170 // opaque
316 if (pitchLayer) { 341 if (pitchLayer) {
317 pitchLayer->setBaseColour(cdb->getColourIndex(tr("Black"))); 342 pitchLayer->setBaseColour(cdb->getColourIndex(tr("Black")));
318 PlayParameters *params = pitchLayer->getPlayParameters(); 343 PlayParameters *params = pitchLayer->getPlayParameters();
319 if (params) params->setPlayPan(1); 344 if (params) params->setPlayPan(1);
320 } 345 }
346 connect(pitchLayer, SIGNAL(modelCompletionChanged()),
347 this, SLOT(layerCompletionChanged()));
321 348
322 FlexiNoteLayer *flexiNoteLayer = 349 FlexiNoteLayer *flexiNoteLayer =
323 qobject_cast<FlexiNoteLayer *>(m_layers[Notes]); 350 qobject_cast<FlexiNoteLayer *>(m_layers[Notes]);
324 if (flexiNoteLayer) { 351 if (flexiNoteLayer) {
325 flexiNoteLayer->setBaseColour(cdb->getColourIndex(tr("Bright Blue"))); 352 flexiNoteLayer->setBaseColour(cdb->getColourIndex(tr("Bright Blue")));
326 PlayParameters *params = flexiNoteLayer->getPlayParameters(); 353 PlayParameters *params = flexiNoteLayer->getPlayParameters();
327 if (params) params->setPlayPan(1); 354 if (params) params->setPlayPan(1);
328 } 355 }
356 connect(flexiNoteLayer, SIGNAL(modelCompletionChanged()),
357 this, SLOT(layerCompletionChanged()));
329 358
330 return ""; 359 return "";
331 } 360 }
332 361
333 QString 362 QString