4

I am using Audio Unit Processing Graph Services on iOS to create a small graph of audio units to output audio. I set a render callback, and feed audio data into the graph when the callback is called.

This works fine until my audio session is interrupted (e.g by a phone call or alarm); at that point the callback stops, and never is called again, even after the interruption finishes.

I tried calling AUGraphStart() again on the graph, but that doesn't seem to help. Any ideas?

leremjs
  • 973
  • 1
  • 9
  • 25

1 Answers1

6

It turns out that you need to explicitly stop the graph with AUGraphStop() in the interruption callback; otherwise the call to AUGraphStart() will not have any effect.

leremjs
  • 973
  • 1
  • 9
  • 25
  • Which interruption callback should we call that in? I believe I'm calling it but `AUGraphStart` still isn't working. – kevlar Nov 19 '13 at 03:47
  • Do you mean your graph is never starting, or it's just not restarting after an interruption? – leremjs Nov 20 '13 at 04:43
  • It wasn't restarting, but I think I fixed it. I had multiple calls to start per start-stop cycle, so I changed all of my code to be sure to only start once and stop once per start-stop cycle. – kevlar Nov 21 '13 at 06:26
  • 1
    Yes that's another tricky detail... it seems that multiple calls to AUGraphStart and AUGraphStart need to be balanced out. So if you call stop twice, you need to call start twice, etc. – leremjs Nov 22 '13 at 15:58