How to set channel map on an AudioQueue
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