• 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
A way to get preferred audio device channels
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

A way to get preferred audio device channels


  • Subject: A way to get preferred audio device channels
  • From: Xiaofeng Li <email@hidden>
  • Date: Mon, 26 Mar 2012 18:35:01 -0500

Hi There,

I am trying to get preferred channels supported of an audio
input/output device in my Mac pro,
I tried the following code which I saw in stackoverflow, I am using
bufferList->mNumberBuffers to tell channels, is this correct? I tried
to kAudioDevicePropertyScopeOutput and my default Buildin-output is
shown only 1 channel, I think the speaker has two channels which is
wrong.  The bufferList I am using is an object of AudioBufferList.

If this is not correct, shall I use AudioChannelLayout?

Your comment is highly appreciated!


//code


....
		thePropertyAddress.mSelector = kAudioDevicePropertyStreamConfiguration;
		thePropertyAddress.mScope = kAudioDevicePropertyScopeInput;


		result = AudioObjectGetPropertyDataSize(theDeviceIDs[i],
&thePropertyAddress, 0, NULL, &thePropSize);


		if(kAudioHardwareNoError != result) {
            fprintf(stderr, "AudioObjectGetPropertyDataSize
(kAudioDevicePropertyStreamConfiguration) failed: %i\n",(int) result);
            continue;
        }

        AudioBufferList *bufferList = (AudioBufferList *)malloc(thePropSize);

        if(NULL == bufferList) {
            fputs("Unable to allocate memory", stderr);

        }


		result = AudioObjectGetPropertyData(theDeviceIDs[i],
&thePropertyAddress, 0, NULL, &thePropSize, bufferList);



		//TODO the following error needs to be handled

		if(kAudioHardwareNoError != result || 0 == bufferList->mNumberBuffers)
              {....
             }

--
Xiaofeng Li
 _______________________________________________
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

  • Prev by Date: Re: MIDIClientCreate() Hangs in 10.7.x?
  • Next by Date: Re: iOS and using Midi events in a custom effect
  • Previous by thread: Re: MIDIClientCreate() Hangs in 10.7.x?
  • Next by thread: How to get mixed audio stream in hardware plug-in?
  • Index(es):
    • Date
    • Thread