Loading...
Searching...
No Matches
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>
15Q_DECLARE_METATYPE(std::size_t)
16W_REGISTER_ARGTYPE(std::size_t)
17namespace Process
18{
19class ControlInlet;
20}
21namespace Media
22{
23namespace Step
24{
35// FIXME export is only needed for the js api in dll build...
36class SCORE_PLUGIN_MEDIA_EXPORT Model final : public Process::ProcessModel
37{
38 SCORE_SERIALIZE_FRIENDS
39 PROCESS_METADATA_IMPL(Media::Step::Model)
40
41 W_OBJECT(Model)
42
43public:
44 static constexpr int maxSequences = 64;
45 static constexpr int maxSteps = 256;
46
47 explicit Model(
48 const TimeVal& duration, const Id<Process::ProcessModel>& id, QObject* parent);
49
50 ~Model() override;
51
52 template <typename Impl>
53 explicit Model(Impl& vis, QObject* parent)
54 : Process::ProcessModel{vis, parent}
55 {
56 vis.writeTo(*this);
57 init();
58 }
59
60 void init();
61
62 std::unique_ptr<Process::ControlInlet> sequenceSelect;
63 std::unique_ptr<Process::ControlInlet> switchQuantification;
64 std::unique_ptr<Process::ControlInlet> stepDuration;
65 std::unique_ptr<Process::Outlet> outlet;
66
68 int stepCount() const;
70 const ossia::float_vector& steps() const;
71 const std::vector<ossia::float_vector>& sequences() const noexcept;
72 int currentSequence() const noexcept;
73 double min() const;
74 double max() const;
75
76public:
77 void stepCountChanged(int arg_1) W_SIGNAL(stepCountChanged, arg_1);
79 void stepsChanged() W_SIGNAL(stepsChanged);
80 void currentSequenceChanged(int arg_1) W_SIGNAL(currentSequenceChanged, arg_1);
81 void minChanged(double arg_1) W_SIGNAL(minChanged, arg_1);
82 void maxChanged(double arg_1) W_SIGNAL(maxChanged, arg_1);
83
85 void execPosition(int arg_1) W_SIGNAL(execPosition, arg_1);
86
87public:
89 void setStepCount(int s);
90 W_SLOT(setStepCount);
92 void setSteps(ossia::float_vector v);
93 W_SLOT(setSteps);
94 void setSequenceSteps(int sequence, ossia::float_vector v);
95 void setSequences(std::vector<ossia::float_vector> v);
98 void setCurrentSequence(int n);
99 void setMin(double v);
100 W_SLOT(setMin);
101 void setMax(double v);
102 W_SLOT(setMax);
103
104private:
105 std::vector<ossia::float_vector> m_sequences;
106 int m_currentSequence{};
107 double m_min{}, m_max{};
108
109 W_PROPERTY(double, max READ max WRITE setMax NOTIFY maxChanged)
110
111 W_PROPERTY(double, min READ min WRITE setMin NOTIFY minChanged)
112
113 W_PROPERTY(int, stepCount READ stepCount WRITE setStepCount NOTIFY stepCountChanged)
114};
115}
116}
117
118W_REGISTER_ARGTYPE(ossia::float_vector)
A step sequencer with several sequences.
Definition score-plugin-media/Media/Step/Model.hpp:37
void stepsChanged()
Any step of any sequence, or the list of sequences.
The Process class.
Definition score-lib-process/Process/Process.hpp:80
The id_base_t class.
Definition Identifier.hpp:59
Base classes and tools to implement processes and layers.
Definition JSONVisitor.hpp:1115
STL namespace.
Definition TimeValue.hpp:21