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

Method stateChanged

distrho/src/DistrhoUI.cpp:485–508  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

483
484#if DISTRHO_PLUGIN_WANT_STATE
485void UI::stateChanged(const char* const key, const char* const value)
486{
487 #if DISTRHO_UI_USE_WEB_VIEW
488 if (uiData->webview != nullptr)
489 {
490 const size_t keylen = std::strlen(key);
491 const size_t valuelen = std::strlen(value);
492 const size_t msglen = keylen + valuelen + 60;
493 if (char* const msg = static_cast<char*>(std::malloc(msglen)))
494 {
495 // TODO escape \\'
496 std::snprintf(msg, msglen - 1,
497 "typeof(stateChanged) === 'function' && stateChanged('%s','%s')", key, value);
498 msg[msglen - 1] = '\0';
499 webViewEvaluateJS(uiData->webview, msg);
500 std::free(msg);
501 }
502 }
503 #else
504 // unused
505 (void)key;
506 (void)value;
507 #endif
508}
509#endif
510
511/* ------------------------------------------------------------------------------------------------------------

Callers 9

notifyFunction · 0.45
setStateFromPluginMethod · 0.45
dssiui_configureMethod · 0.45
lv2ui_port_eventMethod · 0.45
carla_setCustomDataFunction · 0.45
stateChangedFunction · 0.45
setStateFromPluginMethod · 0.45
createUIMethod · 0.45

Calls 1

webViewEvaluateJSFunction · 0.85

Tested by

no test coverage detected