Mercurial > hg > tony
comparison src/Analyser.cpp @ 194:34797795a76c
Clearing the selection by hitting Esc now restores the selected region of the pitch track to its contents from before the selection was made (and any alternate candidate chosen). Fixes feature #885
author | Chris Cannam |
---|---|
date | Wed, 05 Mar 2014 10:38:23 +0000 |
parents | 431a95c9d14d |
children | 73fafd70996e |
comparison
equal
deleted
inserted
replaced
193:abfbe8c2883b | 194:34797795a76c |
---|---|
253 QString | 253 QString |
254 Analyser::reAnalyseSelection(Selection sel, FrequencyRange range) | 254 Analyser::reAnalyseSelection(Selection sel, FrequencyRange range) |
255 { | 255 { |
256 if (sel == m_reAnalysingSelection) return ""; | 256 if (sel == m_reAnalysingSelection) return ""; |
257 | 257 |
258 clearReAnalysis(); | 258 showPitchCandidates(false); |
259 | 259 m_reAnalysisCandidates.clear(); |
260 m_currentCandidate = -1; | |
260 m_reAnalysingSelection = sel; | 261 m_reAnalysingSelection = sel; |
262 | |
263 m_preAnalysis = Clipboard(); | |
264 Layer *myLayer = m_layers[PitchTrack]; | |
265 if (myLayer) { | |
266 myLayer->copy(m_pane, sel, m_preAnalysis); | |
267 } | |
261 | 268 |
262 TransformFactory *tf = TransformFactory::getInstance(); | 269 TransformFactory *tf = TransformFactory::getInstance(); |
263 | 270 |
264 QString plugname = "pYIN"; | 271 QString plugname = "pYIN"; |
265 QString base = "vamp:pyin:localcandidatepyin:"; | 272 QString base = "vamp:pyin:localcandidatepyin:"; |
439 | 446 |
440 pitchTrack->deleteSelection(sel); | 447 pitchTrack->deleteSelection(sel); |
441 } | 448 } |
442 | 449 |
443 void | 450 void |
444 Analyser::clearReAnalysis() | 451 Analyser::clearReAnalysis(Selection sel) |
445 { | 452 { |
446 foreach (Layer *layer, m_reAnalysisCandidates) { | 453 showPitchCandidates(false); |
447 m_document->removeLayerFromView(m_pane, layer); | 454 |
448 m_document->deleteLayer(layer); // also releases its model | |
449 } | |
450 m_reAnalysisCandidates.clear(); | 455 m_reAnalysisCandidates.clear(); |
451 m_reAnalysingSelection = Selection(); | 456 m_reAnalysingSelection = Selection(); |
452 m_currentCandidate = -1; | 457 m_currentCandidate = -1; |
458 | |
459 Layer *myLayer = m_layers[PitchTrack]; | |
460 if (!myLayer) return; | |
461 myLayer->deleteSelection(sel); | |
462 myLayer->paste(m_pane, m_preAnalysis, 0, false); | |
453 } | 463 } |
454 | 464 |
455 void | 465 void |
456 Analyser::takePitchTrackFrom(Layer *otherLayer) | 466 Analyser::takePitchTrackFrom(Layer *otherLayer) |
457 { | 467 { |