我有一个音频流的问题(这是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,但是如何设置呢?
发布于 2011-07-21 07:25:07
在将PCM音频流提供给音频队列API之前,您可能需要在自己的代码中将6个声道预混合为2个声道。
https://stackoverflow.com/questions/6769457
复制相似问题