Delay in playing a beep sound

Posted by iSharreth on Stack Overflow See other posts from Stack Overflow or by iSharreth
Published on 2010-03-31T04:22:08Z Indexed on 2010/03/31 4:33 UTC
Read the original article Hit count: 467

-(IBAction)playSound{ AVAudioPlayer *myExampleSound;

NSString *myExamplePath = [[NSBundle mainBundle] pathForResource:@"myaudiofile" ofType:@"caf"];

myExampleSound =[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:myExamplePath] error:NULL];

myExampleSound.delegate = self;

[myExampleSound play];

}

I want to play a beep sound when a button is clicked. I had used the above code. But it is taking some delay in playing the sound.

Anyone please help.

© Stack Overflow or respective owner

Related posts about iphone-sdk

Related posts about iphone