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
12
namespace
zrythm::dsp
13
{
14
class
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
21
public
:
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
31
private
:
32
Q_SLOT
void
updateTicks ();
33
34
private
:
35
Playhead
&playhead_;
36
double
last_ticks_ = 0.0;
37
utils::QObjectUniquePtr<QTimer>
timer_;
38
};
39
40
}
// 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