AudioQueue output channels
I have a problem with audio stream (this is LPCM stream with 6 channels inside). But when I playing this stream on iPhone via AudioQueue I hear only first two channels. Here AudioQueue initialization code:
- (id)initWithSampleRate:(int)aSampleRate numChannels:(int)aNumChannels
{
self = [super init];
开发者_运维问答 AudioStreamBasicDescription theDescription;
theDescription.mFormatID = kAudioFormatLinearPCM;
theDescription.mSampleRate = aSampleRate;
theDescription.mChannelsPerFrame = aNumChannels;
theDescription.mBytesPerPacket = 2 * aNumChannels;
theDescription.mFramesPerPacket = 1;
theDescription.mBytesPerFrame = 2 * aNumChannels;
theDescription.mBitsPerChannel = 16;
theDescription.mFormatFlags = kAudioFormatFlagsNativeEndian | kAudioFormatFlagIsSignedInteger;
AudioQueueNewOutput(&theDescription, audioQueue_callback, self, CFRunLoopGetCurrent(), kCFRunLoopCommonModes, 0, &audioQueue);
AudioQueueStart(audioQueue, NULL);
return self;
}
Do you know how solve this problem? Probably I should set output channels count to 2, but how?
You might need to, in your own code, pre-mix the 6 channels down to 2 channels before feeding the PCM audio stream to the Audio Queue API.
精彩评论