Domanda

The following code:

ExtAudioFileRef *file = nil;
NSURL *path = [[NSBundle mainBundle] URLForResource:@"beep" withExtension:@"wav"];
OSErr errorCode = ExtAudioFileOpenURL((__bridge CFURLRef)path, file);

leaves file null and errorCode is -50 ("error in user parameter list"). If file is not initialized to nil, like so:

ExtAudioFileRef *file;

I get a EXC_BAD_ACCESS (code=2, address={garbage value of file}).

How am I supposed to do this? I know the path is correct, because it works for playing the sound elsewhere in the application.

È stato utile?

Soluzione

Check with this:

ExtAudioFileRef file = NULL;
NSURL *path = [[NSBundle mainBundle] URLForResource:@"beep" withExtension:@"wav"];
OSErr errorCode = ExtAudioFileOpenURL((__bridge CFURLRef)path, &file);
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top