Skip to content

Commit d92fa95

Browse files
author
Tim
committed
Fixed issue 1313 for rack plugins
1 parent af5ebb3 commit d92fa95

File tree

3 files changed

+63
-36
lines changed

3 files changed

+63
-36
lines changed

src/ChangeLog

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
27.10.2025
2+
- Fixed issue 1313 for rack plugins: Settings not saved or reloaded correctly. (Tim)
3+
Regression from 13.05.2025.
14
14.10.2025
25
- Fixed issue 1313: Settings of LV2 synths are not saved or reloaded correctly. (Tim)
36
Regression from 13.05.2025.

src/muse/lv2host.cpp

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1926,22 +1926,22 @@ int LV2Synth::lv2ui_Resize(LV2UI_Feature_Handle handle, int width, int height)
19261926

19271927
// Static.
19281928
LV2UI_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
}

src/muse/plugin.cpp

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4144,7 +4144,32 @@ void PluginI::configure(const PluginConfiguration& config, ConfigureOptions_t op
41444144
// Otherwise a problem might be that the plugin thinks that the controls
41454145
// were manually altered, and flags its current patch as 'modified'.
41464146
// See getCustomConfiguration() for more info.
4147-
if(!hasCustomData && (opts & ConfigParams))
4147+
bool canLoadControls = !hasCustomData;
4148+
if(_plugin)
4149+
{
4150+
switch(_plugin->_pluginType)
4151+
{
4152+
case MusEPlugin::PluginTypeNone:
4153+
case MusEPlugin::PluginTypeUnknown:
4154+
case MusEPlugin::PluginTypeLADSPA:
4155+
case MusEPlugin::PluginTypeVST:
4156+
case MusEPlugin::PluginTypeDSSI:
4157+
case MusEPlugin::PluginTypeDSSIVST:
4158+
case MusEPlugin::PluginTypeLinuxVST:
4159+
case MusEPlugin::PluginTypeMESS:
4160+
case MusEPlugin::PluginTypeMETRONOME:
4161+
break;
4162+
4163+
// Special for LV2: We never stored the port values with the state data like we do with the synths.
4164+
// We relied only on these external stored control port values.
4165+
// So we must always allow the port values to be used. They take effect on first run.
4166+
case MusEPlugin::PluginTypeLV2:
4167+
canLoadControls = true;
4168+
break;
4169+
}
4170+
}
4171+
4172+
if(canLoadControls && (opts & ConfigParams))
41484173
{
41494174
unsigned long controlPorts = parameters();
41504175

0 commit comments

Comments
 (0)