Vst/Control.hpp
1 #pragma once
2 #include <Dataflow/PortItem.hpp>
3 #include <Vst/EffectModel.hpp>
4 
5 #include <verdigris>
6 
7 namespace Process
8 {
9 struct Context;
10 }
11 namespace vst
12 {
13 
14 class ControlInlet final : public Process::Inlet
15 {
16  W_OBJECT(ControlInlet)
17  SCORE_SERIALIZE_FRIENDS
18 public:
19  MODEL_METADATA_IMPL(ControlInlet)
20  ControlInlet(Id<Process::Port> c, QObject* parent)
21  : Inlet{std::move(c), parent}
22  {
23  }
24 
25  ControlInlet(DataStream::Deserializer& vis, QObject* parent)
26  : Inlet{vis, parent}
27  {
28  vis.writeTo(*this);
29  }
30  ControlInlet(JSONObject::Deserializer& vis, QObject* parent)
31  : Inlet{vis, parent}
32  {
33  vis.writeTo(*this);
34  }
35  ControlInlet(DataStream::Deserializer&& vis, QObject* parent)
36  : Inlet{vis, parent}
37  {
38  vis.writeTo(*this);
39  }
40  ControlInlet(JSONObject::Deserializer&& vis, QObject* parent)
41  : Inlet{vis, parent}
42  {
43  vis.writeTo(*this);
44  }
45 
46  VIRTUAL_CONSTEXPR Process::PortType type() const noexcept override
47  {
48  return Process::PortType::Message;
49  }
50 
51  int fxNum{};
52 
53  float value() const { return m_value; }
54  void setValue(float v)
55  {
56  if(v != m_value)
57  {
58  m_value = v;
59  valueChanged(v);
60  }
61  }
62 
63  inline void setExecutionValue(float value) { executionValueChanged(value); }
64 
65 public:
66  void valueChanged(float arg_1) W_SIGNAL(valueChanged, arg_1);
67  void executionValueChanged(float arg_1) W_SIGNAL(executionValueChanged, arg_1);
68 
69 private:
70  float m_value{};
71 };
72 
74 {
75 public:
76  using Dataflow::AutomatablePortItem::AutomatablePortItem;
77 
78  void setupMenu(QMenu& menu, const score::DocumentContext& ctx) override;
79  bool on_createAutomation(
80  const Scenario::IntervalModel& cst, std::function<void(score::Command*)> macro,
81  const score::DocumentContext& ctx) override;
82 };
83 
85 {
86 public:
87  ~ControlPortFactory() override;
88 
89  UuidKey<Process::Port> concreteKey() const noexcept override;
90 
91  Process::Port* load(const VisitorVariant& vis, QObject* parent) override;
92 
93  Dataflow::PortItem* makePortItem(
94  Process::Inlet& port, const Process::Context& ctx, QGraphicsItem* parent,
95  QObject* context) override;
96 
97  Dataflow::PortItem* makePortItem(
98  Process::Outlet& port, const Process::Context& ctx, QGraphicsItem* parent,
99  QObject* context) override;
100 
101  void setupInletInspector(
102  const Process::Inlet& port, const score::DocumentContext& ctx, QWidget* parent,
103  Inspector::Layout& lay, QObject* context) override;
104 };
105 }
Definition: DataStreamVisitor.hpp:202
Definition: score-plugin-dataflow/Dataflow/PortItem.hpp:22
Definition: score-lib-process/Process/Dataflow/PortItem.hpp:39
Definition: lib/score/widgets/Layout.hpp:29
Definition: JSONVisitor.hpp:423
Definition: Port.hpp:177
Definition: Port.hpp:273
Definition: PortFactory.hpp:30
Definition: Port.hpp:102
Definition: IntervalModel.hpp:50
Definition: UuidKey.hpp:343
The id_base_t class.
Definition: Identifier.hpp:57
The Command class.
Definition: Command.hpp:34
Definition: Vst/Control.hpp:15
Definition: Vst/Control.hpp:85
Base classes and tools to implement processes and layers.
Definition: JSONVisitor.hpp:1324
Definition: ProcessContext.hpp:12
The VisitorVariant struct.
Definition: VisitorInterface.hpp:26
Definition: DocumentContext.hpp:18
Definition: Vst/Control.hpp:74