Mac VST and AU not retaining programs?

I have a system that handles all the programs for the plugin, works perfectly fine on the pc but on the mac when you save your project and load it back up the programs are not retained?? I’m using the same xml structure as in the demo and have a program manager that handles all the parameters and programs, i.e. all the correct things seem to be returned to the host as its working perfect on the pc. When the vst or au loads (after saving the project) the host should be returning the memory of the last settings (program) which is then extracted as xml and set to the current parameters, on the mac this does not seem to happen? What could be happening?

OK, I just did more tests, on the mac setCurrentProgram is not being called at all by the host!! after setstateinformation, where as on the pc setCurrentProgram is being called after setStateInformation, which is ok, is this a bug on the mac wrapper?

I would have thought it’s due to the host behaving differently, not a wrapper bug.

You shouldn’t make any assumptions about the order in which a host will choose to call things, so always write your code to deal with the worst cases.

I agree with you on not making any assumptions on the order of calls, and its the same with 3 different hosts I tested. However, you can safely assume that the host must make at least one call to setstateinformation when the plugin is loaded (after the project is saved and re-opened in the host) so it can set the programs as all hosts on the pc do. Then it should call setCurrentProgram at least once, which it does on the pc, but this does not happen on the mac(logic pro, ableton live, traction). I can’t see how you can write the code to deal with this case.

Well there’s no guarantee that it’ll call setCurrentProgram - e.g. it’s fair enough for the host to assume that if the plugin has already been set to program number 1, then there’s no need to tell it to change to program 1 again just because there’s been a state change.

Why not just do something along the lines of setCurrentProgram (getCurrentProgram()) at the end of your state loading routine?

worked it out:), something unusual to note is if I call setCurrentProgram(getCurrentProgram()) in setstate it still did not work but if i copy whats happening in setCurrentProgram into setstate then it works, somehow calling the function does not seem to be the same as just doing the same thing inside setstate.