MCPcopy Create free account
hub / github.com/DISTRHO/DPF / flushParameters

Method flushParameters

distrho/src/DistrhoPluginCLAP.cpp:1263–1316  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1261 }
1262
1263 void flushParameters(const clap_input_events_t* const in,
1264 const clap_output_events_t* const out,
1265 const uint32_t frameOffset)
1266 {
1267 if (const uint32_t len = in != nullptr ? in->size(in) : 0)
1268 {
1269 for (uint32_t i=0; i<len; ++i)
1270 {
1271 const clap_event_header_t* const event = in->get(in, i);
1272
1273 if (event->type != CLAP_EVENT_PARAM_VALUE)
1274 continue;
1275 if (event->space_id != 0)
1276 continue;
1277
1278 DISTRHO_SAFE_ASSERT_UINT2_BREAK(event->size == sizeof(clap_event_param_value_t),
1279 event->size, sizeof(clap_event_param_value_t));
1280
1281 setParameterValueFromEvent(reinterpret_cast<const clap_event_param_value_t*>(event));
1282 }
1283 }
1284
1285 if (out != nullptr)
1286 {
1287 clap_event_param_value_t clapEvent = {
1288 { sizeof(clap_event_param_value_t), frameOffset, 0, CLAP_EVENT_PARAM_VALUE, CLAP_EVENT_IS_LIVE },
1289 0, nullptr, 0, 0, 0, 0, 0.0
1290 };
1291
1292 float value;
1293 for (uint i=0; i<fCachedParameters.numParams; ++i)
1294 {
1295 if (fPlugin.isParameterOutputOrTrigger(i))
1296 {
1297 value = fPlugin.getParameterValue(i);
1298
1299 if (d_isEqual(fCachedParameters.values[i], value))
1300 continue;
1301
1302 fCachedParameters.values[i] = value;
1303 fCachedParameters.changed[i] = true;
1304
1305 clapEvent.param_id = i;
1306 clapEvent.value = value;
1307 out->try_push(out, &clapEvent.header);
1308 }
1309 }
1310 }
1311
1312 #if DISTRHO_PLUGIN_WANT_LATENCY
1313 const bool active = fPlugin.isActive();
1314 checkForLatencyChanges(active, !active);
1315 #endif
1316 }
1317
1318 // ----------------------------------------------------------------------------------------------------------------
1319

Callers 1

clap_plugin_params_flushFunction · 0.80

Calls 4

d_isEqualFunction · 0.85
sizeMethod · 0.80
isActiveMethod · 0.80
getParameterValueMethod · 0.45

Tested by

no test coverage detected