AudioQueue输出通道

时间:2011-07-20 22:46:56

标签: iphone audio

我的音频流有问题(这是LPCM流,里面有6个频道)。但是当我通过AudioQueue在iPhone上播放这个流时,我只听到前两个频道。 这里有AudioQueue初始化代码:

- (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;
}

你知道如何解决这个问题吗?可能我应该将输出通道数设置为2,但是如何?

1 个答案:

答案 0 :(得分:0)

您可能需要在自己的代码中将6个频道预混合到2个频道,然后再将PCM音频流馈送到音频队列API。