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

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

问题描述

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];

听说我使用拖曳框架来播放声音.1.MediaPlayer.framework2. AudioToolbox.framework

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

我在加载游戏后成功播放了带有重复的背景声音.我还想在单击某些按钮操作后播放声音而不停止以前的背景声音.但是当我单击另一个按钮时,时间背景声音停止并在我提到重复声音时间线的时间间隔(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

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

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