@ssmith_c @DrXibber I appreciate the replies. I ran into another situation while experimenting custom props.
Is there ways to obtain a property's min and max from CMIOExtensionPropertyAttributes if a property is declared as
- (nullable CMIOExtensionDeviceProperties *)devicePropertiesForProperties:(NSSet<CMIOExtensionProperty> *)properties error:(NSError * _Nullable *)outError
{
CMIOExtensionDeviceProperties *deviceProperties = [CMIOExtensionDeviceProperties devicePropertiesWithDictionary:@{}];
if ([properties containsObject:CMIOExtensionPropertyCustomPropertyData_just]) {
NSNumber *min = [[NSNumber alloc] initWithInt:0];
NSNumber *max = [[NSNumber alloc] initWithInt:5];
NSNumber *val = [[NSNumber alloc] initWithInt:3];
NSArray *validRange = @[@0,@1,@2,@3,@4,@5];
CMIOExtensionPropertyAttributes *propertyAttirbutes =
[CMIOExtensionPropertyAttributes propertyAttributesWithMinValue: min maxValue: max validValues: validRange readOnly:NO];
CMIOExtensionPropertyState* propertyState = [CMIOExtensionPropertyState propertyStateWithValue:val attributes:propertyAttirbutes];
[deviceProperties setPropertyState:propertyState forProperty:CMIOExtensionPropertyCustomPropertyData_just];
}
return deviceProperties;
}
In the CMIO API I was able to get the read only boolean value by calling
CMIOObjectPropertyAddress propertyAddress = {
(FOUR_CHAR_CODE( 'just' )),
(kCMIOObjectPropertyScopeGlobal),
(kCMIOObjectPropertyElementMain)};
Boolean settable;
status = CMIOObjectIsPropertySettable(deviceID, &propertyAddress, &settable);
However, calling things like (how we obtained property range for legacy CoreMediaIO plugin)
AudioValueRange myRange;
CMIOObjectPropertyAddress opa = {kCMIOFeatureControlPropertyAbsoluteValue, kCMIOObjectPropertyScopeGlobal, kCMIOObjectPropertyElementMain};
CMIOObjectPropertyAddress opa = {kCMIOFeatureControlPropertyNativeRange, kCMIOObjectPropertyScopeGlobal, kCMIOObjectPropertyElementMain};
result = CMIOObjectGetPropertyDataSize(deivceID, &opa, 0, NULL, &dataSize);
result = CMIOObjectGetPropertyData(deivceID, &opa, 0, NULL, dataSize, &dataSize, &myRange);
did not work and returned
Error: 2003332927, failed //('who?') kCMIOHardwareUnknownPropertyError
Does anyone know the how to obtain values in CMIOExtensionPropertyAttributes?