开发者

make a button play sound without lag

Im making a button play sound, like开发者_Python百科 a button sound effect for example in jely car 3 when you press like a new game button it would have a sound effect like "boop." I have done that but there is heaps of lag on the ios simulator which means there will be more on the iphone HELP TKS!


Inside ViewDidLoad

AVAudioPlayer *pp1 = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"bomb" ofType:@"wav"]] error:nil];
    self.playerBG = pp1;
    [pp1 prepareToPlay];
      [pp1 release];

use the below code to play sound where you want

[playerBG play];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