Loading GarageBand EXS instruments into iOS 6 app using AUSampler
Loading GarageBand EXS instruments into iOS 6 app using AUSampler
- Subject: Loading GarageBand EXS instruments into iOS 6 app using AUSampler
- From: Dany <email@hidden>
- Date: Mon, 18 Mar 2013 10:18:39 -0700
I'm trying to use the new AUSampler API with EXS24 from GarageBand. I tried copying the EXS24 file into the project and also everything under Sampler Files as a folder reference into my project. Yet, no matter what I do, it doesn't seem to load.
I'm loading the instrument with the following code:
-(OSStatus) loadFromEXS: (NSString *) path withSampler: (AudioUnit) sampler { OSStatus result = noErr;
NSURL *presetURL = [[NSURL alloc] initFileURLWithPath:[[NSBundle mainBundle] pathForResource:path ofType:@"exs" inDirectory:@"Sampler Instruments"]];
AUSamplerInstrumentData bpdata = {0};
bpdata.fileURL = (__bridge CFURLRef)(presetURL); bpdata.instrumentType = kInstrumentType_EXS24;
result = AudioUnitSetProperty(sampler, kAUSamplerProperty_LoadInstrument, kAudioUnitScope_Global, 0, &bpdata, sizeof(bpdata)); return result; }
I get the following in the console:
2013-03-18 10:13:49.977 Load Presets[4800:c07] <com.apple.main-thread> GlobalState::LoadEXS24Instrument: Load failed
The result code returned from AudioUnitSetProperty:
(lldb) p result (OSStatus) $0 = -43
According to AudioFile.h, this appears to be a kAudioFileFileNotFoundError. But I'm fairly certain that the files are added properly with folder references into the project, and that they are being added to the right target.
Any ideas as to what could be going wrong here? (Is there any reason for Core Audio to output such vague error messages? It would be helpful to know whether it's having trouble locating WAV files vs the exs file...)
Thanks, --Dany. |
_______________________________________________
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