Hello

I have an application that plays midi songs with different instruments.
When the user picks a song, a new MIDISynth node is added to the audio
graph and the related soundfont is loaded. When user decides to play a
different song, he has to go back which causes audio unit to be
uninitialized and the graph is updated. Then, the user can pick a new song
to play.

The issue is that sometimes when user decides to go back (which removes and
uninitializes a node), the application crashes.

When the application crashes, the last call I make is to:
AudioUnitUninitialize. The crashing thread is AURemoteIO::IOThread,
crashing at SamplerBaseElement::IncrementActiveLayerVoiceCount. Last thing
I see in the logs is: '238: Illegal decrement of empty layer bin count'

The uninitialization flow my app uses is this:
1. Disconnect synth node from the mixer (AUGraphDisconnectNodeInput)
2. Remove synth node from the graph (AUGraphRemoveNode)
3. Uninitialize the synth audio unit (AudioUnitUninitialize) - crash
4. Update the graph (AUGraphUpdate)

>From my testing, the crash is seemingly random - it takes anywhere between
2 to 20 repeats to reproduce (pick a song, go back, then again). The music
plays as intended. Tested on iPhone XS with iOS 12.1.2.

I haven't tested this on a mono iPhone yet. Will try to reproduce and get
back with findings.

Any ideas what's wrong here? Could this be a threading issue?

Regards,
Bartosz Nowotny
 _______________________________________________
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]

Reply via email to