Online Book Reader

Home Category

iPhone Game Development - Chris Craft [51]

By Root 1635 0
actual Clock application running on your device, similar to Figure 4.11. This is a great effect, and from the user's point of the view, the iPhone seems to be opening most applications almost instantly.

The native audio format that Apple uses for sounds on the iPhone is the CAF audio format. You can convert your existing MP3, WAV, AAC, AIFF, and other audio files to the CAF format using iTunes.

FIGURE 4.10

The iPhone Clock application's Default.png


FIGURE 4.11

The iPhone Clock application


To convert to CAF, follow these steps:

1. Set your Import Settings in iTunes to Import Using: AIFF Encoder. Open iTunes Preferences and choose Under General Settings⇒When you insert a CD: click the Import Settings button.

2. Convert the audio file you want to AIFF. Select the song in iTunes, and choose⇒Advanced⇒Create AIFF version.

3. Rename the audio file to CAF. Drag the newly created song to your desktop and rename the AIFF extension to CAF.

A large part of effectively using the iPhone SDK is learning about all the frameworks that are available for you to take advantage of. Instead of you having to create something from scratch, in many cases these frameworks can do the work for you. The following device framework listing summarizes all the device frameworks that are available:

AddressBook.framework. Contains functions for accessing the user's contacts database directly.

AddressBookUI.framework. Contains classes for displaying the system-defined people picker and editor interfaces.

AudioToolbox.framework. Contains the interfaces for handling audio stream data and for playing and recording audio.

AudioUnit.framework. Contains the interfaces for loading and using audio units.

CFNetwork.framework. Contains interfaces for accessing the network via the Wi-Fi and cellular radios.

CoreAudio.framework. Provides the data types used throughout Core Audio.

CoreFoundation.framework. Provides fundamental software services, including abstractions for common data types, string utilities, collection utilities, resource management, and preferences.

CoreGraphics.framework. Contains the interfaces for Quartz 2-D.

CoreLocation.framework. Contains the interfaces for determining the user's location.

Foundation.framework. Contains the classes and methods for the Cocoa Foundation layer.

CoreLocation.framework. Contains the interfaces for determining the user's location.

IOKit.framework. Contains interfaces used by the device. Do not include this framework directly.

MediaPlayer.framework. Contains interfaces for playing full-screen video.

OpenAL.framework. Contains the interfaces for OpenAL, a cross-platform positional audio library.

OpenGLES.framework. Contains the interfaces for OpenGL ES, an embedded version of the OpenGL cross-platform 2-D and 3-D graphics-rendering library.

QuartzCore.framework. Contains the Core Animation interfaces.

Security.framework. Contains interfaces for managing certificates, public and private keys, and trust policies.

SystemConfiguration.framework. Contains interfaces for determining the network configuration of a device.

UIKit.framework. Contains classes and methods for the iPhone application user-interface layer.

iDrum is a good example of an application that uses many existing frameworks to do the work for it. You will need to add the following frameworks to your iDrum project:

AudioToolbox

CoreAudio

OpenAL

Foundation

The Frameworks folder can be found under the iDrum project in the Groups & Files panel of Xcode. Right-click on the folder to locate the Existing Frameworks menu item, which is found under the Add menu. Click the Existing Frameworks menu item, and then open the selected Frameworks folder. The full location for these frameworks is Developer⇒Platforms⇒iPhoneOS.platform⇒Developer⇒SDKs⇒iPhoneOS3.0.sdk⇒System⇒Library⇒Frameworks.

With the Frameworks folder open, you can begin adding the required frameworks. You'll need to add these one at a time since Xcode does not support multiple selections in this dialog box. After you

Return Main Page Previous Page Next Page

®Online Book Reader