@@ -1926,22 +1926,22 @@ int LV2Synth::lv2ui_Resize(LV2UI_Feature_Handle handle, int width, int height)
19261926
19271927// Static.
19281928LV2UI_Request_Value_Status LV2Synth::lv2ui_Request_Value (
1929- LV2UI_Feature_Handle /* handle*/ , LV2_URID /* key*/ , LV2_URID /* type*/ , const LV2_Feature *const */*features*/ )
1929+ LV2UI_Feature_Handle handle, LV2_URID key, LV2_URID type, const LV2_Feature *const */*features*/ )
19301930{
19311931// TODO FIXME Finish this...
1932- // LV2PluginWrapper_State *state = (LV2PluginWrapper_State *)handle;
1933- // LV2Synth *synth = state->synth;
1934- // const char *uriKey = synth->unmapUrid(key);
1935- // const char *uriType = synth->unmapUrid(type);
1936- //
1937- // //fprintf(stderr, "uriKey:%s uriType:%s\n", uriKey, uriType);
1938- //
1939- // LilvNode* keyNode = lilv_new_uri(lilvWorld, uriKey);
1940- // if(keyNode)
1941- // {
1942- //
1943- // lilv_free(keyNode);
1944- // }
1932+ LV2PluginWrapper_State *state = (LV2PluginWrapper_State *)handle;
1933+ LV2Synth *synth = state->synth ;
1934+ const char *uriKey = synth->unmapUrid (key);
1935+ // const char *uriType = synth->unmapUrid(type);
1936+
1937+ // fprintf(stderr, "uriKey:%s uriType:%s\n", uriKey, uriType);
1938+
1939+ LilvNode* keyNode = lilv_new_uri (lilvWorld, uriKey);
1940+ if (keyNode)
1941+ {
1942+
1943+ lilv_free (keyNode);
1944+ }
19451945
19461946 return LV2UI_REQUEST_VALUE_ERR_UNKNOWN;
19471947}
@@ -2513,17 +2513,6 @@ QString LV2Synth::lv2conf_getCustomData(LV2PluginWrapper_State *state)
25132513 state, LV2_STATE_IS_POD, state->_ppifeatures );
25142514 }
25152515
2516- // NOTE: Although plugins store their control values inside the state data,
2517- // those values often only restore a plugin's internal values.
2518- // It can be seen that the UI controls do change to the stored values,
2519- // but the plugin will NOT restore OUR port array, only the plugin's internal values.
2520- // As per LV2 specs, only midi program changes are allowed to self-modify the port array.
2521- // FIXME:
2522- // I could not seem to find something that would ask the plugin to give us its
2523- // internal values so we can update our port array.
2524- // Therefore, we must store OUR port array values along with any plugin state data.
2525- // This seems redundant, but it is possible that the array values might be different than
2526- // the internal values (internals ramped or enumerated etc.) and so both require storing.
25272516 if (state->sif != nullptr ) // write control ports values only for synths
25282517 {
25292518 for (size_t c = 0 ; c < state->sif ->_inportsControl ; c++)
@@ -2628,18 +2617,28 @@ bool LV2Synth::lv2conf_set(LV2PluginWrapper_State *state, const std::vector<QStr
26282617 }
26292618 else
26302619 {
2631- if (state->sif != nullptr ) // setting control value only for synths
2620+ bool ok = false ;
2621+ float val = (float )qVal.toDouble (&ok);
2622+ if (ok)
26322623 {
2633- bool ok = false ;
2634- float val = (float )qVal.toDouble (&ok);
2635- if (ok)
2624+ const auto & iter = state->controlsNameMap .find (name.toLower ());
2625+ if (iter != state->controlsNameMap .end ())
26362626 {
2637- const auto & iter = state->controlsNameMap .find (name.toLower ());
2638- if (iter != state->controlsNameMap .end ())
2639- {
2640- size_t ctrlNum = iter->second ;
2641- state->sif ->_controls [ctrlNum].val = val;
2642- }
2627+ size_t ctrlNum = iter->second ;
2628+ // Changed.
2629+ // state->sif->_controls [ctrlNum].val = val;
2630+ // TODO: See if this part helps.
2631+ // TESTED: Unable to test. The tested plugins did not support UI port_event().
2632+ // So these were not even used in function lv2ui_SendChangedControls().
2633+ // state->sif->_controls [ctrlNum].val = state->lastControls [ctrlNum] = val;
2634+ // // Reset this in case it was set. Prevent sending to the ui. This new value takes priority.
2635+ // state->controlsMask [ctrlNum] = false;
2636+
2637+ if (state->sif )
2638+ state->sif ->_controls [ctrlNum].val = val;
2639+
2640+ if (state->inst && state->plugInst )
2641+ state->plugInst ->controls [ctrlNum].val = val;
26432642 }
26442643 }
26452644 }
0 commit comments