# HG changeset patch # User Chris Cannam # Date 1553080476 0 # Node ID 0cfb882155a6b2279f3878b14138c3ef6831e78b # Parent 26aa42fd60e93af4f59e08827875a71c69da154e Fixes: completion should default to 100 (it never gets set if we aren't a transform target); events added to time-value model should be denied durations; forward the overspill and matching search functions diff -r 26aa42fd60e9 -r 0cfb882155a6 data/model/NoteModel.h --- a/data/model/NoteModel.h Wed Mar 20 11:12:54 2019 +0000 +++ b/data/model/NoteModel.h Wed Mar 20 11:14:36 2019 +0000 @@ -61,7 +61,7 @@ notifyOnAdd ? DeferredNotifier::NOTIFY_ALWAYS : DeferredNotifier::NOTIFY_DEFERRED), - m_completion(0) { + m_completion(100) { if (subtype == FLEXI_NOTE) { m_valueMinimum = 33.f; m_valueMaximum = 88.f; @@ -86,7 +86,7 @@ notifyOnAdd ? DeferredNotifier::NOTIFY_ALWAYS : DeferredNotifier::NOTIFY_DEFERRED), - m_completion(0) { + m_completion(100) { PlayParameterRepository::getInstance()->addPlayable(this); } diff -r 26aa42fd60e9 -r 0cfb882155a6 data/model/RegionModel.h --- a/data/model/RegionModel.h Wed Mar 20 11:12:54 2019 +0000 +++ b/data/model/RegionModel.h Wed Mar 20 11:14:36 2019 +0000 @@ -53,7 +53,7 @@ notifyOnAdd ? DeferredNotifier::NOTIFY_ALWAYS : DeferredNotifier::NOTIFY_DEFERRED), - m_completion(0) { + m_completion(100) { } RegionModel(sv_samplerate_t sampleRate, int resolution, @@ -70,7 +70,7 @@ notifyOnAdd ? DeferredNotifier::NOTIFY_ALWAYS : DeferredNotifier::NOTIFY_DEFERRED), - m_completion(0) { + m_completion(100) { } virtual ~RegionModel() { @@ -123,7 +123,6 @@ /** * Query methods. */ - int getEventCount() const { return m_events.count(); } @@ -159,7 +158,6 @@ { QMutexLocker locker(&m_mutex); m_events.add(e); -//!!!??? if (point.getLabel() != "") m_hasTextLabels = true; float v = e.getValue(); if (!ISNAN(v) && !ISINF(v)) { diff -r 26aa42fd60e9 -r 0cfb882155a6 data/model/SparseTimeValueModel.h --- a/data/model/SparseTimeValueModel.h Wed Mar 20 11:12:54 2019 +0000 +++ b/data/model/SparseTimeValueModel.h Wed Mar 20 11:14:36 2019 +0000 @@ -51,7 +51,7 @@ notifyOnAdd ? DeferredNotifier::NOTIFY_ALWAYS : DeferredNotifier::NOTIFY_DEFERRED), - m_completion(0) { + m_completion(100) { // Model is playable, but may not sound (if units not Hz or // range unsuitable) PlayParameterRepository::getInstance()->addPlayable(this); @@ -70,7 +70,7 @@ notifyOnAdd ? DeferredNotifier::NOTIFY_ALWAYS : DeferredNotifier::NOTIFY_DEFERRED), - m_completion(0) { + m_completion(100) { // Model is playable, but may not sound (if units not Hz or // range unsuitable) PlayParameterRepository::getInstance()->addPlayable(this); @@ -105,7 +105,7 @@ int getCompletion() const { return m_completion; } void setCompletion(int completion, bool update = true) { - + { QMutexLocker locker(&m_mutex); if (m_completion == completion) return; m_completion = completion; @@ -143,8 +143,9 @@ EventVector getEventsSpanning(sv_frame_t f, sv_frame_t duration) const { return m_events.getEventsSpanning(f, duration); } - EventVector getEventsWithin(sv_frame_t f, sv_frame_t duration) const { - return m_events.getEventsWithin(f, duration); + EventVector getEventsWithin(sv_frame_t f, sv_frame_t duration, + int overspill = 0) const { + return m_events.getEventsWithin(f, duration, overspill); } EventVector getEventsStartingWithin(sv_frame_t f, sv_frame_t duration) const { return m_events.getEventsStartingWithin(f, duration); @@ -152,6 +153,13 @@ EventVector getEventsCovering(sv_frame_t f) const { return m_events.getEventsCovering(f); } + bool getNearestEventMatching(sv_frame_t startSearchAt, + std::function predicate, + EventSeries::Direction direction, + Event &found) const { + return m_events.getNearestEventMatching + (startSearchAt, predicate, direction, found); + } /** * Editing methods. @@ -162,7 +170,7 @@ { QMutexLocker locker(&m_mutex); - m_events.add(e); + m_events.add(e.withoutDuration()); // can't have duration here if (e.getLabel() != "") { m_haveTextLabels = true;