Mercurial > hg > tony
comparison src/Analyser.cpp @ 164:62ceae757fe0
Re-analyse frames when selection changes (this only pulls up a set of new candidates for now, can't do anything with them and the old ones are never removed)
author | Chris Cannam |
---|---|
date | Thu, 30 Jan 2014 17:33:55 +0000 |
parents | ec196bd2f068 |
children | ebcfb8dce020 |
comparison
equal
deleted
inserted
replaced
163:ec196bd2f068 | 164:62ceae757fe0 |
---|---|
86 if (error != "") return error; | 86 if (error != "") return error; |
87 | 87 |
88 error = addAnalyses(); | 88 error = addAnalyses(); |
89 if (error != "") return error; | 89 if (error != "") return error; |
90 | 90 |
91 error = addTestCandidates(); | |
92 if (error != "") return error; | |
93 | |
94 loadState(Audio); | 91 loadState(Audio); |
95 loadState(PitchTrack); | 92 loadState(PitchTrack); |
96 loadState(Notes); | 93 loadState(Notes); |
97 loadState(Spectrogram); | 94 loadState(Spectrogram); |
98 | 95 |
99 emit layersChanged(); | 96 emit layersChanged(); |
100 | 97 |
101 return warning; | 98 return warning; |
99 } | |
100 | |
101 QString | |
102 Analyser::reAnalyseSelection(Selection sel) | |
103 { | |
104 return addTestCandidates(sel); | |
102 } | 105 } |
103 | 106 |
104 QString | 107 QString |
105 Analyser::addVisualisations() | 108 Analyser::addVisualisations() |
106 { | 109 { |
242 | 245 |
243 return ""; | 246 return ""; |
244 } | 247 } |
245 | 248 |
246 QString | 249 QString |
247 Analyser::addTestCandidates() | 250 Analyser::addTestCandidates(Selection sel) |
248 { | 251 { |
249 TransformFactory *tf = TransformFactory::getInstance(); | 252 TransformFactory *tf = TransformFactory::getInstance(); |
250 | 253 |
251 QString plugname = "pYIN"; | 254 QString plugname = "pYIN"; |
252 QString base = "vamp:pyin:localcandidatepyin:"; | 255 QString base = "vamp:pyin:localcandidatepyin:"; |
262 Transform t = tf->getDefaultTransformFor | 265 Transform t = tf->getDefaultTransformFor |
263 (base + out, m_fileModel->getSampleRate()); | 266 (base + out, m_fileModel->getSampleRate()); |
264 t.setStepSize(256); | 267 t.setStepSize(256); |
265 t.setBlockSize(2048); | 268 t.setBlockSize(2048); |
266 | 269 |
267 t.setStartTime(RealTime::fromSeconds(10.785)); | 270 RealTime start = RealTime::frame2RealTime |
268 t.setDuration(RealTime::fromSeconds(1.2)); | 271 (sel.getStartFrame(), m_fileModel->getSampleRate()); |
272 | |
273 RealTime end = RealTime::frame2RealTime | |
274 (sel.getEndFrame(), m_fileModel->getSampleRate()); | |
275 | |
276 RealTime duration; | |
277 | |
278 if (sel.getEndFrame() > sel.getStartFrame()) { | |
279 duration = end - start; | |
280 } | |
281 | |
282 t.setStartTime(start); | |
283 t.setDuration(duration); | |
269 | 284 |
270 transforms.push_back(t); | 285 transforms.push_back(t); |
271 | 286 |
272 m_document->createDerivedLayersAsync(transforms, m_fileModel, this); | 287 m_document->createDerivedLayersAsync(transforms, m_fileModel, this); |
273 | 288 |