Zrythm v2.0.0-alpha.1
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
tempo_object_manager.h
1// SPDX-FileCopyrightText: © 2025 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include "structure/arrangement/arranger_object_owner.h"
7#include "structure/arrangement/tempo_object.h"
8#include "structure/arrangement/time_signature_object.h"
9#include "utils/uuid_identifiable_object.h"
10
11namespace zrythm::structure::arrangement
12{
13
17class TempoObjectManager final
18 : public utils::UuidIdentifiableObject<TempoObjectManager>,
19 public ArrangerObjectOwner<TempoObject>,
20 public ArrangerObjectOwner<TimeSignatureObject>
21{
22 Q_OBJECT
23 QML_ELEMENT
24 DEFINE_ARRANGER_OBJECT_OWNER_QML_PROPERTIES (
25 TempoObjectManager,
26 tempoObjects,
28 DEFINE_ARRANGER_OBJECT_OWNER_QML_PROPERTIES (
29 TempoObjectManager,
30 timeSignatureObjects,
32 QML_UNCREATABLE ("")
33
34public:
35 TempoObjectManager (
36 utils::IObjectRegistry &registry,
37 QObject * parent = nullptr);
38
51
52 friend void init_from (
53 TempoObjectManager &obj,
54 const TempoObjectManager &other,
55 utils::ObjectCloneType clone_type);
56
57 std::string
58 get_field_name_for_serialization (const TempoObject *) const override
59 {
60 return std::string{ kTempoObjectsKey };
61 }
62
63 std::string
64 get_field_name_for_serialization (const TimeSignatureObject *) const override
65 {
66 return std::string{ kTimeSignatureObjectsKey };
67 }
68
69private:
70 static constexpr auto kTempoObjectsKey = "tempoObjects"sv;
71 static constexpr auto kTimeSignatureObjectsKey = "timeSignatureObjects"sv;
72 friend void to_json (nlohmann::json &j, const TempoObjectManager &manager);
73 friend void from_json (const nlohmann::json &j, TempoObjectManager &manager);
74};
75
76} // namespace zrythm::structure::arrangement
void sync_to_tempo_map(dsp::TempoMapWrapper &wrapper)
Rebuilds the given tempo map from this manager's objects.
Abstract interface for a UUID-keyed object registry.
CRTP base that adds a typed UUID strong-typedef to a class hierarchy.