Audio questions

Discussion in 'iPhone/iPad Programming' started by fernandovalente, Jul 27, 2010.

  1. macrumors 6502

    fernandovalente

    Joined:
    Aug 29, 2008
    Location:
    Third world **** hole, I mean, Brazil
    #1
    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);
     

Share This Page