在我的iPhone应用程序使用多于一个声音使用Cocos2d [英] Use more then one sound in my iPhone application using Cocos2d

查看:101
本文介绍了在我的iPhone应用程序使用多于一个声音使用Cocos2d的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

avc = [[MPAVController sharedInstance] avController];
//avc is AVController
NSString *path = [[NSBundle mainBundle] pathForResource:@"Sound" ofType:@"wav"];
id feeder = [[MPArrayQueueFeeder alloc] initWithPaths:[NSArray arrayWithObject:path]];
        [avc setQueueFeeder:feeder];
        [avc play:nil];

        [feeder release];
NSTimer *sound = [NSTimer scheduledTimerWithTimeInterval:(9.0) target:self selector:@selector(Gamesoundplay) userInfo:nil repeats:YES];

听到我使用tow框架播放声音。
1. MediaPlayer.framework
2. AudioToolbox.framework

Hear i use tow framework for playing sound. 1. MediaPlayer.framework 2. AudioToolbox.framework

我成功地在加载游戏后重复播放背景声音。我也想播放声音后点击一些按钮动作,而不停止以前的背景声音。但是当我点击另一个按钮,时间背景声音停止,并重新开始后,时间intereval(9.0秒),我提到重复的声音时间线。

I success to play the background sound with repeat after loading the game. I also want to play sound after clicking some button action without stop the previous background sound. But when I click the other button that time background sound is stop and start again after time intereval ( 9.0 sec ) which I mention for repeated the sound time line.

做这项工作然后帮助我完成我的申请。

If anyone do this work then help me to complete my application.

推荐答案

开源游戏引擎Cocos2d iPhone有一个名为Cocos Denshion的库,包含了播放背景音效iPhone。

The open source game engine Cocos2d iPhone has a library called "Cocos Denshion" that wraps up playing background sound and effect sounds on the iPhone.

在此处获取cocos(包含Denishon):

Get cocos (with Denishon in it) here:

http://www.cocos2d-iphone.org/download

并检查这里为如何使用Cocos Denishon:

And check here for how to use Cocos Denishon:

http://www.cocos2d-iphone.org/wiki/doku.php/cocosdenshion:cookbook

这篇关于在我的iPhone应用程序使用多于一个声音使用Cocos2d的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