Re: SaveState, VST2AU and AUValidation
Re: SaveState, VST2AU and AUValidation
- Subject: Re: SaveState, VST2AU and AUValidation
- From: Marc Poirier <email@hidden>
- Date: Mon, 5 Jan 2004 20:42:57 -0600 (CST)
Hmmm, I'm starting to wonder if we're not talking about different things
here... What exactly is it that you would want this WriteRequiredFields()
function to do? Exactly what AUBase::SaveState() does, or something
different (less? more?)? I thought that you were saying that it should do
the same thing. If that's the case, then I'm still saying the same thing,
why not just call AUBase::SaveState()? Otherwise, I think I'm
misunderstanding you.
Even if you wanted most of the base behavior but not all of it, you could
go and remove or change some of the dictionary data after calling
AUBase::SaveState(). And you can certainly add whatever you want (like
your plugin's version, which is *not* currently written by
AUBase::SaveState(), the version value that is written is the version
number of the AU settings dictionary format, not the plugin's version).
For example, this is the way how I often do things:
ComponentResult SuperPlug::SaveState(CFPropertyListRef * outPlist)
{
// do the base stuff, and bail if that fails
ComponentResult result = AUBase::SaveState(outPlist);
if (result != noErr)
return result;
// add in the plugin's current version value
SInt32 versionValue = Version();
CFNumberRef versionCFNum = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &versionValue);
if (versionCFNum != NULL)
{
CFDictionarySetValue(outPlist, CFSTR("GOSW-plugin-version"), versionCFNum);
CFRelease(versionCFNum);
}
// add some bunch of bytes of arbitrary data
CFDataRef cfdata = CFDataCreate(kCFAllocatorDefault, pointerToSuperL33tOpaqueDataBuffer, numBytesOfSuperL33tData);
if (cfdata != NULL)
{
CFDictionarySetValue(outPlist, CFSTR("GOSW-mystery-data"), cfdata);
CFRelease(cfdata);
}
return noErr;
}
Does this make sense or am I totally missing what you're getting at?
Marc
On Mon, 5 Jan 2004, Glenn Olander wrote:
>
How would you write the correct version number in that case? Or do your
>
own parameter interpretation? I don't believe it was intended to be
>
used that way, but I suppose it might suffice for a trivial plugin.
>
>
- Glenn
>
>
>
On Monday, January 5, 2004, at 12:47 PM, Marc Poirier wrote:
>
>
> On Mon, 5 Jan 2004, Glenn Olander wrote:
>
>
>
>> I don't think there is anything "wrong" with RestoreState or
>
>> SaveState.
>
>> However, I do believe it would be a good idea to separate out the
>
>> logic
>
>> from those methods which writes the required fields into a separate
>
>> method, for example called something like WriteRequiredFields(). That
>
>> way, an AU which implements it's own SaveState can call
>
>> WriteRequiredFields(). As it is now, you have to clone that code into
>
>> your own implementation of RestoreState/SaveState.
>
>
>
>
>
> No, you don't, you just call AUBase::RestoreState() in your
>
> Whatever::RestoreState(inPlist) implementation. That's what I'm
>
> getting at. No need to copy and paste anything.
>
>
>
> Marc
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.