• 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
How to set channel map on an AudioQueue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to set channel map on an AudioQueue


  • Subject: How to set channel map on an AudioQueue
  • From: Paul Sanders <email@hidden>
  • Date: Tue, 14 Jan 2014 17:53:08 +0000

I am trying to set a channel map on an AudioQueue and I'm not having much luck. What I want to do is to map specific channel numbers on the device (0, 1, 2, ...) to channels 0 and 1 in my audio data stream (which is stereo). I tried the following, but when I do this I get silence when I play the audio through the queue:

OSStatus SetAudioQueueChannelMap (AudioQueueRef queue, int left_device_channel = 0, int right_device_channel = 1)
{
UInt32 nbytes = sizeof (AudioChannelLayout) + (2 - 1) * sizeof (AudioChannelDescription);

    AudioChannelLayout *layout = malloc (nbytes);
    memset (layout, 0, nbytes);
layout->mChannelLayoutTag = kAudioChannelLayoutTag_UseChannelDescriptions;
    layout->mNumberChannelDescriptions = 2;

    AudioChannelDescription *acd = layout->mChannelDescriptions;
acd [0].mChannelLabel = kAudioChannelLabel_Discrete_0 | left_device_channel; acd [1].mChannelLabel = kAudioChannelLabel_Discrete_0 | right_device_channel;

OSStatus status = AudioQueueSetProperty (queue, kAudioQueueProperty_ChannelLayout, layout, nbytes);

    free (layout);
    return status;
}

Is there any way to achieve this? I may be mistaken in my assumption that kAudioChannelLabel_Discrete_0 is the way to go, but I don't see an alternative.

Many thanks,

Paul Sanders.



_______________________________________________
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: How to set channel map on an AudioQueue
      • From: James <email@hidden>
  • Prev by Date: Re: scheduling a block from a render callback
  • Next by Date: RE: How to set channel map on an AudioQueue
  • Previous by thread: Access AUSampler's pan & pitch parameters via UISlider
  • Next by thread: RE: How to set channel map on an AudioQueue
  • Index(es):
    • Date
    • Thread