• 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: API for switching audio output device or disabling output altogether
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: API for switching audio output device or disabling output altogether


  • Subject: Re: API for switching audio output device or disabling output altogether
  • From: William Stewart <email@hidden>
  • Date: Fri, 11 Dec 2009 16:21:01 -0800


On Dec 11, 2009, at 4:04 PM, Roger Thornhill wrote:

On Fri, Dec 11, 2009 at 3:53 PM, William Stewart <email@hidden> wrote:

On Dec 10, 2009, at 10:49 PM, tahome izwah wrote:

Not sure if this helps but you can get the current default system
output device via

AudioDeviceID currentDevice;
UInt32 propsize = sizeof(AudioDeviceID);
OSStatus err = AudioHardwareGetProperty (kAudioHardwarePropertyDefaultOutputDevice,
&propsize, &currentDevice);


In order to find the built-in device you iterate through all audio
devices calling

Sorry if this is a basic question, but how do you get the list of audio devices in order to iterate through them? I tried searching the coreaudio documentation, but couldn't find the relevant information.


UInt32 transportType; UInt32 propsize=sizeof(AudioDeviceID); OSStatus err = AudioDeviceGetProperty(deviceID, 0, false, kAudioDevicePropertyTransportType, &propsize, &transportType);

on each device. The built-in audio hardware has transportType ==
kIOAudioDeviceTransportTypeBuiltIn. You can set it system wide via
this call when required:

OSStatus err = AudioHardwareSetProperty (kAudioHardwarePropertyDefaultOutputDevice,
sizeof(AudioDeviceID), &outputDevice);

Does the built in audio hardware remain constant? For example, when you insert an optical cable into the audio output port on the Mac, a hardware switch is triggered and the output device now becomes "Digital Out". Will the default output device now be changed to "Digital Out", or will it still refer to the internal speakers?



So you should be able to switch your device as required. Whether or not this is good practice from a user experience POV I do not know -

It is not. Applications should not be setting the default device as this is something the user controls.


It is also completely irrelevant to the question that was asked.

This is the problem I want to rectify. You mention that the default device is something the user controls, however, once you insert a cable into the audio output port, the option for "Internal Speakers" is removed and replaced by "Digital Out". I'd like to give back this option to the user, and allow them to select "Internal Speakers",

That's the point though. The behaviour that we support is to support the user's gesture (plugging the cable) and NOT having to:


(1) Plug the cable
AND
(2) Go to a software panel and configure the output.

This is a UI Policy decision (amongst other things) and I don't see this being changed at this point. Inserting headphones works the same way (as does inserting a mic cable)

Bill

_______________________________________________
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: API for switching audio output device or disabling output altogether
      • From: Paul Davis <email@hidden>
    • Re: API for switching audio output device or disabling output altogether
      • From: Kyle Sluder <email@hidden>
References: 
 >API for switching audio output device or disabling output altogether (From: Roger Thornhill <email@hidden>)
 >Re: API for switching audio output device or disabling output altogether (From: tahome izwah <email@hidden>)
 >Re: API for switching audio output device or disabling output altogether (From: William Stewart <email@hidden>)
 >Re: API for switching audio output device or disabling output altogether (From: Roger Thornhill <email@hidden>)

  • Prev by Date: Re: API for switching audio output device or disabling output altogether
  • Next by Date: Re: API for switching audio output device or disabling output altogether
  • Previous by thread: Re: API for switching audio output device or disabling output altogether
  • Next by thread: Re: API for switching audio output device or disabling output altogether
  • Index(es):
    • Date
    • Thread