• 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
AudioOuputUnitStop
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AudioOuputUnitStop


  • Subject: AudioOuputUnitStop
  • From: Bjorn Roche <email@hidden>
  • Date: Sun, 4 Dec 2005 11:43:59 -0500 (EST)

Hey all,

My audio editing software (www.xowave.com) uses portaudio (www.portaudio.com)[1] for audio I/O.

The CoreAduio section of PortAudio is old, has a number of problems and limitations, and does not use AUHAL. I have mostly rewritten the code and it seems to work. I will probably have more questions, but I'd like to start with the most important deficit in my code.


Portaudio has a concept of "completing" an audio stream and a separate concept of "aborting" the audio stream. As far as I can tell, AUHAL lacks these concepts, so here's what they mean in PortAudio land:


- Completing means that all remaining buffers are played and then the stream is closed. The function in question blocks until this is done. In other circles I have hear this referred to as "draining".

- Aborting means that the stream is closed as soon as possible, even if it means remaining buffers are dropped.

Both operations can be performed from the callback by returning an appropriate value, or from another thread by calling an appropriate function, either PaStop() or PaAbort(). Both the PaStop() and PaAbort() functions are meant to block until the stream is closed and audio has stopped.

One of these concepts is missing from AudioOutputUnit. The docs don't describe the behavior of AudioUnitStop() enough to tell me which of these behaviours is implemented (unless I am missing something) but in tests I found that the behavior seemed to be more like PortAudio's "Abort" behavior. So a few questions come up:

* is that true?

* is it safe to call AudioUnitStop() from the callback? Is there another way of stopping/draining/aborting from within the callback?

* does AUHAL provide a way of draining?

* if not, are there any suggestions? (so far the best I can think of is to let the stream run until the designated amount of time has passed, as measured by the AudioDevice, while running empty buffers through the callback, and then calling AudioUnitStop()... or something. But "draining" an audio device is really not that complex a concept, and it is common in other APIs I've used, so there must be a better way. Someone else must have dealt with this before!)

One thing I thought of was to just leave the stream open and pass empty buffers except when the user wants to play, but this seems wasteful, complex, and not a correct implementation of the portaudio spec, and, again, there must be a better way.

TIA,

	bjorn



[1] PortAudio is a popular open source (BSD-style license) API because it simplifies and unifies a bunch of other APIs, so cross-platform developers only need to learn one, relatively simple, API. It is low latency, professional quality, and currently supports a number of platforms. It is referenced on apple's web-site here: http://developer.apple.com/audio/ under "related links".


------------- Bjorn Roche Check out my CD Mastering Software for Mac OS X : http://www.xowave.com _______________________________________________ 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
  • Follow-Ups:
    • Re: AudioOuputUnitStop
      • From: Doug Wyatt <email@hidden>
    • Re: AudioOuputUnitStop
      • From: Bjorn Roche <email@hidden>
  • Prev by Date: MCL lisp and CoreAudio
  • Next by Date: Get selectRecordInput to show output channels in "input" pop-up
  • Previous by thread: MCL lisp and CoreAudio
  • Next by thread: Re: AudioOuputUnitStop
  • Index(es):
    • Date
    • Thread