views:

35

answers:

1

For instance, this AudioUnit has to connect to a host through the network, and the hostname has to be configured in a Cocoa View, and has to be saved so that reloading the project restores the hostname.

How would you do that (interface + parameter saving, apart from the network thing of course)?

+1  A: 

You need to implement the SaveState() and RestoreState() methods in your AudioUnit. These functions will be called when the sequencer saves and opens a document, respectively, and give you the chance to store data alongside a particular plugin instance.

The definition for these functions can be found in the file AUBase.h in the AudioUnit SDK.

Nik Reiman
Indeed, http://lists.apple.com/archives/coreaudio-api/2008/Feb/msg00112.html says the same thing.
moala
Seems that http://code.google.com/p/vstau/source/browse/trunk/VSTAU.cpp shows a good example in VSTAU::SaveState and VSTAU::RestoreState, for storing whole (VST) chunks in AU's document storage.
moala
But how would you send the NSString from the CocoaView to the AudioUnit Kernel?
moala
moala
But how would you send the NSString (or anything else) from the AudioUnit Kernel to the CocoaView?
moala
@moala, you should make that a separate question... it's kind of O/T here. :)
Nik Reiman
@Nik Reiman: 'k, you're right.
moala
Anyway, I have the answer: use Audio Unit's Properties (AudioUnitGetProperty, AudioUnitSetProperty), event notification (PropertyChanged) and AudioUnitEvent listeners (AUEventListenerCreate). See CoreAudio's Audio Unit Filter example for instance for a model.
moala