10867 errors with AUSampler

This discussion was created from comments split from: Improvements to TAAE in version 1.4.8.

Comments

  • @okramis said:
    I have a class within I use the AEAudioUnitChannel-class to instantiate AUSampler and add to channel groups. This works fine in pre 1.4.8. In 1.4.8, when I remove the audiocontroller and error arguments it compiles, but floods the log with error "AudioUnitRender result -10867" and there's no sound.

    Any clue how to fix that?

    my code attached

    @Michael: I still can't get my subclassed AEAudioUnitChannel (AUSampler) going after your removal of the audiocontroller reference (=>1.4.8). Together with the iPhone 6s-problems (audiobus/taae), I'd like to update to the new framework. It compiles but floods the log with error -10867 and there's no sound. Would you mind, to have a look at my attached code?
    Thanks Otmar

  • Hi @okramis - I made some fixes today, would you mind trying the latest version from github?

  • Hi @Michael - unfortunately no change, still error -10867. I'll try to integrate my class to the sample app and post it here.

    thanks

  • Bugger. Okay, cheers

  • @Michael: Here's the two versions attached. pre148 and 148up, the problem seams in the initialization of the AUSampler:

    self.sampler = [[AEAudioUnitChannel alloc]
                initWithComponentDescription:component
                preInitializeBlock:^(AudioUnit samplerUnit){
    
                    // Get the type of reference we need (NSDictionary is a CFPropertyList)
                    CFPropertyListRef presetPropertyList = (__bridge CFPropertyListRef)(aupreset);
                    // Set the class info property for the Sampler unit using the property list as the value.
                    AudioUnitSetProperty(samplerUnit,
                                         kAudioUnitProperty_ClassInfo,
                                         kAudioUnitScope_Global,
                                         0,
                                         &presetPropertyList,
                                         sizeof(CFPropertyListRef)
                                         ); // should rightly be checking for an error here... took it out for demo
                }
                ];
    if (_sampler) {
        [_audioController addChannels:@[_sampler]];
    }
    

    the demo-action is on the "One Shot" "Play"-button

    get the files here: https://www.dropbox.com/s/42rtc9su8ll8ngq/TAAE_AUSampler.zip?dl=0

    thanks for having a look at

  • You got so close =)

    // should rightly be checking for an error here... took it out for demo
    

    You were right, you should, because that call's failing with 'InvalidPropertyValue' - there's something wrong with your preset. The old version is failing too, but for some reason it's continuing on anyway - it shouldn't be, though, it should be failing like the new version is. No idea why the discrepancy, both versions are creating the audio unit pretty much the same way. But the solution is to fix your preset.

    For future reference: always wrap your Core Audio code in AECheckOSStatus so you know when things are breaking.

  • Got it working. It seems the preInitializeBlock-thing isn't working anymore. When I initialize the sampler first (initWithComponentDescription) and set the properties afterwards, it's working....

    AudioComponentDescription component = AEAudioComponentDescriptionMake(kAudioUnitManufacturer_Apple,
                                                                          kAudioUnitType_MusicDevice,
                                                                          kAudioUnitSubType_Sampler);
    
    CFPropertyListRef presetPropertyList = (__bridge CFPropertyListRef)(_aupreset);
    OSStatus result = noErr;
    
    _sampler = [[AEAudioUnitChannel alloc] initWithComponentDescription:component];
    if (_sampler) {
        [_audioController addChannels:@[_sampler]];
        [_audioController addChannels:@[_sampler] toChannelGroup:group];
    }
    
    result = AudioUnitSetProperty(_sampler.audioUnit,
                                  kAudioUnitProperty_ClassInfo,
                                  kAudioUnitScope_Global,
                                  0,
                                  &presetPropertyList,
                                  sizeof(CFPropertyListRef)
                                  );
    if (result != noErr) {
        _initialized = YES;
    } else {
        NSLog(@"Error setting aupreset");
    }
    
  • Hmm. Maybe some of those properties need to be set after initialisation, not before. Might need to add a postInitializationBlock perhaps?

  • No big deal, now I know how to;-) Maybe a switch pre/post, but I'm happy now.

    Thanks for TAAE!

  • You were right, you should, because that call's failing with 'InvalidPropertyValue' - there's something wrong with your preset. The old version is failing too, but for some reason it's continuing on anyway - it shouldn't be, though, it should be failing like the new version is. No idea why the discrepancy, both versions are creating the audio unit pretty much the same way. But the solution is to fix your preset.

    @Michael: Just found out what's causing the 'InvalidPropertyValue'. Sometime in the past a new property type was introduced to load .auprefs into AUSampler: kAUSamplerProperty_LoadInstrument.

    But this one expects a CFURLRef as it's data. As I implemented my fractal tuning in loading the .auprefs file into a NSMutableDictionary and set fine tuning per needed note in there, I can't bridge it to CFURLRef.

    Fortunately the 'old' way with 'kAudioUnitProperty_ClassInfo' and 'CFPropertyListRef' beside returning the 'InvalidPropertyValue'-error still works when done post initialization, otherwise I would have to reconstruct the whole tuning part;-)

    Thanks for looking at!

Sign In or Register to comment.