Zrythm v2.0.0-alpha.1
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
chord_clip.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_owner.h"
7#include "structure/arrangement/chord_object.h"
8#include "structure/arrangement/clip.h"
9
10namespace zrythm::structure::arrangement
11{
12class ChordClip final : public Clip, public ArrangerObjectOwner<ChordObject>
13{
14 Q_OBJECT
15 DEFINE_ARRANGER_OBJECT_OWNER_QML_PROPERTIES (
17 chordObjects,
19 QML_ELEMENT
20 QML_UNCREATABLE ("")
21
22public:
23 ChordClip (
24 const dsp::TempoMapWrapper &tempo_map_wrapper,
25 utils::IObjectRegistry &registry,
26 QObject * parent = nullptr);
27
28 // ========================================================================
29 // QML Interface
30 // ========================================================================
31
32 // ========================================================================
33
34 std::string
35 get_field_name_for_serialization (const ChordObject *) const override
36 {
37 return "chordObjects";
38 }
39
40 std::vector<ArrangerObjectListModel *> get_child_list_models () const override
41 {
42 return { ArrangerObjectOwner<ChordObject>::get_model () };
43 }
44
45 void shift_all_children (dsp::ContentTick delta) override;
46
47 std::optional<dsp::ContentTick> first_child_position () const override;
48
49private:
50 friend void init_from (
51 ChordClip &obj,
52 const ChordClip &other,
53 utils::ObjectCloneType clone_type);
54
55 friend void to_json (nlohmann::json &j, const ChordClip &clip)
56 {
57 to_json (j, static_cast<const Clip &> (clip));
58 to_json (j, static_cast<const ArrangerObjectOwner &> (clip));
59 }
60 friend void from_json (const nlohmann::json &j, ChordClip &clip)
61 {
62 from_json (j, static_cast<Clip &> (clip));
63 from_json (j, static_cast<ArrangerObjectOwner &> (clip));
64 }
65
66private:
67 BOOST_DESCRIBE_CLASS (
69 (Clip, ArrangerObjectOwner<ChordObject>),
70 (),
71 (),
72 ())
73};
74
75}
A chord placed inside a ChordClip on the chord track.
virtual std::optional< dsp::ContentTick > first_child_position() const =0
Returns the position of the first child, if any.
Abstract interface for a UUID-keyed object registry.