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 <QtQmlIntegration>
10
11namespace zrythm::dsp
12{
13class PlayheadQmlWrapper : public QObject
14{
15 Q_OBJECT
16 Q_PROPERTY (double ticks READ ticks WRITE setTicks NOTIFY ticksChanged)
17 QML_NAMED_ELEMENT (Playhead)
18 QML_UNCREATABLE ("")
19
20public:
21 explicit PlayheadQmlWrapper (Playhead &playhead, QObject * parent = nullptr);
22
23 double ticks () const;
24 void setTicks (double ticks);
25
26 Q_SIGNAL void ticksChanged ();
27
28 auto &playhead () const { return playhead_; }
29
30private:
31 Q_SLOT void updateTicks ();
32
33private:
34 Playhead &playhead_;
35 double last_ticks_ = 0.0;
37};
38
39} // 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