Changes to AUAudioUnit fullState in iPadOS14?

I have some AudioUnits where I use the base class implementation of fullState and setFullState. This has been working fine up until the beta of iPadOS14.

Now, the parameter tree is not being updated after setFullState is called from either my internal preset code or from an AU host. The setFullState method is called but the parameterTree is left in the same state it was before the call.

I'm wondering if this is expected behavior or if it might be a bug in the base class implementation.
If you're seeing a difference in behavior from iOS 13, I strongly recommend you file a bug report. Please post the bug number in this thread.
It's definitely different from any previous version of iOS or iPadOS. I filled a report through the Feedback Assistant interface. The number is FB8412811.


I've noticed this too. Moreover, the userPresets system seems to have changed. My audio unit cannot see user presets in iOS14.
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

Code Block
- (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.
If anyone is wondering about overriding fullState and setFullState so that you can work around the issue, this is what I've done

Code Block
- (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.
It may be worth noting that the userPresets system and the system's implementation of the method used to set the fullState property are still 'broken' in iPadOS 14.0.1.

saveUserPreset does not fail or throw an error but does not write any data to the Documents folder either. The userPresets array, which is used to access preset files from the Documents folder, is invariably empty.

In my app, the system's implementation of the method used to set the fullState property has no effect at all.

Both of these features worked in one of the pre-release iPadOS 14 betas, although I cannot remember which version I used. I first noticed these problems in the release version of iPadOS 14.
Just confirmed this has not been resolved on OS 14.1.
Has anyone checked 14.2 beta?
I confirmed that iPadOS 14.2 beta4 resolves this issue!
Thank you, _bismark! That's great news.
EDIT: It occurs to me that this problem is not related to the subject of the thread. I'll make a new thread.



Since my last post I've installed iPadOS 14.2 beta 4 on my iPad.

Sadly the user presets system remains broken in beta 4. Although the saveUserPreset method does not fail, user presets are not written to the Documents folder, and the userPresets array is invariably empty.

To reiterate what I wrote in an earlier post, the user presets system worked in at least one of the pre-release iPadOS 14 betas. I first noticed the problem when iPadOS 14.0 was released publicly.
Changes to AUAudioUnit fullState in iPadOS14?
 
 
Q