Zrythm v2.0.0-alpha.1
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 (
27 const dsp::TempoMapWrapper &tempo_map_wrapper,
28 QObject * parent = nullptr);
29
30 dsp::TimelinePosition * position () const override
31 {
32 return static_cast<dsp::TimelinePosition *> (ArrangerObject::position ());
33 }
34
35 // =========================================================
36 // QML Interface
37 // =========================================================
38
39 MusicalScale * scale () const { return scale_.get (); }
40 void setScale (MusicalScale * scale);
41 Q_SIGNAL void scaleChanged (MusicalScale * scale);
42
43 // =========================================================
44
45private:
46 friend void init_from (
47 ScaleObject &obj,
48 const ScaleObject &other,
49 utils::ObjectCloneType clone_type);
50
51 static constexpr auto kScaleKey = "scale"sv;
52 friend void to_json (nlohmann::json &j, const ScaleObject &so);
53 friend void from_json (const nlohmann::json &j, ScaleObject &so);
54
55private:
58
59 BOOST_DESCRIBE_CLASS (ScaleObject, (ArrangerObject), (), (), (scale_))
60};
61
62} // namespace zrythm::structure::arrangement
Musical scale descriptor.
A Position whose ticks are absolute timeline ticks.
Definition position.h:97
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