# HG changeset patch # User Chris Cannam # Date 1560947613 -3600 # Node ID c6c8c1645ab6878f825ad24989c2276a4f59ca17 # Parent 9a292b2f244e284e06647a683d590c5538197295 Update subrepos and switch to single-point event types diff -r 9a292b2f244e -r c6c8c1645ab6 repoint-lock.json --- a/repoint-lock.json Thu May 16 11:09:08 2019 +0100 +++ b/repoint-lock.json Wed Jun 19 13:33:33 2019 +0100 @@ -1,31 +1,31 @@ { "libraries": { "vamp-plugin-sdk": { - "pin": "b650289c47b4" + "pin": "62987b6d6a3b" }, "svcore": { - "pin": "a77fc6da288b" + "pin": "78fe29adfd16" }, "svgui": { - "pin": "70e93f996da6" + "pin": "de41a11cabc2" }, "svapp": { - "pin": "6fd0ebfd2bbe" + "pin": "a82b9d410393" }, "checker": { - "pin": "5c60e26e16ca" + "pin": "c8c17e51aab0" }, "piper-vamp-cpp": { "pin": "0e3328c6091f59c912e25bc392a7dc75182be1c7" }, "dataquay": { - "pin": "807b55408d9e" + "pin": "b82360a98f49" }, "bqvec": { - "pin": "be1ce11183f4" + "pin": "c2d355c29372" }, "bqfft": { - "pin": "a766fe47501b" + "pin": "ff1d1bd48876" }, "bqresample": { "pin": "f5dee7d40378" @@ -34,7 +34,7 @@ "pin": "8c4162878ae6" }, "bqaudiostream": { - "pin": "87dac9687fa4" + "pin": "e3a6c41e042f" }, "bqthingfactory": { "pin": "7686116dcdd5" diff -r 9a292b2f244e -r c6c8c1645ab6 src/Analyser.cpp --- a/src/Analyser.cpp Thu May 16 11:09:08 2019 +0100 +++ b/src/Analyser.cpp Wed Jun 19 13:33:33 2019 +0100 @@ -679,8 +679,10 @@ t->setPresentationName("candidate"); m_document->addLayerToView(m_pane, t); m_reAnalysisCandidates.push_back(t); + /* cerr << "New re-analysis candidate model has " - << ((SparseTimeValueModel *)t->getModel())->getPoints().size() << " point(s)" << endl; + << ((SparseTimeValueModel *)t->getModel())->getAllEvents().size() << " point(s)" << endl; + */ } } @@ -768,12 +770,12 @@ layer->deleteSelection(sel); Clipboard shifted; - foreach (Clipboard::Point p, clip.getPoints()) { - if (p.haveValue()) { - Clipboard::Point sp = p.withValue(p.getValue() * factor); - shifted.addPoint(sp); + foreach (Event e, clip.getPoints()) { + if (e.hasValue()) { + Event se = e.withValue(e.getValue() * factor); + shifted.addPoint(se); } else { - shifted.addPoint(p); + shifted.addPoint(e); } } @@ -863,10 +865,10 @@ // Remove all pitches <= 0Hz -- we now save absent pitches as 0Hz // values when exporting a pitch track, so we need to exclude them // here when importing again - Clipboard::PointList after; + EventVector after; int excl = 0; - for (auto &p: clip.getPoints()) { - if (p.haveValue() && p.getValue() > 0.f) { + for (const auto &p: clip.getPoints()) { + if (p.hasValue() && p.getValue() > 0.f) { after.push_back(p); } else { ++excl; diff -r 9a292b2f244e -r c6c8c1645ab6 src/MainWindow.cpp --- a/src/MainWindow.cpp Thu May 16 11:09:08 2019 +0100 +++ b/src/MainWindow.cpp Wed Jun 19 13:33:33 2019 +0100 @@ -26,7 +26,6 @@ #include "view/PaneStack.h" #include "data/model/WaveFileModel.h" #include "data/model/NoteModel.h" -#include "data/model/FlexiNoteModel.h" #include "layer/FlexiNoteLayer.h" #include "data/model/NoteModel.h" #include "view/ViewManager.h" @@ -1314,18 +1313,22 @@ Layer *layer = m_analyser->getLayer(Analyser::Notes); if (!layer) return; - FlexiNoteModel *model = qobject_cast(layer->getModel()); + NoteModel *model = qobject_cast(layer->getModel()); if (!model) return; - FlexiNoteModel::PointList points = model->getPoints(); + //!!! This seems like a strange and inefficient way to do this - + //!!! there is almost certainly a better way making use of + //!!! EventSeries api + + EventVector points = model->getAllEvents(); if (points.empty()) return; - FlexiNoteModel::PointList::iterator i = points.begin(); + EventVector::iterator i = points.begin(); std::set snapFrames; snapFrames.insert(0); while (i != points.end()) { - snapFrames.insert(i->frame); - snapFrames.insert(i->frame + i->duration + 1); + snapFrames.insert(i->getFrame()); + snapFrames.insert(i->getFrame() + i->getDuration() + 1); ++i; } std::set::iterator i2; @@ -2293,7 +2296,7 @@ Layer *layer = m_analyser->getLayer(Analyser::Notes); if (!layer) return; - FlexiNoteModel *model = qobject_cast(layer->getModel()); + NoteModel *model = qobject_cast(layer->getModel()); if (!model) return; FileFinder::FileType type = FileFinder::LayerFileNonSV; @@ -2650,7 +2653,7 @@ MainWindow::formNoteFromSelection() { Layer *layer0 = m_analyser->getLayer(Analyser::Notes); - FlexiNoteModel *model = qobject_cast(layer0->getModel()); + NoteModel *model = qobject_cast(layer0->getModel()); FlexiNoteLayer *layer = qobject_cast(m_analyser->getLayer(Analyser::Notes)); @@ -2664,14 +2667,18 @@ (tr("Form Note from Selection"), true); for (MultiSelection::SelectionList::iterator k = selections.begin(); k != selections.end(); ++k) { - if (!model->getNotesWithin(k->getStartFrame(), k->getEndFrame()).empty()) { + //!!! This fails in the case where an existing note spans + //!!! one end of the selection but does not reach the + //!!! other end - it doesn't get extended + if (!model->getEventsSpanning(k->getStartFrame(), + k->getEndFrame() - k->getStartFrame()).empty()) { layer->splitNotesAt(m_analyser->getPane(), k->getStartFrame()); layer->splitNotesAt(m_analyser->getPane(), k->getEndFrame()); layer->mergeNotes(m_analyser->getPane(), *k, false); } else { layer->addNoteOn(k->getStartFrame(), 100, 100); layer->addNoteOff(k->getEndFrame(), 100); - layer->mergeNotes(m_analyser->getPane(), *k, false); // only so the note adapts in case of exisitng pitch track + layer->mergeNotes(m_analyser->getPane(), *k, false); // only so the note adapts in case of existing pitch track } }