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

ossia / score / 30754311710

02 Aug 2026 03:25PM UTC coverage: 15.222% (-0.04%) from 15.263%
30754311710

Pull #2163

github

web-flow
Merge 8b7bf0aad into e99b6a5da
Pull Request #2163: Fix backwards playback for audio plug-ins (VST, VST3, LV2, JSFX)

0 of 57 new or added lines in 5 files covered. (0.0%)

343 existing lines in 16 files now uncovered.

30381 of 199582 relevant lines covered (15.22%)

1075.26 hits per line

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

51.15
/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/Port.hpp>
6
#include <Process/ExpandMode.hpp>
7
#include <Process/PresetHelpers.hpp>
8
#include <Process/TimeValue.hpp>
9

10
#include <LocalTree/ProcessComponent.hpp>
11

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

20
#include <ossia/detail/algorithms.hpp>
21
#include <ossia/detail/disable_fpe.hpp>
22
#include <ossia/network/base/device.hpp>
23
#include <ossia/network/base/node.hpp>
24

25
#include <QObject>
26

27
#include <wobjectimpl.h>
28

29
W_OBJECT_IMPL(Process::ProcessModel)
1,166✔
30

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

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

92
ProcessModel::~ProcessModel()
1,026✔
93
{
1,026✔
94
  identified_object_destroying(this);
1,026✔
95
}
1,026✔
96

97
QString ProcessModel::effect() const noexcept
×
98
{
99
  return {};
×
100
}
101

102
void ProcessModel::setDurationAndScale(const TimeVal& newDuration) noexcept
×
103
{
104
  setDuration(newDuration);
×
105
}
×
106

107
void ProcessModel::setDurationAndGrow(const TimeVal& newDuration) noexcept
×
108
{
109
  setDuration(newDuration);
×
110
}
×
111

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

117
ProcessModel::ProcessModel(DataStream::Deserializer& vis, QObject* parent)
668✔
118
    : Entity(vis, parent)
334✔
119
{
668✔
120
  ossia::disable_fpe();
334✔
121
  vis.writeTo(*this);
334✔
122
  con(metadata(), &score::ModelMetadata::NameChanged, this,
668✔
123
      [this] { prettyNameChanged(); });
334✔
124
}
×
125

126
ProcessModel::ProcessModel(JSONObject::Deserializer& vis, QObject* parent)
662✔
127
    : Entity(vis, parent)
331✔
128
{
662✔
129
  ossia::disable_fpe();
331✔
130
  vis.writeTo(*this);
331✔
131
  con(metadata(), &score::ModelMetadata::NameChanged, this,
662✔
132
      [this] { prettyNameChanged(); });
331✔
133
}
×
134

135
QString ProcessModel::prettyName() const noexcept
50✔
136
{
137
  return metadata().getName();
50✔
138
}
139

140
void ProcessModel::setParentDuration(ExpandMode mode, const TimeVal& t) noexcept
×
141
{
142
  switch(mode)
×
143
  {
144
    case ExpandMode::Scale:
145
      setDurationAndScale(t);
×
146
      break;
×
147
    case ExpandMode::GrowShrink: {
148
      if(duration() < t)
×
149
        setDurationAndGrow(t);
×
150
      else
151
        setDurationAndShrink(t);
×
152
      break;
×
153
    }
154
    case ExpandMode::ForceGrow: {
155
      if(duration() < t)
×
156
        setDurationAndGrow(t);
×
157
      break;
×
158
    }
159
    case ExpandMode::CannotExpand:
×
160
    default:
161
      break;
×
162
  }
163
}
×
164

165
TimeVal ProcessModel::contentDuration() const noexcept
×
166
{
167
  return TimeVal::zero();
×
168
}
169

170
void ProcessModel::setDuration(const TimeVal& other) noexcept
1✔
171
{
172
  m_duration = other;
1✔
173
  durationChanged(m_duration);
1✔
174
}
1✔
175

176
const TimeVal& ProcessModel::duration() const noexcept
709✔
177
{
178
  return m_duration;
709✔
179
}
180

181
ProcessStateDataInterface* ProcessModel::startStateData() const noexcept
22✔
182
{
183
  return nullptr;
22✔
184
}
185

186
ProcessStateDataInterface* ProcessModel::endStateData() const noexcept
22✔
187
{
188
  return nullptr;
22✔
189
}
190

191
Selection ProcessModel::selectableChildren() const noexcept
×
192
{
193
  return {};
×
194
}
195

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

201
void ProcessModel::setSelection(const Selection& s) const noexcept
×
202
{
203
  // OPTIMIZEME
204
  auto cld = this->findChildren<Selectable*>();
×
205
  for(Selectable* child : cld)
×
206
  {
207
    child->set(s.contains(child->parent()));
×
208
  }
209
}
×
210

211
Process::Inlet* ProcessModel::inlet(const Id<Process::Port>& p) const noexcept
4✔
212
{
213
  for(auto e : m_inlets)
11✔
214
    if(e->id() == p)
10✔
215
      return e;
3✔
216
  return nullptr;
1✔
217
}
4✔
218

219
Process::Outlet* ProcessModel::outlet(const Id<Process::Port>& p) const noexcept
1✔
220
{
221
  for(auto e : m_outlets)
1✔
222
    if(e->id() == p)
1✔
223
      return e;
1✔
224
  return nullptr;
×
225
}
1✔
226

