MCPcopy Create free account
hub / github.com/VCVRack/Rack / json_array_foreach

Function json_array_foreach

src/engine/Engine.cpp:1289–1320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1287 size_t moduleIndex;
1288 json_t* moduleJ;
1289 json_array_foreach(modulesJ, moduleIndex, moduleJ) {
1290 // Get model
1291 plugin::Model* model;
1292 try {
1293 model = plugin::modelFromJson(moduleJ);
1294 }
1295 catch (Exception& e) {
1296 WARN("Cannot load model: %s", e.what());
1297 continue;
1298 }
1299
1300 // Create module
1301 INFO("Creating module %s", model->getFullName().c_str());
1302 Module* module = model->createModule();
1303 assert(module);
1304
1305 try {
1306 module->fromJson(moduleJ);
1307
1308 // Before 1.0, the module ID was the index in the "modules" array
1309 if (module->id < 0) {
1310 module->id = moduleIndex;
1311 }
1312 }
1313 catch (Exception& e) {
1314 WARN("Cannot load module: %s", e.what());
1315 delete module;
1316 continue;
1317 }
1318
1319 modules.push_back(module);
1320 }
1321
1322 std::lock_guard<SharedMutex> lock(internal->mutex);
1323

Callers

nothing calls this directly

Calls 5

modelFromJsonFunction · 0.85
whatMethod · 0.80
getFullNameMethod · 0.45
createModuleMethod · 0.45
fromJsonMethod · 0.45

Tested by

no test coverage detected