Storing state of plugin


I have a plugin that uses a TableListBox. For reading data into the table it searches for an xml file named “Table_Data.xml”. If it’s not found it creates one. It’s fairly similar to the TableListBox tutorial. JUCE: Tutorial: The TableListBox class

But this method does not allow to have different data in a plugin when multiple instances are used (because they all use the same xml file). Also, reading and writing a file on other OS gives some headaches as well (the plugin crashes on Linux if not run as root).

So i was thinking to save the table data to the memoryBlock in my AudioProcessor::getStateInformation and restore it in my AudioProcessor::setStateInformation. My question is, would this be a good solution / are there better solutions? How can i save and restore multiple xml files to the MemoryBlock?

don’t worry. you don’t need to do anything lowlevel. you likely already have a valueTree in your project that saves and loads state. for example the public state object in the AudioProcessorValueTreeState. just append and read the state that is represented by the TableListBox toand from it and let it do its thing just like before

Ah that’s a good idea! Just to be sure, this does not create any extra plugin parameters right? Because the data in the table is not meant to be a parameter and from my understanding plugin parameters can’t be dynamically created at runtime. And i want it to be able to add/remove data to the table at runtime.

yeah, you can add any state you like to it and it will not interact with the parameter layout and its parameters in any way