tags:

views:

1857

answers:

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

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

I success to play the background sound with repeat after lodding 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.

A: 

I would strongly recommend taking a look at SoundEngine.cpp in the Crash Landing example. It is a complete sound engine that supports background sounds, as well as multiple sound effects all using OpenAL. The are a few memory leaks with it, and it does not compile for GCC 4.2 without some tweaking, but you should be able to fix them in a couple of hours.

slf
A: 

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

Get cocos (with Denishon in it) here:

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

And check here for how to use Cocos Denishon:

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

Brad Parks