Mercurial > hg > svcore
changeset 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 | 6b77fcc39723 |
children | 1f98e28f70c6 |
files | transform/FeatureExtractionModelTransformer.cpp transform/FeatureExtractionModelTransformer.h transform/ModelTransformerFactory.cpp transform/ModelTransformerFactory.h |
diffstat | 4 files changed, 26 insertions(+), 32 deletions(-) [+] |
line wrap: on
line diff
--- 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 <iostream> +#include <QSettings> + 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;
--- 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<Vamp::Plugin::OutputDescriptor *> m_descriptors; // per transform std::vector<int> m_fixedRateFeatureNos; // to assign times to FixedSampleRate features std::vector<int> m_outputNos; - PreferredOutputModel m_preferredOutputModel; void createOutputModel(int n);
--- 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)) {
--- 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 ; };