String array to preset string.

For general discussion related FlowStone
Post Reply
User avatar
lalalandsynth
Posts: 600
Joined: Sat Oct 01, 2016 12:48 pm

String array to preset string.

Post by lalalandsynth »

I am trying to save a string array into a preset but on load it always returns the string array with these "/////"
Any thoughts on this ?

preset array.jpg
preset array.jpg (187.71 KiB) Viewed 11799 times
User avatar
wlangfor@uoguelph.ca
Posts: 912
Joined: Tue Apr 03, 2018 5:50 pm
Location: North Bay, Ontario, Canada
Contact:

Re: String array to preset string.

Post by wlangfor@uoguelph.ca »

hmm, odd I've never had that happen before.
Sorry I don't have My PC available to Me ATM but if I did I'd sort it out for You, GL.
My youtube channel: DSPplug
My Websites: www.dspplug.com KVRaudio flowstone products
User avatar
lalalandsynth
Posts: 600
Joined: Sat Oct 01, 2016 12:48 pm

Re: String array to preset string.

Post by lalalandsynth »

This is what it looks like opened in Sublime text.

So It obviously saves it like that ?
preset string.jpg
preset string.jpg (95.76 KiB) Viewed 11797 times
User avatar
trogluddite
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: String array to preset string.

Post by trogluddite »

Multi-line preset strings have always been a problem, but this seems to be a rather new spin on it (I think you're using a later version of FS to me, judging by the extra inputs on your VST String primitive.)

The extra data in the file represents line endings, which in Windows are always a sequence of two characters; CTRL-R (carriage return) followed by CTRL-N (new-line). Backslash is often used as an escape character to indicate that what follows is a control character (as it is in Ruby - "Line1\r\nLine2" would be a two-line String.)

In older versions of FS, you couldn't have line breaks in a preset String at all, because each parameter was allowed only one line of the file, and any new line characters got interpreted literally as starting a new row of the table, messing up the data. It looks as if newer versions of FS have tried to get around this limitation by using escaped control characters to mark line endings - but the doubled backslashes are messing this up. The intent seems pretty clear, so I'd say that this is certainly a bug in FS.

For both the old and this new problem with multi-line VST Strings, you can work around them by joining the array elements into a single String with the "String Array to String" primitive, using a separator character of your choice (e.g. a comma), and then use the "Split String" primitive to convert back to a string array. However, note that a VST String can only contain 255 (IIRC) characters, so you need to be careful that your array isn't too large!
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
lalalandsynth
Posts: 600
Joined: Sat Oct 01, 2016 12:48 pm

Re: String array to preset string.

Post by lalalandsynth »

Excellent ! , Thanks for this Trog .
Only need to save 24 characters but 24 sets of them so 288 if i joined it into one string array .
Will report this as a bug .
User avatar
lalalandsynth
Posts: 600
Joined: Sat Oct 01, 2016 12:48 pm

Re: String array to preset string.

Post by lalalandsynth »

Reported as a bug in the ALPHA , bug found , fixed.
Post Reply