views:

7

answers:

0

I used this code for play .wav file. yes! it OK when I open file name open.wav but! with other file I can't play pleas help me.

//[self playASound:@"open.wav"];

[self playASound:@"kang.wav"];

AudioServicesAddSystemSoundCompletion(soundID, NULL, NULL, endSound, NULL);

//**

-(void) playASound: (NSString *) file {

NSString *path = [NSString stringWithFormat:@"%@/%@",[[NSBundle mainBundle]resourcePath],file];

NSURL *filePath = [NSURL fileURLWithPath:path isDirectory:NO];

AudioServicesCreateSystemSoundID((CFURLRef)filePath, &soundID);

AudioServicesPlaySystemSound(soundID);

}