Welcome to %s forums

BrainModular Users Forum

Login Register

SDK method to set a Settings Line String.

Tell us what you'd like Usine to do
Post Reply
sm_jamieson
Member
Posts: 555
Contact:

Unread post by sm_jamieson » 18 Oct 2018, 17:11

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.

sm_jamieson
Member
Posts: 555
Contact:

Unread post by sm_jamieson » 21 Feb 2019, 11:46

This is still an issue.
We need a way to set the SettingsLineString from within the SDK.

Thanks,
Simon.

sm_jamieson
Member
Posts: 555
Contact:

Unread post by sm_jamieson » 06 Mar 2019, 23:06

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.

sm_jamieson
Member
Posts: 555
Contact:

Unread post by sm_jamieson » 12 Mar 2019, 14:15

This issue was reported as a bug, and a solution is on the way.

Simon.

User avatar
senso
Site Admin
Posts: 4424
Location: France
Contact:

Unread post by senso » 12 Mar 2019, 16:51

yes in the V188

sm_jamieson
Member
Posts: 555
Contact:

Unread post by sm_jamieson » 13 Mar 2019, 15:29

I have tested with V188 and it works fine.
So the issue is resolved.

Thanks all.
Simon.

Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests