Page 2 of 4
Re: how to save dynamically sized arrays in preset?
Posted: Tue Aug 12, 2014 11:52 am
by tulamide
Nubeat7 wrote:@tulamide
the problem is not to assign it dynamically, its to reload it..
lets say you have just saved a preset with 5 elements - so thereis 5 at the n connector - now you load the next preset which has 10 elements - it cannot work because there will be loaded just 5 because on the n connector there is still the 5... so you has to set this connector to the maximum size of the array
You better had named your post "how to reload..." then
Since the n connector is reset to zero and then set to the actual size of the array, this should work when reloading, too? If not, could you give a simple example fsm? I would be happy to work something out.
EDIT: I'm thinking of storing the size of the array as the first entry in the array, so you could always access it and reset N to whatever is needed.
Re: how to save dynamically sized arrays in preset?
Posted: Tue Aug 12, 2014 12:02 pm
by Nubeat7
you would need to set the size of the presetparameter array before it gets loaded,
maybe if you read the preset which should be loaded next with the before presetchange trigger - get the size of it - set the presetparameter array size - and then when this is done load the preset - maybe this could work!?
here is a simple schematic which shows th issue, just try it out with different sizes and reload them
Re: how to save dynamically sized arrays in preset?
Posted: Tue Aug 12, 2014 2:25 pm
by tester
Don't listen to me, but... If your intention is to save/reload only non-zero elements, where 0's can happen in between - then you would need to use two param arrays. One for gathering non-zero indexes and one for gathering non-zero values. Then it can work like this:
incoming:
value
0
vaue
0
value
saving:
value
value
value
(and indexes on second array)
loading:
value
value
value
(and indexes on second array)
redistributing:
value
0
vaue
0
value
*
As for preset array param size - you can set it dynamically, but as I said - it tends to crash the schematics.
Re: how to save dynamically sized arrays in preset?
Posted: Tue Aug 12, 2014 3:47 pm
by Nubeat7
saving the whole multidimensional array into a file and referencing to the presets with the current program which i get from the presetmanager seems to be a very good way.
the problem i get here is, how i could automaticly reference to the loaded project in the DAW?
like when you load the plugin you get the default presets, fine, but when you load a project where it is included already you should get the presets saved in the last session (gets more complicated with more then one instances) i see no way to make this work without saving and loading the presets by hand for each project you are using it.
Re: how to save dynamically sized arrays in preset?
Posted: Tue Aug 12, 2014 4:30 pm
by KG_is_back
How about ruby saveState and loadState functions? wouldn't they work?
Re: how to save dynamically sized arrays in preset?
Posted: Tue Aug 12, 2014 6:25 pm
by Nubeat7
hmm, maybe, but how to make the difference of loading the plugin new into the project or load it with the project... i also don't know how this is handled between DAW and the Presetsystem in FS?
i think the file solution is good for standalone versions, i will give it a try with the arrays and a maximum nr of entries and see how it loads..
Re: how to save dynamically sized arrays in preset?
Posted: Fri Aug 15, 2014 9:07 pm
by tulamide
Here's a possible solution. The trick is that all arrays are concatenated into one big array, and only that array is stored as preset array. Modules for concetanation and accessing the sub-arrays seperately afterwards should be self explaining. But of course, feel free to ask!
Remember, this is just a demo. There are a few things to consider. For example, you might want to give the arrays some id-numbers for an even more comfortable access. Or the fact that preset arrays are said to only have values between 0-1.
But the mechanic is fairly easy expandable. For example, just divide the size parameter by, let's say, 1000 before storing it in the array. When reading such an array from the big array, make sure the size parameter is multiplied by 1000.
Hope it helps. Make use of it and don't hold back, if you've something to ask or to criticise!
Loads of thanks to trog, who solved an issue with the read module and further optimized it!
Re: how to save dynamically sized arrays in preset?
Posted: Fri Aug 15, 2014 10:36 pm
by tester
@tulamide - use CTRL+click on the "x" on the module in "properties" its state, to pin the state permanently.
Then it will not autoclose.
Re: how to save dynamically sized arrays in preset?
Posted: Fri Aug 15, 2014 11:05 pm
by tulamide
tester wrote:@tulamide - use CTRL+click on the "x" on the module in "properties" its state, to pin the state permanently.
Then it will not autoclose.
Ah, I'm sorry! I have auto-close disabled in the options, so that each and every properties view is always pinned (I prefer to manually close those, I don't need to see). I thought, when saving such a schematic, they would stay pinned. I hope to think of it next time

Re: how to save dynamically sized arrays in preset?
Posted: Fri Aug 15, 2014 11:41 pm
by tester
Nothing happened.

I did not knew that trick for a long time of use.