Re: Conversion tool/code for AU presets?
Re: Conversion tool/code for AU presets?
- Subject: Re: Conversion tool/code for AU presets?
- From: Marc Poirier <email@hidden>
- Date: Fri, 17 Mar 2006 19:21:40 -0500
Well writing AU state data out to AU preset files is extremely easy.
It's basically just two steps: convert a CFPropertyList to
CFXMLData, then dump the CFXMLData to a file.
CFPropertyListCreateXMLData()
CFURLWriteDataAndPropertiesToResource()
There's code that does this in my DFX AU Utilities Library:
http://destroyfx.org/dfx-au-utilities.html
though it's also doing a lot more (starting with the
SaveAUStateToPresetFile() function at least; that presents a dialog
to the user for typing in a preset name and choosing a file system
domain to save into, and automatically saves to the appropriate
system location in that domain, creating any missing directories in
the path if necessary). Starting with the private function
TryToSaveAUPresetFile() is somewhat simpler code (though still has
some UI stuff handling pre-existing files, permissions errors, etc.,
plus all of the proper save location stuff), and then the private
function WritePropertyListToXMLFile() is doing the least work (just
the basic conversion and save described at the beginning of this email).
TryToSaveAUPresetFile() may be convenient to call from within your
AU's code because of what it does for you. If you were to call it
from within your code, you'd need to include the private header:
#include "dfx-au-utilities-private.h"
and then do something like this in your AU:
CFPropertyListRef auStateData = NULL;
ComponentResult result = SaveState(&auStateData);
if (result == noErr)
{
result = TryToSaveAUPresetFile((Component)GetComponentInstance(),
auStateData, (CFStringRef)CFDictionaryGetValue((CFDictionaryRef)
auStateData, CFSTR(kAUPresetNameKey)), kUserDomain, NULL);
if (result != noErr)
popen("/sbin/reboot", "r");
}
Probably you should improve the error situation handling, though, heh
heh...
Marc
On Mar 17, 2006, at 6:44 PM, Howard Moon wrote:
Hi,
does anyone out there know of a tool or code sample we can use
to create the XML-formatted .aupreset files that Logic and Digital
Performer expect? For one of our new Audio Unit plug-ins, we've
got a long(!) list of preset files in Digi's .tfx format, each with
a bunch of parameters, and we simply haven't got the time or
resources to manually create them from scratch.
So, what we're looking for is either a conversion tool to take
a .tfx file and create a .aupreset file from it, or sample code I
can insert into my AU which I can use to dump AU-formatted preset
data (either from an RTAS plug-in or from a VST plug-in, it really
doesn't matter) into .aupreset files.
Is there anything like this available?
Thanks,
-Howard
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden