嗨,我一直在尝试从下面的代码创建一个 wav 音频文件,但不断收到错误 Creating file ('fmt?')。有谁可以帮我离开这里吗 ?谢谢。
我的日志: *2012-11-01 13:33:14.183 Novocaine iOS Example[7456:c07] URL: file://localhost/Users/pier/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/01EBF2C0- 2C3A-490D-835E-9C39A3E88E0B/Documents/testrecording.wav
错误:创建文件 ('fmt?')*
- (id)initWithAudioFileURL:(NSURL *)urlToAudioFile samplingRate:(float)thisSamplingRate numChannels:(UInt32)thisNumChannels
{
self = [super init];
if (self)
{
// Zero-out our timer, so we know we're not using our callback yet
self.callbackTimer = nil;
// Open a reference to the audio file
self.audioFileURL = urlToAudioFile;
CFURLRef audioFileRef = (CFURLRef)self.audioFileURL;
AudioStreamBasicDescription outputFileDesc;
// Set a few defaults and presets
self.samplingRate = thisSamplingRate;
self.numChannels = thisNumChannels;
self.currentTime = 0.0;
self.latency = .011609977; // 512 samples / ( 44100 samples / sec ) default
outputFileDesc.mSampleRate = self.samplingRate;
outputFileDesc.mFormatID = kAudioFormatLinearPCM;
outputFileDesc.mFormatFlags = kAudioFormatFlagIsFloat;
outputFileDesc.mBytesPerPacket = 4*self.numChannels;
outputFileDesc.mFramesPerPacket = 1;
outputFileDesc.mBytesPerFrame = 4*self.numChannels;
outputFileDesc.mChannelsPerFrame = self.numChannels;
outputFileDesc.mBitsPerChannel = 32;
CheckError(ExtAudioFileCreateWithURL(audioFileRef, kAudioFileWAVEType, &outputFileDesc, NULL, kAudioFileFlags_EraseFile, &_outputFile), "Creating file");
. . .