Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
zrythm::dsp::TimelineDataCache Class Referenceabstract

Base class for timeline data caches. More...

#include <src/dsp/timeline_data_cache.h>

Inheritance diagram for zrythm::dsp::TimelineDataCache:
Collaboration diagram for zrythm::dsp::TimelineDataCache:

Public Types

using IntervalType = std::pair<units::sample_t, units::sample_t>

Public Member Functions

 TimelineDataCache (QObject *parent=nullptr)
void clear ()
 Clears all cached data and emits cachedRangesChanged.
virtual void remove_sequences_matching_interval (IntervalType interval)=0
 Removes cached data for intervals that truly overlap with the given interval.
void finalize_changes ()
 Finalizes changes, prepares cached data for access, and emits cachedRangesChanged.
virtual bool has_content () const =0
 Checks if the cache has any content.
Q_SIGNAL void cachedRangesChanged (std::vector< IntervalType > ranges) const
 Emitted when the cache content changes (after finalize_changes or clear).

Static Protected Member Functions

static bool intervals_overlap (IntervalType a, IntervalType b) noexcept
 Returns true if two intervals truly overlap (adjacent intervals do not count).

Detailed Description

Base class for timeline data caches.

Provides common functionality for all timeline data cache types. This is an abstract base class that defines the interface that all derived cache classes must implement.

Definition at line 22 of file timeline_data_cache.h.

Member Typedef Documentation

◆ IntervalType

using zrythm::dsp::TimelineDataCache::IntervalType = std::pair<units::sample_t, units::sample_t>

Definition at line 27 of file timeline_data_cache.h.

Constructor & Destructor Documentation

◆ TimelineDataCache()

zrythm::dsp::TimelineDataCache::TimelineDataCache ( QObject * parent = nullptr)
inlineexplicit

Definition at line 29 of file timeline_data_cache.h.

Member Function Documentation

◆ cachedRangesChanged()

Q_SIGNAL void zrythm::dsp::TimelineDataCache::cachedRangesChanged ( std::vector< IntervalType > ranges) const

Emitted when the cache content changes (after finalize_changes or clear).

Carries the current list of sample intervals that are cached. Used for debug visualization of cache coverage.

◆ clear()

void zrythm::dsp::TimelineDataCache::clear ( )
inline

Clears all cached data and emits cachedRangesChanged.

Definition at line 36 of file timeline_data_cache.h.

◆ finalize_changes()

void zrythm::dsp::TimelineDataCache::finalize_changes ( )
inline

Finalizes changes, prepares cached data for access, and emits cachedRangesChanged.

This should be called after all modifications are complete to prepare the cached data for real-time access.

Definition at line 63 of file timeline_data_cache.h.

◆ has_content()

virtual bool zrythm::dsp::TimelineDataCache::has_content ( ) const
pure virtual

Checks if the cache has any content.

Returns
True if the cache contains any data, false otherwise.

Implemented in zrythm::dsp::AudioTimelineDataCache, zrythm::dsp::AutomationTimelineDataCache, and zrythm::dsp::MidiTimelineDataCache.

◆ intervals_overlap()

bool zrythm::dsp::TimelineDataCache::intervals_overlap ( IntervalType a,
IntervalType b )
inlinestaticprotectednoexcept

Returns true if two intervals truly overlap (adjacent intervals do not count).

Definition at line 90 of file timeline_data_cache.h.

◆ remove_sequences_matching_interval()

virtual void zrythm::dsp::TimelineDataCache::remove_sequences_matching_interval ( IntervalType interval)
pure virtual

Removes cached data for intervals that truly overlap with the given interval.

Adjacent intervals (where one's end equals another's start) are NOT considered overlapping, since cache entries use exclusive-end semantics (end = one past the last sample).

Parameters
intervalThe time interval to remove (in samples).

Call finalize_changes() after one or more calls to this method.

Implemented in zrythm::dsp::AudioTimelineDataCache, zrythm::dsp::AutomationTimelineDataCache, and zrythm::dsp::MidiTimelineDataCache.


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