Zrythm v2.0.0-alpha.1
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
chord_object.h
1// SPDX-FileCopyrightText: © 2018-2022, 2024-2026 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include "dsp/chord_descriptor.h"
7#include "structure/arrangement/arranger_object.h"
8#include "utils/icloneable.h"
9#include "utils/qt.h"
10
11namespace zrythm::structure::arrangement
12{
13
19class ChordObject final : public ArrangerObject
20{
21 Q_OBJECT
22 Q_PROPERTY (
23 zrythm::dsp::ChordDescriptor * chordDescriptor READ chordDescriptor CONSTANT)
24 QML_ELEMENT
25 QML_UNCREATABLE ("")
26
27public:
28 ChordObject (
29 const dsp::TempoMapWrapper &tempo_map_wrapper,
30 QObject * parent = nullptr);
31
32 dsp::ContentPosition * position () const override
33 {
34 return qobject_cast<dsp::ContentPosition *> (ArrangerObject::position ());
35 }
36
37 // ========================================================================
38 // QML Interface
39 // ========================================================================
40
41 dsp::ChordDescriptor * chordDescriptor () const
42 {
43 return chord_descriptor_.get ();
44 }
45
46 // ========================================================================
47
48private:
49 friend void init_from (
50 ChordObject &obj,
51 const ChordObject &other,
52 utils::ObjectCloneType clone_type);
53
54 static constexpr auto kChordDescriptorKey = "chordDescriptor"sv;
55 friend void to_json (nlohmann::json &j, const ChordObject &co);
56 friend void from_json (const nlohmann::json &j, ChordObject &co);
57
58private:
60
61 BOOST_DESCRIBE_CLASS (ChordObject, (ArrangerObject), (), (), (chord_descriptor_))
62};
63
64}
Describes a musical chord by its root note, type, accent, inversion, and optional bass note.
A Position whose ticks are content-space (clip-local) ticks.
Definition position.h:118
ArrangerObject(Type type, const dsp::TempoMapWrapper &tempo_map_wrapper, ArrangerObjectFeatures features, QObject *parent=nullptr) noexcept
Construct a new ArrangerObject.
A unique pointer for QObject objects that also works with QObject-based ownership.
Definition qt.h:36