Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
playhead_qml_adapter.h
1// SPDX-FileCopyrightText: © 2025 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include "dsp/playhead.h"
7#include "utils/qt.h"
8
9#include <QTimer>
10#include <QtQmlIntegration/qqmlintegration.h>
11
12namespace zrythm::dsp
13{
14class PlayheadQmlWrapper : public QObject
15{
16 Q_OBJECT
17 Q_PROPERTY (double ticks READ ticks WRITE setTicks NOTIFY ticksChanged)
18 QML_NAMED_ELEMENT (Playhead)
19 QML_UNCREATABLE ("")
20
21public:
22 explicit PlayheadQmlWrapper (Playhead &playhead, QObject * parent = nullptr);
23
24 double ticks () const;
25 void setTicks (double ticks);
26
27 Q_SIGNAL void ticksChanged ();
28
29 auto &playhead () const { return playhead_; }
30
31private:
32 Q_SLOT void updateTicks ();
33
34private:
35 Playhead &playhead_;
36 double last_ticks_ = 0.0;
38};
39
40} // namespace zrythm::dsp
Provides thread-safe playhead positioning with sample-accurate timing.
Definition playhead.h:63
A unique pointer for QObject objects that also works with QObject-based ownership.
Definition qt.h:38