• 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
Race condition when changing data source?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Race condition when changing data source?


  • Subject: Race condition when changing data source?
  • From: Tim Hewett <email@hidden>
  • Date: Wed, 30 Oct 2013 15:09:14 +0000

I have a USB S/|PDIF adaptor with two user-selectable data sources - Speaker and External S/PDIF Interface. Using the Core Audio API I am setting the data source to get the status of all the volume and mute controls, i.e. their existence and writability, which involves discovering the maximum number of channels supported on the stream and setting the device to the maximum number of channels temporarily (so that the volume and mute controls can all be interrogated).

I find that most of the time the API reports than no volume or mute controls exist, even though they are shown in Audio MIDI Setup. If I run under a debugger and set a breakpoint just after setting the data source, then continue execution, the correct values are returned. It seems there is a race condition.

Now I have it do:

	while ( CFRunLoopRunInMode( kCFRunLoopDefaultMode, 1, TRUE ) == kCFRunLoopRunHandledSource );

just after setting the data source, and get consistent results, but it would be better to synchronise with Core Audio and only continue once all the consequences of changing the data source have propagated.

Is there some way to block on Core Audio for this, or if not, poll it? I guess that listeners on these properties will only be called once the changes happen, maybe an option, but it would be preferable to be able to get the properties directly in this context.

Tim.
 _______________________________________________
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: Race condition when changing data source?
      • From: Jeff Moore <email@hidden>
  • Prev by Date: Re: openal.org down? Permanently?
  • Next by Date: iOS7 control center and audio session
  • Previous by thread: AU hosting, two issues: Stereo Metering, How to dispose the last plugin
  • Next by thread: Re: Race condition when changing data source?
  • Index(es):
    • Date
    • Thread