Where does setStateInformation() come into play in AU?

Hi all!

I'm testing my plugin in Logic 9 at the moment and I'm having issues with getStateInformation() & setStateInformation() within my pluginProcessor. If I comment their content out, the plugin works fine, but of course it won't reload saved states.

From what I gathered from the demo notes, getStateInformation() is used to store the current state of the plugin into binary, & setStateInformation() is used to retrieve that info & make use of it sometime during the plugins construction. Intuitivly this would make me think that setStateInformation() is called after the plugins construction, & getStateInformation() is called somewhere right before destruction.

Thus I'm consufes that when I uncomment my (bugged) code in getStateInformation() the plugin crashes upon construction.

What I'm ultimately asking is: during a plugins lifetime, when are these functions called?

Many thanks!

 

Muir

 

Just search the project/solution for setStateInformation

You’ll find it called in the wrapper for the flavour of plugin you’re building

Rail

I found the two methods in juce_AudioUnitPluginFormat.mm. I still havent' found any tips to when these methods are called, though (I could just be overlooking it). I was guessing that the host calls them at certain times, in which the juce code wouldn't give any explicit insight  into when they are called (right?)

Many thanks!

Muir

I'm afraid hosts will call it whenever the hell they want to, and your code has to deal with that.

Yes, Reaper, for example,  gets/sets the current program state all of the time e.g. every time you touch a knob, huh.

From my observations using DBG() & the console (on mac) it seems like Logic Pro 9 calls setStateInformation() whenever I repoen a session with an instance of my plugin. The getStateInformation seems like a crapshoot: it's called at seemingly random times (those are just rough observations though). This makes a fair amount of sense: It only loads the previous settings once, & then periodically "saves" the current state (probably for mulitple reasons, I'm guessing).