Re: kAudioOutputUnitProperty_CurrentDevice not sticking (Mac)
Re: kAudioOutputUnitProperty_CurrentDevice not sticking (Mac)
- Subject: Re: kAudioOutputUnitProperty_CurrentDevice not sticking (Mac)
- From: Seth Willits <email@hidden>
- Date: Thu, 15 Nov 2012 09:51:22 -0800
On Nov 15, 2012, at 6:57 AM, Daniel Kennett wrote:
> 1) This setting works in that audio is diverted to the given audio device. However, when a new default output device is chosen in the Sound pane of System Preferences, my audio gets diverted to that device. I'd like it to stay where it's told.
>
> 2) I'd also like to be able to have an option for the audio to follow the default device, as most applications behave.
In that case, I believe you want to use kAudioUnitSubType_HALOutput, not the DefaultOutput. I believe the latter always switches to the users's choice where the former does not.
To watch the device ID change, I believe you use AudioObjectAddPropertyListener. (I haven't used it myself.)
> OSStatus status = AudioHardwareServiceGetPropertyData(kAudioObjectSystemObject, &property, 0, NULL, &propertySize, &outputDeviceID);
You know, I thought this was the deprecated function, so I went and looked, and now I've learned there are three of these. In the olden days there was AudioHardwareGetProperty() which was deprecated and there's a technote which says to use AudioObjectGetPropertyData() instead, but I see that AudioHardwareService is a whole other API added at the time the previous one was deprecated. I wonder why the difference. Anyway, yours should be fine but I use AudioObjectGetPropertyData. For the above listener I guess AudioHardwareServiceAddPropertyListener works as well. I wonder if these are just shims with call the AudioObject functions since they use the same parameters…
--
Seth Willits
_______________________________________________
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