Hi
i have a problem using the Custom Properties on a Audio Server PlugIn.
My Code looks like this:
On my PlugIn i configure the Custom Properties like this:
GetPropertyData:
case kAudioObjectPropertyCustomPropertyInfoList: {
UInt32 theNumberItemsToFetch;
// Calculate the number of items that have been requested. Note
that this
// number is allowed to be smaller than the actual size of the
list. In such
// case, only that number of items will be returned
theNumberItemsToFetch = (UInt32)(inDataSize /
sizeof(AudioServerPlugInCustomPropertyInfo));
// clamp it to the number of items we have
if (theNumberItemsToFetch >
kAudioPlugInPropertyUltraschallNumberOfObjects) {
theNumberItemsToFetch =
kAudioPlugInPropertyUltraschallNumberOfObjects;
}
if (theNumberItemsToFetch > 0) {
((AudioServerPlugInCustomPropertyInfo*)outData)[0].mSelector =
kAudioPlugInPropertyUltraschallSettings;
((AudioServerPlugInCustomPropertyInfo*)outData)[0].mPropertyDataType
= kAudioServerPlugInCustomPropertyDataTypeCFPropertyList;
((AudioServerPlugInCustomPropertyInfo*)outData)[0].mQualifierDataType =
kAudioServerPlugInCustomPropertyDataTypeNone;
}
if (theNumberItemsToFetch > 1) {
((AudioServerPlugInCustomPropertyInfo*)outData)[1].mSelector =
kAudioPlugInPropertyUltraschallDump;
((AudioServerPlugInCustomPropertyInfo*)outData)[1].mPropertyDataType
= kAudioServerPlugInCustomPropertyDataTypeCFString;
((AudioServerPlugInCustomPropertyInfo*)outData)[1].mQualifierDataType =
kAudioServerPlugInCustomPropertyDataTypeNone;
}
// report how much we wrote
outDataSize = (UInt32)(theNumberItemsToFetch *
sizeof(AudioServerPlugInCustomPropertyInfo));
break;
}
and my test values returned like this:
case kAudioPlugInPropertyUltraschallSettings: {
// check the arguments
ThrowIf(inDataSize < sizeof(AudioObjectID),
CAException(kAudioHardwareBadPropertySizeError), "UltHub_GetPlugInPropertyData:
not enough space for the return value of
kAudioPlugInPropertyUltraschallSettings");
CACFDictionary test;
test.AddBool(CFSTR("TEST"), true);
CFPropertyListRef data = test.AsPropertyList();
*reinterpret_cast<CFPropertyListRef*>(outData) = data;
outDataSize = sizeof(CFPropertyListRef);
break;
}
case kAudioPlugInPropertyUltraschallDump: {
CAMutex::Locker theLocker(mMutex);
// check the arguments
ThrowIf(inDataSize < sizeof(AudioObjectID),
CAException(kAudioHardwareBadPropertySizeError), "UltHub_GetPlugInPropertyData:
not enough space for the return value of
kAudioPlugInPropertyUltraschallSettings");
*reinterpret_cast<CFStringRef*>(outData) = CFSTR(“Test");
outDataSize = sizeof(CFStringRef);
break;
}
after i debug my plugin all looks right on the plugin side.
But on my Console Test Application i always get a EXEC_BAS_ACCESS exception.
CAHALAudioSystemObject systemObject;
AudioObjectID pluginID =
systemObject.GetAudioPlugInForBundleID(CFSTR("fm.ultraschall.UltraschallHub"));
CAHALAudioObject plugin(pluginID);
AudioObjectShow(pluginID);
CAPropertyAddress inAddress(kAudioPlugInPropertyUltraschallDump);
if (plugin.HasProperty(inAddress)) {
CFStringRef dump = plugin.GetPropertyData_CFString(inAddress);
NSLog(@"dump: %@", dump);
}
I can’t find any documentation of Custom Properties but it looks like i can’t
access the memory where the CFStringRef points to.
Do i use the Custom Properties in a wrong way or is this a bug?
regards
Daniel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/coreaudio-api/archive%40mail-archive.com
This email sent to [email protected]