score-plugin-nodal/Nodal/Process.hpp
1 #pragma once
2 #include <Process/Dataflow/Port.hpp>
3 #include <Process/GenericProcessFactory.hpp>
4 #include <Process/Process.hpp>
5 
6 #include <Nodal/Metadata.hpp>
7 
8 #include <score/model/ObjectEditor.hpp>
9 
10 namespace Nodal
11 {
12 
13 class Model final : public Process::ProcessModel
14 {
15  SCORE_SERIALIZE_FRIENDS
16  PROCESS_METADATA_IMPL(Nodal::Model)
17  W_OBJECT(Model)
18 
19 public:
20  std::unique_ptr<Process::AudioInlet> inlet;
21  std::unique_ptr<Process::AudioOutlet> outlet;
22 
23  Model(
24  const TimeVal& duration, const Id<Process::ProcessModel>& id,
25  const score::DocumentContext& ctx, QObject* parent);
26 
27  template <typename Impl>
28  Model(Impl& vis, const score::DocumentContext& ctx, QObject* parent)
29  : Process::ProcessModel{vis, parent}
30  , m_context{ctx}
31  {
32  vis.writeTo(*this);
33  init();
34  }
35 
36  void init()
37  {
38  m_inlets.push_back(inlet.get());
39  m_outlets.push_back(outlet.get());
40  }
41 
42  ~Model() override;
43 
45 
46 private:
47  void loadPreset(const Process::Preset& preset) override;
48  Process::Preset savePreset() const noexcept override;
49 
50  QString prettyName() const noexcept override;
51 
52  void setDurationAndScale(const TimeVal& newDuration) noexcept override;
53  void setDurationAndGrow(const TimeVal& newDuration) noexcept override;
54  void setDurationAndShrink(const TimeVal& newDuration) noexcept override;
55 
56  void ancestorStartDateChanged() override;
57  void ancestorTempoChanged() override;
58 
59  const score::DocumentContext& m_context;
60 };
61 
63 
65 {
66  SCORE_CONCRETE("5e1c7e92-5beb-4313-92c8-f690089ff340")
67 
68  bool
69  copy(JSONReader& r, const Selection& s, const score::DocumentContext& ctx) override;
70  bool paste(
71  QPoint pos, QObject* focusedObject, const QMimeData& mime,
72  const score::DocumentContext& ctx) override;
73  bool remove(const Selection& s, const score::DocumentContext& ctx) override;
74 };
75 }
Definition: JSONVisitor.hpp:52
Definition: score-plugin-nodal/Nodal/Process.hpp:14
Definition: score-plugin-nodal/Nodal/Process.hpp:65
Definition: GenericProcessFactory.hpp:15
The Process class.
Definition: score-lib-process/Process/Process.hpp:61
Definition: Selection.hpp:12
The id_base_t class.
Definition: Identifier.hpp:57
Definition: Preset.hpp:32
Definition: TimeValue.hpp:21
Definition: DocumentContext.hpp:18
Definition: ObjectEditor.hpp:12