资源描述:
《斯坦福大学iphone开发教程之音频视频api》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、CS193P-Lecture16iPhoneApplicationDevelopmentAudioAPIsVideoPlaybackDisplayingWebContentSettingsAnnouncements•Finalprojectsduein11days■Sunday,June7,11:59pm■Submit:■Code■Power-pointslides■ReadMefile•Finalprojectdemos■June8,from12:15-3:15pm■2minutepresentation,follow
2、edbydemo-fair■Rapid-fire!!■Timelimitstrictlyenforced■AppsoptionallymadeavailabletoyourclassmatesAnnouncements•AdWhirloutsideafterclass■FreeJambaJuice!■Findouthowtoaddadvertisingintoyourapp•MeetEddie&James■CS193palumni■AuthorsofAirGuitar&ShotgunFreeToday’sTopics•A
3、udioAPIs•VideoPlayback•UIWebView•SettingsBundlesAudioUsesforAudio•Soundeffects■buttonclicks■alertsounds■shortsoundsaccompanyinguseractions•Arbitrarylengthsounds(music,podcasts,spokencontent)•Streamedcontentfromwebservices•RecordingaudioHowtodoit?•Couldbecomplex:■
4、Potentiallymultiplesimultaneoussources■Numerouspossibleoutputs■Dynamicevents,oftenoutofuser’scontrol■Differentprioritiesforseeminglysimilaractions•TheOSmanagesthesoundsystem■Youcanaskforbehavior,buttheOShascontrolCoreAudio•Highlevel,easytouse■SystemSoundAPI-short
5、sounds■AVAudioPlayerclass-ObjC,simpleAPI•Lowerlevel,takesmoreeffortbutmuchmorecontrol■AudioToolbox-recordingandplayback,streaming,fullcontrol■AudioUnits-processingaudio■OpenAL-3Dpositionalsound•Whichoneyouusedependsonwhatyou’retryingtodo■ManyofyouarefinewithSyste
6、mSoundsandAVAudioPlayerPlayingShortSounds•“short”meanslessthan5seconds•VerysimpleAPI,buthasrestrictions■Nolooping■Novolumecontrol■Immediateplayback■Limitedsetofformats■LinearPCMorIMA4■.caf,.aifor.wavfilePlayingShortSounds•Twostepprocess■Registerthesound,geta“soun
7、dID”inreturn■Playthesound■OptionallycangetcallbackwhensoundfinishesplayingNSURL*fileURL=...//urltoafileSystemSoundIDmyID;//FirstregisterthesoundAudioServicesCreateSystemSoundID((CFURLRef)fileURL,&myID);//ThenyoucanplaythesoundAudioServicesPlaySystemSound(myID);Pl
8、ayingShortSounds•Cleanup■DisposeofsoundIDwhenyou’redone■OrifyougetamemorywarningSystemSoundIDmyID;//disposeofthepreviouslyregisteredsoundAudioServicesDisposeSy