开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