hostingcore-audioaudiounit

How to save and restore an audiounit's state as an audiounit host


I am writing an app that hosts apple system supplied audiounits. I would like to save the parameter states of an audiounit after a user has dialed them in and restore them when the user loads the audiounit again.

I can't find out to do this from a host. I've seen that AUs should have SaveState() and RestoreState() methods, but how do you access them?


Solution

  • Basically, you handle them by getting or setting the kAudioUnitProperty_ClassInfo property with AudioUnitGetProperty() or AudioUnitSetProperty() (for saving and restoring, respectively).

    You can see an example implementation of this in the DestroyFX Audio Unit utilities library in the methods RestoreAUStateFromPresetFile() and SaveAUStateToPresetFile_Bundle() in the dfx-au-utilities-preset-files.c file.