Re: AudioQueue - Setting channel layout
Re: AudioQueue - Setting channel layout
- Subject: Re: AudioQueue - Setting channel layout
- From: Doug Wyatt <email@hidden>
- Date: Mon, 10 Aug 2009 09:21:42 -0700
On Aug 8, 2009, at 9:08 , Richard Bannister wrote:
Folks,
I'm having a considerable amount of trouble trying to set up a
channel layout for playback of audio -- Mac -- calling
AudioQueueSetProperty with my kAudioQueueProperty_ChannelLayout
invariably returns -66683.
However, if I try with the below to get the correct size of the
channel layout the code also fails, this time with -66684.
What on earth am I doing wrong?
kAudioQueueErr_InvalidPropertySize = -66683,
@constant kAudioQueueErr_InvalidPropertySize The size of the
specified property is invalid.
How are you computing the size of your audio channel layout?
// Make a format description
memset(&fmt, 0, sizeof(AudioStreamBasicDescription));
fmt.mFormatID = kAudioFormatLinearPCM;
fmt.mFormatFlags = kAudioFormatFlagIsSignedInteger |
kAudioFormatFlagIsPacked;
fmt.mSampleRate = audio_sample_rate;
fmt.mChannelsPerFrame = audio_channels;
fmt.mBitsPerChannel = audio_bits;
fmt.mBytesPerFrame = fmt.mChannelsPerFrame * (fmt.mBitsPerChannel
>> 3);
fmt.mFramesPerPacket = 1;
fmt.mBytesPerPacket = fmt.mBytesPerFrame * fmt.mFramesPerPacket;
// Create output queue if needed
status = AudioQueueNewOutput(&fmt, &play_callback, &playbits,
CFRunLoopGetCurrent(), kCFRunLoopCommonModes, 0, &q_output);
if (status != noErr)
{
printf("PLAYBACK: Unable to create output queue, error %i\n",
status);
return;
}
status = AudioQueueGetPropertySize(q_output,
kAudioQueueProperty_ChannelLayout, &cls);
if (status != noErr)
{
printf("PLAYBACK: Unable to get size of channel layout, error %i
\n", status);
return;
}
kAudioQueueErr_InvalidProperty = -66684,
I think this simply means that in this case you haven't set a channel
layout, so there isn't one to get.
All this said, I have a suspicion that setting the channel layout on a
queue using PCM will have no effect (6998734). Sorry. The workaround
for that would be to manipulate your data's channel order to match
that of the default output device. You can do that with
AudioConverter, or, if you happen to be using ExtAudioFile, there.
Doug
_______________________________________________
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