Zrythm v2.0.0-alpha.1
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
automation_region.h
1// SPDX-FileCopyrightText: © 2019-2022, 2024-2026 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 utils::IObjectRegistry &registry,
32 QObject * parent = nullptr);
33
34 // ========================================================================
35 // QML Interface
36 // ========================================================================
37
38 // ========================================================================
39
43 AutomationPoint * get_prev_ap (const AutomationPoint &ap) const;
44
51 [[gnu::hot]] AutomationPoint *
52 get_next_ap (const AutomationPoint &ap, bool check_positions) const;
53
62 [[gnu::hot]] double
63 get_normalized_value_in_curve (const AutomationPoint &ap, double x) const;
64
69 bool curves_up (const AutomationPoint &ap) const;
70
71 std::string
72 get_field_name_for_serialization (const AutomationPoint *) const override
73 {
74 return "automationPoints";
75 }
76
77 std::vector<ArrangerObjectListModel *> get_child_list_models () const override
78 {
79 return { ArrangerObjectOwner<AutomationPoint>::get_model () };
80 }
81
82private:
83 friend void init_from (
85 const AutomationRegion &other,
86 utils::ObjectCloneType clone_type);
87
88 friend void to_json (nlohmann::json &j, const AutomationRegion &region);
89 friend void from_json (const nlohmann::json &j, AutomationRegion &region);
90
91private:
92 BOOST_DESCRIBE_CLASS (
94 (ArrangerObject, ArrangerObjectOwner<AutomationPoint>),
95 (),
96 (),
97 ())
98};
99}
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.
Abstract interface for a UUID-keyed object registry.