227
void ProcessModel::loadPreset(const Preset& preset)
×
228
{
229
  const rapidjson::Document doc = readJson(preset.data);
×
230
  loadFixedControls(doc.GetArray(), *this);
×
231
}
×
232

233
Preset ProcessModel::savePreset() const noexcept
×
234
{
235
  Preset p;
×
236
  p.name = this->metadata().getName();
×
237
  p.key.key = this->concreteKey();
×
238

239
  JSONReader r;
×
240
  saveFixedControls(r, *this);
×
241
  p.data = r.toByteArray();
×
242
  return p;
×
243
}
×
244

245
std::vector<Preset> ProcessModel::builtinPresets() const noexcept
×
246
{
247
  return {};
×
248
}
249

250
void ProcessModel::ancestorStartDateChanged() { }
×
251

252
void ProcessModel::ancestorTempoChanged() { }
×
253

254
void ProcessModel::forEachControl(
×
255
    smallfun::function<void(ControlInlet&, const ossia::value&)> f) const
256
{
257
  for(const auto& inlet : m_inlets)
×
258
  {
259
    if(auto ctrl = qobject_cast<Process::ControlInlet*>(inlet))
×
260
    {
261
      f(*ctrl, ctrl->value());
×
262
    }
×
263
  }
264
}
×
265

266
void ProcessModel::setCreatingControls(bool ok) { }
×
267

268
bool ProcessModel::creatingControls() const noexcept
×
269
{
270
  return this->flags() & ProcessFlags::CreateControls;
×
271
}
272

273
void ProcessModel::setLoops(bool b)
6✔
274
{
275
  if(b != m_loops)
6✔
276
  {
277
    m_loops = b;
4✔
278
    loopsChanged(b);
4✔
279
  }
4✔
280
}
6✔
281

282
void ProcessModel::setStartOffset(TimeVal b)
1✔
283
{
284
  if(b != m_startOffset)
1✔
285
  {
286
    m_startOffset = b;
1✔
287
    startOffsetChanged(b);
1✔
288
  }
1✔
289
}
1✔
290

291
void ProcessModel::setLoopDuration(TimeVal b)
×
292
{
293
  if(b.msec() < 0.1)
×
294
    b = TimeVal::fromMsecs(0.1);
×
295

296
  if(b != m_loopDuration)
×
297
  {
298
    m_loopDuration = b;
×
299
    loopDurationChanged(b);
×
300
  }
×
301
}
×
302

303
QPointF ProcessModel::position() const noexcept
10✔
304
{
305
  return m_position;
10✔
306
}
307

308
QSizeF ProcessModel::size() const noexcept
7✔
309
{
310
  return m_size;
7✔
311
}
312

313
void ProcessModel::setPosition(const QPointF& v)
25✔
314
{
315
  if(v != m_position)
25✔
316
  {
317
    m_position = v;
25✔
318
    positionChanged(v);
25✔
319
  }
25✔
320
}
25✔
321

322
void ProcessModel::setSize(const QSizeF& v)
5✔
323
{
324
  if(v != m_size)
5✔
325
  {
326
    m_size = v;
5✔
327
    sizeChanged(v);
5✔
328
  }
5✔
329
}
5✔
330

331
double ProcessModel::getSlotHeight() const noexcept
888✔
332
{
333
  return m_slotHeight;
888✔
334
}
335

336
void ProcessModel::setSlotHeight(double v) noexcept
18✔
337
{
338
  m_slotHeight = v;
18✔
339
  slotHeightChanged(v);
18✔
340
}
18✔
341

UNCOV
342
void ProcessModel::setExecuting(bool e)
×
343
{
UNCOV
344
  m_executing = e;
×
UNCOV
345
}
×
346

347
std::optional<Process::MagneticInfo>
348
ProcessModel::magneticPosition(const QObject* o, const TimeVal t) const noexcept
×
349
{
350
  return {};
×
351
}
352

353
ProcessModel* parentProcess(QObject* obj) noexcept
2✔
354
{
355
  if(obj)
2✔
356
    obj = obj->parent();
2✔
357

358
  while(obj && !qobject_cast<ProcessModel*>(obj))
2✔
359
  {
360
    obj = obj->parent();
×
361
  }
362

363
  if(obj)
2✔
364
    return static_cast<ProcessModel*>(obj);
2✔
365
  return nullptr;
×
366
}
2✔
367

368
const ProcessModel* parentProcess(const QObject* obj) noexcept
×
369
{
370
  if(obj)
×
371
    obj = obj->parent();
×
372

373
  while(obj && !qobject_cast<const ProcessModel*>(obj))
×
374
  {
375
    obj = obj->parent();
×
376
  }
377

378
  if(obj)
×
379
    return static_cast<const ProcessModel*>(obj);
×
380
  return nullptr;
×
381
}
×
382

383
QString processLocalTreeAddress(const ProcessModel& proc)
×
384
{
385
  if(auto lt = findComponent<LocalTree::ProcessComponent>(proc.components()))
×
386
  {
387
    return QString::fromStdString(
×
388
        lt->node().get_device().get_name() + ":" + lt->node().osc_address());
×
389
  }
390
  return {};
×
391
}
×
392
}
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