Saving the state of an AudioProcessorGraph

I would like to save the state of an AudioProcessorGraph as XML. Ideally this would include:

  • The collection of nodes and how they are hooked together
  • The processor used by each node, including its filename (they are VSTs in my graph) so that it can be reloaded
  • The parameters for each processor

I can see that AudioProcessorGraph as a getStateInformation() method. But when I call it on a graph that I know is connected together, it returns an empty memory block.

It looks as though I’m supposed to use getStateInformation() and getXmlFromBinary() to do what I want, but I don’t get the binary data and getXmlFromBinary() is protected. So I can’t call it on my graph. I’m writing a VST hosting app, so I’m just using the various audio classes, rather than creating my own.

Any help would be greatly appreciated!

thanks,
Richard

getStateInformation is only used with external plugins such as VSTs, AudioUnits, etc. AudioProcessorGraph doesn’t have a built in function to store it’s state but the Plugin Host Demo can save and reload the state of the graph so having a look at that should get you where you need to go.