• 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: Audio Device Property Caching in Snow Leopard?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Audio Device Property Caching in Snow Leopard?


  • Subject: Re: Audio Device Property Caching in Snow Leopard?
  • From: Jeff Moore <email@hidden>
  • Date: Fri, 23 Oct 2009 08:45:40 -0700


On Oct 23, 2009, at 6:35 AM, AI Developer wrote:

I've still not been able to get a handle on this problem, but I had a thought, perhaps someone can help me on this:

Is it possible that the GetProperty will not reflect the change until the SR change notification is handled by the HAL's notification handler.

Yes. The HAL isn't omniscient. It needs to be informed by the driver and other outside entities when things change.



And if the notification handler's run loop source has been added only to the primary thread (which is also making this call), the state will not get updated until the notification handler gets a chance to do it's work?

This is also correct. The HAL's handles all the interesting notifications using the run loop specified by kAudioHardwarePropertyRunLoop. If this run loop is not getting time to run, the HAL will not be able to get any information from the outside world.


By default, kAudioHardwarePropertyRunLoop points at the process's main thread on SnowLeopard. You can set kAudioHardwarePropertyRunLoop to any run loop in your process that is definitely going to get time to run. If your process lacks such a run loop, you can set kAudioHardwarePropertyRunLoop to NULL which tells the HAL to run it's own thread for notifications (which was the default prior to SnowLeopard).


AI Developer wrote:
Hi,

Does Snow Leopard cache audio device properties, and satisfy calls from the cache?

I've run into a very wierd problem when trying to change the Sampling Rate of a device on SR.

If I set the SR, and then query the SR back, I do not get the new value - ever, as long as the application instance is running!

Here's some sample code that demonstrates the problem:

-------
err = AudioDeviceSetProperty(currentID, NULL, 0, 0,
    kAudioDevicePropertyNominalSampleRate, propSize, &srToSet);

if (err == kAudioHardwareNoError)
{
Float64 currentSR = 0.0;
propSize = sizeof (currentSR);
err = AudioDeviceGetProperty(currentID, 0, 0, kAudioDevicePropertyNominalSampleRate, &propSize, &currentSR);
if (err == kAudioHardwareNoError)
{
std::cout << "\tResultant Nominal Sampling Rate: " << (int) currentSR << " Hz.";
}
}
-------


If srToSet is differet from the current rate, and I execute this code, the value coming out of the GetProperty is not as expected.

Note that at the same time, the SR has been changed properly (Audio MIDI Setup shows the new value as soon as the SetProperty succeeds). It's just that the process that has invoked the SetProperty shows the wrong value.

This only happens on 10.6, not on 10.5.

Am I doing something wrong here?

Thanks.
Devendra.

_______________________________________________ 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


--

Jeff Moore
Core Audio
Apple



_______________________________________________
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: Audio Device Property Caching in Snow Leopard?
      • From: AI Developer <email@hidden>
References: 
 >One Cocoa view for multiple AUs? (From: ipmlists <email@hidden>)
 >Audio Device Property Caching in Snow Leopard? (From: AI Developer <email@hidden>)
 >Re: Audio Device Property Caching in Snow Leopard? (From: AI Developer <email@hidden>)

  • Prev by Date: Re: Audio Device Property Caching in Snow Leopard?
  • Next by Date: Re: One Cocoa view for multiple AUs?
  • Previous by thread: Re: Audio Device Property Caching in Snow Leopard?
  • Next by thread: Re: Audio Device Property Caching in Snow Leopard?
  • Index(es):
    • Date
    • Thread