# HG changeset patch # User Chris Cannam # Date 1386185402 0 # Node ID 13803edd513db44070abe2046e31ce3f176abbc4 # Parent 6b77fcc397235e22e0ba1a4d7584e3d13cedab94 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 diff -r 6b77fcc39723 -r 13803edd513d transform/FeatureExtractionModelTransformer.cpp --- a/transform/FeatureExtractionModelTransformer.cpp Wed Dec 04 19:29:19 2013 +0000 +++ b/transform/FeatureExtractionModelTransformer.cpp Wed Dec 04 19:30:02 2013 +0000 @@ -37,12 +37,12 @@ #include +#include + FeatureExtractionModelTransformer::FeatureExtractionModelTransformer(Input in, - const Transform &transform, - const PreferredOutputModel outputmodel) : + const Transform &transform) : ModelTransformer(in, transform), - m_plugin(0), - m_preferredOutputModel(outputmodel) + m_plugin(0) { // SVDEBUG << "FeatureExtractionModelTransformer::FeatureExtractionModelTransformer: plugin " << pluginId << ", outputName " << m_transform.getOutput() << endl; @@ -50,11 +50,9 @@ } FeatureExtractionModelTransformer::FeatureExtractionModelTransformer(Input in, - const Transforms &transforms, - const PreferredOutputModel outputmodel) : + const Transforms &transforms) : ModelTransformer(in, transforms), - m_plugin(0), - m_preferredOutputModel(outputmodel) + m_plugin(0) { // SVDEBUG << "FeatureExtractionModelTransformer::FeatureExtractionModelTransformer: plugin " << pluginId << ", outputName " << m_transform.getOutput() << endl; @@ -344,25 +342,35 @@ // problem of determining whether to use that here (if bin // count > 1). But we don't. - if (isNoteModel && m_preferredOutputModel == NoteOutputModel) { + QSettings settings; + settings.beginGroup("Transformer"); + bool flexi = settings.value("use-flexi-note-model", false).toBool(); + settings.endGroup(); + + cerr << "flexi = " << flexi << endl; + + if (isNoteModel && !flexi) { NoteModel *model; if (haveExtents) { - model = new NoteModel (modelRate, modelResolution, minValue, maxValue, false); + model = new NoteModel + (modelRate, modelResolution, minValue, maxValue, false); } else { - model = new NoteModel (modelRate, modelResolution, false); + model = new NoteModel + (modelRate, modelResolution, false); } model->setScaleUnits(m_descriptors[n]->unit.c_str()); out = model; - // GF: FlexiNoteModel is selected if the m_preferredOutputModel is set - } else if (isNoteModel && m_preferredOutputModel == FlexiNoteOutputModel) { + } else if (isNoteModel && flexi) { FlexiNoteModel *model; if (haveExtents) { - model = new FlexiNoteModel (modelRate, modelResolution, minValue, maxValue, false); + model = new FlexiNoteModel + (modelRate, modelResolution, minValue, maxValue, false); } else { - model = new FlexiNoteModel (modelRate, modelResolution, false); + model = new FlexiNoteModel + (modelRate, modelResolution, false); } model->setScaleUnits(m_descriptors[n]->unit.c_str()); out = model; diff -r 6b77fcc39723 -r 13803edd513d transform/FeatureExtractionModelTransformer.h --- a/transform/FeatureExtractionModelTransformer.h Wed Dec 04 19:29:19 2013 +0000 +++ b/transform/FeatureExtractionModelTransformer.h Wed Dec 04 19:30:02 2013 +0000 @@ -31,22 +31,14 @@ Q_OBJECT public: - enum PreferredOutputModel { - NoteOutputModel, - FlexiNoteOutputModel, - UndefinedOutputModel = 255 - }; - FeatureExtractionModelTransformer(Input input, - const Transform &transform, - const PreferredOutputModel outputmodel); + const Transform &transform); // Obtain outputs for a set of transforms that all use the same // plugin and input (but with different outputs). i.e. run the // plugin once only and collect more than one output from it. FeatureExtractionModelTransformer(Input input, - const Transforms &relatedTransforms, - const PreferredOutputModel outputmodel); + const Transforms &relatedTransforms); virtual ~FeatureExtractionModelTransformer(); @@ -59,7 +51,6 @@ std::vector m_descriptors; // per transform std::vector m_fixedRateFeatureNos; // to assign times to FixedSampleRate features std::vector m_outputNos; - PreferredOutputModel m_preferredOutputModel; void createOutputModel(int n); diff -r 6b77fcc39723 -r 13803edd513d transform/ModelTransformerFactory.cpp --- a/transform/ModelTransformerFactory.cpp Wed Dec 04 19:29:19 2013 +0000 +++ b/transform/ModelTransformerFactory.cpp Wed Dec 04 19:30:02 2013 +0000 @@ -175,7 +175,7 @@ if (FeatureExtractionPluginFactory::instanceFor(id)) { transformer = - new FeatureExtractionModelTransformer(input, transforms, FeatureExtractionModelTransformer::FlexiNoteOutputModel); //!!! gross + new FeatureExtractionModelTransformer(input, transforms); } else if (RealTimePluginFactory::instanceFor(id)) { diff -r 6b77fcc39723 -r 13803edd513d transform/ModelTransformerFactory.h --- a/transform/ModelTransformerFactory.h Wed Dec 04 19:29:19 2013 +0000 +++ b/transform/ModelTransformerFactory.h Wed Dec 04 19:30:02 2013 +0000 @@ -129,11 +129,6 @@ TransformerSet m_runningTransformers; static ModelTransformerFactory *m_instance; - /** - * allows the FeatureExtractionModelTransformer output model to be selected externally, - * but only in case of the need for NoteModel or FlexiNoteModel - */ - FeatureExtractionModelTransformer::PreferredOutputModel m_preferredOutputModel ; };