| 1174 | |
| 1175 | |
| 1176 | void Engine::updateParamHandle_NoLock(ParamHandle* paramHandle, int64_t moduleId, int paramId, bool overwrite) { |
| 1177 | // Check that it exists |
| 1178 | auto it = internal->paramHandles.find(paramHandle); |
| 1179 | DISTRHO_SAFE_ASSERT_RETURN(it != internal->paramHandles.end(),); |
| 1180 | |
| 1181 | // Set IDs |
| 1182 | paramHandle->moduleId = moduleId; |
| 1183 | paramHandle->paramId = paramId; |
| 1184 | paramHandle->module = NULL; |
| 1185 | // At this point, the ParamHandle cache might be invalid. |
| 1186 | |
| 1187 | if (paramHandle->moduleId >= 0) { |
| 1188 | // Replace old ParamHandle, or reset the current ParamHandle |
| 1189 | ParamHandle* oldParamHandle = getParamHandle_NoLock(moduleId, paramId); |
| 1190 | if (oldParamHandle) { |
| 1191 | if (overwrite) { |
| 1192 | oldParamHandle->moduleId = -1; |
| 1193 | oldParamHandle->paramId = 0; |
| 1194 | oldParamHandle->module = NULL; |
| 1195 | } |
| 1196 | else { |
| 1197 | paramHandle->moduleId = -1; |
| 1198 | paramHandle->paramId = 0; |
| 1199 | paramHandle->module = NULL; |
| 1200 | } |
| 1201 | } |
| 1202 | } |
| 1203 | |
| 1204 | // Set module pointer if the above block didn't reset it |
| 1205 | if (paramHandle->moduleId >= 0) { |
| 1206 | paramHandle->module = getModule_NoLock(paramHandle->moduleId); |
| 1207 | } |
| 1208 | |
| 1209 | Engine_refreshParamHandleCache(this); |
| 1210 | } |
| 1211 | |
| 1212 | |
| 1213 | json_t* Engine::toJson() { |
no test coverage detected