Mercurial > hg > svcore
comparison data/model/Model.h @ 1725:78fe29adfd16
Re-implement extendEndFrame behaviour, used by Tony application
author | Chris Cannam |
---|---|
date | Wed, 19 Jun 2019 13:32:52 +0100 |
parents | 0d89abd631ac |
children | 601851995f4b |
comparison
equal
deleted
inserted
replaced
1724:157c62ff0056 | 1725:78fe29adfd16 |
---|---|
60 * model's "resolution" granularity, if more than 1). The end | 60 * model's "resolution" granularity, if more than 1). The end |
61 * frame minus the start frame should yield the total duration in | 61 * frame minus the start frame should yield the total duration in |
62 * frames (as a multiple of the resolution) spanned by the | 62 * frames (as a multiple of the resolution) spanned by the |
63 * model. This is broadly consistent with the definition of the | 63 * model. This is broadly consistent with the definition of the |
64 * end frame of a Selection object. | 64 * end frame of a Selection object. |
65 */ | 65 * |
66 virtual sv_frame_t getEndFrame() const = 0; | 66 * If the end has been extended by extendEndFrame() beyond the |
67 * true end frame, return the extended end instead. This is | |
68 * usually the behaviour you want. | |
69 */ | |
70 sv_frame_t getEndFrame() const { | |
71 sv_frame_t trueEnd = getTrueEndFrame(); | |
72 if (m_extendTo > trueEnd) { | |
73 return m_extendTo; | |
74 } else { | |
75 return trueEnd; | |
76 } | |
77 } | |
78 | |
79 /** | |
80 * Return the audio frame at the end of the model. This is | |
81 * identical to getEndFrame(), except that it ignores any extended | |
82 * duration set with extendEndFrame(). | |
83 */ | |
84 virtual sv_frame_t getTrueEndFrame() const = 0; | |
85 | |
86 /** | |
87 * Extend the end of the model. If this is set to something beyond | |
88 * the true end of the data within the model, then getEndFrame() | |
89 * will return this value instead of the true end. (This is used | |
90 * by the Tony application.) | |
91 */ | |
92 void extendEndFrame(sv_frame_t to) { | |
93 m_extendTo = to; | |
94 } | |
67 | 95 |
68 /** | 96 /** |
69 * Return the frame rate in frames per second. | 97 * Return the frame rate in frames per second. |
70 */ | 98 */ |
71 virtual sv_samplerate_t getSampleRate() const = 0; | 99 virtual sv_samplerate_t getSampleRate() const = 0; |
313 Model() : | 341 Model() : |
314 m_id(getNextId()), | 342 m_id(getNextId()), |
315 m_sourceModel(0), | 343 m_sourceModel(0), |
316 m_alignment(0), | 344 m_alignment(0), |
317 m_abandoning(false), | 345 m_abandoning(false), |
318 m_aboutToDelete(false) { } | 346 m_aboutToDelete(false), |
347 m_extendTo(0) { } | |
319 | 348 |
320 // Not provided. | 349 // Not provided. |
321 Model(const Model &); | 350 Model(const Model &); |
322 Model &operator=(const Model &); | 351 Model &operator=(const Model &); |
323 | 352 |
325 Model *m_sourceModel; | 354 Model *m_sourceModel; |
326 AlignmentModel *m_alignment; | 355 AlignmentModel *m_alignment; |
327 QString m_typeUri; | 356 QString m_typeUri; |
328 bool m_abandoning; | 357 bool m_abandoning; |
329 bool m_aboutToDelete; | 358 bool m_aboutToDelete; |
330 | 359 sv_frame_t m_extendTo; |
360 | |
331 int getNextId(); | 361 int getNextId(); |
332 }; | 362 }; |
333 | 363 |
334 #endif | 364 #endif |