使用 Cocos2d 在我的 iPhone 应用程序中使用多个声音我的、多个、应用程序、声音

2023-09-07 08:48:15 作者:絮恋

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