| 51 | | // Preserve mSampleRate and mChannelsPerFrame |
| 52 | | _pcmFormat.mBitsPerChannel = (0 == _pcmFormat.mBitsPerChannel ? 16 : _pcmFormat.mBitsPerChannel); |
| | 51 | // For alac the source bit depth is encoded in the format flag |
| | 52 | if(kAudioFormatAppleLossless == _sourceFormat.mFormatID) { |
| | 53 | switch (_sourceFormat.mFormatFlags) { |
| | 54 | case kAppleLosslessFormatFlag_16BitSourceData: |
| | 55 | _pcmFormat.mBitsPerChannel = 16; |
| | 56 | break; |
| | 57 | // case kAppleLosslessFormatFlag_20BitSourceData: |
| | 58 | // _pcmFormat.mBitsPerChannel = 20; |
| | 59 | // break; |
| | 60 | case kAppleLosslessFormatFlag_24BitSourceData: |
| | 61 | _pcmFormat.mBitsPerChannel = 24; |
| | 62 | break; |
| | 63 | case kAppleLosslessFormatFlag_32BitSourceData: |
| | 64 | _pcmFormat.mBitsPerChannel = 32; |
| | 65 | break; |
| | 66 | |
| | 67 | // FIXME: How to handle 20-bit files? |
| | 68 | default: |
| | 69 | _pcmFormat.mBitsPerChannel = 16; |
| | 70 | break; |
| | 71 | } |
| | 72 | } |
| | 73 | else |
| | 74 | // Preserve mSampleRate and mChannelsPerFrame |
| | 75 | _pcmFormat.mBitsPerChannel = (0 == _pcmFormat.mBitsPerChannel ? 16 : _pcmFormat.mBitsPerChannel); |