Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

fernandovalente

macrumors 6502
Original poster
May UIVideoEditorController be used to edit audio?

I would like to record audio from my app. I'm trying to use ExtAudioFile in order to do that. I keep getting the error 1718449215 when setting the kExtAudioFileProperty_ClientDataFormat property.

Code:
AudioStreamBasicDescription desc;
	desc.mSampleRate = 44100;
	desc.mFormatID = kAudioFormatMPEGLayer3;
	desc.mFormatFlags = 0;
	desc.mBytesPerPacket = 4;
	desc.mFramesPerPacket = 1;
	desc.mBytesPerFrame = 2;
	desc.mChannelsPerFrame = 1;
	desc.mBitsPerChannel = 16;
	ExtAudioFileRef ref = NULL;
	NSLog(@"variables");
	OSStatus createFile = ExtAudioFileCreateWithURL(url, kAudioFileMP3Type, &desc, NULL, kAudioFileFlags_EraseFile, &ref);
	NSLog(@"%d", createFile);
	
	ExtAudioFileRef xaref = nil;
	ExtAudioFileOpenURL(url, &xaref);
	CAStreamBasicDescription clientFormat;
	
	clientFormat.mFormatID = kAudioFormatLinearPCM;
	clientFormat.mSampleRate = 44100;
	clientFormat.mChannelsPerFrame = 1;
	clientFormat.SetCanonical(1, true);
	UInt32 propSize = sizeof(clientFormat);
	createFile = ExtAudioFileSetProperty(ref, kExtAudioFileProperty_ClientDataFormat, propSize, &clientFormat);
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.