I’m having some trouble encoding certain configurations of multi-channel Apple Lossless files. I have no problems with 2, 4 and 6 channel configurations, however I’m running into trouble generating a 12-channel file.
Using the ExtAudioFile APIs, I’m able to create the audio file with a 12-channel AudioStreamBasicDescription and a 12-channel FileChannelLayout. When it comes to setting the 12-channel ClientDataFormat (done before setting the client layout, which, obviously also fails), I get the “fmt?" error code.
My AudioStreamBasicDescription for the ClientDataFormat is generated as follows:
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;
The sample rate is 176.4 kHz and m_channels is correctly set. This has worked properly for 2, 4 and 6 channel setups, so I don’t think it is at fault. I’ve also tried using 32-bit signed integers instead of 64-bit floats, but the result is the same.
I’m not sure what I’m missing. Is it possible the Apple Lossless codec doesn’t support 12-channel encodings?