Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
chord_object.h
1// SPDX-FileCopyrightText: © 2018-2022, 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{
18class ChordObject final : public ArrangerObject
19{
20 Q_OBJECT
21 Q_PROPERTY (
22 int chordDescriptorIndex READ chordDescriptorIndex WRITE
23 setChordDescriptorIndex NOTIFY chordDescriptorIndexChanged)
24 QML_ELEMENT
25 QML_UNCREATABLE ("")
26
27public:
28 ChordObject (const dsp::TempoMap &tempo_map, QObject * parent = nullptr);
29
30 // ========================================================================
31 // QML Interface
32 // ========================================================================
33
34 int chordDescriptorIndex () const { return chord_index_; }
35 void setChordDescriptorIndex (int descr);
36 Q_SIGNAL void chordDescriptorIndexChanged (int);
37
38 // ========================================================================
39
40private:
41 friend void init_from (
42 ChordObject &obj,
43 const ChordObject &other,
44 utils::ObjectCloneType clone_type);
45
46 static constexpr auto kChordIndexKey = "chordIndex"sv;
47 friend void to_json (nlohmann::json &j, const ChordObject &co)
48 {
49 to_json (j, static_cast<const ArrangerObject &> (co));
50 j[kChordIndexKey] = co.chord_index_;
51 }
52 friend void from_json (const nlohmann::json &j, ChordObject &co)
53 {
54 from_json (j, static_cast<ArrangerObject &> (co));
55 j.at (kChordIndexKey).get_to (co.chord_index_);
56 }
57
58private:
60 int chord_index_ = 0;
61
62 BOOST_DESCRIBE_CLASS (ChordObject, (ArrangerObject), (), (), (chord_index_))
63};
64
65}
ArrangerObject(Type type, const dsp::TempoMap &tempo_map, ArrangerObjectFeatures features, QObject *parent=nullptr) noexcept
Construct a new ArrangerObject.