O'Reilly logo

Cocos2d for iPhone 1 Game Development Cookbook by Nathan Burba

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Metering dialogue for animation

A LongAudioSource object can be any kind of audio, not just music. In this recipe, we will use the metering technique to animate the mouth of the gregarious Senator Beauregard Claghorn.

Metering dialogue for animation

Getting ready

Please refer to the project RecipeCollection02 for full working code of this recipe.

How to do it...

Execute the following code:

#import "SimpleAudioEngine.h" @implementation Ch6_MeteringDialogue -(CCLayer*) runRecipe { /* CODE OMITTED */ //Add the sounds [self loadLongAudioSource:@"claghorn_a_joke_son.caf"]; [self loadLongAudioSource:@"claghorn_carolina.caf"]; /* CODE OMITTED */ //Add the background music [self loadBackgroundMusic:@"dixie_1916.mp3"]; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required