score-plugin-media/Media/Step/Model.hpp
1 #pragma once
2 #include <Process/Process.hpp>
3 
4 #include <Media/Step/Metadata.hpp>
5 
7 #include <score/serialization/JSONVisitor.hpp>
9 
10 #include <ossia/detail/pod_vector.hpp>
11 
12 #include <score_plugin_media_export.h>
13 
14 #include <verdigris>
15 Q_DECLARE_METATYPE(std::size_t)
16 W_REGISTER_ARGTYPE(std::size_t)
17 namespace Media
18 {
19 namespace Step
20 {
21 // FIXME export is only needed for the js api in dll build...
22 class SCORE_PLUGIN_MEDIA_EXPORT Model final : public Process::ProcessModel
23 {
24  SCORE_SERIALIZE_FRIENDS
25  PROCESS_METADATA_IMPL(Media::Step::Model)
26 
27  W_OBJECT(Model)
28 
29 public:
30  explicit Model(
31  const TimeVal& duration, const Id<Process::ProcessModel>& id, QObject* parent);
32 
33  ~Model() override;
34 
35  template <typename Impl>
36  explicit Model(Impl& vis, QObject* parent)
37  : Process::ProcessModel{vis, parent}
38  {
39  vis.writeTo(*this);
40  init();
41  }
42 
43  void init() { m_outlets.push_back(outlet.get()); }
44 
45  std::unique_ptr<Process::Outlet> outlet;
46 
47  int stepCount() const;
48  int stepDuration() const;
49  const ossia::float_vector& steps() const;
50  double min() const;
51  double max() const;
52 
53 public:
54  void stepCountChanged(int arg_1) W_SIGNAL(stepCountChanged, arg_1);
55  void stepDurationChanged(int arg_1) W_SIGNAL(stepDurationChanged, arg_1);
56  void stepsChanged() W_SIGNAL(stepsChanged);
57  void minChanged(double arg_1) W_SIGNAL(minChanged, arg_1);
58  void maxChanged(double arg_1) W_SIGNAL(maxChanged, arg_1);
59 
60 public:
61  void setStepCount(int s);
62  W_SLOT(setStepCount);
63  void setStepDuration(int s);
64  W_SLOT(setStepDuration);
65  void setSteps(ossia::float_vector v);
66  W_SLOT(setSteps);
67  void setMin(double v);
68  W_SLOT(setMin);
69  void setMax(double v);
70  W_SLOT(setMax);
71 
72 private:
73  ossia::float_vector m_steps;
74  int m_stepCount{8};
75  int m_stepDuration{22000};
76  double m_min{}, m_max{};
77 
78  W_PROPERTY(double, max READ max WRITE setMax NOTIFY maxChanged)
79 
80  W_PROPERTY(double, min READ min WRITE setMin NOTIFY minChanged)
81 
82  W_PROPERTY(
83  int,
84  stepDuration READ stepDuration WRITE setStepDuration NOTIFY stepDurationChanged)
85 
86  W_PROPERTY(int, stepCount READ stepCount WRITE setStepCount NOTIFY stepCountChanged)
87 };
88 }
89 }
90 
91 W_REGISTER_ARGTYPE(ossia::float_vector)
Definition: score-plugin-media/Media/Step/Model.hpp:23
The Process class.
Definition: score-lib-process/Process/Process.hpp:61
The id_base_t class.
Definition: Identifier.hpp:57
Definition: TimeValue.hpp:21