Mercurial > hg > svcore
comparison transform/FeatureExtractionModelTransformer.cpp @ 1881:b504df98c3be
Ensure completion on output model is started at zero, so if it's checked before the input model has become ready and the transform has begun, it is not accidentally reported as complete (affected re-aligning models in Sonic Lineup when replacing the session)
author | Chris Cannam |
---|---|
date | Fri, 26 Jun 2020 11:45:39 +0100 |
parents | 1b688ab5f1b3 |
children |
comparison
equal
deleted
inserted
replaced
1880:5671836cdac7 | 1881:b504df98c3be |
---|---|
247 } | 247 } |
248 } | 248 } |
249 | 249 |
250 for (int j = 0; in_range_for(m_transforms, j); ++j) { | 250 for (int j = 0; in_range_for(m_transforms, j); ++j) { |
251 createOutputModels(j); | 251 createOutputModels(j); |
252 setCompletion(j, 0); | |
252 } | 253 } |
253 | 254 |
254 m_outputMutex.lock(); | 255 m_outputMutex.lock(); |
255 m_haveOutputs = true; | 256 m_haveOutputs = true; |
256 m_outputsCondition.wakeAll(); | 257 m_outputsCondition.wakeAll(); |
358 if (binCount == 0 && | 359 if (binCount == 0 && |
359 (preDurationPlugin || !m_descriptors[n].hasDuration)) { | 360 (preDurationPlugin || !m_descriptors[n].hasDuration)) { |
360 | 361 |
361 // Anything with no value and no duration is an instant | 362 // Anything with no value and no duration is an instant |
362 | 363 |
364 SVDEBUG << "FeatureExtractionModelTransformer::createOutputModels: " | |
365 << "creating a SparseOneDimensionalModel" << endl; | |
366 | |
363 out = std::make_shared<SparseOneDimensionalModel> | 367 out = std::make_shared<SparseOneDimensionalModel> |
364 (modelRate, modelResolution, false); | 368 (modelRate, modelResolution, false); |
365 | 369 |
366 QString outputEventTypeURI = description.getOutputEventTypeURI(outputId); | 370 QString outputEventTypeURI = description.getOutputEventTypeURI(outputId); |
367 out->setRDFTypeURI(outputEventTypeURI); | 371 out->setRDFTypeURI(outputEventTypeURI); |
417 QSettings settings; | 421 QSettings settings; |
418 settings.beginGroup("Transformer"); | 422 settings.beginGroup("Transformer"); |
419 bool flexi = settings.value("use-flexi-note-model", false).toBool(); | 423 bool flexi = settings.value("use-flexi-note-model", false).toBool(); |
420 settings.endGroup(); | 424 settings.endGroup(); |
421 | 425 |
422 SVCERR << "flexi = " << flexi << endl; | 426 SVDEBUG << "FeatureExtractionModelTransformer::createOutputModels: " |
427 << "creating a NoteModel (flexi = " << flexi << ")" << endl; | |
423 | 428 |
424 NoteModel *model; | 429 NoteModel *model; |
425 if (haveExtents) { | 430 if (haveExtents) { |
426 model = new NoteModel | 431 model = new NoteModel |
427 (modelRate, modelResolution, minValue, maxValue, false, | 432 (modelRate, modelResolution, minValue, maxValue, false, |
434 model->setScaleUnits(m_descriptors[n].unit.c_str()); | 439 model->setScaleUnits(m_descriptors[n].unit.c_str()); |
435 out.reset(model); | 440 out.reset(model); |
436 | 441 |
437 } else { | 442 } else { |
438 | 443 |
444 SVDEBUG << "FeatureExtractionModelTransformer::createOutputModels: " | |
445 << "creating a RegionModel" << endl; | |
446 | |
439 RegionModel *model; | 447 RegionModel *model; |
440 if (haveExtents) { | 448 if (haveExtents) { |
441 model = new RegionModel | 449 model = new RegionModel |
442 (modelRate, modelResolution, minValue, maxValue, false); | 450 (modelRate, modelResolution, minValue, maxValue, false); |
443 } else { | 451 } else { |
479 | 487 |
480 if (!haveBinCount || binCount > 1) { | 488 if (!haveBinCount || binCount > 1) { |
481 m_needAdditionalModels[n] = true; | 489 m_needAdditionalModels[n] = true; |
482 } | 490 } |
483 | 491 |
492 SVDEBUG << "FeatureExtractionModelTransformer::createOutputModels: " | |
493 << "creating a SparseTimeValueModel " | |
494 << "(additional models to come? -> " | |
495 << m_needAdditionalModels[n] << ")" << endl; | |
496 | |
484 SparseTimeValueModel *model; | 497 SparseTimeValueModel *model; |
485 if (haveExtents) { | 498 if (haveExtents) { |
486 model = new SparseTimeValueModel | 499 model = new SparseTimeValueModel |
487 (modelRate, modelResolution, minValue, maxValue, false); | 500 (modelRate, modelResolution, minValue, maxValue, false); |
488 } else { | 501 } else { |
502 | 515 |
503 // Anything that is not a 1D, note, or interval model and that | 516 // Anything that is not a 1D, note, or interval model and that |
504 // has a fixed sample rate and more than one value per result | 517 // has a fixed sample rate and more than one value per result |
505 // must be a dense 3D model. | 518 // must be a dense 3D model. |
506 | 519 |
520 SVDEBUG << "FeatureExtractionModelTransformer::createOutputModels: " | |
521 << "creating a BasicCompressedDenseThreeDimensionalModel" | |
522 << endl; | |
523 | |
507 auto model = | 524 auto model = |
508 new BasicCompressedDenseThreeDimensionalModel | 525 new BasicCompressedDenseThreeDimensionalModel |
509 (modelRate, modelResolution, binCount, false); | 526 (modelRate, modelResolution, binCount, false); |
510 | 527 |
511 if (!m_descriptors[n].binNames.empty()) { | 528 if (!m_descriptors[n].binNames.empty()) { |