• 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
kAudioOutputUnitProperty_CurrentDevice not sticking (Mac)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

kAudioOutputUnitProperty_CurrentDevice not sticking (Mac)


  • Subject: kAudioOutputUnitProperty_CurrentDevice not sticking (Mac)
  • From: Daniel Kennett <email@hidden>
  • Date: Thu, 15 Nov 2012 15:57:56 +0100

Hey guys,

I'm playing audio successfully using an AUGraph with an output unit created using the following description:

AudioComponentDescription outputDescription;

outputDescription.componentType =kAudioUnitType_Output;

outputDescription.componentSubType =kAudioUnitSubType_DefaultOutput;

outputDescription.componentManufacturer =kAudioUnitManufacturer_Apple;

outputDescription.componentFlags = 0;

outputDescription.componentFlagsMask = 0;


Today, I've been trying to add the ability to choose the audio output device independently of the default device. I'm doing this by setting the kAudioOutputUnitProperty_CurrentDevice property on the output audio unit, like this:

OSStatus status = AudioUnitSetProperty(outputUnit,

kAudioOutputUnitProperty_CurrentDevice,

kAudioUnitScope_Output,

0,

&deviceId,

sizeof(deviceId));


I have two questions:

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. However, I can't seem to find out how to do this once I've set kAudioOutputUnitProperty_CurrentDevice (assuming the audio stays in place as in my first question). I try to find the AudioDeviceID for the default device and set that, but I get an error code -10851 when I try to set the kAudioOutputUnitProperty_CurrentDevice with the device ID I find. The device ID is being found like this:

AudioObjectPropertyAddress property;

property.mScope = kAudioObjectPropertyScopeGlobal;

property.mElement = kAudioObjectPropertyElementMaster;

property.mSelector = kAudioHardwarePropertyDefaultOutputDevice;


AudioDeviceID outputDeviceID = kAudioObjectUnknown;

UInt32 propertySize = sizeof(AudioDeviceID);

OSStatus status = AudioHardwareServiceGetPropertyData(kAudioObjectSystemObject, &property, 0, NULL, &propertySize, &outputDeviceID);


Thanks in advance for any help
 _______________________________________________
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: kAudioOutputUnitProperty_CurrentDevice not sticking (Mac)
      • From: Seth Willits <email@hidden>
  • Prev by Date: listening in on default input and output devices?
  • Next by Date: Re: kAudioOutputUnitProperty_CurrentDevice not sticking (Mac)
  • Previous by thread: Re: listening in on default input and output devices?
  • Next by thread: Re: kAudioOutputUnitProperty_CurrentDevice not sticking (Mac)
  • Index(es):
    • Date
    • Thread