• 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

66.32
/src/plugins/score-plugin-js/JS/Executor/Component.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 "Component.hpp"
4

5
#include <LocalTree/LocalTreeDocumentPlugin.hpp>
6

7
#include "CPUNode.hpp"
8

9
#include <Explorer/DocumentPlugin/DeviceDocumentPlugin.hpp>
10

11
#include <Scenario/Execution/score2OSSIA.hpp>
12

13
#include <Execution/DocumentPlugin.hpp>
14
#include <JS/JSProcessModel.hpp>
15

16
#include <score/tools/FilePath.hpp>
17

18
#if defined(SCORE_HAS_GPU_JS)
19
#include "GPUNode.hpp"
20

21
#include <Gfx/GfxApplicationPlugin.hpp>
22
#include <Gfx/TexturePort.hpp>
23
#endif
24

25
#include <score/tools/Bind.hpp>
26

27
#include <stdexcept>
28

29
namespace JS
30
{
31
namespace Executor
32
{
33
Component::Component(
5 ✔
34
    JS::ProcessModel& element, const ::Execution::Context& ctx, QObject* parent)
35
    : ::Execution::ProcessComponent_T<JS::ProcessModel, ossia::node_process>{
5 ✔
36
        element, ctx, "JSComponent", parent}
5 ✔
37
{
5 ✔
38
#if defined(__EMSCRIPTEN__)
39
  // The QML engine runs on the audio thread, which in a browser is an
40
  // AudioWorklet: a Wasm Worker, not a pthread. pthread_self() is null there,
41
  // so Qt cannot tell threads apart and QRecursiveMutex excludes nothing; the
42
  // first contended lock spins forever and takes the page with it.
43
  throw std::runtime_error{"Javascript processes are not supported in the web build"};
44
#endif
45
  const bool isGpu = element.isGpu();
5 ✔
46

47
  if(!isGpu)
5 ✔
48
  {
49
    auto& tree = ctx.doc.plugin<LocalTree::DocumentPlugin>();
5 ✔
50
    std::shared_ptr<js_node> node
51
        = ossia::make_node<js_node>(*ctx.execState, *ctx.execState, tree.snapshot());
5 ✔
52
    this->node = node;
5 ✔
53

54
    // The old names go back to the GUI thread to be released
55
    connect(
5 ✔
56
        &tree, &LocalTree::ScriptableTreeBase::snapshotChanged, this,
5 ✔
57
        [this, node, &tree] {
5 ✔
58
      in_exec([node, names = tree.snapshot(), gcq = weak_gc]() mutable {
×
59
        std::swap(node->m_names, names);
×
60
        node->m_namesChanged = true;
×
61
        if(auto q = gcq.lock())
×
62
          q->enqueue(Execution::gc(std::move(names)));
×
63
      });
×
64
    });
×
65

66
    // FIXME also process in this GPU
67
    node->m_modelState = element.state();
5 ✔
68
    node->m_uiContext = this;
5 ✔
69
    node->m_modelContext = &element;
5 ✔
70
    node->m_messageToUi = [this] (const QVariant& v){
5 ✔
71
      OSSIA_ENSURE_CURRENT_THREAD_KIND(ossia::thread_type::Ui);
×
72
      this->process().executionToUi(v);
×
73
    };
×
74
    connect(
5 ✔
75
        &element, &JS::ProcessModel::uiToExecution, this,
5 ✔
76
        [this, node](const QVariant& v) {
5 ✔
77
      auto encaps = std::make_unique<QVariant>(v);
×
78
      in_exec([node, vv=std::move(encaps)] { node->uiMessage(*vv); });
×
79
    }, Qt::QueuedConnection);
×
80
    connect(
5 ✔
81
        &element, &JS::ProcessModel::stateElementChanged, this,
5 ✔
82
        [this, node](const QString& k, const ossia::value& v) {
6 ✔
83
      in_exec([node, k=k, v=v] { node->stateElementChanged(k, v); });
1 ✔
84
    }, Qt::QueuedConnection);
1 ✔
85

86
    auto proc = std::make_shared<js_process>(node);
5 ✔
87
    m_ossia_process = proc;
5 ✔
88
    on_scriptChange();
5 ✔
89
  }
5 ✔
90
  else
91
  {
92
#if defined(SCORE_HAS_GPU_JS)
93
    std::shared_ptr<gpu_exec_node> node = ossia::make_node<gpu_exec_node>(
94
        *ctx.execState, ctx.doc.plugin<Gfx::DocumentPlugin>().exec);
95
    this->node = node;
96

97
    m_ossia_process = std::make_shared<ossia::node_process>(node);
98

99
    on_scriptChange();
100
#else
101
    throw std::runtime_error(
×
102
        "GPU Nodes not supported in this build of score, use a distribution with an "
103
        "up-to-date version of Qt.");
104
#endif
105
  }
106

107
  con(element, &JS::ProcessModel::programChanged, this, &Component::on_scriptChange,
10 ✔
108
      Qt::DirectConnection);
5 ✔
109
}
5 ✔
110

111
Component::~Component() { }
5 ✔
112

113
void Component::cleanup()
9 ✔
114
{
115
#if defined(SCORE_HAS_GPU_JS)
116
  for(auto* outlet : process().outlets())
117
    if(auto out = qobject_cast<Gfx::TextureOutlet*>(outlet))
118
      out->nodeId = score::gfx::invalid_node_index;
119
#endif
120
  Execution::ProcessComponent::cleanup();
9 ✔
121
}
9 ✔
122

123
void Component::on_scriptChange()
5 ✔
124
{
125
  enum Type
126
  {
127
    None,
128
    Cpu,
129
    Gpu
130
  };
131
  Type cur_type{};
5 ✔
132
  Type next_type = process().isGpu() ? Gpu : Cpu;
5 ✔
133

134
  if(!node)
5 ✔
135
  {
136
    cur_type = None;
×
137
  }
×
138
  else if(auto old_node = std::dynamic_pointer_cast<js_node>(node))
10 ✔
139
  {
140
    cur_type = Cpu;
5 ✔
141
  }
5 ✔
142
  else
143
  {
144
    cur_type = Gpu;
×
145
  }
146

147
  Execution::Transaction commands{system()};
5 ✔
148

149
  // 0. Unregister all the previous inlets / outlets
150
  auto& setup = system().setup;
5 ✔
151
  setup.unregister_node_soft(process().inlets(), process().outlets(), node, commands);
5 ✔
152
#if defined(SCORE_HAS_GPU_JS)
153
  for(auto* outlet : process().outlets())
154
    if(auto out = qobject_cast<Gfx::TextureOutlet*>(outlet))
155
      out->nodeId = score::gfx::invalid_node_index;
156
#endif
157

158
  std::tuple<ossia::inlets, ossia::outlets, std::vector<Execution::ExecutionCommand>>
159
      new_ports;
5 ✔
160

161
  for(auto ctrl : process().inlets())
7 ✔
162
    disconnect(ctrl, nullptr, this, nullptr);
2 ✔
163
  for(auto ctrl : process().outlets())
8 ✔
164
    disconnect(ctrl, nullptr, this, nullptr);
3 ✔
165

166
  const auto& script = process().qmlData();
5 ✔
167
  // 1. Recreate ports & change the script
168
  if(cur_type == next_type)
5 ✔
169
  {
170
    if(next_type == Cpu)
5 ✔
171
      new_ports = on_cpuScriptChange(script, commands);
5 ✔
172
    else if(next_type == Gpu)
×
173
      new_ports = on_gpuScriptChange(script, commands);
×
174
  }
5 ✔
175
  else
176
  {
177
    // FIXME destroy the node
178
    if(next_type == Cpu)
×
179
      new_ports = on_cpuScriptChange(script, commands);
×
180
    else if(next_type == Gpu)
×
181
      new_ports = on_gpuScriptChange(script, commands);
×
182
  }
183

184
  // 3. Register the inlets / outlets
185
  auto& [inls, outls, controlSetups] = new_ports;
25 ✔
186

187
  for(std::size_t i = 0; i < inls.size(); i++)
7 ✔
188
  {
189
    setup.register_inlet(*process().inlets()[i], inls[i], node, commands);
2 ✔
190
  }
2 ✔
191
  for(std::size_t i = 0; i < outls.size(); i++)
8 ✔
192
  {
193
    setup.register_outlet(*process().outlets()[i], outls[i], node, commands);
3 ✔
194
  }
3 ✔
195

196
  // Additional commands once the inlets / outlets are set
197
  commands.commands.reserve(commands.commands.size() + controlSetups.size());
10 ✔
198
  // OPTIMIZEME std::move algorithm
199
  for(auto& cmd : controlSetups)
6 ✔
200
    commands.commands.push_back(std::move(cmd));
1 ✔
201
  controlSetups.clear();
5 ✔
202

203
  commands.run_all();
5 ✔
204

205
  m_oldInlets = process().inlets();
5 ✔
206
  m_oldOutlets = process().outlets();
5 ✔
207
}
5 ✔
208

209
std::tuple<ossia::inlets, ossia::outlets, std::vector<Execution::ExecutionCommand>>
210
Component::on_gpuScriptChange(const QString& script, Execution::Transaction& commands)
×
211
{
212
#if defined(SCORE_HAS_GPU_JS)
213
  auto node = std::dynamic_pointer_cast<gpu_exec_node>(this->node);
214
  std::weak_ptr<Gfx::gfx_exec_node> weak_node = node;
215
  int script_index = ++node->script_index;
216

217
  // 1. Create new inlet & outlet arrays
218
  ossia::inlets inls;
219
  ossia::outlets outls;
220
  Gfx::exec_controls controls;
221
  std::vector<Execution::ExecutionCommand> controlSetups;
222

223
  int inlet_idx = 0;
224
  int outlet_idx = 0;
225
  std::size_t control_index = 0;
226
  {
227
    const Execution::Context& ctx = system();
228
    if(auto object = process().currentExecutionObject())
229
    {
230
      for(auto n : object->children())
231
      {
232
        auto inlet = qobject_cast<Inlet*>(n);
233
        auto outlet = qobject_cast<Outlet*>(n);
234
        if(!inlet && !outlet)
235
          continue;
236

237
        if([[maybe_unused]] auto val_in = qobject_cast<ValueInlet*>(inlet))
238
        {
239
          // NOTE! we do not use add_control() here as it changes the internal arrays,
240
          // while we will replace them after in ossia::recabler
241

242
          auto inletport = new ossia::value_inlet;
243
          auto control = std::make_shared<Gfx::gfx_exec_node::control>();
244
          control->port = &**inletport;
245
          control->changed = true;
246
          controls.push_back(control);
247

248
          inls.push_back(inletport);
249

250
          control_index++;
251
        }
252

253
        else if([[maybe_unused]] auto ctrl_in = qobject_cast<JS::ControlInlet*>(inlet))
254
        {
255
          auto inletport = new ossia::value_inlet;
256
          auto control = std::make_shared<Gfx::gfx_exec_node::control>();
257
          control->port = &**inletport;
258
          control->changed = true;
259

260
          // Configure control forwarding
261

262
          {
263
            auto model_port = process().inlets()[inlet_idx];
264
            auto model_ctrl = safe_cast<Process::ControlInlet*>(model_port);
265

266
            model_ctrl->setupExecution(*inletport, this);
267
            control->changed = true;
268

269
            // TODO assert that we aren't going to connect UI -> exec twice
270

271
            if(auto ctrl = model_ctrl; qobject_cast<Process::FileChooserBase*>(ctrl))
272
            {
273
              connect(
274
                  ctrl, &Process::ControlInlet::valueChanged, this,
275
                  [&ctx, control_index, script_index,
276
                   weak_node](const ossia::value& val) {
277
                if(auto str = val.target<std::string>())
278
                {
279
                  auto path = score::locateFilePath(
280
                      QString::fromStdString(*str).trimmed(), ctx.doc);
281
                  Gfx::con_unvalidated{ctx, control_index, script_index, weak_node}(
282
                      path.toStdString());
283
                }
284
              });
285
              control->value = model_ctrl->value();
286
              if(auto str = model_ctrl->value().target<std::string>())
287
              {
288
                auto path = score::locateFilePath(
289
                    QString::fromStdString(*str).trimmed(), ctx.doc);
290
                control->value = path.toStdString();
291
              }
292
            }
293
            else
294
            {
295
              QObject::connect(
296
                  model_ctrl, &Process::ControlInlet::valueChanged, this,
297
                  Gfx::con_unvalidated{ctx, control_index, script_index, weak_node});
298
              control->value = model_ctrl->value();
299
            }
300
            // FIXME initial control state
301
            // controlSetups.push_back([/* node, val = ctrl->value(), idx */] {
302
            //   // node->setControl(idx, val.apply(ossia::qt::ossia_to_qvariant{}));
303
            // });
304
          }
305

306
          controls.push_back(control);
307

308
          inls.push_back(inletport);
309

310
          control_index++;
311
        }
312
        else if([[maybe_unused]] auto tex_in = qobject_cast<TextureInlet*>(inlet))
313
        {
314
          auto model_port = process().inlets()[inlet_idx];
315
          auto p = new ossia::texture_inlet;
316
          inls.push_back(p);
317
          model_port->setupExecution(*p, this);
318
        }
319
        /*
320
        if(auto ctrl_in = qobject_cast<ControlInlet*>(n))
321
        {
322
          inls.push_back(new ossia::value_inlet);
323
          inls.back()->target<ossia::value_port>()->is_event = false;
324

325
          ++idx;
326
        }
327
        else if(auto val_in = qobject_cast<ValueInlet*>(n))
328
        {
329
          inls.push_back(new ossia::value_inlet);
330
          auto& vp = *inls.back()->target<ossia::value_port>();
331

332
          vp.is_event = !val_in->isEvent();
333
          if(auto ctrl = qobject_cast<Process::ControlInlet*>(process().inlets()[idx]))
334
          {
335
            vp.type = ctrl->value().get_type();
336
            vp.domain = ctrl->domain().get();
337

338
            disconnect(ctrl, nullptr, this, nullptr);
339
            if(auto impulse = qobject_cast<Process::ImpulseButton*>(ctrl))
340
            {
341
              // connect(
342
              //     ctrl, &Process::ControlInlet::valueChanged, this,
343
              //     [this, node, idx](const ossia::value& val) {
344
              //   this->in_exec([node, idx] { node->impulse(idx); });
345
              //     });
346
            }
347
            else
348
            {
349
              // // Common case
350
              // connect(
351
              //     ctrl, &Process::ControlInlet::valueChanged, this,
352
              //     [this, node, idx](const ossia::value& val) {
353
              //   this->in_exec([node, val, idx] {
354
              //     node->setControl(idx, val.apply(ossia::qt::ossia_to_qvariant{}));
355
              //   });
356
              //     });
357
              // controlSetups.push_back([node, val = ctrl->value(), idx] {
358
              //   node->setControl(idx, val.apply(ossia::qt::ossia_to_qvariant{}));
359
              // });
360
            }
361
          }
362

363
          ++idx;
364
        }
365
        else if(auto aud_in = qobject_cast<AudioInlet*>(n))
366
        {
367
          inls.push_back(new ossia::audio_inlet);
368

369
          ++idx;
370
        }
371
        else if(auto mid_in = qobject_cast<MidiInlet*>(n))
372
        {
373
          inls.push_back(new ossia::midi_inlet);
374

375
          ++idx;
376
        }
377
        else if(auto val_out = qobject_cast<ValueOutlet*>(n))
378
        {
379
          outls.push_back(new ossia::value_outlet);
380
        }
381
        else if(auto aud_out = qobject_cast<AudioOutlet*>(n))
382
        {
383
          outls.push_back(new ossia::audio_outlet);
384
        }
385
        else if(auto mid_out = qobject_cast<MidiOutlet*>(n))
386
        {
387
          outls.push_back(new ossia::midi_outlet);
388
        }
389
*/
390

391
        else if(qobject_cast<ValueOutlet*>(outlet))
392
        {
393
          outls.push_back(new ossia::value_outlet);
394
        }
395
        else if([[maybe_unused]] auto tex_out = qobject_cast<TextureOutlet*>(outlet))
396
        {
397
          outls.push_back(new ossia::texture_outlet);
398
        }
399

400
        if(inlet)
401
          inlet_idx++;
402
        else if(outlet)
403
          outlet_idx++;
404
      }
405
    }
406
    else
407
    {
408
      return {};
409
    }
410
  }
411

412
  // Send the updates to the node
413
  auto recable = std::shared_ptr<ossia::recabler>(
414
      new ossia::recabler{node, system().execGraph, inls, outls});
415
  commands.push_back(
416
      [node, controls, recable, self = QPointer{this}, weak_node, script_index,
417
       source = std::make_unique<std::tuple<QString, QString, JS::JSState>>(
418
           process().rootPath(), script, process().state())]() mutable {
419
    using namespace std;
420
    // Note: we need to do this because we try to keep the Javascript node around
421
    // because it's slow to recreate.
422
    // But this causes a lot of problems, it'd be better to do like e.g. the faust
423
    // process and entirely recreate a new node, + call update node.
424
    (*recable)();
425

426
    swap(node->controls, controls);
427
    auto& [root, script, state] = *source;
428
    // This runs on the execution thread, while the UI thread may be removing
429
    // the process: build the new GpuNode here, but connect and register it
430
    // from the UI thread, and only if the component (hence its process) is
431
    // still alive and this is still the latest script.
432
    auto box = std::make_shared<std::unique_ptr<score::gfx::Node>>(
433
        node->prepareScript(root, script, std::move(state)));
434
    QMetaObject::invokeMethod(
435
        qApp,
436
        [self, weak_node, script_index, box] {
437
      const auto exec = std::dynamic_pointer_cast<gpu_exec_node>(weak_node.lock());
438
      if(!self || !exec || self->node != exec || exec->script_index != script_index
439
         || !*box)
440
        return; // dropping the box deletes the unregistered node, here on the UI thread
441
      const int32_t id = exec->attachAndRegister(std::move(*box), self->process());
442
      self->system().executionQueue.enqueue(
443
          [exec, id, script_index] { exec->adoptId(id, script_index); });
444
      for(auto* outlet : self->process().outlets())
445
        if(auto out = qobject_cast<Gfx::TextureOutlet*>(outlet))
446
          out->nodeId = id;
447
    },
448
        Qt::QueuedConnection);
449
  });
450

451
  SCORE_ASSERT(process().inlets().size() == inls.size());
452
  SCORE_ASSERT(process().outlets().size() == outls.size());
453
  return {std::move(inls), std::move(outls), std::move(controlSetups)};
454
#else
455
  return {};
×
456
#endif
457
}
458

459
std::tuple<ossia::inlets, ossia::outlets, std::vector<Execution::ExecutionCommand>>
460
Component::on_cpuScriptChange(const QString& script, Execution::Transaction& commands)
5 ✔
461
{
462
  [[maybe_unused]] auto& setup = system().setup;
5 ✔
463
  auto node = std::dynamic_pointer_cast<js_node>(this->node);
5 ✔
464

465
  // 1. Create new inlet & outlet arrays
466
  ossia::inlets inls;
5 ✔
467
  ossia::outlets outls;
5 ✔
468
  std::vector<Execution::ExecutionCommand> controlSetups;
5 ✔
469

470
  {
471
    if(auto object = process().currentExecutionObject())
5 ✔
472
    {
473
      int idx = 0;
5 ✔
474
      auto process_if_control
475
          = [this, &node, &controlSetups](ossia::value_port& vp, int idx) {
7 ✔
476
        if(auto ctrl = qobject_cast<Process::ControlInlet*>(process().inlets()[idx]))
2 ✔
477
        {
478
          vp.type = ctrl->value().get_type();
1 ✔
479
          vp.domain = ctrl->domain().get();
1 ✔
480

481
          if([[maybe_unused]] auto impulse = qobject_cast<Process::ImpulseButton*>(ctrl))
1 ✔
482
          {
483
            connect(
×
484
                ctrl, &Process::ControlInlet::valueChanged, this,
×
485
                [this, node, idx](const ossia::value& val) {
×
486
              in_exec([node, idx] { node->impulse(idx); });
×
487
            });
×
488
          }
×
489
          else if(
490
              [[maybe_unused]] auto impulse
1 ✔
491
              = qobject_cast<Process::FileChooserBase*>(ctrl))
1 ✔
492
          {
493
            connect(
×
494
                ctrl, &Process::ControlInlet::valueChanged, this,
×
495
                [&ctx = system().context().doc, node, idx](const ossia::value& val) {
×
496
              if(auto str = val.target<std::string>())
×
497
              {
498
                auto path
499
                    = score::locateFilePath(QString::fromStdString(*str).trimmed(), ctx);
×
500
                node->setControl(idx, path);
×
501
              }
×
502
            });
×
503
            controlSetups.push_back(
×
504
                [&ctx = system().context().doc, node, val = ctrl->value(), idx] {
×
505
              if(auto str = val.target<std::string>())
×
506
              {
507
                auto path
508
                    = score::locateFilePath(QString::fromStdString(*str).trimmed(), ctx);
×
509
                node->setControl(idx, path);
×
510
              }
×
511
            });
×
512
          }
×
513
          else
514
          {
515
            // Common case
516
            connect(
1 ✔
517
                ctrl, &Process::ControlInlet::valueChanged, this,
1 ✔
518
                [this, node, idx](const ossia::value& val) {
1 ✔
519
              in_exec([node, val, idx] {
×
520
                node->setControl(idx, val.apply(ossia::qt::ossia_to_qvariant{}));
×
521
              });
×
522
            });
×
523
            controlSetups.push_back([node, val = ctrl->value(), idx] {
2 ✔
524
              node->setControl(idx, val.apply(ossia::qt::ossia_to_qvariant{}));
1 ✔
525
            });
1 ✔
526
          }
527
        }
1 ✔
528
      };
2 ✔
529
      for(auto n : object->children())
10 ✔
530
      {
531
        if(qobject_cast<ControlInlet*>(n))
5 ✔
532
        {
533
          inls.push_back(new ossia::value_inlet);
1 ✔
534
          auto& vp = *inls.back()->target<ossia::value_port>();
1 ✔
535
          vp.is_event = false;
1 ✔
536

537
          process_if_control(vp, idx);
1 ✔
538

539
          ++idx;
1 ✔
540
        }
1 ✔
541
        else if(auto val_in = qobject_cast<ValueInlet*>(n))
4 ✔
542
        {
543
          inls.push_back(new ossia::value_inlet);
1 ✔
544
          auto& vp = *inls.back()->target<ossia::value_port>();
1 ✔
545
          vp.is_event = !val_in->isEvent();
1 ✔
546

547
          process_if_control(vp, idx);
1 ✔
548

549
          ++idx;
1 ✔
550
        }
1 ✔
551
        else if(qobject_cast<AudioInlet*>(n))
3 ✔
552
        {
553
          inls.push_back(new ossia::audio_inlet);
×
554

555
          ++idx;
×
556
        }
×
557
        else if(qobject_cast<MidiInlet*>(n))
3 ✔
558
        {
559
          inls.push_back(new ossia::midi_inlet);
×
560

561
          ++idx;
×
562
        }
×
563
        else if(qobject_cast<ValueOutlet*>(n))
3 ✔
564
        {
565
          outls.push_back(new ossia::value_outlet);
3 ✔
566
        }
3 ✔
567
        else if(qobject_cast<AudioOutlet*>(n))
×
568
        {
569
          outls.push_back(new ossia::audio_outlet);
×
570
        }
×
571
        else if(qobject_cast<MidiOutlet*>(n))
×
572
        {
573
          outls.push_back(new ossia::midi_outlet);
×
574
        }
×
575
      }
576
    }
5 ✔
577
    else
578
    {
579
      return {};
×
580
    }
581
  }
582

583
  // Send the updates to the node
584
  auto recable = std::shared_ptr<ossia::recabler>(
5 ✔
585
      new ossia::recabler{node, system().execGraph, inls, outls});
5 ✔
586
  commands.push_back([node, path = process().rootPath(), script, recable,
15 ✔
587
                      st = std::make_unique<JS::JSState>(process().state())]() mutable {
5 ✔
588
    // Note: we need to do this because we try to keep the Javascript node around
589
    // because it's slow to recreate.
590
    // But this causes a lot of problems, it'd be better to do like e.g. the faust
591
    // process and entirely recreate a new node, + call update node.
592
    (*recable)();
5 ✔
593

594
    node->m_modelState = std::move(*st);
5 ✔
595
    node->setScript(path, std::move(script));
5 ✔
596
  });
5 ✔
597

598
  SCORE_ASSERT(process().inlets().size() == inls.size());
5 ✔
599
  SCORE_ASSERT(process().outlets().size() == outls.size());
5 ✔
600
  return {std::move(inls), std::move(outls), std::move(controlSetups)};
5 ✔
601
}
5 ✔
602

603
}
604
}
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