• 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: resetting audio engine after NaN in audio buffer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: resetting audio engine after NaN in audio buffer


  • Subject: Re: resetting audio engine after NaN in audio buffer
  • From: Christian Rober <email@hidden>
  • Date: Thu, 14 May 2015 09:05:21 -0400

Without looking at any code/off the top of my head:

This seems like an AVAudioSession state issue.  I too have seen interesting behavior where other apps can reset the AVAudioSession, especially when they change the category or options (ex: Mix with others).  I have seen arbitrary volume jumps and IAA callbacks suddenly break when the session changes or is reset, for example.  

I would experiment with setting the session to inactive, then setting it to active again, for starters.  I think of AVAudioSession as a local handle to a device-wide process.  In other words, all apps running on an iOS device actually share the same AVAudioSession, and your app is given a specific API to access that shared state.

You probably need to listen to notifications from the AVAudioSession as well.  I could see passing a NaN value to the audio engine causing an AVAudioSession reset.  In that case you should set a breakpoint on your callbacks from these notifications and see what the state is at that point.  Start with the documentation:

https://developer.apple.com/library/prerelease/ios/documentation/AVFoundation/Reference/AVAudioSession_ClassReference/index.html#//apple_ref/c/data/AVAudioSessionInterruptionNotification

Also, If you are using an AUGraph and/or using the RemoteI/O audio unit, you may need to turn them off temporarily (i.e. stop pulling audio buffers), re-set properties/ASBD's, then restart them.  There are some WWDC videos that talk about handling an AVAudioSession reset using audio units.  Note that the order of enabling AVAudioSession, AUGraphs and the Remote I/O unit matters, but I defer to the documentation and code samples that apple provides to illustrate this ordering.

--Christian

On Tue, May 12, 2015 at 5:18 PM, ben kamen <email@hidden> wrote:
I’ve been experimenting with some DSP C functions on iOS and have a couple times encountered an issue where NaN value gets sent into the output audio buffer.   (Obviously that indicates a bug!  but anyways….)

When this occurs audio stops functioning though the rest of the app (usually) keeps on going as if nothing happened.

That makes sense, but I can’t figure out the best way to recover after that — quitting/restarting the app doesn’t fix it, and audio in most other apps is silenced as well.

The easiest solution I’ve found is to open up the app “Samplr” which apparently has something in it that resets core audio and allows everything to recover.  Any ideas what that would be?

Thanks,
Ben



 _______________________________________________
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

 _______________________________________________
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

References: 
 >resetting audio engine after NaN in audio buffer (From: ben kamen <email@hidden>)

  • Prev by Date: Re: Use AudioQueue or AudioUnits?
  • Next by Date: Re: Use AudioQueue or AudioUnits?
  • Previous by thread: resetting audio engine after NaN in audio buffer
  • Next by thread: Use AudioQueue or AudioUnits?
  • Index(es):
    • Date
    • Thread