2

我想从麦克风录制音频,并且我需要音频采用特定格式。这是我要运行的代码:

AudioStreamBasicDescription asbd;
memset(&asbd, 0, sizeof(asbd));
asbd.mBitsPerChannel   = 16;
asbd.mBytesPerFrame    = 2;
asbd.mBytesPerPacket   = 2;
asbd.mChannelsPerFrame = 1;
asbd.mFormatFlags      = kLinearPCMFormatFlagIsBigEndian | kLinearPCMFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsPacked;
asbd.mFormatID         = kAudioFormatLinearPCM;
asbd.mFramesPerPacket  = 1;
asbd.mSampleRate       = 8000;
self.microphone = [EZMicrophone microphoneWithDelegate:self];
[self.microphone setAudioStreamBasicDescription:asbd];

但是应用程序崩溃了。这是屏幕截图。如何解决? 在此处输入图像描述

4

0 回答 0