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)?

skaffman
  • 398,947
  • 96
  • 818
  • 769
moala
  • 5,094
  • 9
  • 45
  • 66

1 Answers1

1

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
  • 39,067
  • 29
  • 104
  • 160
  • Indeed, http://lists.apple.com/archives/coreaudio-api/2008/Feb/msg00112.html says the same thing. – moala Sep 29 '10 at 12:49
  • 1
    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 Sep 29 '10 at 13:05
  • But how would you send the NSString from the CocoaView to the AudioUnit Kernel? – moala Oct 01 '10 at 11:48
  • Answer: maybe use the Properties instead of the Parameters see http://www.kvraudio.com/forum/viewtopic.php?p=4169706&sid=27064441ff62205844e893a9d82b5007#4169706 – moala Oct 01 '10 at 15:19
  • But how would you send the NSString (or anything else) from the AudioUnit Kernel to the CocoaView? – moala Oct 05 '10 at 15:37
  • 1
    @moala, you should make that a separate question... it's kind of O/T here. :) – Nik Reiman Oct 05 '10 at 17:50
  • 1
    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 Oct 07 '10 at 12:10