Hello,
for the sake of the list archive I'd like to add that the same problem occurs
when trying to load a SoundFont into an AVAudioUnitSampler (when being invoked
on a background thread). The result code is -10871 (kAudioUnitErr_InvalidFile).
It can be solved with the same workaround:
// May be called in other thread than the main thread
AudioUnit audioUnit = config->samplerAudioUnit;
AUSamplerInstrumentData instData;
instData.fileURL = url;
instData.bankLSB = kAUSampler_DefaultBankLSB;
instData.bankMSB = kAUSampler_DefaultMelodicBankMSB;
instData.presetID = presetNo;
instData.instrumentType = kInstrumentType_SF2Preset;
errno = 0; // Workaround for iOS bug; AudioUnitSetProperty() may fail when
invoked on different thread than main thread
// Load soundfont preset by setting the kAUSamplerProperty_LoadPresetFromBank
property
OSStatus result;
result = AudioUnitSetProperty(audioUnit, kAUSamplerProperty_LoadInstrument,
kAudioUnitScope_Global, 0, &instData, sizeof(AUSamplerInstrumentData));
if (result != noErr) {
DLog(@"Could not load preset %u from soundfont '%@': result=%d",
presetNo, ((__bridge NSURL *)url).lastPathComponent, (int)result);
} else {
DLog(@"Loaded preset %u from soundfont '%@'", presetNo, ((__bridge
NSURL *)url).lastPathComponent);
OSAtomicTestAndSet(0, &config->presetLoaded);
}
Best regards,
Sven
> Am 14.10.2016 um 21:00 schrieb [email protected]:
>
>> I cannot promise the specific release in which this will be fixed, but the
>> problem is understood, and I can tell you that if you can force ‘errno’ to
>> reset to 0, any following call to MusicSequenceFileLoadData() will succeed.
>>
>> -DS
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/coreaudio-api/archive%40mail-archive.com
This email sent to [email protected]