ArrayArrayArrayArrayArrayArrayArrayArray
BrainModularBrainModular Users Forum2018-10-17T23:18:35+02:00https://brainmodular.org/forums/app.php/feed/topic/59992018-10-17T23:18:35+02:002018-10-17T23:18:35+02:00https://brainmodular.org/forums/viewtopic.php?t=5999&p=40266#p40266Perhaps Senso can confirm that the value is supposed to be a UTF-16 string and that it will not change to another type of encoding.
Simon.
Statistics: Posted by sm_jamieson — 17 Oct 2018, 23:18
]]>2017-12-13T23:13:17+02:002017-12-13T23:13:17+02:00https://brainmodular.org/forums/viewtopic.php?t=5999&p=38760#p38760Statistics: Posted by 23fx23 — 13 Dec 2017, 22:13
]]>
2017-12-13T12:09:45+02:002017-12-13T12:09:45+02:00https://brainmodular.org/forums/viewtopic.php?t=5999&p=38755#p38755 I did try it a different simpler way first, but I was only seeing the first character of the string. This was because the second byte was zero due to it being Unicode, but zero marks the end of a normal C string. When I pasted in a funny quote symbol from a Word document, the 2nd byte of Unicode was not zero. I looked up the 2 bytes in a Unicode table and it matched the character I had pasted in.
I don't know if it is Unicode intentionally, or if this changes according to a locale setting in Windows. But the normal Usine text data flow is definitely not Unicode. Of course Unicode supports an extended character set which is useful.
But the SDK does lack in documentation - so we have to find some example code, or fiddle around until it works.
I don't really care if it is Unicode or not, as long as it does not change and break my User modules !
Statistics: Posted by sm_jamieson — 13 Dec 2017, 11:09
]]>2017-12-13T11:47:45+02:002017-12-13T11:47:45+02:00https://brainmodular.org/forums/viewtopic.php?t=5999&p=38754#p38754Statistics: Posted by 23fx23 — 13 Dec 2017, 10:47
]]>2017-12-13T11:31:37+02:002017-12-13T11:31:37+02:00https://brainmodular.org/forums/viewtopic.php?t=5999&p=38753#p38753
OK, well thats interesting. How do you get the modified value back when the user changes the settings string ? Do you find that the string in test_text has changed to match what the user entered ? I will certainly try it since if that works, some C++ magic must be happening. Perhaps the string class can handle a C string and a Unicode string automatically.
Statistics: Posted by sm_jamieson — 13 Dec 2017, 10:31
]]>2017-12-12T16:09:05+02:002017-12-12T16:09:05+02:00https://brainmodular.org/forums/viewtopic.php?t=5999&p=38745#p38745 Usine puts a UTF-16 string at the address passed to sdkAddSettingsLineString(), rather than a normal string. Whether this is intentional, or the same on the Mac, I don't know.
Anyway, on Windows the string should be defined as like this:
wchar_t *testString;
The address is then passed to Usine in the SDK function like this:
AnsiCharPtr is actually a char* type, so strictly speaking the SDK parameter type is wrong. The SDK needs to define a new type such as AnsiUTF16CharPtr or AnsiWideCharPtr or something (which would also drop the hint to the SDK users). The parameter type would then be "AnsiWideCharPtr *".
The string can be printed out using printf "%S" rather than "%s".
You can use the C++ wstring class to store the UFT16 string.
Statistics: Posted by sm_jamieson — 12 Dec 2017, 15:09
]]>2017-11-30T16:42:48+02:002017-11-30T16:42:48+02:00https://brainmodular.org/forums/viewtopic.php?t=5999&p=38636#p38636 There are 3 new functions in the new SDK:
sdkAddSettingsLineString - who allocates the memory that the string is stored in, for example, should pVal be just a pointer for Usine to set up, or should it point to a buffer ? If a buffer, where is the size of the buffer specified ?
If I allocate a buffer, then the string can be modified from the Usine settings panel, but I cannot access it from within the User module, either to read the modified value in onSettingsHasChanged(), or to set the value from within the User module.
Should sdkGetSettingValue and sdkSetSettingValue be used to do this ? I have tried various things but nothing works, including this: UsineEventPtr ev = sdkGetSettingValue(SettingsLineStringCaption); AnsiCharPtr pointer_to_settings_string = sdkGetEvtPChar(ev);
Can we please have an example User module that does this, since it is not obvious ?
Thanks, Simon.
Statistics: Posted by sm_jamieson — 30 Nov 2017, 15:42
]]>BrainModularBrainModular Users Forum2018-10-17T23:18:35+02:00https://brainmodular.org/forums/app.php/feed/topic/59992018-10-17T23:18:35+02:002018-10-17T23:18:35+02:00https://brainmodular.org/forums/viewtopic.php?t=5999&p=40266#p40266Perhaps Senso can confirm that the value is supposed to be a UTF-16 string and that it will not change to another type of encoding.
Simon.
Statistics: Posted by sm_jamieson — 17 Oct 2018, 23:18
]]>2017-12-13T23:13:17+02:002017-12-13T23:13:17+02:00https://brainmodular.org/forums/viewtopic.php?t=5999&p=38760#p38760Statistics: Posted by 23fx23 — 13 Dec 2017, 22:13
]]>2017-12-13T12:09:45+02:002017-12-13T12:09:45+02:00https://brainmodular.org/forums/viewtopic.php?t=5999&p=38755#p38755 I did try it a different simpler way first, but I was only seeing the first character of the string. This was because the second byte was zero due to it being Unicode, but zero marks the end of a normal C string. When I pasted in a funny quote symbol from a Word document, the 2nd byte of Unicode was not zero. I looked up the 2 bytes in a Unicode table and it matched the character I had pasted in.
I don't know if it is Unicode intentionally, or if this changes according to a locale setting in Windows. But the normal Usine text data flow is definitely not Unicode. Of course Unicode supports an extended character set which is useful.
But the SDK does lack in documentation - so we have to find some example code, or fiddle around until it works.
I don't really care if it is Unicode or not, as long as it does not change and break my User modules !
Statistics: Posted by sm_jamieson — 13 Dec 2017, 11:09
]]>2017-12-13T11:47:45+02:002017-12-13T11:47:45+02:00https://brainmodular.org/forums/viewtopic.php?t=5999&p=38754#p38754Statistics: Posted by 23fx23 — 13 Dec 2017, 10:47
]]>2017-12-13T11:31:37+02:002017-12-13T11:31:37+02:00https://brainmodular.org/forums/viewtopic.php?t=5999&p=38753#p38753
OK, well thats interesting. How do you get the modified value back when the user changes the settings string ? Do you find that the string in test_text has changed to match what the user entered ? I will certainly try it since if that works, some C++ magic must be happening. Perhaps the string class can handle a C string and a Unicode string automatically.
Statistics: Posted by sm_jamieson — 13 Dec 2017, 10:31
]]>2017-12-12T16:09:05+02:002017-12-12T16:09:05+02:00https://brainmodular.org/forums/viewtopic.php?t=5999&p=38745#p38745 Usine puts a UTF-16 string at the address passed to sdkAddSettingsLineString(), rather than a normal string. Whether this is intentional, or the same on the Mac, I don't know.
Anyway, on Windows the string should be defined as like this:
wchar_t *testString;
The address is then passed to Usine in the SDK function like this:
AnsiCharPtr is actually a char* type, so strictly speaking the SDK parameter type is wrong. The SDK needs to define a new type such as AnsiUTF16CharPtr or AnsiWideCharPtr or something (which would also drop the hint to the SDK users). The parameter type would then be "AnsiWideCharPtr *".
The string can be printed out using printf "%S" rather than "%s".
You can use the C++ wstring class to store the UFT16 string.
Statistics: Posted by sm_jamieson — 12 Dec 2017, 15:09
]]>2017-11-30T16:42:48+02:002017-11-30T16:42:48+02:00https://brainmodular.org/forums/viewtopic.php?t=5999&p=38636#p38636 There are 3 new functions in the new SDK:
sdkAddSettingsLineString - who allocates the memory that the string is stored in, for example, should pVal be just a pointer for Usine to set up, or should it point to a buffer ? If a buffer, where is the size of the buffer specified ?
If I allocate a buffer, then the string can be modified from the Usine settings panel, but I cannot access it from within the User module, either to read the modified value in onSettingsHasChanged(), or to set the value from within the User module.
Should sdkGetSettingValue and sdkSetSettingValue be used to do this ? I have tried various things but nothing works, including this: UsineEventPtr ev = sdkGetSettingValue(SettingsLineStringCaption); AnsiCharPtr pointer_to_settings_string = sdkGetEvtPChar(ev);
Can we please have an example User module that does this, since it is not obvious ?
Thanks, Simon.
Statistics: Posted by sm_jamieson — 30 Nov 2017, 15:42