• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ossia / score / 30712882626

01 Aug 2026 06:35PM UTC coverage: 15.224% (-0.04%) from 15.263%
30712882626

Pull #2170

github

web-flow
Merge 03b0da44d into 3ceec338e
Pull Request #2170: Make the X11-dependent parts optional (gfx, vst3, linuxcheck)

30381 of 199565 relevant lines covered (15.22%)

1075.35 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

44.44
/src/plugins/score-lib-process/Process/Process.hpp
1
#pragma once
2
#include <Process/Dataflow/PortForward.hpp>
3
#include <Process/ExpandMode.hpp>
4
#include <Process/Preset.hpp>
5
#include <Process/ProcessFlags.hpp>
6
#include <Process/TimeValue.hpp>
7

8
#include <Magnetism/MagneticInfo.hpp>
9

10
#include <score/model/Component.hpp>
11
#include <score/model/EntityImpl.hpp>
12
#include <score/model/Identifier.hpp>
13
#include <score/model/ModelMetadata.hpp>
14
#include <score/plugins/SerializableInterface.hpp>
15
#include <score/selection/Selectable.hpp>
16
#include <score/selection/Selection.hpp>
17
#include <score/serialization/VisitorInterface.hpp>
18
#include <score/tools/Metadata.hpp>
19

20
#include <ossia/detail/small_vector.hpp>
21

22
#include <QString>
23

24
#include <QMetaProperty>
25
#include <score_lib_process_export.h>
26
#include <smallfun.hpp>
27

28
#include <optional>
29
#include <vector>
30
#include <verdigris>
31

