Re: Presets
Re: Presets
- Subject: Re: Presets
- From: Art Gillespie <email@hidden>
- Date: Mon, 28 Oct 2002 14:02:29 -0500
Hi Howard,
It's pretty straightforward really. Here's how we're doing it...
...
ComponentResult AU303::SaveState(CFPropertyListRef * outData)
{
AUBase::SaveState(outData); //not sure how dependent au base is on
default impl
void* data; //phatmatik will give us a pointer to its chunk
long len; //phatmatik will tell us how long the buffer is
len = phatmatik->GetChunk(&data, true);
//create a CFData object with the program data
CFDataRef r = CFDataCreate(NULL, (UInt8*)o, len);
if (r == NULL) {
return 1;
}
//put phatmatik's data in a key called, um, phatmatik-data
CFDictionarySetValue((CFMutableDictionaryRef)(*outData),
CFSTR("phatmatik-data"), r);
CFRelease(r);//does this delete data?
return noErr;
}
ComponentResult AU303::RestoreState(CFPropertyListRef plist)
{
AUBase::RestoreState(plist);
//get the CFDataRef corresponding to our data
CFDataRef data =
reinterpret_cast<CFDataRef>(
CFDictionaryGetValue((CFDictionaryRef)plist,
CFSTR("au303-data")));
if (data == NULL)
return kAudioUnitErr_InvalidPropertyValue;
const UInt8 *p;
unsigned long len;
p = CFDataGetBytePtr(data);
len = CFDataGetLength(data);
//give phatmatik the data and the length
phatmatik->SetChunk((void*)p, len, true);
return noErr;
}
On 10/28/02 1:23 PM, "Howard Moon" <email@hidden> wrote:
>
Hi...
>
does the Preset facility in AudioUnits allow for saving/restoring
>
data other than the parameters, such as "chunk" data (graphical or
>
audio data)? We're trying to determine what kind of changes we'll be
>
needing to our plug-ins, which currently use GetChunk/SetChunk calls at
>
startup and closedown of the plug-in to get/save data that is more
>
complex than just the individual parameter values.
>
Thanks...
>
-Howard
>
_______________________________________________
>
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.
_______________________________________________
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.
References: | |
| >Presets (From: Howard Moon <email@hidden>) |