Mercurial > hg > svcore
changeset 1655:0cfb882155a6 single-point
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
author | Chris Cannam |
---|---|
date | Wed, 20 Mar 2019 11:14:36 +0000 |
parents | 26aa42fd60e9 |
children | e4084bc60fe8 |
files | data/model/NoteModel.h data/model/RegionModel.h data/model/SparseTimeValueModel.h |
diffstat | 3 files changed, 18 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- 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); }
--- 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)) {
--- 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<bool(Event)> 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;