Can't load preset into iOS Audio Unit Sampler
Can't load preset into iOS Audio Unit Sampler
- Subject: Can't load preset into iOS Audio Unit Sampler
- From: Jeffrey Fried <email@hidden>
- Date: Mon, 11 Feb 2013 16:48:14 -0800
I'm trying to learn how use the kAudioUnitSubType_Sampler by taking the audio code in the controller in Apple's LoadPresetDemo and putting it into it's own class used by a controller controlling UI elements of my own design. I've gotten everything to work except loading the Trombone preset. The Vibraphone preset that comes with the LoadPresetDemo loads fine, but no sound is played when the Trombone preset is loaded. I can run LoadPresetDemo successfully and the load preset code in my project is identical to that one except that I've removed all the UI code. I'm testing using iso SDK 6.1 on an iPhone 5.
Tracing through the code that loads the preset, everything is the same between loading the trombone and vibraphone except for the line of code:
result = AudioUnitSetProperty( self.samplerUnit, kAudioUnitProperty_ClassInfo, kAudioUnitScope_Global, 0, &presetPropertyList, sizeof(CFPropertyListRef) );
When loading the vibraphone, result is zero which I assume is success, but trombone loading returns -43 to result. All the documented result codes are in the -10000s so I don't know what -43 means. Passing the result code through:
NSError *error = [NSError errorWithDomain:NSOSStatusErrorDomain code:result userInfo:nil]; NSString *serror = [error localizedDescription]; NSLog(@"Result is %ld. Error is %@", result, serror);
yields serror values of "The operation couldn't be completed" for both a result code of -43 as well as for 0, so I'm assuming that explanation is not the problem, although maybe non-completion means something different to each of the presets. The main difference I can see between the two is that Trombone preset references audio files (which are in the project), the vibraphone preset doesn't.
Any ideas on what might be wrong or what a result -43 returned from AudioUnitSetProperty means would be greatly appreciated.
Thanks in advance for any enlightenment on the above,
Jeff Fried. |
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden