Mercurial > hg > svapp
changeset 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 | 6240788893e7 |
children | 25554f7a5b0d |
files | audio/AudioGenerator.cpp framework/Document.cpp framework/MainWindowBase.cpp framework/SVFileReader.cpp |
diffstat | 4 files changed, 22 insertions(+), 64 deletions(-) [+] |
line wrap: on
line diff
--- 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<const SparseOneDimensionalModel *>(model) || - qobject_cast<const NoteModel *>(model) || - qobject_cast<const FlexiNoteModel *>(model)); + qobject_cast<const NoteModel *>(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<const NoteModel *>(model) || - qobject_cast<const FlexiNoteModel *>(model)); + bool does = (qobject_cast<const NoteModel *>(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<NoteExportable *>(model); if (exportable) { - notes = exportable->getNotesWithin(reqStart, - reqStart + m_processingBlockSize); + notes = exportable->getNotesStartingWithin(reqStart, + m_processingBlockSize); } std::vector<ClipMixer::NoteStart> starts;
--- 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"
--- 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<NoteModel *>(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<FlexiNoteModel *>(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
--- 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<NoteModel *>(model)) good = true; - else if (dynamic_cast<FlexiNoteModel *>(model)) good = true; else if (dynamic_cast<RegionModel *>(model)) good = true; else if (dynamic_cast<EditableDenseThreeDimensionalModel *>(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<FlexiNoteModel *>(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; }