Page 1 of 1

understanding preset primatives

Posted: Sun Dec 15, 2013 6:12 am
by Quentin
I am trying to understand the preset modules and have confused myself- I have the string presets working- I give them distinct names as they have distinct values as I cycle through different "programs" in the preset manager.
However, the array preset confuses me. I am not able to create distinct float arrays based on their names eg "array_1" "array_2"in my example. I must be missing something.
Thanks,
Quentin

Re: understanding preset primatives

Posted: Sun Dec 15, 2013 6:46 am
by nix
That all looks fine Quentin.
What's wrong with the example?

Where are you checking the saved arrays?
It does work, I have hundreds of float array presets in my VSTs

Re: understanding preset primatives

Posted: Sun Dec 15, 2013 2:09 pm
by trogluddite
Hi Quentin,

I don't think you've done anything wrong, it really should work. There is something odd going on with the String->Array conversion - possibly a bug in FS. When I looked inside the array presets module, I found that the string is not being converted to an array on its way into the preset parameter.
Can't work out why that is - I tried the same string with other array prim's, and it didn't work with those either. I thought maybe the line separators were not right, but they looked OK when I scanned the string with Ruby - but maybe the multi-line edit is inserting some other illegal non-printing character that's confusing the array conversion?

Anyhow - here's a fix.
preset_question FIX.fsm
(7.86 KiB) Downloaded 927 times

I put in a little Ruby module to turn the string into an array. It works by actually scanning for the pattern of characters that makes up a number, so it should work regardless of what separator characters are used, and will ignore any illegal characters.
I also set the "Trig" inputs on the edit box primitives to true - this makes the edit box only send a value when you finish editing the value on the GUI. Without this, you will get a nasty feedback loop where; edit box updates preset, preset updates edit box, edit box updates preset.... round and round until FS blows its "too many triggers" fuse.