Mercurial > hg > svcore
diff transform/FeatureExtractionModelTransformer.cpp @ 1713:978c143c767f
Merge from branch single-point
author | Chris Cannam |
---|---|
date | Fri, 17 May 2019 10:02:43 +0100 |
parents | 5b7b01da430a |
children | 565575463752 |
line wrap: on
line diff
--- a/transform/FeatureExtractionModelTransformer.cpp Thu May 16 12:54:58 2019 +0100 +++ b/transform/FeatureExtractionModelTransformer.cpp Fri May 17 10:02:43 2019 +0100 @@ -28,7 +28,6 @@ #include "data/model/EditableDenseThreeDimensionalModel.h" #include "data/model/DenseTimeValueModel.h" #include "data/model/NoteModel.h" -#include "data/model/FlexiNoteModel.h" #include "data/model/RegionModel.h" #include "data/model/FFTModel.h" #include "data/model/WaveFileModel.h" @@ -410,13 +409,8 @@ // count > 1). But we don't. QSettings settings; - settings.beginGroup("Transformer"); - bool flexi = settings.value("use-flexi-note-model", false).toBool(); - settings.endGroup(); - cerr << "flexi = " << flexi << endl; - - if (isNoteModel && !flexi) { + if (isNoteModel) { NoteModel *model; if (haveExtents) { @@ -429,19 +423,6 @@ model->setScaleUnits(m_descriptors[n]->unit.c_str()); out = model; - } else if (isNoteModel && flexi) { - - FlexiNoteModel *model; - if (haveExtents) { - model = new FlexiNoteModel - (modelRate, modelResolution, minValue, maxValue, false); - } else { - model = new FlexiNoteModel - (modelRate, modelResolution, false); - } - model->setScaleUnits(m_descriptors[n]->unit.c_str()); - out = model; - } else { RegionModel *model; @@ -996,8 +977,7 @@ getConformingOutput<SparseOneDimensionalModel>(n); if (!model) return; - model->addPoint(SparseOneDimensionalModel::Point - (frame, feature.label.c_str())); + model->add(Event(frame, feature.label.c_str())); } else if (isOutput<SparseTimeValueModel>(n)) { @@ -1023,11 +1003,10 @@ // << " for output " << n << " bin " << i << std::endl; } - targetModel->addPoint - (SparseTimeValueModel::Point(frame, value, label)); + targetModel->add(Event(frame, value, label)); } - } else if (isOutput<FlexiNoteModel>(n) || isOutput<NoteModel>(n) || isOutput<RegionModel>(n)) { //GF: Added Note Model + } else if (isOutput<NoteModel>(n) || isOutput<RegionModel>(n)) { int index = 0; @@ -1045,24 +1024,7 @@ } } - if (isOutput<FlexiNoteModel>(n)) { // GF: added for flexi note model - - float velocity = 100; - if ((int)feature.values.size() > index) { - velocity = feature.values[index++]; - } - if (velocity < 0) velocity = 127; - if (velocity > 127) velocity = 127; - - FlexiNoteModel *model = getConformingOutput<FlexiNoteModel>(n); - if (!model) return; - model->addPoint(FlexiNoteModel::Point(frame, - value, // value is pitch - duration, - velocity / 127.f, - feature.label.c_str())); - // GF: end -- added for flexi note model - } else if (isOutput<NoteModel>(n)) { + if (isOutput<NoteModel>(n)) { float velocity = 100; if ((int)feature.values.size() > index) { @@ -1073,10 +1035,10 @@ NoteModel *model = getConformingOutput<NoteModel>(n); if (!model) return; - model->addPoint(NoteModel::Point(frame, value, // value is pitch - duration, - velocity / 127.f, - feature.label.c_str())); + model->add(Event(frame, value, // value is pitch + duration, + velocity / 127.f, + feature.label.c_str())); } else { RegionModel *model = getConformingOutput<RegionModel>(n); @@ -1093,17 +1055,17 @@ label = QString("[%1] %2").arg(i+1).arg(label); } - model->addPoint(RegionModel::Point(frame, - value, - duration, - label)); + model->add(Event(frame, + value, + duration, + label)); } } else { - model->addPoint(RegionModel::Point(frame, - value, - duration, - feature.label.c_str())); + model->add(Event(frame, + value, + duration, + feature.label.c_str())); } } @@ -1160,13 +1122,6 @@ if (model->isAbandoning()) abandon(); model->setCompletion(completion, true); - } else if (isOutput<FlexiNoteModel>(n)) { - - FlexiNoteModel *model = getConformingOutput<FlexiNoteModel>(n); - if (!model) return; - if (model->isAbandoning()) abandon(); - model->setCompletion(completion, true); - } else if (isOutput<RegionModel>(n)) { RegionModel *model = getConformingOutput<RegionModel>(n);