Post

Replies

Boosts

Views

Activity

Reply to Changes to AUAudioUnit fullState in iPadOS14?
If anyone is wondering about overriding fullState and setFullState so that you can work around the issue, this is what I've done (NSDictionary<NSString *, id> *) fullState {     // Get the Component information     AudioComponentDescription acd = [self componentDescription];     NSMutableDictionary<NSString *,id> *result = [NSMutableDictionary dictionary];     [result setValue:[NSNumber numberWithInt:acd.componentManufacturer] forKey:@"manufacturer"];     [result setValue:[NSNumber numberWithInt:acd.componentSubType] forKey:@"subtype"];     [result setValue:[NSNumber numberWithInt:acd.componentType] forKey:@"type"];     [result setValue:[NSNumber numberWithInt:[self componentVersion]] forKey:@"version"];     [result setValue:[NSNumber numberWithFloat:2.0] forKey:@"preset_version"];     // The parameter space is flat and the ids are unique into the AUParameters.     // Doing this as a dictionary keyed by NSNumbers does not work with the     // PropertyListSerialization class used in NeSiUserPreset to store to disk.     // So, we go with two arrays.     NSMutableArray<NSNumber *> *parameter_ids = [NSMutableArray array];     NSMutableArray<NSNumber *> *parameter_values = [NSMutableArray array];     for (AUParameter *param in [[self parameterTree] allParameters]) {         [parameter_ids addObject: [NSNumber numberWithLongLong:param.address]];         [parameter_values addObject: [NSNumber numberWithFloat:param.value]];     }     [result setObject:parameter_ids forKey:@"parameters_ids"];     [result setObject:parameter_values forKey:@"parameters_values"];     return result;     //return [super fullState]; // Use this to get the old version of presets for testing. } (void) setFullState:(NSDictionary<NSString *,id> *)fullState {     // Check to see what version of the AU fullState is being used.     NSNumber *preset_version = [fullState valueForKey:@"preset_version"];     if (preset_version != nil) { // Implies a version 2.0 preset         // The parameterTree for LRC5 is flat and the ids are unique. This is the easy way to get         // the values into the parameter nodes.         NSArray<NSNumber *> *parameter_ids = [fullState valueForKey:@"parameters_ids"];         NSArray<NSNumber *> *parameters_values = [fullState valueForKey:@"parameters_values"];         AUParameterTree *pt = [self parameterTree];         for (int i = 0; i < parameter_ids.count; i++) {             AUParameter *param = [pt parameterWithAddress:parameter_ids[i].longLongValue];             param.value = parameters_values[i].floatValue;         }     } else { #ifdef DEBUG         os_log(OS_LOG_DEFAULT, "Preset is old style..."); #endif         [super setFullState:fullState];     } } This will let you move to a new method of working with fullState and will still be able to read fullState sent to it from old documents and presets. But, in iOS 14, the problem with the base class implementation of setFullState is still there for old style presets and documents. It does work on iOS 13 and iOS 12. It should also work fine when the issue is fixed in iOS 14 and let users work with both old and new document and preset state.
Sep ’20
Reply to Changes to AUAudioUnit fullState in iPadOS14?
I have an internal preset handling system for my AU's that I've been using since I first wrote them. This was before the new system was released with iOS 13. I connected the new host-AU integration API up to my internal preset handling, so I haven't used anything with the default implementation from AUAudioUnit. I have moved to using my own implementation of fullState and setFullState that doesn't call the superclass implementation. This now works in all hosts I've tested it in. This does still leave open the issue that previously saved documents (projects) and presets still won't work. It would be worth trying to override the fullState related methods and see if this allows your user presets system to work. Also, check to see if you've implemented (BOOL) supportsUserPresets to return YES because I suspect that the way hosts are interacting with this may be changing and it's possible the base class version has changed in this release of iOS.
Sep ’20