我正在通过AVAssets加载音频 Assets 。我想弄清楚 Assets 中有多少个 channel (基本上是单声道或立体声)。做这个的最好方式是什么?
最佳答案
这似乎是我要寻找的。
AVAssetTrack* songTrack = [mAssetToLoad.tracks objectAtIndex:0];
NSArray* formatDesc = songTrack.formatDescriptions;
for(unsigned int i = 0; i < [formatDesc count]; ++i) {
CMAudioFormatDescriptionRef item = (CMAudioFormatDescriptionRef)[formatDesc objectAtIndex:i];
const AudioStreamBasicDescription* bobTheDesc = CMAudioFormatDescriptionGetStreamBasicDescription (item);
if(bobTheDesc && bobTheDesc->mChannelsPerFrame == 1) {
mIsMono = true;
}
}
关于iphone - 从AVAsset查找 channel 数,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/6930862/