Zrythm v2.0.0-alpha.1
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
automation_clip.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 <utility>
7
8#include "dsp/tick_types.h"
9#include "structure/arrangement/arranger_object_owner.h"
10#include "structure/arrangement/automation_point.h"
11#include "structure/arrangement/clip.h"
12
13namespace zrythm::structure::arrangement
14{
20class AutomationClip final
21 : public Clip,
22 public ArrangerObjectOwner<AutomationPoint>
23{
24 Q_OBJECT
25 DEFINE_ARRANGER_OBJECT_OWNER_QML_PROPERTIES (
27 automationPoints,
29 QML_ELEMENT
30 QML_UNCREATABLE ("")
31
32public:
34 const dsp::TempoMapWrapper &tempo_map_wrapper,
35 utils::IObjectRegistry &registry,
36 QObject * parent = nullptr);
37
38 // ========================================================================
39 // QML Interface
40 // ========================================================================
41
42 // ========================================================================
43
47 AutomationPoint * get_prev_ap (const AutomationPoint &ap) const;
48
55 [[gnu::hot]] AutomationPoint *
56 get_next_ap (const AutomationPoint &ap, bool check_positions) const;
57
66 [[gnu::hot]] double
67 get_normalized_value_in_curve (const AutomationPoint &ap, double x) const;
68
79 std::pair<float, AutomationPoint *>
80 get_value_at_virt_tick (dsp::ContentTick virt_tick) const;
81
82 std::string
83 get_field_name_for_serialization (const AutomationPoint *) const override
84 {
85 return "automationPoints";
86 }
87
88 std::vector<ArrangerObjectListModel *> get_child_list_models () const override
89 {
90 return { ArrangerObjectOwner<AutomationPoint>::get_model () };
91 }
92
93 void shift_all_children (dsp::ContentTick delta) override;
94
95 std::optional<dsp::ContentTick> first_child_position () const override;
96
97private:
98 friend void init_from (
99 AutomationClip &obj,
100 const AutomationClip &other,
101 utils::ObjectCloneType clone_type);
102
103 friend void to_json (nlohmann::json &j, const AutomationClip &clip);
104 friend void from_json (const nlohmann::json &j, AutomationClip &clip);
105
106private:
107 BOOST_DESCRIBE_CLASS (
109 (Clip, ArrangerObjectOwner<AutomationPoint>),
110 (),
111 (),
112 ())
113};
114}
Represents an automation clip, which contains a collection of automation points.
An automation point inside an AutomationTrack.
virtual std::optional< dsp::ContentTick > first_child_position() const =0
Returns the position of the first child, if any.
Abstract interface for a UUID-keyed object registry.