Buggy OpenAL Code

Nibbie
Posts: 2
Joined: 2008.04
Post: #1
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?
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #2
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.

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Quote this message in a reply
Nibbie
Posts: 2
Joined: 2008.04
Post: #3
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?
Quote this message in a reply
Post Reply