Re: Device sample rates and stream virtual formats
Re: Device sample rates and stream virtual formats
- Subject: Re: Device sample rates and stream virtual formats
- From: "Stephen F. Booth" <email@hidden>
- Date: Sat, 7 Aug 2010 18:01:50 -0700
Hi Jeff,
Thanks for the reply.
> When one sets a device's sample rate (kAudioDevicePropertyNominalSampleRate), is it expected that the device's streams will change their virtual formats (kAudioStreamPropertyVirtualFormat) to match the new sample rate?
Yes. The physical format properties would be updated as well.
> I searched the archives and documentation and wasn't able to find any clarification on the matter.
An AudioDevice can only have one current sample rate.
> This is the behavior that I've been seeing with the built-in audio on my MacBook Pro as well as on two different external USB DACs. I recently acquired a FireWire audio interface and it seems that most of the time, but not all of the time, the virtual format changes along with the device's sample rate. When the virtual format does not change but the sample rate does, strange things happen since I end up sending audio at the wrong rate to the stream.
>
> I should probably note that I register property listeners on the device and stream, and use them to determine when I need to adjust the audio format I'm sending.
That sounds like a bug of some sort. It's probably worth filing something so we can take a look.
As always is the case when I post to this list, the error was mine and not a bug in Apple's code.
I think the issue I was seeing was caused by two mistakes- the first is that I was monitoring kAudioDevicePropertyStreams for changes but erroneously using global scope instead of output scope and as such never received any of the property change notifications. Unfortunately the FireWire device I am using changes its streams with every sample rate change.
The second issue seems to be one of timing. The FireWire device sends virtual format change notifications for the *old* streams following a sample rate change- but never for the new ones. Depending on whether I was running in release or debug mode and whether I was using the debugger seemed to determine the order in which the notifications are received. Once I receive a streams changed notification I remove all old property listeners which explains why I wasn't getting the virtual format change notifications every time.
Stephen
_______________________________________________
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