Mercurial > hg > tony
comparison src/Analyser.cpp @ 402:a0eedd10dee3 cxx11-types
Merge from default branch
| author | Chris Cannam |
|---|---|
| date | Mon, 23 Mar 2015 10:33:32 +0000 |
| parents | ffd1a89a68fa 6f7133733032 |
| children | cc33cdb114f6 |
comparison
equal
deleted
inserted
replaced
| 400:4b9b7ff3f19c | 402:a0eedd10dee3 |
|---|---|
| 372 t.setParameter("precisetime", 0); | 372 t.setParameter("precisetime", 0); |
| 373 } | 373 } |
| 374 | 374 |
| 375 if (lowamp) { | 375 if (lowamp) { |
| 376 cerr << "setting parameters for lowamp suppression" << endl; | 376 cerr << "setting parameters for lowamp suppression" << endl; |
| 377 t.setParameter("lowampsuppression", 0.2f); | 377 t.setParameter("lowampsuppression", 0.1f); |
| 378 } else { | 378 } else { |
| 379 cerr << "setting parameters for no lowamp suppression" << endl; | 379 cerr << "setting parameters for no lowamp suppression" << endl; |
| 380 t.setParameter("lowampsuppression", 0.0f); | 380 t.setParameter("lowampsuppression", 0.0f); |
| 381 } | 381 } |
| 382 | 382 |
| 406 qobject_cast<TimeValueLayer *>(m_layers[PitchTrack]); | 406 qobject_cast<TimeValueLayer *>(m_layers[PitchTrack]); |
| 407 if (pitchLayer) { | 407 if (pitchLayer) { |
| 408 pitchLayer->setBaseColour(cdb->getColourIndex(tr("Black"))); | 408 pitchLayer->setBaseColour(cdb->getColourIndex(tr("Black"))); |
| 409 PlayParameters *params = pitchLayer->getPlayParameters(); | 409 PlayParameters *params = pitchLayer->getPlayParameters(); |
| 410 if (params) params->setPlayPan(1); | 410 if (params) params->setPlayPan(1); |
| 411 } | 411 connect(pitchLayer, SIGNAL(modelCompletionChanged()), |
| 412 connect(pitchLayer, SIGNAL(modelCompletionChanged()), | 412 this, SLOT(layerCompletionChanged())); |
| 413 this, SLOT(layerCompletionChanged())); | 413 } |
| 414 | 414 |
| 415 FlexiNoteLayer *flexiNoteLayer = | 415 FlexiNoteLayer *flexiNoteLayer = |
| 416 qobject_cast<FlexiNoteLayer *>(m_layers[Notes]); | 416 qobject_cast<FlexiNoteLayer *>(m_layers[Notes]); |
| 417 if (flexiNoteLayer) { | 417 if (flexiNoteLayer) { |
| 418 flexiNoteLayer->setBaseColour(cdb->getColourIndex(tr("Bright Blue"))); | 418 flexiNoteLayer->setBaseColour(cdb->getColourIndex(tr("Bright Blue"))); |
| 419 PlayParameters *params = flexiNoteLayer->getPlayParameters(); | 419 PlayParameters *params = flexiNoteLayer->getPlayParameters(); |
| 420 if (params) params->setPlayPan(1); | 420 if (params) params->setPlayPan(1); |
| 421 } | 421 connect(flexiNoteLayer, SIGNAL(modelCompletionChanged()), |
| 422 connect(flexiNoteLayer, SIGNAL(modelCompletionChanged()), | 422 this, SLOT(layerCompletionChanged())); |
| 423 this, SLOT(layerCompletionChanged())); | 423 connect(flexiNoteLayer, SIGNAL(reAnalyseRegion(int, int, float, float)), |
| 424 this, SLOT(reAnalyseRegion(int, int, float, float))); | |
| 425 connect(flexiNoteLayer, SIGNAL(materialiseReAnalysis()), | |
| 426 this, SLOT(materialiseReAnalysis())); | |
| 427 } | |
| 424 | 428 |
| 425 return ""; | 429 return ""; |
| 430 } | |
| 431 | |
| 432 void | |
| 433 Analyser::reAnalyseRegion(int frame0, int frame1, float freq0, float freq1) | |
| 434 { | |
| 435 cerr << "Analyser::reAnalyseRegion(" << frame0 << ", " << frame1 | |
| 436 << ", " << freq0 << ", " << freq1 << ")" << endl; | |
| 437 showPitchCandidates(true); | |
| 438 (void)reAnalyseSelection(Selection(frame0, frame1), | |
| 439 FrequencyRange(freq0, freq1)); | |
| 440 } | |
| 441 | |
| 442 void | |
| 443 Analyser::materialiseReAnalysis() | |
| 444 { | |
| 445 if (m_reAnalysingSelection.isEmpty()) return; | |
| 446 switchPitchCandidate(m_reAnalysingSelection, true); // or false, doesn't matter | |
| 426 } | 447 } |
| 427 | 448 |
| 428 QString | 449 QString |
| 429 Analyser::reAnalyseSelection(Selection sel, FrequencyRange range) | 450 Analyser::reAnalyseSelection(Selection sel, FrequencyRange range) |
| 430 { | 451 { |
| 431 QMutexLocker locker(&m_asyncMutex); | 452 QMutexLocker locker(&m_asyncMutex); |
| 432 | 453 |
| 433 if (sel == m_reAnalysingSelection || sel.isEmpty()) return ""; | 454 if (!m_reAnalysingSelection.isEmpty()) { |
| 455 if (sel == m_reAnalysingSelection && range == m_reAnalysingRange) { | |
| 456 cerr << "selection & range are same as current analysis, ignoring" << endl; | |
| 457 return ""; | |
| 458 } | |
| 459 } | |
| 460 | |
| 461 if (sel.isEmpty()) return ""; | |
| 434 | 462 |
| 435 if (m_currentAsyncHandle) { | 463 if (m_currentAsyncHandle) { |
| 436 m_document->cancelAsyncLayerCreation(m_currentAsyncHandle); | 464 m_document->cancelAsyncLayerCreation(m_currentAsyncHandle); |
| 437 } | 465 } |
| 438 | 466 |
| 442 discardPitchCandidates(); | 470 discardPitchCandidates(); |
| 443 CommandHistory::getInstance()->endCompoundOperation(); | 471 CommandHistory::getInstance()->endCompoundOperation(); |
| 444 } | 472 } |
| 445 | 473 |
| 446 m_reAnalysingSelection = sel; | 474 m_reAnalysingSelection = sel; |
| 475 m_reAnalysingRange = range; | |
| 447 | 476 |
| 448 m_preAnalysis = Clipboard(); | 477 m_preAnalysis = Clipboard(); |
| 449 Layer *myLayer = m_layers[PitchTrack]; | 478 Layer *myLayer = m_layers[PitchTrack]; |
| 450 if (myLayer) { | 479 if (myLayer) { |
| 451 myLayer->copy(m_pane, sel, m_preAnalysis); | 480 myLayer->copy(m_pane, sel, m_preAnalysis); |
