Hi,
I'm trying to read a presets file for the AUFilePlayer and restore its state accordingly in my own app.
I have a presets file that works great in AULab.
However, when I try to read it, much of the information stored in this file does not get read or does not affect the GUI.
Only the file names are working.
Regions and loop conditions are lost.
Code Snippet:
NSError *err =
nil;
NSData *xmlData = [NSData
dataWithContentsOfURL:presetURL options:NSUncachedRead
error:&err];
NSString *errorString =
nil;
NSPropertyListFormat plistFormat =
NSPropertyListXMLFormat_v1_0;
id Plist = [NSPropertyListSerialization
propertyListFromData:xmlData
mutabilityOption:NSPropertyListImmutable
format:&plistFormat
errorDescription:&errorString];
if (nil != Plist) {
NSLog(@"Format %@", Plist);
// *see below
ComponentResult err =
AudioUnitSetProperty(fileCAAU,
kAudioUnitProperty_ClassInfo,
kAudioUnitScope_Global,
0,
&Plist,
sizeof(Plist));
AudioUnitParameter changedUnit;
changedUnit.mAudioUnit =
fileCAAU;
changedUnit.mParameterID =
kAUParameterListener_AnyParameter;
OSStatus err =
AUParameterListenerNotify(NULL,
NULL, &changedUnit);
End Code Snippet
NSLog output showing the Plist:
{
data = "">
"file-references" = {
"File 1" = "/Users/admin/Documents/REAPER Media/Hash Pipe 2.aif";
"File 2" = "/Users/admin/Documents/REAPER Media/03 Foreplay Long Time.L.wav";
};
kAUPresetPersistentStateKey = (
{
FileName = "/Users/admin/Documents/REAPER Media/Hash Pipe 2.aif";
Regions = (
{
IsSelectedRegion = 1;
RegionData = <00000000 00000000 60fc4605 a036637b 28ecfdbf 662d9393 10e65cac 8e6e3a05 58ecfdbf 70249393 60fc4605 107a4605 60fc4605 a036637b 01000000 03000000 00000000 00000000
00000000 00000000 23560100 00000000 f6490600>;
RegionDoesLoop = 1;
RegionName = "Region 2";
},
{
RegionData = <00000000 00000000 e805febf 70249393 b4f94605 80794605 b4f94605 d94e4194 c8385dac 5e044800 f4229393 30da457c 02ef0f94 30da457c 01000000 e1229393 00000000 00000000
00000000 00000000 00000000 00000000 00560a00>;
RegionDoesLoop = 0;
RegionName = "New Region";
}
);
},
{
FileName = "/Users/admin/Documents/REAPER Media/03 Foreplay Long Time.L.wav";
IsSelectedFile = 1;
Regions = (
{
IsSelectedRegion = 1;
RegionData = <00000000 00000000 bc601e00 048a2b00 00000000 18d9af7b b0b34a7c bea79493 48ecfdbf 0aa89493 44375dac 38ecfdbf 4f4cb583 b0b34a7c 01000000 03000000 00000000 00000000
00000000 00000000 00000000 00000000 24f53b01>;
RegionDoesLoop = 0;
RegionName = "New Region";
}
);
}
);
manufacturer = 1634758764;
name = "Hash Pipe Loop";
subtype = 1634103404;
type = 1635084142;
version = 0;
}
Not sure what's going wrong.
I'm assuming I only have to call AudioUnitSetProperty once. Right?
I'd love to look at the source for AULab, but can't find that.
Any help is greatly appreciated.
Thanks
Mark
|