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

MIDI-specific timeline data cache. More...

#include <src/dsp/timeline_data_cache.h>

Inheritance diagram for zrythm::dsp::MidiTimelineDataCache:
Collaboration diagram for zrythm::dsp::MidiTimelineDataCache:

Public Member Functions

 MidiTimelineDataCache (QObject *parent=nullptr)
void add_midi_sequence (IntervalType interval, const juce::MidiMessageSequence &sequence)
 Adds a MIDI sequence for the given interval.
const juce::MidiMessageSequence & get_midi_events () const
 Gets the cached MIDI events.
void remove_sequences_matching_interval (IntervalType interval) override
 Removes cached data for intervals that truly overlap with the given interval.
bool has_content () const override
 Checks if the cache has any content.
Public Member Functions inherited from zrythm::dsp::TimelineDataCache
 TimelineDataCache (QObject *parent=nullptr)
void clear ()
 Clears all cached data and emits cachedRangesChanged.
void finalize_changes ()
 Finalizes changes, prepares cached data for access, and emits cachedRangesChanged.
Q_SIGNAL void cachedRangesChanged (std::vector< IntervalType > ranges) const
 Emitted when the cache content changes (after finalize_changes or clear).

Additional Inherited Members

Public Types inherited from zrythm::dsp::TimelineDataCache
using IntervalType = std::pair<units::sample_t, units::sample_t>
Static Protected Member Functions inherited from zrythm::dsp::TimelineDataCache
static bool intervals_overlap (IntervalType a, IntervalType b) noexcept
 Returns true if two intervals truly overlap (adjacent intervals do not count).

Detailed Description

MIDI-specific timeline data cache.

Handles caching of MIDI sequences with thread-safe access and range-based updates.

Definition at line 111 of file timeline_data_cache.h.

Constructor & Destructor Documentation

◆ MidiTimelineDataCache()

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

Definition at line 114 of file timeline_data_cache.h.

Member Function Documentation

◆ add_midi_sequence()

void zrythm::dsp::MidiTimelineDataCache::add_midi_sequence ( IntervalType interval,
const juce::MidiMessageSequence & sequence )

Adds a MIDI sequence for the given interval.

Parameters
intervalThe time interval (in samples).
sequenceThe MIDI message sequence.

◆ get_midi_events()

const juce::MidiMessageSequence & zrythm::dsp::MidiTimelineDataCache::get_midi_events ( ) const
inline

Gets the cached MIDI events.

Returns
Reference to the merged MIDI message sequence.

Definition at line 134 of file timeline_data_cache.h.

◆ has_content()

bool zrythm::dsp::MidiTimelineDataCache::has_content ( ) const
overridevirtual

Checks if the cache has any content.

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

Implements zrythm::dsp::TimelineDataCache.

◆ remove_sequences_matching_interval()

void zrythm::dsp::MidiTimelineDataCache::remove_sequences_matching_interval ( IntervalType interval)
overridevirtual

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.

Implements zrythm::dsp::TimelineDataCache.


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