• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: MusicSequenceFileLoad Returns -1 on iOS10 (AudioToolbox/MusicPlayer)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MusicSequenceFileLoad Returns -1 on iOS10 (AudioToolbox/MusicPlayer)


  • Subject: Re: MusicSequenceFileLoad Returns -1 on iOS10 (AudioToolbox/MusicPlayer)
  • From: Sven Thoennissen <email@hidden>
  • Date: Wed, 19 Oct 2016 17:25:44 +0200

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@hidden:

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@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: AudioUnitGetProperty with Swift 3
  • Next by Date: Re: AudioUnitGetProperty with Swift 3
  • Previous by thread: Re: MusicSequenceFileLoad Returns -1 on iOS10 (AudioToolbox/MusicPlayer)
  • Next by thread: Querying "Ambient Noise Reduction" property
  • Index(es):
    • Date
    • Thread