MCPcopy Create free account
hub / github.com/DISTRHO/Cardinal / osc_param_handler

Function osc_param_handler

src/CardinalCommon.cpp:424–456  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

422}
423
424static int osc_param_handler(const char*, const char* types, lo_arg** argv, int argc, const lo_message m, void* const self)
425{
426 d_debug("osc_param_handler()");
427 DISTRHO_SAFE_ASSERT_RETURN(argc == 3, 0);
428 DISTRHO_SAFE_ASSERT_RETURN(types != nullptr, 0);
429 DISTRHO_SAFE_ASSERT_RETURN(types[0] == 'h', 0);
430 DISTRHO_SAFE_ASSERT_RETURN(types[1] == 'i', 0);
431 DISTRHO_SAFE_ASSERT_RETURN(types[2] == 'f', 0);
432
433 if (CardinalBasePlugin* const plugin = static_cast<Initializer*>(self)->remotePluginInstance)
434 {
435 CardinalPluginContext* const context = plugin->context;
436
437 const int64_t moduleId = argv[0]->h;
438 const int paramId = argv[1]->i;
439 const float paramValue = argv[2]->f;
440
441 #ifdef CARDINAL_INIT_OSC_THREAD
442 rack::contextSet(context);
443 #endif
444
445 rack::engine::Module* const module = context->engine->getModule(moduleId);
446 DISTRHO_SAFE_ASSERT_RETURN(module != nullptr, 0);
447
448 context->engine->setParamValue(module, paramId, paramValue);
449
450 #ifdef CARDINAL_INIT_OSC_THREAD
451 rack::contextSet(nullptr);
452 #endif
453 }
454
455 return 0;
456}
457
458static int osc_host_param_handler(const char*, const char* types, lo_arg** argv, int argc, const lo_message m, void* const self)
459{

Callers

nothing calls this directly

Calls 3

setParamValueMethod · 0.80
contextSetFunction · 0.50
getModuleMethod · 0.45

Tested by

no test coverage detected