我想从麦克风录制音频,我需要音频采用特定格式。这是我试图运行的代码:
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];
但是应用程序崩溃。这是屏幕截图。如何解决?