我在编码多通道Apple Lossless文件的某些配置时遇到了一些问题。我对2,4和6通道配置没有任何问题,但是我在生成12通道文件时遇到了麻烦。
使用ExtAudioFile API,我可以使用12通道AudioStreamBasicDescription和12通道FileChannelLayout创建音频文件。当设置12通道ClientDataFormat(在设置客户端布局之前完成,显然也失败了)时,我得到“fmt?”错误代码。
ClientDataFormat的My AudioStreamBasicDescription生成如下:
AudioStreamBasicDescription asbd;
asbd.mSampleRate = m_sampleRate;
asbd.mFormatID = kAudioFormatLinearPCM;
asbd.mFormatFlags = kAudioFormatFlagIsFloat;
asbd.mBytesPerPacket = m_channels * 64 / 8;
asbd.mBytesPerFrame = asbd.mBytesPerPacket;
asbd.mFramesPerPacket = 1;
asbd.mBitsPerChannel = 64;
asbd.mChannelsPerFrame = m_channels;
asbd.mReserved = 0;
采样率为176.4 kHz,并且正确设置了m_channels。这适用于2,4和6通道设置,所以我认为它没有错。我也尝试过使用32位有符号整数而不是64位浮点数,但结果是一样的。
我不确定我错过了什么。 Apple Lossless编解码器是否有可能不支持12通道编码?
答案 0 :(得分:1)
我不确定MacOSForge的规格是否确定,但根据http://alac.macosforge.org/trac/browser/trunk/ReadMe.txt
3. From one to eight channels are supported. Channel orders for the supported formats are described as:
Num Chan Order
1 mono
2 stereo (Left, Right)
3 MPEG 3.0 B (Center, Left, Right)
4 MPEG 4.0 B (Center, Left, Right, Center Surround)
5 MPEG 5.0 D (Center, Left, Right, Left Surround, Right Surround)
6 MPEG 5.1 D (Center, Left, Right, Left Surround, Right Surround, Low Frequency Effects)
7 Apple AAC 6.1 (Center, Left, Right, Left Surround, Right Surround, Center Surround, Low Frequency Effects)
8 MPEG 7.1 B (Center, Left Center, Right Center, Left, Right, Left Surround, Right Surround, Low Frequency Effects)