PDA

View Full Version : ExtAudioFileOpenURL gives bad access..???




SameeraB
Dec 21, 2008, 10:40 PM
Hello All,

I have to convert an audio file from one from to another in iPhone. I found that we have afconvert in apple developer's example. I tried to use it in my iPhone App. I created a sample application having the files that afconvert uses in /Developer/Example/CoreAudio/Serives/AudioFileTools. But it gives me exec-bad-access when i execute the ExtAudioFileOpenURL api.

I have my input file names "test.mp3" in app's document folder.

Following is the code snippet..

NSArray * arr = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask,
YES
);
NSString *str = [arr objectAtIndex:0];
NSString *str1 = [NSString stringWithFormat:@"%@/test.mp3", str];
//NSLog(@"%@", str1);

ExtAudioFileRef file = NULL;
CFURLRef url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, (CFStringRef)str1, kCFURLPOSIXPathStyle, FALSE);
ExtAudioFileOpenURL(url, &file);

//release the allocated resource


I received "EXC_BAD_ACCESS" in ExtAudioFileOpenURL... :(

Can anybody please help me.. Please..
Thanks in an advance.

sameera



kainjow
Dec 22, 2008, 02:05 AM
Make sure 'url' is actually a valid object. It might be null.

SameeraB
Dec 22, 2008, 02:10 AM
hi,

I have checked it.. it is the proper "url".. :(
Anything else I need to look into.. I'm sure i must be missing something..


thanks for the help in an advance

SameeraB
Dec 22, 2008, 05:37 AM
I have ensured validity of url by using this url with the AudioFileOpenUrl api.
It works fine.

SameeraB
Dec 22, 2008, 09:24 PM
can anyone please help me? pls..