Zrythm v2.0.0-alpha.1
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
marker.h
1// SPDX-FileCopyrightText: © 2019-2021, 2024-2026 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include "structure/arrangement/arranger_object.h"
7#include "utils/icloneable.h"
8
9#include <nlohmann/json_fwd.hpp>
10
11namespace zrythm::structure::arrangement
12{
13
17class Marker final : public ArrangerObject
18{
19 Q_OBJECT
20 Q_PROPERTY (Marker::MarkerType markerType READ markerType CONSTANT)
21 QML_ELEMENT
22 QML_UNCREATABLE ("")
23
24public:
28 enum class MarkerType : std::uint8_t
29 {
36 };
37 Q_ENUM (MarkerType)
38
39 Marker (
40 const dsp::TempoMapWrapper &tempo_map_wrapper,
41 MarkerType type,
42 QObject * parent = nullptr);
43
44 dsp::TimelinePosition * position () const override
45 {
46 return static_cast<dsp::TimelinePosition *> (ArrangerObject::position ());
47 }
48
49 // ========================================================================
50 // QML Interface
51 // ========================================================================
52
53 auto markerType () const { return marker_type_; }
54
55 Q_INVOKABLE bool isStartMarker () const
56 {
57 return marker_type_ == MarkerType::Start;
58 }
59 Q_INVOKABLE bool isEndMarker () const
60 {
61 return marker_type_ == MarkerType::End;
62 }
63
64 // ========================================================================
65
66private:
67 friend void
68 init_from (Marker &obj, const Marker &other, utils::ObjectCloneType clone_type);
69
70 static constexpr auto kMarkerTypeKey = "markerType"sv;
71 friend void to_json (nlohmann::json &j, const Marker &m);
72 friend void from_json (const nlohmann::json &j, Marker &m);
73
74private:
76 MarkerType marker_type_ = MarkerType::Custom;
77
78 BOOST_DESCRIBE_CLASS (Marker, (ArrangerObject), (), (), (marker_type_))
79};
80
81} // namespace zrythm::structure::arrangement
A Position whose ticks are absolute timeline ticks.
Definition position.h:97
ArrangerObject(Type type, const dsp::TempoMapWrapper &tempo_map_wrapper, ArrangerObjectFeatures features, QObject *parent=nullptr) noexcept
Construct a new ArrangerObject.
Marker for the MarkerTrack.
Definition marker.h:18
@ End
Song end Marker that cannot be deleted.
Definition marker.h:33
@ Start
Song start Marker that cannot be deleted.
Definition marker.h:31