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

ossia / score / 41569965004

03 Nov 2026 03:04AM UTC coverage: 53.588% (+1.9%) from 51.66%
41569965004

push

github

jcelerier
ci: build the documentation on Ubuntu 24.04, which its deps script targets

ubuntu-latest is now 26.04, where ubuntu.noble.deps.sh's Qt package names
(libqt6websockets6-dev and the like) no longer exist.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KdPguhTJiZUHjuouE7tkj5

197270 of 368126 relevant lines covered (53.59%)

304198.31 hits per line

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

84.67
/src/plugins/score-lib-process/Process/Process.cpp
1
// This is an open source non-commercial project. Dear PVS-Studio, please check
2
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
3
#include "Process.hpp"
4

5
#include <Process/Dataflow/PortVisibility.hpp>
6

7
#include <Process/Dataflow/Port.hpp>
8
#include <Process/ExpandMode.hpp>
9
#include <Process/PresetHelpers.hpp>
10
#include <Process/TimeValue.hpp>
11

12
#include <LocalTree/ProcessComponent.hpp>
13

14
#include <score/model/ComponentUtils.hpp>
15
#include <score/model/EntitySerialization.hpp>
16
#include <score/model/IdentifiedObject.hpp>
17
#include <score/model/Identifier.hpp>
18
#include <score/model/ModelMetadata.hpp>
19
#include <score/tools/Bind.hpp>
20
#include <score/widgets/SetIcons.hpp>
21

22
#include <ossia/detail/algorithms.hpp>
23
#include <ossia/detail/disable_fpe.hpp>
24
#include <ossia/detail/hash_map.hpp>
25
#include <ossia/network/base/device.hpp>
26
#include <ossia/network/base/node.hpp>
27

28
#include <QObject>
29

30
#include <wobjectimpl.h>
31

32
W_OBJECT_IMPL(Process::ProcessModel)
874,375 ✔
33

