Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
scale_object.h
1// SPDX-FileCopyrightText: © 2018-2021, 2024-2025 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include "dsp/musical_scale.h"
7#include "structure/arrangement/arranger_object.h"
8#include "utils/icloneable.h"
9
10namespace zrythm::structure::arrangement
11{
12
13class ScaleObject final : public ArrangerObject
14{
15 Q_OBJECT
16 Q_PROPERTY (
17 zrythm::dsp::MusicalScale * scale READ scale WRITE setScale NOTIFY
18 scaleChanged)
19 QML_ELEMENT
20 QML_UNCREATABLE ("")
21
22public:
23 using MusicalScale = dsp::MusicalScale;
24
25public:
26 ScaleObject (const dsp::TempoMap &tempo_map, QObject * parent = nullptr);
27
28 // =========================================================
29 // QML Interface
30 // =========================================================
31
32 MusicalScale * scale () const { return scale_.get (); }
33 void setScale (MusicalScale * scale);
34 Q_SIGNAL void scaleChanged (MusicalScale * scale);
35
36 // =========================================================
37
38private:
39 friend void init_from (
40 ScaleObject &obj,
41 const ScaleObject &other,
42 utils::ObjectCloneType clone_type);
43
44 static constexpr auto kScaleKey = "scale"sv;
45 friend void to_json (nlohmann::json &j, const ScaleObject &so);
46 friend void from_json (const nlohmann::json &j, ScaleObject &so);
47
48private:
51
52 BOOST_DESCRIBE_CLASS (ScaleObject, (ArrangerObject), (), (), (scale_))
53};
54
55} // namespace zrythm::structure::arrangement
Musical scale descriptor.
ArrangerObject(Type type, const dsp::TempoMap &tempo_map, 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:38