Mercurial > hg > svapp
comparison framework/SVFileReader.cpp @ 646:3168deb50199 single-point
Updates for single-point changes, including removal of FlexiNoteModel
author | Chris Cannam |
---|---|
date | Thu, 14 Mar 2019 15:33:40 +0000 |
parents | e2715204feaa |
children | eec0c50bb44f |
comparison
equal
deleted
inserted
replaced
645:6240788893e7 | 646:3168deb50199 |
---|---|
29 #include "data/model/ReadOnlyWaveFileModel.h" | 29 #include "data/model/ReadOnlyWaveFileModel.h" |
30 #include "data/model/EditableDenseThreeDimensionalModel.h" | 30 #include "data/model/EditableDenseThreeDimensionalModel.h" |
31 #include "data/model/SparseOneDimensionalModel.h" | 31 #include "data/model/SparseOneDimensionalModel.h" |
32 #include "data/model/SparseTimeValueModel.h" | 32 #include "data/model/SparseTimeValueModel.h" |
33 #include "data/model/NoteModel.h" | 33 #include "data/model/NoteModel.h" |
34 #include "data/model/FlexiNoteModel.h" | |
35 #include "data/model/RegionModel.h" | 34 #include "data/model/RegionModel.h" |
36 #include "data/model/TextModel.h" | 35 #include "data/model/TextModel.h" |
37 #include "data/model/ImageModel.h" | 36 #include "data/model/ImageModel.h" |
38 #include "data/model/AlignmentModel.h" | 37 #include "data/model/AlignmentModel.h" |
39 #include "data/model/AggregateWaveModel.h" | 38 #include "data/model/AggregateWaveModel.h" |
711 model->setValueQuantization(valueQuantization); | 710 model->setValueQuantization(valueQuantization); |
712 model->setScaleUnits(units); | 711 model->setScaleUnits(units); |
713 model->setObjectName(name); | 712 model->setObjectName(name); |
714 m_models[id] = model; | 713 m_models[id] = model; |
715 } else if (attributes.value("subtype") == "flexinote") { | 714 } else if (attributes.value("subtype") == "flexinote") { |
716 FlexiNoteModel *model; | 715 NoteModel *model; |
717 if (haveMinMax) { | 716 if (haveMinMax) { |
718 model = new FlexiNoteModel | 717 model = new NoteModel |
719 (sampleRate, resolution, minimum, maximum, notifyOnAdd); | 718 (sampleRate, resolution, minimum, maximum, |
719 notifyOnAdd, | |
720 NoteModel::FLEXI_NOTE); | |
720 } else { | 721 } else { |
721 model = new FlexiNoteModel | 722 model = new NoteModel |
722 (sampleRate, resolution, notifyOnAdd); | 723 (sampleRate, resolution, notifyOnAdd, |
724 NoteModel::FLEXI_NOTE); | |
723 } | 725 } |
724 model->setValueQuantization(valueQuantization); | 726 model->setValueQuantization(valueQuantization); |
725 model->setScaleUnits(units); | 727 model->setScaleUnits(units); |
726 model->setObjectName(name); | 728 model->setObjectName(name); |
727 m_models[id] = model; | 729 m_models[id] = model; |
1049 else if (dynamic_cast<PathModel *>(model)) good = true; | 1051 else if (dynamic_cast<PathModel *>(model)) good = true; |
1050 break; | 1052 break; |
1051 | 1053 |
1052 case 3: | 1054 case 3: |
1053 if (dynamic_cast<NoteModel *>(model)) good = true; | 1055 if (dynamic_cast<NoteModel *>(model)) good = true; |
1054 else if (dynamic_cast<FlexiNoteModel *>(model)) good = true; | |
1055 else if (dynamic_cast<RegionModel *>(model)) good = true; | 1056 else if (dynamic_cast<RegionModel *>(model)) good = true; |
1056 else if (dynamic_cast<EditableDenseThreeDimensionalModel *>(model)) { | 1057 else if (dynamic_cast<EditableDenseThreeDimensionalModel *>(model)) { |
1057 m_datasetSeparator = attributes.value("separator"); | 1058 m_datasetSeparator = attributes.value("separator"); |
1058 good = true; | 1059 good = true; |
1059 } | 1060 } |
1113 float level = attributes.value("level").trimmed().toFloat(&ok); | 1114 float level = attributes.value("level").trimmed().toFloat(&ok); |
1114 if (!ok) { // level is optional | 1115 if (!ok) { // level is optional |
1115 level = 1.f; | 1116 level = 1.f; |
1116 ok = true; | 1117 ok = true; |
1117 } | 1118 } |
1118 nm->addPoint(NoteModel::Point(frame, value, duration, level, label)); | 1119 nm->add(Event(frame, value, duration, level, label)); |
1119 return ok; | |
1120 } | |
1121 | |
1122 FlexiNoteModel *fnm = dynamic_cast<FlexiNoteModel *>(m_currentDataset); | |
1123 | |
1124 if (fnm) { | |
1125 // SVCERR << "Current dataset is a flexinote model" << endl; | |
1126 float value = 0.0; | |
1127 value = attributes.value("value").trimmed().toFloat(&ok); | |
1128 int duration = 0; | |
1129 duration = attributes.value("duration").trimmed().toInt(&ok); | |
1130 QString label = attributes.value("label"); | |
1131 float level = attributes.value("level").trimmed().toFloat(&ok); | |
1132 if (!ok) { // level is optional | |
1133 level = 1.f; | |
1134 ok = true; | |
1135 } | |
1136 fnm->addPoint(FlexiNoteModel::Point(frame, value, duration, level, label)); | |
1137 return ok; | 1120 return ok; |
1138 } | 1121 } |
1139 | 1122 |
1140 RegionModel *rm = dynamic_cast<RegionModel *>(m_currentDataset); | 1123 RegionModel *rm = dynamic_cast<RegionModel *>(m_currentDataset); |
1141 | 1124 |