monome / norns

norns is many sound instruments.
http://monome.org
GNU General Public License v3.0
633 stars 147 forks source link

user script state saving: folder, standard methods #169

Closed tehn closed 6 years ago

tehn commented 6 years ago

right now the norns/menu system saves global state in state.lua:

we should also have a state (or other word) folder, where user scripts can store files in the same way. it'd make sense to create a set of helper methods for doing this-- for example-- if the script stores all of its want-to-save data in a table, then the helper function can write a file with that table data (and likewise have a read function do the reverse.) there can be a user-defined post-load function that can do whatever once the data is loaded.

related: another possibility i'm considering is a "preset" function that could be used alongside the "parameters" helper function (in the menu, a quick way to set list values w/o building a custom interface). basically a preset would take all the values and store them in a table (and then file). all presets/state data would get loaded at the same time a script on script change or bootup.

tehn commented 6 years ago

update: now with the presence of the data folder within the user area (dust), scripts can make their own folder and store whatever.

but some scaffolding for common uses would still be good.

tehn commented 6 years ago

param menu now has script state saving (single slot, not loaded by default).

could be expanded in the future for numbered states (multiple files).

currently saved to dust/data/