Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
zrythm::structure::tracks::PlaybackCacheActivityTracker Class Reference

Helper that manages cache activity state for a cache-holding object. More...

#include <src/structure/tracks/playback_cache_activity_tracker.h>

Inheritance diagram for zrythm::structure::tracks::PlaybackCacheActivityTracker:
Collaboration diagram for zrythm::structure::tracks::PlaybackCacheActivityTracker:

Public Types

using SampleToTickConverter = std::function<double (units::sample_t)>
 Function type for converting sample position to tick position.

Signals

void pendingChanged ()
void entriesChanged ()
void cachedRangesChanged ()

Public Member Functions

 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.
bool isPending () const
QVariantList entries () const
size_t entryCount () const
QVariantList cachedRanges () const

Static Public Attributes

static constexpr auto kMaxEntries = 100zu
static constexpr auto kEntryLifetimeMs = std::chrono::milliseconds (300)

Properties

bool pending
QVariantList entries
QVariantList cachedRanges

Detailed Description

Helper that manages cache activity state for a cache-holding object.

Encapsulates the shared logic used by both Track and AutomationTrack for tracking pending cache requests and completed regeneration entries.

The pending state is driven solely by the scheduler's isPendingChanged signal. The entries list is capped at kMaxEntries to prevent unbounded growth. Entries are automatically removed after kEntryLifetimeMs by a periodic sweep timer.

Definition at line 66 of file playback_cache_activity_tracker.h.

Member Typedef Documentation

◆ SampleToTickConverter

Function type for converting sample position to tick position.

Definition at line 82 of file playback_cache_activity_tracker.h.

Constructor & Destructor Documentation

◆ PlaybackCacheActivityTracker()

zrythm::structure::tracks::PlaybackCacheActivityTracker::PlaybackCacheActivityTracker ( utils::PlaybackCacheScheduler * scheduler,
const dsp::TimelineDataCache & cache,
SampleToTickConverter sample_to_tick,
QObject * parent = nullptr )
explicit
Parameters
schedulerThe playback cache scheduler to track.
cacheThe timeline data cache to observe for range changes.
sample_to_tickFunction that converts sample positions to tick positions.
parentParent QObject.

Member Function Documentation

◆ entryCount()

size_t zrythm::structure::tracks::PlaybackCacheActivityTracker::entryCount ( ) const
inlinenodiscard

Definition at line 107 of file playback_cache_activity_tracker.h.

◆ isPending()

bool zrythm::structure::tracks::PlaybackCacheActivityTracker::isPending ( ) const
inlinenodiscard

Definition at line 105 of file playback_cache_activity_tracker.h.

◆ onRegenerationComplete()

void zrythm::structure::tracks::PlaybackCacheActivityTracker::onRegenerationComplete ( utils::ExpandableTickRange affectedRange)

Called when cache regeneration completes.

Adds an entry to the entries list and trims to kMaxEntries. Does NOT modify pending state – that is driven solely by isPendingChanged.

Field Documentation

◆ kEntryLifetimeMs

auto zrythm::structure::tracks::PlaybackCacheActivityTracker::kEntryLifetimeMs = std::chrono::milliseconds (300)
staticconstexpr

Definition at line 77 of file playback_cache_activity_tracker.h.

◆ kMaxEntries

auto zrythm::structure::tracks::PlaybackCacheActivityTracker::kMaxEntries = 100zu
staticconstexpr

Definition at line 76 of file playback_cache_activity_tracker.h.

Property Documentation

◆ cachedRanges

QVariantList zrythm::structure::tracks::PlaybackCacheActivityTracker::cachedRanges
read

Definition at line 71 of file playback_cache_activity_tracker.h.

◆ entries

QVariantList zrythm::structure::tracks::PlaybackCacheActivityTracker::entries
read

Definition at line 70 of file playback_cache_activity_tracker.h.

◆ pending

bool zrythm::structure::tracks::PlaybackCacheActivityTracker::pending
read

Definition at line 69 of file playback_cache_activity_tracker.h.


The documentation for this class was generated from the following file: