iDevGames Forums
Buggy OpenAL Code - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: iPhone, iPad & iPod Game Development (/forum-11.html)
+--- Thread: Buggy OpenAL Code (/thread-8000.html)



Buggy OpenAL Code - m15399 - Aug 17, 2010 05:11 PM

I get EXC_BAD_ACCESS every time this runs.
Code:
-(AudioFileID)openAudioFile:(NSString*)filePath
{
    AudioFileID outAFID;
    
    NSURL * afUrl = [NSURL fileURLWithPath:filePath];
    
    OSStatus result = AudioFileOpenURL((CFURLRef)afUrl, kAudioFileReadPermission, kAudioFileCAFType, &outAFID);
    if (result != 0) NSLog(@"cannot openf file: %@",filePath);
    
    return outAFID;
}
It goes fine until it hits the return. For some reason outAFID is... broken? I've tested the code several times and I'm sure that the return statement is where is breaks. Any idea why?


RE: Buggy OpenAL Code - Skorche - Aug 18, 2010 06:36 AM

Make sure you are compiling in debug mode or the line numbers given to you by the debugger probably won't make a lot of sense.


RE: Buggy OpenAL Code - m15399 - Aug 19, 2010 01:45 PM

If I put NSLogs in between every line in that function they print fine, but any after the function is called don't work. Is there anything wrong with the code i posted or is there some other problem in my program?