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

Recording audio

A notable feature on most iOS devices is the ability to record audio. In this recipe, we will use the microphone to record audio and save it to a temporary location on the disk using the AVAudioRecorder class. We will then play it back with a modified pitch using the CDSoundEngine class.

Recording audio

Getting ready

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

How to do it...

Link the CoreAudio and AVFoundation frameworks to your project. Now, execute the following code:

#import <AVFoundation/AVFoundation.h> #import <CoreAudio/CoreAudioTypes.h> #import "CocosDenshion.h" @interface Ch6_RecordingAudio : Recipe <AVAudioRecorderDelegate> ...

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