16-AudioVideoWeb

16-AudioVideoWeb - CS193P - Lecture 16 iPhone Application...

Info iconThis preview shows pages 1–14. Sign up to view the full content.

View Full Document Right Arrow Icon
CS193P - Lecture 16 iPhone Application Development Audio APIs Video Playback Displaying Web Content Settings
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Announcements Final projects due in 11 days Sunday, June 7, 11:59 pm Submit: Code Power-point slides ReadMe file Final project demos June 8, from 12:15 - 3:15 pm 2 minute presentation, followed by demo-fair Rapid-fire!! Time limit strictly enforced Apps optionally made available to your classmates
Background image of page 2
Announcements AdWhirl outside after class Free Jamba Juice! Find out how to add advertising into your app CS193p alumni Authors of Air Guitar & Shotgun Free
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Audio APIs Video Playback UIWebView Settings Bundles Today’s Topics
Background image of page 4
Audio
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Uses for Audio Sound effects button clicks alert sounds short sounds accompanying user actions Arbitrary length sounds (music, podcasts, spoken content) Streamed content from web services Recording audio
Background image of page 6
How to do it? Could be complex: Potentially multiple simultaneous sources Numerous possible outputs Dynamic events, often out of user’s control Different priorities for seemingly similar actions The OS manages the sound system You can ask for behavior, but the OS has control
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CoreAudio High level, easy to use System Sound API - short sounds AVAudioPlayer class - ObjC, simple API Lower level, takes more effort but much more control Audio Toolbox - recording and playback, streaming, full control Audio Units - processing audio OpenAL - 3D positional sound Which one you use depends on what you’re trying to do Many of you are fine with System Sounds and AVAudioPlayer
Background image of page 8
Playing Short Sounds “short” means less than 5 seconds Very simple API, but has restrictions No looping No volume control Immediate playback Limited set of formats Linear PCM or IMA4 .caf, .aif or .wav file
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Playing Short Sounds Two step process Register the sound, get a “sound ID” in return Play the sound Optionally can get callback when sound finishes playing NSURL *fileURL = . .. // url to a file SystemSoundID myID; // First register the sound AudioServicesCreateSystemSoundID ((CFURLRef)fileURL, &myID); // Then you can play the sound AudioServicesPlaySystemSound (myID);
Background image of page 10
Playing Short Sounds Clean up Dispose of sound ID when you’re done Or if you get a memory warning SystemSoundID myID; // dispose of the previously registered sound AudioServicesDisposeSystemSoundID (myID);
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Feel the vibration System sound API allows for triggering the phone’s vibration Use the special system sound ID kSystemSoundID_Vibrate Does nothing on iPod touch - (void)vibrate { // trigger the phone’s vibration AudioServicesPlaySystemSound ( kSystemSoundID_Vibrate ); }
Background image of page 12
Command line utility to convert sounds /usr/bin/afconvert Supports wide variety of input and output formats See man page for details
Background image of page 13

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 14
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/29/2009 for the course CS 193D taught by Professor Staff during the Spring '08 term at Stanford.

Page1 / 53

16-AudioVideoWeb - CS193P - Lecture 16 iPhone Application...

This preview shows document pages 1 - 14. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online