Page 1 of 1

Posted: 18 Oct 2018, 17:11
by sm_jamieson
sdkAddSettingsLineString() takes the address of a pointer.
When the settings line string is changed in the settings panel, Usine allocates memory and writes a Unicode representation of the string to that memory, then modifies the pointer to point to the Unicode string.

However, there is no proper way in the SDK to set the setting string in a User Module.

It is possible to alter the string up to the size allocated by Usine, but this is really a hack, and you cannot assign a longer string.

I thought that sdkGetSettingValue() and sdkSetSettingValue() could be used to do this, but sdkGetSettingValue() always causes Usine to crash.

Can we please have a method to set the setting line string in the SDK ?
For example, something like sdkSetSettingsLineString(string).

For previous discussion on this matter, see
https://sensomusic.org/forums/viewtopic.php?id=5999

Thanks,
Simon.

Posted: 21 Feb 2019, 11:46
by sm_jamieson
This is still an issue.
We need a way to set the SettingsLineString from within the SDK.

Thanks,
Simon.

Posted: 06 Mar 2019, 23:06
by sm_jamieson
Well, I have found the problem with sdkGetSettingValue().

It is defined like this:

/// Getter for an existing setting line entry
inline UsineEventPtr sdkGetSettingValue(AnsiCharPtr settingName)
{
UsineEventPtr settingEvent = nullptr;
m_masterInfo->GetSettingValue(m_moduleInfo, settingName, settingEvent);

return settingEvent;
}

But the SDK is wrong.The GetSettingValue need an existing event, not a null pointer.

This works for a sdkAddSettingLineSingle() :-

UsineEventPtr event;
m_masterInfo->GetSettingValue(m_moduleInfo, "Minimum value", event);
float val = sdkGetEvtData(event);
sdkSetSettingValue("Maximum value", event); // copy event to another setting

However this does not work for a sdkAddSettingsLineString() :-

m_masterInfo->GetSettingValue(m_moduleInfo, "Parameter Name", event);
AnsiCharPtr pname = sdkGetEvtPChar(event);
sdkSetSettingValue("Parameter Name 2", event); // does not work - text is blanked in setting

I have not tried all the other setting line types.

But the problem still exists. You cannot set a setting line string from within a User Module.
I have tried on recent Usine version 3.0.186.

Can we please have a method to set the setting line string in the SDK ?
Either make sdkSetSettingValue() work for strings (best solution) or add something like
sdkSetSettingsLineString("Param Name", string).

Thanks,
Simon.

Posted: 12 Mar 2019, 14:15
by sm_jamieson
This issue was reported as a bug, and a solution is on the way.

Simon.

Posted: 12 Mar 2019, 16:51
by senso
yes in the V188

Posted: 13 Mar 2019, 15:29
by sm_jamieson
I have tested with V188 and it works fine.
So the issue is resolved.

Thanks all.
Simon.