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
12namespace zrythm::utils
13{
24class PlaybackCacheScheduler : public QObject
25{
26 Q_OBJECT
27 Q_PROPERTY (bool isPending READ isPending NOTIFY isPendingChanged)
28
29public:
30 PlaybackCacheScheduler (QObject * parent = nullptr);
31
32 Q_INVOKABLE void
33 queueCacheRequestForRange (double affectedTickStart, double affectedTickEnd);
34
35 Q_INVOKABLE void queueFullCacheRequest ();
36
37 Q_INVOKABLE void queueCacheRequest (utils::ExpandableTickRange affectedRange);
38
42 void setDelay (std::chrono::milliseconds delay);
43
44 [[nodiscard]] bool isPending () const { return debouncer_->is_pending (); }
45
46Q_SIGNALS:
47 void cacheRequested (utils::ExpandableTickRange affectedRange);
48 void isPendingChanged ();
49
50private:
51 void execute_pending_request ();
52
53private:
55 std::optional<utils::ExpandableTickRange> affected_range_;
56};
57}
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:36
String utilities.