Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
playback_cache_scheduler.h
1// SPDX-FileCopyrightText: © 2025 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include <chrono>
7
8#include "utils/debouncer.h"
9#include "utils/expandable_tick_range.h"
10#include "utils/qt.h"
11
12using namespace std::chrono_literals;
13
14namespace zrythm::utils
15{
26class PlaybackCacheScheduler : public QObject
27{
28 Q_OBJECT
29
30public:
31 PlaybackCacheScheduler (QObject * parent = nullptr);
32
33 Q_INVOKABLE void
34 queueCacheRequestForRange (double affectedTickStart, double affectedTickEnd);
35
36 Q_INVOKABLE void queueFullCacheRequest ();
37
38 Q_INVOKABLE void queueCacheRequest (utils::ExpandableTickRange affectedRange);
39
43 void setDelay (std::chrono::milliseconds delay);
44
45Q_SIGNALS:
46 void cacheRequested (utils::ExpandableTickRange affectedRange);
47
48private:
49 void execute_pending_request ();
50
51private:
53 std::optional<utils::ExpandableTickRange> affected_range_;
54};
55}
void setDelay(std::chrono::milliseconds delay)
Sets the delay to be used starting from the next cache request.
A unique pointer for QObject objects that also works with QObject-based ownership.
Definition qt.h:38
String utilities.
Definition algorithms.h:12