# HG changeset patch # User Chris Cannam # Date 1552577620 0 # Node ID 3168deb501995bd5b67a825e60ba3fe56b503ba6 # Parent 6240788893e72193cf72e03d252115c6aad508fe Updates for single-point changes, including removal of FlexiNoteModel diff -r 6240788893e7 -r 3168deb50199 audio/AudioGenerator.cpp --- a/audio/AudioGenerator.cpp Fri Mar 08 13:37:51 2019 +0000 +++ b/audio/AudioGenerator.cpp Thu Mar 14 15:33:40 2019 +0000 @@ -22,7 +22,6 @@ #include "base/Exceptions.h" #include "data/model/NoteModel.h" -#include "data/model/FlexiNoteModel.h" #include "data/model/DenseTimeValueModel.h" #include "data/model/SparseTimeValueModel.h" #include "data/model/SparseOneDimensionalModel.h" @@ -185,8 +184,7 @@ { bool clip = (qobject_cast(model) || - qobject_cast(model) || - qobject_cast(model)); + qobject_cast(model)); return clip; } @@ -196,9 +194,7 @@ // basically, anything that usually has sustain (like notes) or // often has multiple sounds at once (like notes) wants to use a // quieter level than simple click tracks - bool does = - (qobject_cast(model) || - qobject_cast(model)); + bool does = (qobject_cast(model)); return does; } @@ -559,6 +555,8 @@ float **bufferIndexes = new float *[m_targetChannelCount]; + //!!! + for first block, prime with notes already active + for (int i = 0; i < blocks; ++i) { sv_frame_t reqStart = startFrame + i * m_processingBlockSize; @@ -566,8 +564,8 @@ NoteList notes; NoteExportable *exportable = dynamic_cast(model); if (exportable) { - notes = exportable->getNotesWithin(reqStart, - reqStart + m_processingBlockSize); + notes = exportable->getNotesStartingWithin(reqStart, + m_processingBlockSize); } std::vector starts; diff -r 6240788893e7 -r 3168deb50199 framework/Document.cpp --- a/framework/Document.cpp Fri Mar 08 13:37:51 2019 +0000 +++ b/framework/Document.cpp Thu Mar 14 15:33:40 2019 +0000 @@ -21,7 +21,6 @@ #include "data/model/WritableWaveFileModel.h" #include "data/model/DenseThreeDimensionalModel.h" #include "data/model/DenseTimeValueModel.h" -#include "data/model/FlexiNoteModel.h" #include "data/model/AggregateWaveModel.h" #include "layer/Layer.h" diff -r 6240788893e7 -r 3168deb50199 framework/MainWindowBase.cpp --- a/framework/MainWindowBase.cpp Fri Mar 08 13:37:51 2019 +0000 +++ b/framework/MainWindowBase.cpp Thu Mar 14 15:33:40 2019 +0000 @@ -22,7 +22,6 @@ #include "data/model/WritableWaveFileModel.h" #include "data/model/SparseOneDimensionalModel.h" #include "data/model/NoteModel.h" -#include "data/model/FlexiNoteModel.h" #include "data/model/Labeller.h" #include "data/model/TabularModel.h" #include "view/ViewManager.h" @@ -1249,15 +1248,13 @@ NoteModel *nm = dynamic_cast(layer->getModel()); if (nm) { - NoteModel::Point point(alignedStart, - nm->getValueMinimum(), - alignedDuration, - 1.f, - ""); - NoteModel::EditCommand *command = - new NoteModel::EditCommand(nm, tr("Add Point")); - command->addPoint(point); - command->setName(name); + Event point(alignedStart, + nm->getValueMinimum(), + alignedDuration, + 1.f, + ""); + NoteModel::EditCommand *command = new NoteModel::EditCommand(nm, name); + command->add(point); c = command->finish(); } @@ -1265,25 +1262,6 @@ CommandHistory::getInstance()->addCommand(c, false); return; } - - FlexiNoteModel *fnm = dynamic_cast(layer->getModel()); - if (fnm) { - FlexiNoteModel::Point point(alignedStart, - fnm->getValueMinimum(), - alignedDuration, - 1.f, - ""); - FlexiNoteModel::EditCommand *command = - new FlexiNoteModel::EditCommand(fnm, tr("Add Point")); - command->addPoint(point); - command->setName(name); - c = command->finish(); - } - - if (c) { - CommandHistory::getInstance()->addCommand(c, false); - return; - } } void diff -r 6240788893e7 -r 3168deb50199 framework/SVFileReader.cpp --- a/framework/SVFileReader.cpp Fri Mar 08 13:37:51 2019 +0000 +++ b/framework/SVFileReader.cpp Thu Mar 14 15:33:40 2019 +0000 @@ -31,7 +31,6 @@ #include "data/model/SparseOneDimensionalModel.h" #include "data/model/SparseTimeValueModel.h" #include "data/model/NoteModel.h" -#include "data/model/FlexiNoteModel.h" #include "data/model/RegionModel.h" #include "data/model/TextModel.h" #include "data/model/ImageModel.h" @@ -713,13 +712,16 @@ model->setObjectName(name); m_models[id] = model; } else if (attributes.value("subtype") == "flexinote") { - FlexiNoteModel *model; + NoteModel *model; if (haveMinMax) { - model = new FlexiNoteModel - (sampleRate, resolution, minimum, maximum, notifyOnAdd); + model = new NoteModel + (sampleRate, resolution, minimum, maximum, + notifyOnAdd, + NoteModel::FLEXI_NOTE); } else { - model = new FlexiNoteModel - (sampleRate, resolution, notifyOnAdd); + model = new NoteModel + (sampleRate, resolution, notifyOnAdd, + NoteModel::FLEXI_NOTE); } model->setValueQuantization(valueQuantization); model->setScaleUnits(units); @@ -1051,7 +1053,6 @@ case 3: if (dynamic_cast(model)) good = true; - else if (dynamic_cast(model)) good = true; else if (dynamic_cast(model)) good = true; else if (dynamic_cast(model)) { m_datasetSeparator = attributes.value("separator"); @@ -1115,25 +1116,7 @@ level = 1.f; ok = true; } - nm->addPoint(NoteModel::Point(frame, value, duration, level, label)); - return ok; - } - - FlexiNoteModel *fnm = dynamic_cast(m_currentDataset); - - if (fnm) { -// SVCERR << "Current dataset is a flexinote model" << endl; - float value = 0.0; - value = attributes.value("value").trimmed().toFloat(&ok); - int duration = 0; - duration = attributes.value("duration").trimmed().toInt(&ok); - QString label = attributes.value("label"); - float level = attributes.value("level").trimmed().toFloat(&ok); - if (!ok) { // level is optional - level = 1.f; - ok = true; - } - fnm->addPoint(FlexiNoteModel::Point(frame, value, duration, level, label)); + nm->add(Event(frame, value, duration, level, label)); return ok; }