App crashes with this error. Any idea what can be causing this or how to debug?
Wondering if it has to do with any of the warnings produced by running Analyze.
Please provide more information on how this crash occurs, ideally with an attached sample project that reproduces the crash.
Hi Michael, unfortunately (or fortunately?) I haven't been able to reproduce the bug since I posted this, even though it was happening fairly frequently / randomly at the time. I believe it may have had to do with actively setting player modules pulled from my AEArray to nil (in main thread land), which I later realized isn't necessary because AEArray should take care of clearing any references. I will keep my eye out and try to recreate the crash in a sample project if I happen to see it again. Apologies for often posting about issues that end up working themselves out on their own!
Ah okay, no problem!
The error has returned! It seems to arise when there are many players, each with their own completion block (I've been using players' completion blocks to schedule their next play times, which I'm starting to realize may not be the best strategy). With all of these callbacks to the main thread and other events in the app requiring work on the main thread, it makes sense why things might get out of order.
In general, I'd really benefit from being able to schedule additional playback for the players exclusively on the audio thread, because repeatedly scheduling on the main thread appears to be demanding / take some time for a lot of files. I basically need to achieve looping, but where the loop duration can be greater than the files duration, so that the time interval between a file's playback is constant. I imagine subclassing AEAudioFilePlayerModule may be able to help but I'm not really sure where to start. Any thoughts?
One hack-y solution which appears to work okay is using an avmutablecomposition/avexportsession to create a new file with a duration equal to the length of time between the desired playback times, so I can then take advantage of the loop property of the player. I worry this approach of creating larger files might make the app less performant, though, and cause other issues down the road.
Hmm, yes, that seems a bit suboptimal to me... have you considered using an actual sequencer AU? There's not a wrapper for that in TAAE2, so you'd need to interact with the audio unit directly - or, take a look at the excellent AudioKit