9#include "dsp/timeline_data_cache.h"
10#include "utils/playback_cache_scheduler.h"
13#include <QtQmlIntegration/qqmlintegration.h>
15namespace zrythm::structure::tracks
24 Q_PROPERTY (qint64
id MEMBER
id)
25 Q_PROPERTY (
double startTick MEMBER startTick)
26 Q_PROPERTY (
double endTick MEMBER endTick)
27 Q_PROPERTY (
bool isFullContent MEMBER isFullContent)
28 QML_VALUE_TYPE (playbackCacheActivityEntry)
36 std::chrono::milliseconds createdAtMs;
45 Q_PROPERTY (
double startTick MEMBER startTick)
46 Q_PROPERTY (
double endTick MEMBER endTick)
47 QML_VALUE_TYPE (cachedTickRange)
69 Q_PROPERTY (
bool pending READ isPending NOTIFY pendingChanged)
70 Q_PROPERTY (QVariantList entries READ entries NOTIFY entriesChanged)
72 QVariantList cachedRanges READ cachedRanges NOTIFY cachedRangesChanged)
77 static constexpr auto kMaxEntries = 100zu;
78 static constexpr auto kEntryLifetimeMs = std::chrono::milliseconds (300);
96 QObject * parent =
nullptr);
106 [[nodiscard]]
bool isPending ()
const {
return pending_; }
107 [[nodiscard]] QVariantList entries ()
const;
108 [[nodiscard]]
size_t entryCount ()
const {
return entries_.size (); }
109 [[nodiscard]] QVariantList cachedRanges ()
const;
112 void pendingChanged ();
113 void entriesChanged ();
114 void cachedRangesChanged ();
117 void sweepExpiredEntries ();
119 bool pending_ =
false;
120 std::vector<PlaybackCacheActivityEntry> entries_;
121 std::vector<CachedTickRange> cached_ranges_;
Base class for timeline data caches.
PlaybackCacheActivityTracker(utils::PlaybackCacheScheduler *scheduler, const dsp::TimelineDataCache &cache, SampleToTickConverter sample_to_tick, QObject *parent=nullptr)
void onRegenerationComplete(utils::ExpandableTickRange affectedRange)
Called when cache regeneration completes.
std::function< double(units::sample_t)> SampleToTickConverter
Function type for converting sample position to tick position.
Cache request handler for a tick range, with built-in debouncing and expanding of the range.
A tick range representing currently valid cached content.
A single completed cache regeneration entry for debug visualization.