При попытке написать аудиофайл PCM с помощью ExtAudioFileCreateWithURL, я получаю сообщение «fmt?». эээ при использовании 2-канальный звук формата (Mac OS X, SDK 10,10)Создает ли AVAudioFormat initStandardFormatWithSampleRate неверное описание потока?
Я создаю аудиоформат с
[[AVAudioFormat alloc] initStandardFormatWithSampleRate:sampleRate channels:channelCount]
, а также использовать его в качестве аудио формата для AUGraph в моем приложении.
AUGraph отлично работает с форматами 1ch и 2ch, но при попытке записи аудиофайла с ExtAudioFileCreateWithURL он работает только с 1ch, 2ch в формате fmt? ошибка.
При выполнении следующего теста ...
AVAudioFormat* ch1 = [[AVAudioFormat alloc] initStandardFormatWithSampleRate:44100. channels:1];
AVAudioFormat* ch2 = [[AVAudioFormat alloc] initStandardFormatWithSampleRate:44100. channels:2];
NSLog(@"ch1: %@", [ch1 description]);
NSLog(@"ch1 mBitsPerChannel: %d", ch1.streamDescription->mBitsPerChannel);
NSLog(@"ch1 mChannelsPerFrame: %d", ch1.streamDescription->mChannelsPerFrame);
NSLog(@"ch1 mBytesPerFrame: %d", ch1.streamDescription->mBytesPerFrame);
NSLog(@"ch1 mBytesPerPacket: %d", ch1.streamDescription->mBytesPerPacket);
NSLog(@"ch1 mFramesPerPacket: %d", ch1.streamDescription->mFramesPerPacket);
NSLog(@"ch2: %@", [ch2 description]);
NSLog(@"ch2 mBitsPerChannel: %d", ch2.streamDescription->mBitsPerChannel);
NSLog(@"ch2 mChannelsPerFrame: %d", ch2.streamDescription->mChannelsPerFrame);
NSLog(@"ch2 mBytesPerFrame: %d", ch2.streamDescription->mBytesPerFrame);
NSLog(@"ch2 mBytesPerPacket: %d", ch2.streamDescription->mBytesPerPacket);
NSLog(@"ch2 mFramesPerPacket: %d", ch2.streamDescription->mFramesPerPacket);
... это выход в консоли:
ch1: <AVAudioFormat 0x600000084560: 1 ch, 44100 Hz, Float32>
ch1 mBitsPerChannel: 32
ch1 mChannelsPerFrame: 1
ch1 mBytesPerFrame: 4
ch1 mBytesPerPacket: 4
ch1 mFramesPerPacket: 1
ch2: <AVAudioFormat 0x6000000845b0: 2 ch, 44100 Hz, Float32, non-inter>
ch2 mBitsPerChannel: 32
ch2 mChannelsPerFrame: 2
ch2 mBytesPerFrame: 4
ch2 mBytesPerPacket: 4
ch2 mFramesPerPacket: 1
Не должно ли быть разница в полях mBytesPerFrame и mBytesPerPacket ? Или я что-то пропустил?