1 / 16

Audio

Yu Feng CGDD 4903. Audio. Review. 1. Set up 2. IOS sound Core Audio Short Sound Long Sound Control Sound Background Sound 3.Cocos2d sound. Set up. Core Audio. High level System Sound API– short sounds AVAudioPlayer (AVFoundation)– Long sounds Lower level

kennan
Télécharger la présentation

Audio

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Yu Feng CGDD 4903 Audio

  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: • Add header -- “SimpleAudioEngine.h” and “CocosDenshion.h” • Add sound file into support file • 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

More Related