34
#if !defined(SCORE_ALL_UNITY)
35
template class IdentifiedObject<Process::ProcessModel>;
36
template class score::SerializableInterface<Process::ProcessModelFactory>;
37
#endif
38
namespace Process
39
{
40

41
const QIcon& getCategoryIcon(const QString& category) noexcept
210,280 ✔
42
{
43
  static const ossia::flat_map<QString, QIcon> categoryIcon{
216,216 ✔
44
      {"AI", makeIcon(QStringLiteral(":/icons/ai.png"))},
371 ✔
45
      {"Analysis", makeIcon(QStringLiteral(":/icons/analysis.png"))},
371 ✔
46
      {"Audio", makeIcon(QStringLiteral(":/icons/audio.png"))},
371 ✔
47
      {"Plugins", makeIcon(QStringLiteral(":/icons/filter.png"))},
371 ✔
48
      {"Midi", makeIcon(QStringLiteral(":/icons/midi.png"))},
371 ✔
49
      {"Control", makeIcon(QStringLiteral(":/icons/controls.png"))},
371 ✔
50
      {"Visuals", makeIcon(QStringLiteral(":/icons/gfx.png"))},
371 ✔
51
      {"Automations", makeIcon(QStringLiteral(":/icons/automation.png"))},
371 ✔
52
      {"Impro", makeIcon(QStringLiteral(":/icons/controls.png"))},
371 ✔
53
      {"Script", makeIcon(QStringLiteral(":/icons/script.png"))},
371 ✔
54
      {"Structure", makeIcon(QStringLiteral(":/icons/structure.png"))},
371 ✔
55
      {"Network", makeIcon(QStringLiteral(":/icons/sync.png"))},
371 ✔
56
      {"Monitoring", makeIcon(QStringLiteral(":/icons/ui.png"))},
371 ✔
57
      {"Spatial", makeIcon(QStringLiteral(":/icons/spatial.png"))},
371 ✔
58
      {"Synths", makeIcon(QStringLiteral(":/icons/synths.png"))},
371 ✔
59
      {"Timing", makeIcon(QStringLiteral(":/icons/timing.png"))},
371 ✔
60
  };
61
  static const QIcon invalid;
210,280 ✔
62
  if(auto it = categoryIcon.find(category); it != categoryIcon.end())
210,280 ✔
63
  {
64
    return it->second;
210,280 ✔
65
  }
66
  if(auto slash_it = category.indexOf("/"); slash_it != -1)
×
67
  {
68
    if(auto it = categoryIcon.find(category.mid(0, slash_it)); it != categoryIcon.end())
×
69
    {
70
      return it->second;
×
71
    }
72
  }
×
73
  return invalid;
×
74
}
210,280 ✔
75
ProcessModel::ProcessModel(
11,688 ✔
76
    TimeVal duration, const Id<ProcessModel>& id, const QString& name, QObject* parent)
77
    : Entity{id, name, parent}
5,844 ✔
78
    , m_duration{std::move(duration)}
79
    , m_slotHeight{300}
80
    , m_loopDuration{m_duration}
81
    , m_size{200, 100}
82
    , m_loops{false}
83
{
11,688 ✔
84
  ossia::disable_fpe();
5,844 ✔
85
  con(metadata(), &score::ModelMetadata::NameChanged, this,
11,688 ✔
86
      [this] { prettyNameChanged(); });
11,984 ✔
87
  connect(this, &Process::ProcessModel::resetExecution, this, [this] {
9,630 ✔
88
    for(auto& p : this->m_inlets)
30,907 ✔
89
      p->executionReset();
27,121 ✔
90
    for(auto& p : this->m_outlets)
9,755 ✔
91
      p->executionReset();
5,969 ✔
92
  });
3,786 ✔
93
  // metadata().setInstanceName(*this);
94
}
×
95

96
ProcessModel::~ProcessModel()
7,334 ✔
97
{
7,334 ✔
98
  identified_object_destroying(this);
7,334 ✔
99
}
7,334 ✔
100

101
QString ProcessModel::effect() const noexcept
5,072 ✔
102
{
103
  return {};
5,072 ✔
104
}
105

106
void ProcessModel::setDurationAndScale(const TimeVal& newDuration) noexcept
2 ✔
107
{
108
  setDuration(newDuration);
2 ✔
109
}
2 ✔
110

111
void ProcessModel::setDurationAndGrow(const TimeVal& newDuration) noexcept
×
112
{
113
  setDuration(newDuration);
×
114
}
×
115

116
void ProcessModel::setDurationAndShrink(const TimeVal& newDuration) noexcept
×
117
{
118
  setDuration(newDuration);
×
119
}
×
120

121
ProcessModel::ProcessModel(DataStream::Deserializer& vis, QObject* parent)
1,654 ✔
122
    : Entity(vis, parent)
827 ✔
123
{
1,654 ✔
124
  ossia::disable_fpe();
827 ✔
125
  vis.writeTo(*this);
827 ✔
126
  con(metadata(), &score::ModelMetadata::NameChanged, this,
1,654 ✔
127
      [this] { prettyNameChanged(); });
853 ✔
128
}
×
129

130
ProcessModel::ProcessModel(JSONObject::Deserializer& vis, QObject* parent)
1,326 ✔
131
    : Entity(vis, parent)
663 ✔
132
{
1,326 ✔
133
  ossia::disable_fpe();
663 ✔
134
  vis.writeTo(*this);
663 ✔
135
  con(metadata(), &score::ModelMetadata::NameChanged, this,
1,326 ✔
136
      [this] { prettyNameChanged(); });
666 ✔
137
}
×
138

139
QString ProcessModel::prettyName() const noexcept
12,536 ✔
140
{
141
  return metadata().getName();
12,536 ✔
142
}
143

144
void ProcessModel::setParentDuration(ExpandMode mode, const TimeVal& t) noexcept
2,027 ✔
145
{
146
  switch(mode)
2,027 ✔
147
  {
148
    case ExpandMode::Scale:
149
      setDurationAndScale(t);
2,006 ✔
150
      break;
2,006 ✔
151
    case ExpandMode::GrowShrink: {
152
      if(duration() < t)
13 ✔
153
        setDurationAndGrow(t);
12 ✔
154
      else
155
        setDurationAndShrink(t);
1 ✔
156
      break;
13 ✔
157
    }
158
    case ExpandMode::ForceGrow: {
159
      if(duration() < t)
8 ✔
160
        setDurationAndGrow(t);
×
161
      break;
8 ✔
162
    }
163
    case ExpandMode::CannotExpand:
×
164
    default:
165
      break;
×
166
  }
167
}
2,027 ✔
168

169
TimeVal ProcessModel::contentDuration() const noexcept
×
170
{
171
  return TimeVal::zero();
×
172
}
173

174
void ProcessModel::setDuration(const TimeVal& other) noexcept
2,054 ✔
175
{
176
  m_duration = other;
2,054 ✔
177
  durationChanged(m_duration);
2,054 ✔
178
}
2,054 ✔
179

180
const TimeVal& ProcessModel::duration() const noexcept
9,948 ✔
181
{
182
  return m_duration;
9,948 ✔
183
}
184

185
ProcessStateDataInterface* ProcessModel::startStateData() const noexcept
6,376 ✔
186
{
187
  return nullptr;
6,376 ✔
188
}
189

190
ProcessStateDataInterface* ProcessModel::endStateData() const noexcept
5,076 ✔
191
{
192
  return nullptr;
5,076 ✔
193
}
194

195
Selection ProcessModel::selectableChildren() const noexcept
×
196
{
197
  return {};
×
198
}
199

200
Selection ProcessModel::selectedChildren() const noexcept
×
201
{
202
  return {};
×
203
}
204

205
void ProcessModel::setSelection(const Selection& s) const noexcept
31 ✔
206
{
207
  ossia::hash_set<const QObject*> selected;
31 ✔
208
  selected.reserve(s.size());
31 ✔
209
  for(const auto& obj : s)
1,230,032 ✔
210
    selected.insert(obj.data());
1,230,001 ✔
211

212
  for(Selectable* child : this->findChildren<Selectable*>())
1,380,101 ✔
213
    child->set(selected.contains(child->parent()));
1,380,070 ✔
214
}
31 ✔
215

216
Process::Inlet* ProcessModel::inlet(const Id<Process::Port>& p) const noexcept
6,524 ✔
217
{
218
  for(auto e : m_inlets)
137,543 ✔
219
    if(e->id() == p)
137,542 ✔
220
      return e;
6,523 ✔
221
  return nullptr;
1 ✔
222
}
6,524 ✔
223

224
Process::Outlet* ProcessModel::outlet(const Id<Process::Port>& p) const noexcept
1 ✔
225
{
226
  for(auto e : m_outlets)
1 ✔
227
    if(e->id() == p)
1 ✔
228
      return e;
1 ✔
229
  return nullptr;
×
230
}
1 ✔
231

232
void ProcessModel::loadPreset(const Preset& preset)
60 ✔
233
{
234
  const rapidjson::Document doc = readJson(preset.data);
60 ✔
235
  loadFixedControls(doc.GetArray(), *this);
60 ✔
236
}
60 ✔
237

238
Preset ProcessModel::savePreset() const noexcept
41 ✔
239
{
240
  Preset p;
41 ✔
241
  p.name = this->metadata().getName();
41 ✔
242
  p.key.key = this->concreteKey();
41 ✔
243

244
  JSONReader r;
41 ✔
245
  saveFixedControls(r, *this);
41 ✔
246
  p.data = r.toByteArray();
41 ✔
247
  return p;
41 ✔
248
}
41 ✔
249

250
std::vector<Preset> ProcessModel::builtinPresets() const noexcept
24 ✔
251
{
252
  return {};
24 ✔
253
}
254

255
bool ProcessModel::presetMatches(const Preset& preset) const noexcept
467 ✔
256
{
257
  return preset.key.key == concreteKey() && preset.key.effect == effect();
467 ✔
258
}
259

260
bool ProcessModel::presetChangesPorts(const Preset& preset) const noexcept
1,592 ✔
261
{
262
  if(flags() & ProcessFlags::DynamicPorts)
1,592 ✔
263
    return true;
95 ✔
264
  return !preset.key.effect.isEmpty() && preset.key.effect != effect();
1,497 ✔
265
}
1,592 ✔
266

267
bool ProcessModel::scriptPresetChangesPorts(const Preset& preset) const noexcept
21 ✔
268
{
269
  return !preset.key.effect.isEmpty() && preset.key.effect != effect();
21 ✔
270
}
271

272
void ProcessModel::ancestorStartDateChanged() { }
5 ✔
273

274
void ProcessModel::ancestorTempoChanged() { }
×
275

276
void ProcessModel::forEachControl(
85 ✔
277
    smallfun::function<void(ControlInlet&, const ossia::value&)> f) const
278
{
279
  for(const auto& inlet : m_inlets)
771 ✔
280
  {
281
    if(auto ctrl = qobject_cast<Process::ControlInlet*>(inlet))
686 ✔
282
    {
283
      f(*ctrl, ctrl->value());
649 ✔
284
    }
649 ✔
285
  }
286
}
85 ✔
287

288
void ProcessModel::setCreatingControls(bool ok) { }
753 ✔
289

290
bool ProcessModel::creatingControls() const noexcept
×
291
{
292
  return this->flags() & ProcessFlags::CreateControls;
×
293
}
294

295
void ProcessModel::setScriptable(bool b)
128 ✔
296
{
297
  if(b != m_scriptable)
128 ✔
298
  {
299
    m_scriptable = b;
128 ✔
300
    scriptableChanged(b);
128 ✔
301
  }
128 ✔
302
}
128 ✔
303

304
void ProcessModel::setLoops(bool b)
34 ✔
305
{
306
  if(b != m_loops)
34 ✔
307
  {
308
    m_loops = b;
31 ✔
309
    loopsChanged(b);
31 ✔
310
  }
31 ✔
311
}
34 ✔
312

313
void ProcessModel::setStartOffset(TimeVal b)
11 ✔
314
{
315
  if(b != m_startOffset)
11 ✔
316
  {
317
    m_startOffset = b;
10 ✔
318
    startOffsetChanged(b);
10 ✔
319
  }
10 ✔
320
}
11 ✔
321

322
void ProcessModel::setLoopDuration(TimeVal b)
12 ✔
323
{
324
  if(b.msec() < 0.1)
12 ✔
325
    b = TimeVal::fromMsecs(0.1);
×
326

327
  if(b != m_loopDuration)
12 ✔
328
  {
329
    m_loopDuration = b;
12 ✔
330
    loopDurationChanged(b);
12 ✔
331
  }
12 ✔
332
}
12 ✔
333

334
QPointF ProcessModel::position() const noexcept
181,943,763 ✔
335
{
336
  return m_position;
181,943,763 ✔
337
}
338

339
QSizeF ProcessModel::size() const noexcept
181,351,500 ✔
340
{
341
  return m_size;
181,351,500 ✔
342
}
343

344
void ProcessModel::setPosition(const QPointF& v)
4,761 ✔
345
{
346
  if(v != m_position)
4,761 ✔
347
  {
348
    m_position = v;
4,758 ✔
349
    positionChanged(v);
4,758 ✔
350
  }
4,758 ✔
351
}
4,761 ✔
352

353
void ProcessModel::setSize(const QSizeF& v)
2,094 ✔
354
{
355
  if(v != m_size)
2,094 ✔
356
  {
357
    m_size = v;
2,090 ✔
358
    sizeChanged(v);
2,090 ✔
359
  }
2,090 ✔
360
}
2,094 ✔
361

362
FoldMode ProcessModel::foldMode() const noexcept
1,170 ✔
363
{
364
  return m_foldMode;
1,170 ✔
365
}
366

367
void ProcessModel::setFoldMode(FoldMode v)
8 ✔
368
{
369
  if(v != m_foldMode)
8 ✔
370
  {
371
    m_foldMode = v;
8 ✔
372
    foldModeChanged(v);
8 ✔
373
  }
8 ✔
374
}
8 ✔
375

376
bool ProcessModel::folded() const noexcept
2,539 ✔
377
{
378
  switch(m_foldMode)
2,539 ✔
379
  {
380
    case FoldMode::Folded:
381
      return true;
8 ✔
382
    case FoldMode::Unfolded:
383
      return false;
4 ✔
384
    case FoldMode::Auto:
2,527 ✔
385
    default:
386
      return std::ssize(m_inlets) > MaxUnpaginatedControls;
2,527 ✔
387
  }
388
}
2,539 ✔
389

390
double ProcessModel::getSlotHeight() const noexcept
34,379 ✔
391
{
392
  return m_slotHeight;
34,379 ✔
393
}
394

395
void ProcessModel::setSlotHeight(double v) noexcept
1,455 ✔
396
{
397
  m_slotHeight = v;
1,455 ✔
398
  slotHeightChanged(v);
1,455 ✔
399
}
1,455 ✔
400

401
void ProcessModel::setExecuting(bool e)
12,790 ✔
402
{
403
  m_executing = e;
12,790 ✔
404
}
12,790 ✔
405

406
void ProcessModel::setMonitor(std::shared_ptr<Monitor> m)
51 ✔
407
{
408
  if(m == m_monitor)
51 ✔
409
    return;
17 ✔
410
  m_monitor = std::move(m);
34 ✔
411
  monitorChanged();
34 ✔
412
}
51 ✔
413

414
std::optional<Process::MagneticInfo>
415
ProcessModel::magneticPosition(const QObject* o, const TimeVal t) const noexcept
×
416
{
417
  return {};
×
418
}
419

420
bool ProcessModel::externalSourceOutOfDate() const noexcept
×
421
{
422
  return false;
×
423
}
424

425
score::Command*
426
ProcessModel::refreshFromExternalSource(const score::DocumentContext& ctx) const
×
427
{
428
  return nullptr;
×
429
}
430

431
ProcessModel* parentProcess(QObject* obj) noexcept
19,577 ✔
432
{
433
  if(obj)
19,577 ✔
434
    obj = obj->parent();
19,577 ✔
435

436
  while(obj && !qobject_cast<ProcessModel*>(obj))
37,453 ✔
437
  {
438
    obj = obj->parent();
17,876 ✔
439
  }
440

441
  if(obj)
19,577 ✔
442
    return static_cast<ProcessModel*>(obj);
17,625 ✔
443
  return nullptr;
1,952 ✔
444
}
19,577 ✔
445

446
const ProcessModel* parentProcess(const QObject* obj) noexcept
49,990 ✔
447
{
448
  if(obj)
49,990 ✔
449
    obj = obj->parent();
49,990 ✔
450

451
  while(obj && !qobject_cast<const ProcessModel*>(obj))
63,960 ✔
452
  {
453
    obj = obj->parent();
13,970 ✔
454
  }
455

456
  if(obj)
49,990 ✔
457
    return static_cast<const ProcessModel*>(obj);
48,526 ✔
458
  return nullptr;
1,464 ✔
459
}
49,990 ✔
460

461
QString processLocalTreeAddress(const ProcessModel& proc)
×
462
{
463
  if(auto lt = findComponent<LocalTree::ProcessComponent>(proc.components()))
×
464
  {
465
    return QString::fromStdString(
×
466
        lt->node().get_device().get_name() + ":" + lt->node().osc_address());
×
467
  }
468
  return {};
×
469
}
×
470
}
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