Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
marker.h
1// SPDX-FileCopyrightText: © 2019-2021, 2024-2025 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
9namespace zrythm::structure::arrangement
10{
11
15class Marker final : public ArrangerObject
16{
17 Q_OBJECT
18 Q_PROPERTY (Marker::MarkerType markerType READ markerType CONSTANT)
19 QML_ELEMENT
20 QML_UNCREATABLE ("")
21
22public:
26 enum class MarkerType : std::uint8_t
27 {
34 };
35 Q_ENUM (MarkerType)
36
37 Marker (
38 const dsp::TempoMap &tempo_map,
39 MarkerType type,
40 QObject * parent = nullptr);
41
42 // ========================================================================
43 // QML Interface
44 // ========================================================================
45
46 auto markerType () const { return marker_type_; }
47
48 Q_INVOKABLE bool isStartMarker () const
49 {
50 return marker_type_ == MarkerType::Start;
51 }
52 Q_INVOKABLE bool isEndMarker () const
53 {
54 return marker_type_ == MarkerType::End;
55 }
56
57 // ========================================================================
58
59private:
60 friend void
61 init_from (Marker &obj, const Marker &other, utils::ObjectCloneType clone_type);
62
63 static constexpr auto kMarkerTypeKey = "markerType"sv;
64 friend void to_json (nlohmann::json &j, const Marker &m)
65 {
66 to_json (j, static_cast<const ArrangerObject &> (m));
67 j[kMarkerTypeKey] = m.marker_type_;
68 }
69 friend void from_json (const nlohmann::json &j, Marker &m)
70 {
71 from_json (j, static_cast<ArrangerObject &> (m));
72 j.at (kMarkerTypeKey).get_to (m.marker_type_);
73 }
74
75private:
77 MarkerType marker_type_ = MarkerType::Custom;
78
79 BOOST_DESCRIBE_CLASS (Marker, (ArrangerObject), (), (), (marker_type_))
80};
81
82} // namespace zrythm::structure::arrangement
ArrangerObject(Type type, const dsp::TempoMap &tempo_map, ArrangerObjectFeatures features, QObject *parent=nullptr) noexcept
Construct a new ArrangerObject.
Marker for the MarkerTrack.
Definition marker.h:16
@ End
Song end Marker that cannot be deleted.
Definition marker.h:31
@ Start
Song start Marker that cannot be deleted.
Definition marker.h:29