Mercurial > hg > svcore
comparison base/EventSeries.h @ 1617:bdc19a09a1f9 single-point
Minor tweaks, comments, span tests
author | Chris Cannam |
---|---|
date | Fri, 08 Mar 2019 11:15:59 +0000 |
parents | de446dd905e6 |
children | ba3ddb7fe2bd |
comparison
equal
deleted
inserted
replaced
1616:de446dd905e6 | 1617:bdc19a09a1f9 |
---|---|
51 | 51 |
52 ++m_events[p]; | 52 ++m_events[p]; |
53 ++m_count; | 53 ++m_count; |
54 | 54 |
55 if (p.hasDuration()) { | 55 if (p.hasDuration()) { |
56 sv_frame_t frame = p.getFrame(); | 56 |
57 sv_frame_t endFrame = p.getFrame() + p.getDuration(); | 57 const sv_frame_t frame = p.getFrame(); |
58 const sv_frame_t endFrame = p.getFrame() + p.getDuration(); | |
58 | 59 |
59 createSeam(frame); | 60 createSeam(frame); |
60 createSeam(endFrame); | 61 createSeam(endFrame); |
61 | 62 |
62 // These calls must both succeed after calling createSeam above | 63 // These calls must both succeed after calling createSeam above |
99 --m_count; | 100 --m_count; |
100 } | 101 } |
101 | 102 |
102 if (p.hasDuration() && isUnique) { | 103 if (p.hasDuration() && isUnique) { |
103 | 104 |
104 sv_frame_t frame = p.getFrame(); | 105 const sv_frame_t frame = p.getFrame(); |
105 sv_frame_t endFrame = p.getFrame() + p.getDuration(); | 106 const sv_frame_t endFrame = p.getFrame() + p.getDuration(); |
106 | 107 |
107 const auto i0 = m_seams.find(frame); | 108 const auto i0 = m_seams.find(frame); |
108 const auto i1 = m_seams.find(endFrame); | 109 const auto i1 = m_seams.find(endFrame); |
109 | 110 |
110 #ifdef DEBUG_EVENT_SERIES | 111 #ifdef DEBUG_EVENT_SERIES |
188 * - An event with duration is within the span if its start frame | 189 * - An event with duration is within the span if its start frame |
189 * is less than f + d and its start frame plus its duration is | 190 * is less than f + d and its start frame plus its duration is |
190 * greater than f. | 191 * greater than f. |
191 * | 192 * |
192 * Note that getEventsSpanning(f, 0) is not equivalent to | 193 * Note that getEventsSpanning(f, 0) is not equivalent to |
193 * getEventsCovering(f) - they have different behaviour in the | 194 * getEventsCovering(f). The latter includes durationless events |
194 * case of events starting exactly at f, which are included in the | 195 * at f and events starting at f, both of which are excluded from |
195 * latter but not the former. | 196 * the former. |
196 */ | 197 */ |
197 EventVector getEventsSpanning(sv_frame_t f, sv_frame_t d) const { | 198 EventVector getEventsSpanning(sv_frame_t frame, |
199 sv_frame_t duration) const { | |
198 EventVector span; | 200 EventVector span; |
199 | 201 |
200 sv_frame_t start = f; | 202 const sv_frame_t start = frame; |
201 sv_frame_t end = f + d; | 203 const sv_frame_t end = frame + duration; |
202 | 204 |
203 // first find any zero-duration events | 205 // first find any zero-duration events |
204 | 206 |
205 auto pitr = m_events.lower_bound(Event(start, QString())); | 207 auto pitr = m_events.lower_bound(Event(start, QString())); |
206 while (pitr != m_events.end() && pitr->first.getFrame() < end) { | 208 while (pitr != m_events.end() && pitr->first.getFrame() < end) { |