Download presentation
Presentation is loading. Please wait.
Published byBarbara Armstrong Modified over 9 years ago
1
Audio Yu Feng CGDD 4903
2
Review 1. Set up 2. IOS sound – Core Audio – Short Sound – Long Sound – Control Sound – Background Sound 3.Cocos2d sound
3
Set up
4
Core Audio High level System Sound API– short sounds AVAudioPlayer (AVFoundation)– Long sounds Lower level Audio Toolbox – recording and playback, streaming, full control Audio Units – processing audio OpenAL – 3D positional sound
5
Short Sounds Less than 5 seconds No looping No volume control Immediate playback Limited set of formats (wav)
6
Short Sound Code Two process: 1. register the sound and get a ID 2. play the sound Using AduioToolkit
7
Long Sound Play longer sounds (> 5 seconds) Locally stored files or in-memory Can loop, seek, play, pause Provides metering Play multiple sounds simultaneously Supports many more formats
8
Long Sound Code [player play];
9
Simple Ways to Control Audio 1. Move Forward and Backward –Use Button –Use Slider
10
2.Change Volume
11
3.Play, Pause and Reset
12
4.Interruption
13
Background Music
14
Add Audio in Cocos2d Audio Library: CocosDenshion Three ways to import audio: SimpleAudioEngine CDSoundEngine CDAudioManager
15
SimpleAudioEngine How it works: 1.Add header -- “SimpleAudioEngine.h” and “CocosDenshion.h” 2.Add sound file into support file 3.Code:
16
Different method playEffect: play a sound, play once handle sound effect: stopEffect playEffect preloadEffect unloadEffect playBackgroundMusic: user can set loop times (.numberOfLoops=2) handle background music: pauseBackgroundMusic resumeBackgroundMusic rewindBackgroundMusic preloadBackgroundMusic
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.