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

Method updateParamHandle_NoLock

src/engine/Engine.cpp:1211–1245  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1209
1210
1211void Engine::updateParamHandle_NoLock(ParamHandle* paramHandle, int64_t moduleId, int paramId, bool overwrite) {
1212 // Check that it exists
1213 auto it = internal->paramHandles.find(paramHandle);
1214 assert(it != internal->paramHandles.end());
1215
1216 // Set IDs
1217 paramHandle->moduleId = moduleId;
1218 paramHandle->paramId = paramId;
1219 paramHandle->module = NULL;
1220 // At this point, the ParamHandle cache might be invalid.
1221
1222 if (paramHandle->moduleId >= 0) {
1223 // Replace old ParamHandle, or reset the current ParamHandle
1224 ParamHandle* oldParamHandle = getParamHandle_NoLock(moduleId, paramId);
1225 if (oldParamHandle) {
1226 if (overwrite) {
1227 oldParamHandle->moduleId = -1;
1228 oldParamHandle->paramId = 0;
1229 oldParamHandle->module = NULL;
1230 }
1231 else {
1232 paramHandle->moduleId = -1;
1233 paramHandle->paramId = 0;
1234 paramHandle->module = NULL;
1235 }
1236 }
1237 }
1238
1239 // Set module pointer if the above block didn't reset it
1240 if (paramHandle->moduleId >= 0) {
1241 paramHandle->module = getModule_NoLock(paramHandle->moduleId);
1242 }
1243
1244 Engine_refreshParamHandleCache(this);
1245}
1246
1247
1248json_t* Engine::toJson() {

Callers 2

clearMaps_NoLockMethod · 0.80
json_array_foreachMethod · 0.80

Calls 1

Tested by

no test coverage detected