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

ossia / score / 37965809739

09 Oct 2026 05:22PM UTC coverage: 48.076% (-0.5%) from 48.588%
37965809739

push

github

jcelerier
3rdparty: pin avendish to main, now that #219 is merged

celtera/avendish#219 merged as 797b3c9d7e, so the ColorDisplay fix this
branch needs is on main and the pin no longer has to name
fix/color-display-unit-aliases. Pinned to main's tip a1f6471c53, which
also picks up #220.

Content is unchanged where it matters: the tree at the old pin and at
797b3c9d7e is byte-identical (`git diff` reports no files), and #220 on
top touches one line -- a Catch2 tag inside `if(BUILD_TESTING)` in
cmake/avendish.tests.cmake -- which score never evaluates.

Note `git cherry` is useless for checking this: #219 was squash-merged, so
its 7 commits collapsed into 1 and no patch-id matches. Compare trees, not
commits. A pin on a feature branch dies when that branch is tidied up,
which is why this matters beyond neatness.

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

156491 of 325507 relevant lines covered (48.08%)

146731.39 hits per line

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

82.26
/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)
118,132 ✔
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
146,461 ✔
42
{
43
  static const ossia::flat_map<QString, QIcon> categoryIcon{
151,293 ✔
44
      {"AI", makeIcon(QStringLiteral(":/icons/ai.png"))},
302 ✔
45
      {"Analysis", makeIcon(QStringLiteral(":/icons/analysis.png"))},
302 ✔
46
      {"Audio", makeIcon(QStringLiteral(":/icons/audio.png"))},
302 ✔
47
      {"Plugins", makeIcon(QStringLiteral(":/icons/filter.png"))},
302 ✔
48
      {"Midi", makeIcon(QStringLiteral(":/icons/midi.png"))},
302 ✔
49
      {"Control", makeIcon(QStringLiteral(":/icons/controls.png"))},
302 ✔
50
      {"Visuals", makeIcon(QStringLiteral(":/icons/gfx.png"))},
302 ✔
51
      {"Automations", makeIcon(QStringLiteral(":/icons/automation.png"))},
302 ✔
52
      {"Impro", makeIcon(QStringLiteral(":/icons/controls.png"))},
302 ✔
53
      {"Script", makeIcon(QStringLiteral(":/icons/script.png"))},
302 ✔
54
      {"Structure", makeIcon(QStringLiteral(":/icons/structure.png"))},
302 ✔
55
      {"Network", makeIcon(QStringLiteral(":/icons/sync.png"))},
302 ✔
56
      {"Monitoring", makeIcon(QStringLiteral(":/icons/ui.png"))},
302 ✔
57
      {"Spatial", makeIcon(QStringLiteral(":/icons/spatial.png"))},
302 ✔
58
      {"Synths", makeIcon(QStringLiteral(":/icons/synths.png"))},
302 ✔
59
      {"Timing", makeIcon(QStringLiteral(":/icons/timing.png"))},
302 ✔
60
  };
61
  static const QIcon invalid;
146,461 ✔
62
  if(auto it = categoryIcon.find(category); it != categoryIcon.end())
146,461 ✔
63
  {
64
    return it->second;
146,461 ✔
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
}
146,461 ✔
75
ProcessModel::ProcessModel(
8,154 ✔
76
    TimeVal duration, const Id<ProcessModel>& id, const QString& name, QObject* parent)
77
    : Entity{id, name, parent}
4,077 ✔
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
{
8,154 ✔
84
  ossia::disable_fpe();
4,077 ✔
85
  con(metadata(), &score::ModelMetadata::NameChanged, this,
8,154 ✔
86
      [this] { prettyNameChanged(); });
8,409 ✔
87
  connect(this, &Process::ProcessModel::resetExecution, this, [this] {
5,596 ✔
88
    for(auto& p : this->m_inlets)
5,278 ✔
89
      p->executionReset();
3,759 ✔
90
    for(auto& p : this->m_outlets)
3,182 ✔
91
      p->executionReset();
1,663 ✔
92
  });
1,519 ✔
93
  // metadata().setInstanceName(*this);
94
}
×
95

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

101
QString ProcessModel::effect() const noexcept
852 ✔
102
{
103
  return {};
852 ✔
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,022 ✔
122
    : Entity(vis, parent)
511 ✔
123
{
1,022 ✔
124
  ossia::disable_fpe();
511 ✔
125
  vis.writeTo(*this);
511 ✔
126
  con(metadata(), &score::ModelMetadata::NameChanged, this,
1,022 ✔
127
      [this] { prettyNameChanged(); });
537 ✔
128
}
×
129

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

139
QString ProcessModel::prettyName() const noexcept
6,744 ✔
140
{
141
  return metadata().getName();
6,744 ✔
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,046 ✔
175
{
176
  m_duration = other;
2,046 ✔
177
  durationChanged(m_duration);
2,046 ✔
178
}
2,046 ✔
179

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

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

190
ProcessStateDataInterface* ProcessModel::endStateData() const noexcept
2,132 ✔
191
{
192
  return nullptr;
2,132 ✔
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
363 ✔
217
{
218
  for(auto e : m_inlets)
55,037 ✔
219
    if(e->id() == p)
55,036 ✔
220
      return e;
362 ✔
221
  return nullptr;
1 ✔
222
}
363 ✔
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)
15 ✔
233
{
234
  const rapidjson::Document doc = readJson(preset.data);
15 ✔
235
  loadFixedControls(doc.GetArray(), *this);
15 ✔
236
}
15 ✔
237

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

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

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

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

260
void ProcessModel::ancestorStartDateChanged() { }
5 ✔
261

262
void ProcessModel::ancestorTempoChanged() { }
×
263

264
void ProcessModel::forEachControl(
83 ✔
265
    smallfun::function<void(ControlInlet&, const ossia::value&)> f) const
266
{
267
  for(const auto& inlet : m_inlets)
749 ✔
268
  {
269
    if(auto ctrl = qobject_cast<Process::ControlInlet*>(inlet))
666 ✔
270
    {
271
      f(*ctrl, ctrl->value());
629 ✔
272
    }
629 ✔
273
  }
274
}
83 ✔
275

276
void ProcessModel::setCreatingControls(bool ok) { }
23 ✔
277

278
bool ProcessModel::creatingControls() const noexcept
×
279
{
280
  return this->flags() & ProcessFlags::CreateControls;
×
281
}
282

283
void ProcessModel::setScriptable(bool b)
128 ✔
284
{
285
  if(b != m_scriptable)
128 ✔
286
  {
287
    m_scriptable = b;
128 ✔
288
    scriptableChanged(b);
128 ✔
289
  }
128 ✔
290
}
128 ✔
291

292
void ProcessModel::setLoops(bool b)
26 ✔
293
{
294
  if(b != m_loops)
26 ✔
295
  {
296
    m_loops = b;
23 ✔
297
    loopsChanged(b);
23 ✔
298
  }
23 ✔
299
}
26 ✔
300

301
void ProcessModel::setStartOffset(TimeVal b)
11 ✔
302
{
303
  if(b != m_startOffset)
11 ✔
304
  {
305
    m_startOffset = b;
10 ✔
306
    startOffsetChanged(b);
10 ✔
307
  }
10 ✔
308
}
11 ✔
309

310
void ProcessModel::setLoopDuration(TimeVal b)
10 ✔
311
{
312
  if(b.msec() < 0.1)
10 ✔
313
    b = TimeVal::fromMsecs(0.1);
×
314

315
  if(b != m_loopDuration)
10 ✔
316
  {
317
    m_loopDuration = b;
10 ✔
318
    loopDurationChanged(b);
10 ✔
319
  }
10 ✔
320
}
10 ✔
321

322
QPointF ProcessModel::position() const noexcept
168,253,046 ✔
323
{
324
  return m_position;
168,253,046 ✔
325
}
326

327
QSizeF ProcessModel::size() const noexcept
167,751,840 ✔
328
{
329
  return m_size;
167,751,840 ✔
330
}
331

332
void ProcessModel::setPosition(const QPointF& v)
3,127 ✔
333
{
334
  if(v != m_position)
3,127 ✔
335
  {
336
    m_position = v;
3,124 ✔
337
    positionChanged(v);
3,124 ✔
338
  }
3,124 ✔
339
}
3,127 ✔
340

341
void ProcessModel::setSize(const QSizeF& v)
975 ✔
342
{
343
  if(v != m_size)
975 ✔
344
  {
345
    m_size = v;
975 ✔
346
    sizeChanged(v);
975 ✔
347
  }
975 ✔
348
}
975 ✔
349

350
FoldMode ProcessModel::foldMode() const noexcept
1,073 ✔
351
{
352
  return m_foldMode;
1,073 ✔
353
}
354

355
void ProcessModel::setFoldMode(FoldMode v)
8 ✔
356
{
357
  if(v != m_foldMode)
8 ✔
358
  {
359
    m_foldMode = v;
8 ✔
360
    foldModeChanged(v);
8 ✔
361
  }
8 ✔
362
}
8 ✔
363

364
bool ProcessModel::folded() const noexcept
747 ✔
365
{
366
  switch(m_foldMode)
747 ✔
367
  {
368
    case FoldMode::Folded:
369
      return true;
8 ✔
370
    case FoldMode::Unfolded:
371
      return false;
4 ✔
372
    case FoldMode::Auto:
735 ✔
373
    default:
374
      return std::ssize(m_inlets) > MaxUnpaginatedControls;
735 ✔
375
  }
376
}
747 ✔
377

378
double ProcessModel::getSlotHeight() const noexcept
25,787 ✔
379
{
380
  return m_slotHeight;
25,787 ✔
381
}
382

383
void ProcessModel::setSlotHeight(double v) noexcept
1,266 ✔
384
{
385
  m_slotHeight = v;
1,266 ✔
386
  slotHeightChanged(v);
1,266 ✔
387
}
1,266 ✔
388

389
void ProcessModel::setExecuting(bool e)
3,194 ✔
390
{
391
  m_executing = e;
3,194 ✔
392
}
3,194 ✔
393

394
std::optional<Process::MagneticInfo>
395
ProcessModel::magneticPosition(const QObject* o, const TimeVal t) const noexcept
×
396
{
397
  return {};
×
398
}
399

400
bool ProcessModel::externalSourceOutOfDate() const noexcept
×
401
{
402
  return false;
×
403
}
404

405
score::Command*
406
ProcessModel::refreshFromExternalSource(const score::DocumentContext& ctx) const
×
407
{
408
  return nullptr;
×
409
}
410

411
ProcessModel* parentProcess(QObject* obj) noexcept
4,310 ✔
412
{
413
  if(obj)
4,310 ✔
414
    obj = obj->parent();
4,310 ✔
415

416
  while(obj && !qobject_cast<ProcessModel*>(obj))
9,928 ✔
417
  {
418
    obj = obj->parent();
5,618 ✔
419
  }
420

421
  if(obj)
4,310 ✔
422
    return static_cast<ProcessModel*>(obj);
3,714 ✔
423
  return nullptr;
596 ✔
424
}
4,310 ✔
425

426
const ProcessModel* parentProcess(const QObject* obj) noexcept
7,118 ✔
427
{
428
  if(obj)
7,118 ✔
429
    obj = obj->parent();
7,118 ✔
430

431
  while(obj && !qobject_cast<const ProcessModel*>(obj))
11,542 ✔
432
  {
433
    obj = obj->parent();
4,424 ✔
434
  }
435

436
  if(obj)
7,118 ✔
437
    return static_cast<const ProcessModel*>(obj);
6,671 ✔
438
  return nullptr;
447 ✔
439
}
7,118 ✔
440

441
QString processLocalTreeAddress(const ProcessModel& proc)
×
442
{
443
  if(auto lt = findComponent<LocalTree::ProcessComponent>(proc.components()))
×
444
  {
445
    return QString::fromStdString(
×
446
        lt->node().get_device().get_name() + ":" + lt->node().osc_address());
×
447
  }
448
  return {};
×
449
}
×
450
}
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