comparison transform/FeatureExtractionModelTransformer.cpp @ 859:13803edd513d tonioni

Use a settings setting for flexi/non-flexi determination -- this may not be the right thing in the long run but it's simpler and easier than passing through a random value that doesn't actually come from anywhere
author Chris Cannam
date Wed, 04 Dec 2013 19:30:02 +0000
parents dba8a02b0413
children 862fe7b20df7 3e6ed8a8577b
comparison
equal deleted inserted replaced
858:6b77fcc39723 859:13803edd513d
35 35
36 #include "TransformFactory.h" 36 #include "TransformFactory.h"
37 37
38 #include <iostream> 38 #include <iostream>
39 39
40 #include <QSettings>
41
40 FeatureExtractionModelTransformer::FeatureExtractionModelTransformer(Input in, 42 FeatureExtractionModelTransformer::FeatureExtractionModelTransformer(Input in,
41 const Transform &transform, 43 const Transform &transform) :
42 const PreferredOutputModel outputmodel) :
43 ModelTransformer(in, transform), 44 ModelTransformer(in, transform),
44 m_plugin(0), 45 m_plugin(0)
45 m_preferredOutputModel(outputmodel)
46 { 46 {
47 // SVDEBUG << "FeatureExtractionModelTransformer::FeatureExtractionModelTransformer: plugin " << pluginId << ", outputName " << m_transform.getOutput() << endl; 47 // SVDEBUG << "FeatureExtractionModelTransformer::FeatureExtractionModelTransformer: plugin " << pluginId << ", outputName " << m_transform.getOutput() << endl;
48 48
49 initialise(); 49 initialise();
50 } 50 }
51 51
52 FeatureExtractionModelTransformer::FeatureExtractionModelTransformer(Input in, 52 FeatureExtractionModelTransformer::FeatureExtractionModelTransformer(Input in,
53 const Transforms &transforms, 53 const Transforms &transforms) :
54 const PreferredOutputModel outputmodel) :
55 ModelTransformer(in, transforms), 54 ModelTransformer(in, transforms),
56 m_plugin(0), 55 m_plugin(0)
57 m_preferredOutputModel(outputmodel)
58 { 56 {
59 // SVDEBUG << "FeatureExtractionModelTransformer::FeatureExtractionModelTransformer: plugin " << pluginId << ", outputName " << m_transform.getOutput() << endl; 57 // SVDEBUG << "FeatureExtractionModelTransformer::FeatureExtractionModelTransformer: plugin " << pluginId << ", outputName " << m_transform.getOutput() << endl;
60 58
61 initialise(); 59 initialise();
62 } 60 }
342 340
343 // If we had a "sparse 3D model", we would have the additional 341 // If we had a "sparse 3D model", we would have the additional
344 // problem of determining whether to use that here (if bin 342 // problem of determining whether to use that here (if bin
345 // count > 1). But we don't. 343 // count > 1). But we don't.
346 344
347 if (isNoteModel && m_preferredOutputModel == NoteOutputModel) { 345 QSettings settings;
346 settings.beginGroup("Transformer");
347 bool flexi = settings.value("use-flexi-note-model", false).toBool();
348 settings.endGroup();
349
350 cerr << "flexi = " << flexi << endl;
351
352 if (isNoteModel && !flexi) {
348 353
349 NoteModel *model; 354 NoteModel *model;
350 if (haveExtents) { 355 if (haveExtents) {
351 model = new NoteModel (modelRate, modelResolution, minValue, maxValue, false); 356 model = new NoteModel
357 (modelRate, modelResolution, minValue, maxValue, false);
352 } else { 358 } else {
353 model = new NoteModel (modelRate, modelResolution, false); 359 model = new NoteModel
360 (modelRate, modelResolution, false);
354 } 361 }
355 model->setScaleUnits(m_descriptors[n]->unit.c_str()); 362 model->setScaleUnits(m_descriptors[n]->unit.c_str());
356 out = model; 363 out = model;
357 364
358 // GF: FlexiNoteModel is selected if the m_preferredOutputModel is set 365 } else if (isNoteModel && flexi) {
359 } else if (isNoteModel && m_preferredOutputModel == FlexiNoteOutputModel) {
360 366
361 FlexiNoteModel *model; 367 FlexiNoteModel *model;
362 if (haveExtents) { 368 if (haveExtents) {
363 model = new FlexiNoteModel (modelRate, modelResolution, minValue, maxValue, false); 369 model = new FlexiNoteModel
370 (modelRate, modelResolution, minValue, maxValue, false);
364 } else { 371 } else {
365 model = new FlexiNoteModel (modelRate, modelResolution, false); 372 model = new FlexiNoteModel
373 (modelRate, modelResolution, false);
366 } 374 }
367 model->setScaleUnits(m_descriptors[n]->unit.c_str()); 375 model->setScaleUnits(m_descriptors[n]->unit.c_str());
368 out = model; 376 out = model;
369 377
370 } else { 378 } else {