2 #include <State/Address.hpp>
3 #include <State/Domain.hpp>
5 #include <Device/Address/AddressSettings.hpp>
7 #include <Process/Dataflow/PortForward.hpp>
8 #include <Process/Dataflow/PortType.hpp>
10 #include <score/model/IdentifiedObject.hpp>
11 #include <score/model/path/Path.hpp>
12 #include <score/plugins/SerializableInterface.hpp>
13 #include <score/selection/Selectable.hpp>
14 #include <score/serialization/VisitorInterface.hpp>
16 #include <ossia/detail/small_vector.hpp>
17 #include <ossia/network/value/value.hpp>
21 #include <score_lib_process_export.h>
22 #include <smallfun.hpp>
26 #if __cpp_constexpr >= 201907
27 #define VIRTUAL_CONSTEXPR constexpr
29 #define VIRTUAL_CONSTEXPR
53 "8884228a-d197-4b0a-b6ca-d1fb15291559")
56 "34e2c5a7-18c4-4759-b6cc-46feaeee06e2")
59 "769dd38a-bfb3-4dc6-b52a-b6abb7afe2a3")
62 "cff96158-cc72-46d7-99dc-b6038171375b")
65 "c18adc77-e0e0-4ddf-a46c-43cb0719a890")
68 "d8a3ed3d-b9c2-46f2-bdb3-d282a48481c6")
71 "a1574bb0-cbd4-4c7d-9417-0c25cfd1187b")
74 "a1d97535-18ac-444a-8417-0cbc1692d897")
77 "9a13fb32-269a-47bf-99a9-930188c1f19c")
80 "3620ea94-5991-41cf-89b3-11f842cc39d0")
86 static constexpr
const qreal default_margin = 5.;
87 static constexpr
const qreal default_padding = 5.;
92 QPointF label{12., 0.};
93 QPointF control{0., 12.};
94 std::optional<Qt::Alignment> labelAlignment{std::nullopt};
95 bool labelVisible{
true};
99 class SCORE_LIB_PROCESS_EXPORT
Port
104 SCORE_SERIALIZE_FRIENDS
108 bool noValueChangeOnMove{};
114 const QString& visualName()
const noexcept;
115 const QString& visualDescription()
const noexcept;
117 const QString& name()
const noexcept;
119 const std::vector<Path<Cable>>& cables()
const noexcept;
120 const QString& exposed()
const noexcept;
121 const QString& description()
const noexcept;
123 virtual PortType type()
const noexcept = 0;
129 void setName(
const QString& customData);
131 void setExposed(
const QString& add);
133 void setDescription(
const QString& add);
134 W_SLOT(setDescription);
138 void nameChanged(
const QString& name)
139 E_SIGNAL(SCORE_LIB_PROCESS_EXPORT, nameChanged, name)
140 void exposedChanged(
const QString& addr)
141 E_SIGNAL(SCORE_LIB_PROCESS_EXPORT, exposedChanged, addr)
142 void descriptionChanged(
const QString& txt)
143 E_SIGNAL(SCORE_LIB_PROCESS_EXPORT, descriptionChanged, txt)
144 void cablesChanged() E_SIGNAL(SCORE_LIB_PROCESS_EXPORT, cablesChanged)
146 E_SIGNAL(SCORE_LIB_PROCESS_EXPORT, addressChanged, address)
147 void executionReset() E_SIGNAL(SCORE_LIB_PROCESS_EXPORT, executionReset)
151 address W_READ address W_WRITE setAddress W_NOTIFY addressChanged)
152 PROPERTY(QString, name W_READ name W_WRITE setName W_NOTIFY nameChanged)
154 virtual QByteArray saveData()
const noexcept;
155 virtual void loadData(
const QByteArray& arr) noexcept;
169 std::vector<Path<Cable>> m_cables;
172 QString m_description;
181 MODEL_METADATA_IMPL_HPP(
Inlet)
185 virtual void setupExecution(ossia::inlet&)
const noexcept;
186 virtual void forChildInlets(
const smallfun::function<
void(
Inlet&)>&)
const noexcept;
187 virtual void mapExecution(
189 const smallfun::function<
void(
Inlet&, ossia::inlet&)>&)
const noexcept;
206 SCORE_SERIALIZE_FRIENDS
220 VIRTUAL_CONSTEXPR PortType type()
const noexcept
override
222 return Process::PortType::Message;
225 const ossia::value& value()
const noexcept {
return m_value; }
226 const ossia::value& init()
const noexcept {
return m_init; }
227 const State::Domain& domain()
const noexcept {
return m_domain; }
229 QByteArray saveData()
const noexcept
override;
230 void loadData(
const QByteArray& arr) noexcept
override;
233 void valueChanged(
const ossia::value& v)
234 E_SIGNAL(SCORE_LIB_PROCESS_EXPORT, valueChanged, v)
235 void initChanged(
const ossia::value& v)
236 E_SIGNAL(SCORE_LIB_PROCESS_EXPORT, initChanged, v)
237 void executionValueChanged(
const ossia::value& v)
238 E_SIGNAL(SCORE_LIB_PROCESS_EXPORT, executionValueChanged, v)
240 E_SIGNAL(SCORE_LIB_PROCESS_EXPORT, domainChanged, d)
243 void setValue(
const ossia::value& value);
245 void setInit(
const ossia::value& value);
248 inline void setExecutionValue(
const ossia::value& value)
250 executionValueChanged(value);
263 PROPERTY(
State::Domain, domain W_READ domain W_WRITE setDomain W_NOTIFY domainChanged)
264 PROPERTY(ossia::value, value W_READ value W_WRITE setValue W_NOTIFY valueChanged)
265 PROPERTY(ossia::value, init W_READ init W_WRITE setInit W_NOTIFY initChanged)
267 ossia::value m_value;
276 SCORE_SERIALIZE_FRIENDS
279 MODEL_METADATA_IMPL_HPP(
Outlet)
282 virtual void setupExecution(ossia::outlet&)
const noexcept;
283 virtual void forChildInlets(
const smallfun::function<
void(
Inlet&)>&)
const noexcept;
284 virtual void mapExecution(
286 const smallfun::function<
void(
Inlet&, ossia::inlet&)>&)
const noexcept;
303 SCORE_SERIALIZE_FRIENDS
316 VIRTUAL_CONSTEXPR PortType type()
const noexcept
override
318 return Process::PortType::Audio;
326 SCORE_SERIALIZE_FRIENDS
339 VIRTUAL_CONSTEXPR PortType type()
const noexcept
override
341 return Process::PortType::Audio;
344 void forChildInlets(
const smallfun::function<
void(
Inlet&)>&)
const noexcept
override;
347 const smallfun::function<
void(
Inlet&, ossia::inlet&)>&)
const noexcept
override;
349 QByteArray saveData()
const noexcept
override;
350 void loadData(
const QByteArray& arr) noexcept
override;
352 bool propagate()
const;
353 void setPropagate(
bool propagate);
354 void propagateChanged(
bool propagate)
355 E_SIGNAL(SCORE_LIB_PROCESS_EXPORT, propagateChanged, propagate)
358 void setGain(
double g);
359 void gainChanged(
double g) E_SIGNAL(SCORE_LIB_PROCESS_EXPORT, gainChanged, g)
363 void panChanged(
pan_weight g) E_SIGNAL(SCORE_LIB_PROCESS_EXPORT, panChanged, g)
365 std::unique_ptr<Process::ControlInlet> gainInlet;
366 std::unique_ptr<Process::ControlInlet> panInlet;
369 bool, propagate W_READ propagate W_WRITE setPropagate W_NOTIFY propagateChanged)
370 PROPERTY(
double, gain W_READ gain W_WRITE setGain W_NOTIFY gainChanged)
371 PROPERTY(
pan_weight, pan W_READ pan W_WRITE setPan W_NOTIFY panChanged)
375 bool m_propagate{
false};
382 SCORE_SERIALIZE_FRIENDS
395 VIRTUAL_CONSTEXPR PortType type()
const noexcept
override
397 return Process::PortType::Midi;
405 SCORE_SERIALIZE_FRIENDS
418 VIRTUAL_CONSTEXPR PortType type()
const noexcept
override
420 return Process::PortType::Midi;
428 SCORE_SERIALIZE_FRIENDS
442 VIRTUAL_CONSTEXPR PortType type()
const noexcept
override
444 return Process::PortType::Message;
447 QByteArray saveData()
const noexcept
override;
448 void loadData(
const QByteArray& arr) noexcept
override;
450 const ossia::value& value()
const {
return m_value; }
454 void valueChanged(
const ossia::value& v)
455 E_SIGNAL(SCORE_LIB_PROCESS_EXPORT, valueChanged, v)
456 void executionValueChanged(
const ossia::value& v)
457 E_SIGNAL(SCORE_LIB_PROCESS_EXPORT, executionValueChanged, v)
459 E_SIGNAL(SCORE_LIB_PROCESS_EXPORT, domainChanged, d)
462 void setExecutionValue(
const ossia::value& value) { executionValueChanged(value); }
464 void setValue(
const ossia::value& value)
484 PROPERTY(
State::Domain, domain W_READ domain W_WRITE setDomain W_NOTIFY domainChanged)
485 PROPERTY(ossia::value, value W_READ value W_WRITE setValue W_NOTIFY valueChanged)
487 ossia::value m_value;
495 SCORE_SERIALIZE_FRIENDS
508 VIRTUAL_CONSTEXPR PortType type()
const noexcept
override
510 return Process::PortType::Message;
518 SCORE_SERIALIZE_FRIENDS
531 VIRTUAL_CONSTEXPR PortType type()
const noexcept
override
533 return Process::PortType::Message;
537 SCORE_LIB_PROCESS_EXPORT
538 std::unique_ptr<Inlet> make_value_inlet(
const Id<Process::Port>& c, QObject* parent);
539 SCORE_LIB_PROCESS_EXPORT
540 std::unique_ptr<Outlet> make_value_outlet(
const Id<Process::Port>& c, QObject* parent);
542 SCORE_LIB_PROCESS_EXPORT
543 std::unique_ptr<MidiInlet> make_midi_inlet(
const Id<Process::Port>& c, QObject* parent);
544 SCORE_LIB_PROCESS_EXPORT
545 std::unique_ptr<MidiOutlet>
548 SCORE_LIB_PROCESS_EXPORT
549 std::unique_ptr<AudioInlet>
551 SCORE_LIB_PROCESS_EXPORT
552 std::unique_ptr<AudioOutlet>
560 W_REGISTER_ARGTYPE(
Process::Port)
563 W_REGISTER_ARGTYPE(
Process::pan_weight)
Definition: QmlObjects.hpp:406
Definition: QmlObjects.hpp:433
Definition: QmlObjects.hpp:114
Definition: DataStreamVisitor.hpp:202
The IdentifiedObject class.
Definition: IdentifiedObject.hpp:19
Definition: JSONVisitor.hpp:423
Definition: QmlObjects.hpp:464
Definition: QmlObjects.hpp:500
Definition: QmlObjects.hpp:51
The Selectable class.
Definition: Selectable.hpp:14
Definition: QmlObjects.hpp:82
Definition: QmlObjects.hpp:376
The id_base_t class.
Definition: Identifier.hpp:57
Generic serialization method for abstract classes.
Definition: SerializableInterface.hpp:21
Base classes and tools to implement processes and layers.
Definition: JSONVisitor.hpp:1324
Definition: AddressSettings.hpp:131
Definition: PortForward.hpp:31
Definition: Address.hpp:108
Definition: Domain.hpp:17