-
Re: MusicSequenceFileLoad Returns -1 on iOS10
drock Oct 13, 2016 3:57 PM (in response to drock)I received some guidance from an Apple engineer via the Core Audio Mailing List and have successfully implemented the proposed work-around for this issue in iOS10.
By updating the "errno" value to 0 after a failed call, subsequent calls to 'MusicSequenceFileLoad' generate a successful response. Therefore, I've amended my code as follows:
OSStatus statusOfInitialAttempt = CheckError(MusicSequenceFileLoad(self.masterMidiMusicSequence, (__bridge CFURLRef)midiFileURL, 0, 0), "MusicSequenceFileLoad"); if (statusOfInitialAttempt == -1) { errno = 0; OSStatus statusOfSecondAttempt = CheckErrorAndReturnOnFailure(MusicSequenceFileLoad(self.masterMidiMusicSequence, (__bridge CFURLRef)midiFileURL, 0, 0), "MusicSequenceFileLoad"); if (statusOfSecondAttempt == -1) { // Handle error case } }
... where the CheckError() function simply checks the OSStatus return value against known OSStatus codes and is similar to this one on GitHub (originally created by Chris Adamson from his blog post / presentation "Core Audio Cranks It Up").
I understand that this issue is expected to be resolved in a future iOS update according to what was posted on the Core Audio Mailing List.
-
Re: MusicSequenceFileLoad Returns -1 on iOS10
SoundOfMind Oct 13, 2016 5:24 PM (in response to drock)This issue has come up a couple of times, is a known problem now, and will be fixed in a future release.
The workaround should be as simple as adding
#import <sys/errno.h>
to your source, and add the line:
errno = 0;
just prior to your call to MusicSequenceFileLoad()
-DS