PDA

View Full Version : Audio questions




fernandovalente
Jul 27, 2010, 03:42 AM
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.

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);