Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
automation_region.h
1// SPDX-FileCopyrightText: © 2019-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_owner.h"
7#include "structure/arrangement/automation_point.h"
8
9namespace zrythm::structure::arrangement
10{
17 : public ArrangerObject,
18 public ArrangerObjectOwner<AutomationPoint>
19{
20 Q_OBJECT
21 DEFINE_ARRANGER_OBJECT_OWNER_QML_PROPERTIES (
23 automationPoints,
25 QML_ELEMENT
26 QML_UNCREATABLE ("")
27
28public:
30 const dsp::TempoMap &tempo_map,
31 ArrangerObjectRegistry &object_registry,
32 dsp::FileAudioSourceRegistry &file_audio_source_registry,
33 QObject * parent = nullptr);
34
35 // ========================================================================
36 // QML Interface
37 // ========================================================================
38
39 // ========================================================================
40
44 AutomationPoint * get_prev_ap (const AutomationPoint &ap) const;
45
52 [[gnu::hot]] AutomationPoint *
53 get_next_ap (const AutomationPoint &ap, bool check_positions) const;
54
63 [[gnu::hot]] double
64 get_normalized_value_in_curve (const AutomationPoint &ap, double x) const;
65
70 bool curves_up (const AutomationPoint &ap) const;
71
72 std::string
73 get_field_name_for_serialization (const AutomationPoint *) const override
74 {
75 return "automationPoints";
76 }
77
78private:
79 friend void init_from (
81 const AutomationRegion &other,
82 utils::ObjectCloneType clone_type);
83
84 friend void to_json (nlohmann::json &j, const AutomationRegion &region)
85 {
86 to_json (j, static_cast<const ArrangerObject &> (region));
87 to_json (j, static_cast<const ArrangerObjectOwner &> (region));
88 }
89 friend void from_json (const nlohmann::json &j, AutomationRegion &region)
90 {
91 from_json (j, static_cast<ArrangerObject &> (region));
92 from_json (j, static_cast<ArrangerObjectOwner &> (region));
93 }
94
95private:
96 BOOST_DESCRIBE_CLASS (
98 (ArrangerObject, ArrangerObjectOwner<AutomationPoint>),
99 (),
100 (),
101 ())
102};
103}
ArrangerObject(Type type, const dsp::TempoMap &tempo_map, ArrangerObjectFeatures features, QObject *parent=nullptr) noexcept
Construct a new ArrangerObject.
An automation point inside an AutomationTrack.
Represents an automation region, which contains a collection of automation points.