Mercurial > hg > svapp
comparison align/TransformAligner.cpp @ 753:31289e8592c7 pitch-align
Switch to using the pulled-out TransformAligner and ExternalProgramAligner
author | Chris Cannam |
---|---|
date | Fri, 24 Apr 2020 14:38:22 +0100 |
parents | 32654e402f8b |
children | 6429a164b7e1 |
comparison
equal
deleted
inserted
replaced
752:32654e402f8b | 753:31289e8592c7 |
---|---|
187 SVDEBUG << "TransformAligner: Tuning difference transform step size " << transform.getStepSize() << ", block size " << transform.getBlockSize() << endl; | 187 SVDEBUG << "TransformAligner: Tuning difference transform step size " << transform.getStepSize() << ", block size " << transform.getBlockSize() << endl; |
188 | 188 |
189 ModelTransformerFactory *mtf = ModelTransformerFactory::getInstance(); | 189 ModelTransformerFactory *mtf = ModelTransformerFactory::getInstance(); |
190 | 190 |
191 QString message; | 191 QString message; |
192 ModelId tuningDiffOutputModelId = mtf->transform(transform, | 192 m_tuningDiffOutputModel = mtf->transform(transform, |
193 m_aggregateModel, | 193 m_aggregateModel, |
194 message); | 194 message); |
195 | 195 |
196 auto tuningDiffOutputModel = | 196 auto tuningDiffOutputModel = |
197 ModelById::getAs<SparseTimeValueModel>(tuningDiffOutputModelId); | 197 ModelById::getAs<SparseTimeValueModel>(m_tuningDiffOutputModel); |
198 if (!tuningDiffOutputModel) { | 198 if (!tuningDiffOutputModel) { |
199 SVCERR << "Align::alignModel: ERROR: Failed to create tuning-difference output model (no Tuning Difference plugin?)" << endl; | 199 SVCERR << "Align::alignModel: ERROR: Failed to create tuning-difference output model (no Tuning Difference plugin?)" << endl; |
200 error = message; | 200 error = message; |
201 ModelById::release(alignmentModel); | 201 ModelById::release(alignmentModel); |
202 return false; | 202 return false; |
225 void | 225 void |
226 TransformAligner::tuningDifferenceCompletionChanged(ModelId tuningDiffOutputModelId) | 226 TransformAligner::tuningDifferenceCompletionChanged(ModelId tuningDiffOutputModelId) |
227 { | 227 { |
228 if (tuningDiffOutputModelId != m_tuningDiffOutputModel) { | 228 if (tuningDiffOutputModelId != m_tuningDiffOutputModel) { |
229 SVCERR << "WARNING: TransformAligner::tuningDifferenceCompletionChanged: Model " | 229 SVCERR << "WARNING: TransformAligner::tuningDifferenceCompletionChanged: Model " |
230 << tuningDiffOutputModelId | 230 << tuningDiffOutputModelId |
231 << " is not ours!" << endl; | 231 << " is not ours! (ours is " |
232 << m_tuningDiffOutputModel << ")" << endl; | |
232 return; | 233 return; |
233 } | 234 } |
234 | 235 |
235 auto tuningDiffOutputModel = | 236 auto tuningDiffOutputModel = |
236 ModelById::getAs<SparseTimeValueModel>(m_tuningDiffOutputModel); | 237 ModelById::getAs<SparseTimeValueModel>(m_tuningDiffOutputModel); |
287 bool | 288 bool |
288 TransformAligner::beginAlignmentPhase() | 289 TransformAligner::beginAlignmentPhase() |
289 { | 290 { |
290 TransformId id = getAlignmentTransformName(); | 291 TransformId id = getAlignmentTransformName(); |
291 | 292 |
293 SVDEBUG << "TransformAligner::beginAlignmentPhase: transform is " | |
294 << id << endl; | |
295 | |
292 TransformFactory *tf = TransformFactory::getInstance(); | 296 TransformFactory *tf = TransformFactory::getInstance(); |
293 | 297 |
294 auto aggregateModel = | 298 auto aggregateModel = |
295 ModelById::getAs<AggregateWaveModel>(m_aggregateModel); | 299 ModelById::getAs<AggregateWaveModel>(m_aggregateModel); |
296 auto alignmentModel = | 300 auto alignmentModel = |
325 << " and pitch " << pitch << " -> cents " << cents << endl; | 329 << " and pitch " << pitch << " -> cents " << cents << endl; |
326 } | 330 } |
327 | 331 |
328 alignmentModel->setRelativePitch(cents); | 332 alignmentModel->setRelativePitch(cents); |
329 | 333 |
330 SVDEBUG << "Align::alignModel: Alignment transform step size " | 334 SVDEBUG << "TransformAligner: Alignment transform step size " |
331 << transform.getStepSize() << ", block size " | 335 << transform.getStepSize() << ", block size " |
332 << transform.getBlockSize() << endl; | 336 << transform.getBlockSize() << endl; |
333 | 337 |
334 ModelTransformerFactory *mtf = ModelTransformerFactory::getInstance(); | 338 ModelTransformerFactory *mtf = ModelTransformerFactory::getInstance(); |
335 | 339 |
336 QString message; | 340 QString message; |
337 ModelId pathOutputModelId = mtf->transform | 341 m_pathOutputModel = mtf->transform |
338 (transform, m_aggregateModel, message); | 342 (transform, m_aggregateModel, message); |
339 | 343 |
340 if (pathOutputModelId.isNone()) { | 344 if (m_pathOutputModel.isNone()) { |
341 transform.setStepSize(0); | 345 transform.setStepSize(0); |
342 pathOutputModelId = mtf->transform | 346 m_pathOutputModel = mtf->transform |
343 (transform, m_aggregateModel, message); | 347 (transform, m_aggregateModel, message); |
344 } | 348 } |
345 | 349 |
346 auto pathOutputModel = | 350 auto pathOutputModel = |
347 ModelById::getAs<SparseTimeValueModel>(pathOutputModelId); | 351 ModelById::getAs<SparseTimeValueModel>(m_pathOutputModel); |
348 | 352 |
349 //!!! callers will need to be updated to get error from | 353 //!!! callers will need to be updated to get error from |
350 //!!! alignment model after initial call | 354 //!!! alignment model after initial call |
351 | 355 |
352 if (!pathOutputModel) { | 356 if (!pathOutputModel) { |
367 void | 371 void |
368 TransformAligner::alignmentCompletionChanged(ModelId alignmentModelId) | 372 TransformAligner::alignmentCompletionChanged(ModelId alignmentModelId) |
369 { | 373 { |
370 if (alignmentModelId != m_alignmentModel) { | 374 if (alignmentModelId != m_alignmentModel) { |
371 SVCERR << "WARNING: TransformAligner::alignmentCompletionChanged: Model " | 375 SVCERR << "WARNING: TransformAligner::alignmentCompletionChanged: Model " |
372 << alignmentModelId | 376 << alignmentModelId |
373 << " is not ours!" << endl; | 377 << " is not ours! (ours is " |
378 << m_alignmentModel << ")" << endl; | |
374 return; | 379 return; |
375 } | 380 } |
376 | 381 |
377 auto alignmentModel = ModelById::getAs<AlignmentModel>(m_alignmentModel); | 382 auto alignmentModel = ModelById::getAs<AlignmentModel>(m_alignmentModel); |
378 | 383 |