32
class ProcessStateDataInterface;
33
namespace ossia
34
{
35
class value;
36
}
37
namespace Process
38
{
39
class Port;
40
class Inlet;
41
class ControlInlet;
42
class Outlet;
43
class AudioInlet;
44
class AudioOutlet;
45
class MidiInlet;
46
class MidiOutlet;
47
class ProcessModelFactory;
48
class LayerFactory;
49
class ProcessModel;
50
class LayerFactory;
51
struct Inlets;
52
struct Outlets;
53

54
/**
55
 * @brief The Process class
56
 *
57
 * Interface to implement to make a process.
58
 */
59
class SCORE_LIB_PROCESS_EXPORT ProcessModel
60
    : public score::Entity<ProcessModel>
61
    , public score::SerializableInterface<ProcessModel>
62
{
63
  W_OBJECT(ProcessModel)
64
  SCORE_SERIALIZE_FRIENDS
65
public:
66
  Selectable selection{this};
67
  ProcessModel(
68
      TimeVal duration, const Id<ProcessModel>& id, const QString& name,
69
      QObject* parent);
70

71
  ProcessModel(DataStream::Deserializer& vis, QObject* parent);
72
  ProcessModel(JSONObject::Deserializer& vis, QObject* parent);
73

74
  virtual ~ProcessModel();
75

76
  // If the process can have multiple distinct implementations
77
  // for which presets are incompatible, e.g. VST, Faust...
78
  // This allows to differentiate them
79
  virtual QString effect() const noexcept;
80

81
  // A user-friendly text to show to the users
82
  virtual QString prettyName() const noexcept;
83
  virtual QString prettyShortName() const noexcept = 0;
84
  virtual QString category() const noexcept = 0;
85
  virtual QStringList tags() const noexcept = 0;
86
  virtual ProcessFlags flags() const noexcept = 0;
87

88
  //// Features of a process
89
  /// Duration
90
  void setParentDuration(ExpandMode mode, const TimeVal& t) noexcept;
91

92
  virtual TimeVal contentDuration() const noexcept;
93

94
  void setDuration(const TimeVal& other) noexcept;
95
  const TimeVal& duration() const noexcept;
96

97
  /// Nodal things
98
  QPointF position() const noexcept;
99
  QSizeF size() const noexcept;
100

101
  void setPosition(const QPointF& v);
102
  void setSize(const QSizeF& v);
103

104
  void positionChanged(QPointF p) E_SIGNAL(SCORE_LIB_PROCESS_EXPORT, positionChanged, p)
25✔
105
  void sizeChanged(QSizeF p) E_SIGNAL(SCORE_LIB_PROCESS_EXPORT, sizeChanged, p)
5✔
106

107
  PROPERTY(
108
      QPointF, position W_READ position W_WRITE setPosition W_NOTIFY positionChanged)
109
  PROPERTY(QSizeF, size W_READ size W_WRITE setSize W_NOTIFY sizeChanged)
110

111
  /// States. The process has ownership.
112
  virtual ProcessStateDataInterface* startStateData() const noexcept;
113
  virtual ProcessStateDataInterface* endStateData() const noexcept;
114

115
  /// Selection
116
  virtual Selection selectableChildren() const noexcept;
117
  virtual Selection selectedChildren() const noexcept;
118
  virtual void setSelection(const Selection& s) const noexcept;
119

120
  double getSlotHeight() const noexcept;
121
  void setSlotHeight(double) noexcept;
122

123
  const Process::Inlets& inlets() const noexcept { return m_inlets; }
1,385✔
124
  const Process::Outlets& outlets() const noexcept { return m_outlets; }
1,341✔
125

126
  Process::Inlet* inlet(const Id<Process::Port>&) const noexcept;
127
  Process::Outlet* outlet(const Id<Process::Port>&) const noexcept;
128

129
  virtual void loadPreset(const Preset& preset);
130
  virtual Preset savePreset() const noexcept;
131
  virtual std::vector<Process::Preset> builtinPresets() const noexcept;
132

133
  // Called when an ancestor was moved in the timeline
134
  virtual void ancestorStartDateChanged();
135
  virtual void ancestorTempoChanged();
136

137
  virtual void forEachControl(
138
      smallfun::function<void(Process::ControlInlet&, const ossia::value&)>) const;
139

140
  // Magnetism
141
  virtual std::optional<Process::MagneticInfo>
142
  magneticPosition(const QObject* o, const TimeVal t) const noexcept;
143

144
  // Clip duration things
145
  bool loops() const noexcept { return m_loops; }
742✔
146
  void setLoops(bool b);
147
  void loopsChanged(bool b) E_SIGNAL(SCORE_LIB_PROCESS_EXPORT, loopsChanged, b)
4✔
148
  PROPERTY(bool, loops W_READ loops W_WRITE setLoops W_NOTIFY loopsChanged)
149

150
  TimeVal startOffset() const noexcept { return m_startOffset; }
702✔
151
  void setStartOffset(TimeVal b);
152
  void startOffsetChanged(TimeVal b)
1✔
153
      E_SIGNAL(SCORE_LIB_PROCESS_EXPORT, startOffsetChanged, b)
1✔
154
  PROPERTY(
155
      TimeVal,
156
      startOffset W_READ startOffset W_WRITE setStartOffset W_NOTIFY startOffsetChanged)
157

158
  TimeVal loopDuration() const noexcept { return m_loopDuration; }
658✔
159
  void setLoopDuration(TimeVal b);
160
  void loopDurationChanged(TimeVal b)
×
161
      E_SIGNAL(SCORE_LIB_PROCESS_EXPORT, loopDurationChanged, b)
×
162
  PROPERTY(
163
      TimeVal, loopDuration W_READ loopDuration W_WRITE setLoopDuration W_NOTIFY
164
                   loopDurationChanged)
165

166
  virtual void setCreatingControls(bool ok);
167
  bool creatingControls() const noexcept;
168
  void creatingControlsChanged(bool b)
×
169
      E_SIGNAL(SCORE_LIB_PROCESS_EXPORT, creatingControlsChanged, b)
×
170
  PROPERTY(
171
      bool, creatingControls W_READ creatingControls W_WRITE setCreatingControls W_NOTIFY
172
                creatingControlsChanged)
173

174
  // FIXME ugh
175
  QWidget* scriptUI{};
176
  QWidget* externalUI{};
177

178
  /// Execution
179
  bool executing() const noexcept { return m_executing; }
×
180
  void setExecuting(bool v);
181
  void startExecution() E_SIGNAL(SCORE_LIB_PROCESS_EXPORT, startExecution)
×
182
  void stopExecution() E_SIGNAL(SCORE_LIB_PROCESS_EXPORT, stopExecution)
×
183
  void resetExecution() E_SIGNAL(SCORE_LIB_PROCESS_EXPORT, resetExecution)
×
184

185
  void durationChanged(const TimeVal& arg_1)
1✔
186
      E_SIGNAL(SCORE_LIB_PROCESS_EXPORT, durationChanged, arg_1)
1✔
187
  void useParentDurationChanged(bool arg_1)
×
188
      E_SIGNAL(SCORE_LIB_PROCESS_EXPORT, useParentDurationChanged, arg_1)
×
189

190
  void slotHeightChanged(double arg_1)
18✔
191
      E_SIGNAL(SCORE_LIB_PROCESS_EXPORT, slotHeightChanged, arg_1)
18✔
192
  void prettyNameChanged() E_SIGNAL(SCORE_LIB_PROCESS_EXPORT, prettyNameChanged)
364✔
193

194
  void inletsChanged() E_SIGNAL(SCORE_LIB_PROCESS_EXPORT, inletsChanged)
1✔
195
  void outletsChanged() E_SIGNAL(SCORE_LIB_PROCESS_EXPORT, outletsChanged)
×
196

197
  void controlAdded(const Id<Process::Port>& arg_1)
18✔
198
      E_SIGNAL(SCORE_LIB_PROCESS_EXPORT, controlAdded, arg_1)
18✔
199
  void controlRemoved(const Process::Port& arg_1)
×
200
      E_SIGNAL(SCORE_LIB_PROCESS_EXPORT, controlRemoved, arg_1)
×
201
  void controlOutletAdded(const Id<Process::Port>& arg_1)
×
202
      E_SIGNAL(SCORE_LIB_PROCESS_EXPORT, controlOutletAdded, arg_1)
×
203
  void controlOutletRemoved(const Process::Port& arg_1)
×
204
      E_SIGNAL(SCORE_LIB_PROCESS_EXPORT, controlOutletRemoved, arg_1)
×
205

206
  void benchmark(double arg_1) E_SIGNAL(SCORE_LIB_PROCESS_EXPORT, benchmark, arg_1)
×
207
  void externalUIVisible(bool v) const
×
208
      E_SIGNAL(SCORE_LIB_PROCESS_EXPORT, externalUIVisible, v)
×
209
  void scriptUIVisible(bool v) const
×
210
      E_SIGNAL(SCORE_LIB_PROCESS_EXPORT, scriptUIVisible, v)
×
211

212
  void flagsChanged() const
×
213
      E_SIGNAL(SCORE_LIB_PROCESS_EXPORT, flagsChanged)
×
214

215
protected:
216
  // Used to scale the process.
217
  // This should be commutative :
218
  //   setDurationWithScale(2); setDurationWithScale(3);
219
  // yields the same result as :
220
  //   setDurationWithScale(3); setDurationWithScale(2);
221
  virtual void setDurationAndScale(const TimeVal& newDuration) noexcept;
222

223
  // Does nothing if newDuration < currentDuration
224
  virtual void setDurationAndGrow(const TimeVal& newDuration) noexcept;
225

226
  // Does nothing if newDuration > currentDuration
227
  virtual void setDurationAndShrink(const TimeVal& newDuration) noexcept;
228

229
  Process::Inlets m_inlets;
230
  Process::Outlets m_outlets;
231

232
private:
233
  TimeVal m_duration{};
234
  double m_slotHeight{}; //! Height in full view
235
  TimeVal m_startOffset{};
236
  TimeVal m_loopDuration{};
237
  QPointF m_position{};
238
  QSizeF m_size{};
239
  bool m_loops{};
240
  bool m_executing{};
241
};
242

243
SCORE_LIB_PROCESS_EXPORT
244
ProcessModel* parentProcess(QObject* obj) noexcept;
245
SCORE_LIB_PROCESS_EXPORT
246
const ProcessModel* parentProcess(const QObject* obj) noexcept;
247

248
SCORE_LIB_PROCESS_EXPORT
249
QString processLocalTreeAddress(const Process::ProcessModel& proc);
250
}
251
DEFAULT_MODEL_METADATA(Process::ProcessModel, "Process")
8,973✔
252

253
Q_DECLARE_METATYPE(Id<Process::ProcessModel>)
32✔
254
W_REGISTER_ARGTYPE(Id<Process::ProcessModel>)
255
W_REGISTER_ARGTYPE(OptionalId<Process::ProcessModel>)
256

257
Q_DECLARE_METATYPE(Process::ProcessModel*)
258
Q_DECLARE_METATYPE(const Process::ProcessModel*)
×
259
W_REGISTER_ARGTYPE(Process::ProcessModel*)
260
W_REGISTER_ARGTYPE(const Process::ProcessModel*)
261
W_REGISTER_ARGTYPE(QPointer<const Process::ProcessModel>)
262
W_REGISTER_ARGTYPE(QPointer<Process::ProcessModel>)
263

264
Q_DECLARE_METATYPE(std::shared_ptr<Process::Preset>)
265
W_REGISTER_ARGTYPE(std::shared_ptr<Process::Preset>)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc