79178378

Date: 2024-11-11 16:23:48
Score: 1
Natty:
Report link

For anyone running into similar problems, I want to document what I found out about a similar challenge, and the error messages I saw. In my app, I have several short MIDI tracks that I need to play back based on the user interaction. Like the OP, I used a separate AVAudioSequencer for each track, all using a single AVAudioEngine. In one version of the code, each sequencer was started when it was time to play the track, but then it was never actively stopped, continuing to "run" in parallel with the more recently started tracks, but not actually playing any notes (since there weren't any left on the track). This worked correctly the first time the entire setup was executed, but the second time I get a series of errors of the type

from AU (0x102907d00): auou/rioc/appl, render err: -1
          CAMutex.cpp:224    CAMutex::Try: call to pthread_mutex_trylock failed, Error: 22

and in this case I often hear no sound.

Further issues arise when some of the sequencers are restarted from the beginning of their track after already having played, just like what the OP describes. When other sequencers are running in parallel (again, not actually playing any notes in parallel), I observe two problems:

  1. The track with the active notes is played back much faster than its configured rate
  2. On the next call to sequencer.stop(), the UI thread freezes, waiting for a mutex that is never released (call to CADeprecated::CAMutex::Lock).

Tested on iPadOS 17.6.1

Reasons:
  • Blacklisted phrase (0.5): I need
  • RegEx Blacklisted phrase (1): I want
  • Long answer (-1):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: timr