Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7078707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:34:50+00:00 2026-05-28T06:34:50+00:00

So here’s what is going on. I am attempting to work with Core Audio,

  • 0

So here’s what is going on.

I am attempting to work with Core Audio, specifically input devices. I want to mute, change volume, etc, etc. I’ve encountered something absolutely bizarre that I cannot figure out. Thus far, google has been of no help.

When I query the system and ask for a list of all audio devices, I am returned an array of device IDs. In this case, 261, 259, 263, 257.

Using kAudioDevicePropertyDeviceName, I get the following:

261: Built-in Microphone
259: Built-in Input
263: Built-in Output
257: iPhoneSimulatorAudioDevice

This is all well and good.

// This method returns an NSArray of all the audio devices on the system, both input and
// On my system, it returns 261, 259, 263, 257
- (NSArray*)getAudioDevices
{
  AudioObjectPropertyAddress propertyAddress = { 
    kAudioHardwarePropertyDevices, 
    kAudioObjectPropertyScopeGlobal, 
    kAudioObjectPropertyElementMaster 
  };

  UInt32 dataSize = 0;
  OSStatus status = AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &propertyAddress, 0, NULL, &dataSize);
  if(kAudioHardwareNoError != status)
  {
    MZLog(@"Unable to get number of audio devices. Error: %d",status);
    return NULL;
  }

  UInt32 deviceCount = dataSize / sizeof(AudioDeviceID);

  AudioDeviceID *audioDevices = malloc(dataSize);

  status = AudioObjectGetPropertyData(kAudioObjectSystemObject, &propertyAddress, 0, NULL, &dataSize, audioDevices);
  if(kAudioHardwareNoError != status) 
  {
    MZLog(@"AudioObjectGetPropertyData failed when getting device IDs. Error: %d",status);
    free(audioDevices), audioDevices = NULL;
    return NULL;
  }

  NSMutableArray* devices = [NSMutableArray array];

  for(UInt32 i = 0; i < deviceCount; i++)
  {    
    MZLog(@"device found: %d",audioDevices[i]);   
    [devices addObject:[NSNumber numberWithInt:audioDevices[i]]];
  }

  free(audioDevices);

  return [NSArray arrayWithArray:devices];
}

The problem crops up when I then query the system and ask it for the ID of the default input device. This method returns an ID of 269, which is not listed in the array of all devices.

If I attempt to use kAudioDevicePropertyDeviceName to get the name of the device, I am returned an empty string. Although it doesn’t appear to have a name, if I mute this device ID, my built-in microphone will mute. Conversely, if I mute the 261 ID, which is named “Built-In Microphone”, my microphone does not mute.

// Gets the current default audio input device
// On my system, it returns 269, which is NOT LISTED in the array of ALL audio devices
- (AudioDeviceID)defaultInputDevice
{
  AudioDeviceID defaultAudioDevice;
  UInt32 propertySize = 0;
  OSStatus status = noErr;
  AudioObjectPropertyAddress propertyAOPA;

  propertyAOPA.mElement = kAudioObjectPropertyElementMaster;
  propertyAOPA.mScope = kAudioObjectPropertyScopeGlobal;
  propertyAOPA.mSelector = kAudioHardwarePropertyDefaultInputDevice;
  propertySize = sizeof(AudioDeviceID);

  status = AudioHardwareServiceGetPropertyData(kAudioObjectSystemObject, &propertyAOPA, 0, NULL, &propertySize, &defaultAudioDevice); 

  if(status) 
  { //Error
    NSLog(@"Error %d retreiving default input device",status);
    return 0;
  }

  return defaultAudioDevice;
}

To further confuse things, if I manually switch my input to “Line In” and re-run the program, I get an ID of 259 when querying for the default input device, which is listed in the array of all devices.

So, to summarize:

I am attempting to interact with the input devices in my system. If I try to interact with device ID 261 which is my “Built-In Microphone”, nothing happens. If I try to interact with device ID 269 which is, apparently, a phantom ID, my built-in microphone is affected. The 269 ID is returned when I query the system for the default input device, but it is not listed when I query the system for a list of all devices.

Does anyone know what is happening? Am I simply going insane?

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T06:34:51+00:00Added an answer on May 28, 2026 at 6:34 am

    Fixed it.

    First off, the phantom device ID was simply a virtual device the system was using.

    Secondly, the reason I couldn’t mute or do anything with the actual devices was because I was using AudioHardwareServiceSetPropertyData instead of AudioObjectSetPropertyData.

    It all works now.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's my situation. I have a DotNetNuke application. I want to link to an
here is what I want to do: Add a CALayer as a sublayer to
Here is my code...I have two dimensional matrices A,B. I want to develop the
here i want to understand the architecture of bluez (Bluetooth Stack Protocol). I understood
Here's the flow that I am trying to achieve: 1) User uploads an audio
Here is the situation, I am attempting to fire a set of Gallio tests
Here's a basic regex technique that I've never managed to remember. Let's say I'm
Here's a problem I ran into recently. I have attributes strings of the form
Here is the issue I am having: I have a large query that needs
Here's my scenario - I have an SSIS job that depends on another prior

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.