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
11
namespace
zrythm::dsp
12
{
13
class
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
20
public
:
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
30
private
:
31
Q_SLOT
void
updateTicks ();
32
33
private
:
34
Playhead
&playhead_;
35
double
last_ticks_ = 0.0;
36
utils::QObjectUniquePtr<QTimer>
timer_;
37
};
38
39
}
// namespace zrythm::dsp
zrythm::dsp::Playhead
Provides thread-safe playhead positioning with sample-accurate timing.
Definition
playhead.h:63
zrythm::utils::QObjectUniquePtr
A unique pointer for QObject objects that also works with QObject-based ownership.
Definition
qt.h:38
src
dsp
playhead_qml_adapter.h
Generated by
1.15.0