AutomationModel.hpp
1 #pragma once
2 
3 #include <State/Address.hpp>
4 #include <State/Unit.hpp>
5 
6 #include <Process/TimeValue.hpp>
7 
8 #include <Curve/Process/CurveProcessModel.hpp>
9 
10 #include <Automation/AutomationProcessMetadata.hpp>
11 #include <Automation/State/AutomationState.hpp>
12 
14 #include <score/serialization/VisitorInterface.hpp>
15 
16 #include <QString>
17 
18 #include <verdigris>
19 
20 class DataStream;
21 class JSONObject;
22 
23 namespace Process
24 {
25 class ProcessModel;
26 class Outlet;
27 }
28 class QObject;
29 #include <score/model/Identifier.hpp>
30 
31 #include <score_plugin_automation_export.h>
32 
33 namespace Automation
34 {
35 class SCORE_PLUGIN_AUTOMATION_EXPORT ProcessModel final : public Curve::CurveProcessModel
36 {
37  SCORE_SERIALIZE_FRIENDS
38  PROCESS_METADATA_IMPL(Automation::ProcessModel)
39 
40  W_OBJECT(ProcessModel)
41 
42  // Min and max to scale the curve with at execution
43 
44 public:
46  const TimeVal& duration, const Id<Process::ProcessModel>& id, QObject* parent);
47  ~ProcessModel() override;
48 
49  ProcessModel(DataStream::Deserializer& vis, QObject* parent);
50  ProcessModel(JSONObject::Deserializer& vis, QObject* parent);
51 
52  const ::State::AddressAccessor& address() const;
53 
54  double min() const;
55  double max() const;
56 
57  void setAddress(const ::State::AddressAccessor& arg);
58  void setMin(double arg);
59  void setMax(double arg);
60 
61  State::Unit unit() const;
62  void setUnit(const State::Unit&);
63 
64  bool tween() const;
65  void setTween(bool tween);
66 
67  QString prettyName() const noexcept override;
68  QString prettyValue(double x, double y) const noexcept override;
69  std::unique_ptr<Process::Outlet> outlet;
70 
71 public:
72  void addressChanged(const ::State::AddressAccessor& arg_1)
73  E_SIGNAL(SCORE_PLUGIN_AUTOMATION_EXPORT, addressChanged, arg_1)
74  void minChanged(double arg_1)
75  E_SIGNAL(SCORE_PLUGIN_AUTOMATION_EXPORT, minChanged, arg_1)
76  void maxChanged(double arg_1)
77  E_SIGNAL(SCORE_PLUGIN_AUTOMATION_EXPORT, maxChanged, arg_1)
78  void tweenChanged(bool tween)
79  E_SIGNAL(SCORE_PLUGIN_AUTOMATION_EXPORT, tweenChanged, tween)
80  void unitChanged(const State::Unit& arg_1)
81  E_SIGNAL(SCORE_PLUGIN_AUTOMATION_EXPORT, unitChanged, arg_1)
82 
83  PROPERTY(State::Unit, unit READ unit WRITE setUnit NOTIFY unitChanged)
84  PROPERTY(bool, tween READ tween WRITE setTween NOTIFY tweenChanged)
85  PROPERTY(double, max READ max WRITE setMax NOTIFY maxChanged)
86  PROPERTY(double, min READ min WRITE setMin NOTIFY minChanged)
87  PROPERTY(
89  address READ address WRITE setAddress NOTIFY addressChanged)
90 
91 private:
92  void init();
93 
95  void setDurationAndScale(const TimeVal& newDuration) noexcept override;
96  void setDurationAndGrow(const TimeVal& newDuration) noexcept override;
97  void setDurationAndShrink(const TimeVal& newDuration) noexcept override;
98 
99  void loadPreset(const Process::Preset& preset) override;
100  Process::Preset savePreset() const noexcept override;
101 
102  std::optional<Process::MagneticInfo>
103  magneticPosition(const QObject* o, const TimeVal t) const noexcept override;
104 
106  ProcessState* startStateData() const noexcept override;
107  ProcessState* endStateData() const noexcept override;
108 
109  void setCurve_impl() override;
110 
111  ProcessState* m_startState{};
112  ProcessState* m_endState{};
113  bool m_tween = false;
114 };
115 }
Definition: AutomationModel.hpp:36
Definition: AutomationState.hpp:20
Definition: CurveProcessModel.hpp:11
Definition: VisitorInterface.hpp:53
Definition: DataStreamVisitor.hpp:202
Definition: VisitorInterface.hpp:61
Definition: JSONVisitor.hpp:423
Definition: QmlObjects.hpp:51
The id_base_t class.
Definition: Identifier.hpp:57
Namespace related to the Automation process.
Definition: AutomationColors.cpp:8
Base classes and tools to implement processes and layers.
Definition: JSONVisitor.hpp:1324
Definition: Preset.hpp:32
Definition: Address.hpp:108
Definition: Unit.hpp:18
Definition: TimeValue.hpp:21