- 浏览: 323061 次
- 性别:
- 来自: 杭州
文章分类
最新评论
-
arlenliugj:
才发现这贴子好早
如何在Ubuntu下安装windows7 -
arlenliugj:
请问一下,这样安装上windows会不会把已经装好的linux ...
如何在Ubuntu下安装windows7 -
zhaomengbin:
写的很不错,可以写个文件给合并的方法么?,将分割后的几份文件还 ...
文件分割程序 -
junhe0723:
3Q,刚出现这个问题解决了。
jvm terminated exit code 1 -
Anddy:
shell 双击选中太不智能了。
XSHELL快捷键设置
Audio Session Programming Guide
- 博客分类:
- 苹果开发
Audio Session:自己开发的应用和IOS应用程序处理的中介,你的应用启动,会产生一个单例的Audio Session,通过配置它来处理你应用的用途。
audio session category:is a key that identifies a set of audio behaviors for your application.通过定义你category告知系统你的应用的意图,比如锁屏时候,是否需要继续播放音乐。有六个category,通过开关设置(YES OR NO)来控制你应用的行为。
audio session是在应用程序启动自动激活的。
audio session默认的行为:
播放功能启用和录音功能禁用。
当用户移动静音开关(iPhone上的响铃/静音开关)的“沉默”的位置,您的音频静音。
当用户按下“睡眠/唤醒“按钮,在屏幕锁定或自动锁定期限届满时,您的音频静音。
您的音频开始时,其他音频设备,如iPod的音频已经沉默。
以上这些行为被封装在AVAudioSessionCategorySoloAmbient类中,默认的category往往不是我们需要的。
默认的设置不适合的几种场景:
1:你听着音乐,过了一段时间,系统自动锁屏,音乐静音,这是需要设置category的AVAudioSessionCategoryPlayback。
2:确保iPod音乐是没有被中断,配置您的audio session允许混合。使用AVAudioSessionCategoryAmbient
3:写了一个视屏播放程序,当用户看视频看到一半的时候,突然来了一个电话,用户处理完成之后,点击播放按钮,就没有效果,必须得重头播放。这时候的处理就是写一个回调方法,继续刚才的视频。
Audio Session处理有两个API:
1:AVAudioSession类,用objective-c实现,使用这个API有两个优势,第一获取Audio Session的单例和C的API一样。第二你可以利用简单的委托方法处理音频中断和改变硬件配置,如采样率和信道数。你可以使用这些委托方法不管你使用音频技术为播放,录音,或处理。
2:Audio Session Services:是用C写的一个一个类,提供对所有的基本和高级特性的操作。
这两个API是互相兼容的,可以同时使用。
使用模拟器,以下几个方式是不行的:
1:调用中断
2:更改静音开关的设置
3:模拟屏幕锁定
4:模拟插上或拔下耳机
5:Query audio route information or test audio session category behavior
6:音频的混合测试(同时ipod和你的应用)
配置audio session:
初始化audio session:使用 AV Foundation framework来处理中断,苹果推荐使用隐士的初始化session,当你在处理AVAudioSession,AVAudioPlayer,AVAudioRecorder这些类的代理方法时候。
当然你也可以用C写一个回调函数来处理中断。
一般会在应用启动的时候初始化session,一般也在viewDidLoad中写初始化代码,系统在闹钟,电话,日历等提醒音时候会禁用session,然后处理完之后又开启。苹果建议使用AVAudioSessionDelegate的代理类来reactive(重新激活)session。
苹果的六个audio session category作用:
1:Three for playback
2:One for recording
3:One that supports playback and recording—that need not occur simultaneously
4:One for offline audio processing
以下是六个category:
1:AVAudioSessionCategoryAmbient(或者使用kAudioSessionCategory_AmbientSound)
2:AVAudioSessionCategorySoloAmbient(或者使用kAudioSessionCategory_SoloAmbientSound)
3:AVAudioSessionCategoryPlayback(或者使用kAudioSessionCategory_MediaPlayback)
4:AVAudioSessionCategoryRecord(或者使用kAudioSessionCategory_RecordAudio)
5:AVAudioSessionCategoryPlayAndRecord(或者使用kAudioSessionCategory_PlayAndRecord)
6:AVAudioSessionCategoryAudioProcessing(或者使用kAudioSessionCategory_AudioProcessing)
可以在viewdidiload方法中查看这些属性的值。
Audio Session Category最好在启动的时候设置,然后不要改变它。
Audio中断的处理方式:
1:使用AV Foundation framework里面定义的delegate方法处理
2:使用C语言的回调函数处理
What needs to happen during an audio session interruption
处理中断的技术:
1:AV Foundation framework的AVAudioPlayer和AVAudioRecorder类
2:Audio Queue Services, I/O audio unit
3:OpenAL
4:System Sound Services
An audio session gets interrupted
AVAudioSessionDelegate的两个方法来处理:beginInterruption和endInterruption
AVAudioRecorder和AVAudioPlayback的代理也提供
audioPlayerBeginInterruption、 audioPlayerEndInterruption、audioRecorderBeginInterruption、audioRecorderEndInterruption
使用c语言的回调来处理中断
An audio hardware route:是一个有线电子通道的音频信号,类似耳机拔插或者介入其他硬件设备
audio session API可以指定硬件的采样频率和I/O缓冲区。已到达优化的作用,设置属性AudioSessionSetProperty值kAudioSessionProperty_PreferredHardwareSampleRate和kAudioSessionProperty_PreferredHardwareIOBufferDuration,最好是在inactive状态就设置好了
可以查询硬件的特征,通过访问属性kAudioSessionProperty_-
CurrentHardwareSampleRate、kAudioSessionProperty_-
CurrentHardwareOutputVolume、kAudioSessionProperty_-
CurrentHardwareOutputLatency、kAudioSessionProperty_-
AudioInputAvailable,这些属性改变时候都会有事件,可以自定义callback函数处理
处理音乐和视频
ipod音乐:MPMusicPlayerController类,是系统默认的一个audio session
视频:MPMoviePlayerController类,是系统默认的一个audio session,但是要设置useApplicationAudioSession为NO。
它们都需要配置audio session
Configuring audio sessions when using a movie player
附件是sample code
audio session category:is a key that identifies a set of audio behaviors for your application.通过定义你category告知系统你的应用的意图,比如锁屏时候,是否需要继续播放音乐。有六个category,通过开关设置(YES OR NO)来控制你应用的行为。
audio session是在应用程序启动自动激活的。
audio session默认的行为:
播放功能启用和录音功能禁用。
当用户移动静音开关(iPhone上的响铃/静音开关)的“沉默”的位置,您的音频静音。
当用户按下“睡眠/唤醒“按钮,在屏幕锁定或自动锁定期限届满时,您的音频静音。
您的音频开始时,其他音频设备,如iPod的音频已经沉默。
以上这些行为被封装在AVAudioSessionCategorySoloAmbient类中,默认的category往往不是我们需要的。
默认的设置不适合的几种场景:
1:你听着音乐,过了一段时间,系统自动锁屏,音乐静音,这是需要设置category的AVAudioSessionCategoryPlayback。
2:确保iPod音乐是没有被中断,配置您的audio session允许混合。使用AVAudioSessionCategoryAmbient
3:写了一个视屏播放程序,当用户看视频看到一半的时候,突然来了一个电话,用户处理完成之后,点击播放按钮,就没有效果,必须得重头播放。这时候的处理就是写一个回调方法,继续刚才的视频。
Audio Session处理有两个API:
1:AVAudioSession类,用objective-c实现,使用这个API有两个优势,第一获取Audio Session的单例和C的API一样。第二你可以利用简单的委托方法处理音频中断和改变硬件配置,如采样率和信道数。你可以使用这些委托方法不管你使用音频技术为播放,录音,或处理。
2:Audio Session Services:是用C写的一个一个类,提供对所有的基本和高级特性的操作。
这两个API是互相兼容的,可以同时使用。
使用模拟器,以下几个方式是不行的:
1:调用中断
2:更改静音开关的设置
3:模拟屏幕锁定
4:模拟插上或拔下耳机
5:Query audio route information or test audio session category behavior
6:音频的混合测试(同时ipod和你的应用)
配置audio session:
初始化audio session:使用 AV Foundation framework来处理中断,苹果推荐使用隐士的初始化session,当你在处理AVAudioSession,AVAudioPlayer,AVAudioRecorder这些类的代理方法时候。
// implicitly initializes your audio session AVAudioSession *session = [AVAudioSession sharedInstance];
当然你也可以用C写一个回调函数来处理中断。
一般会在应用启动的时候初始化session,一般也在viewDidLoad中写初始化代码,系统在闹钟,电话,日历等提醒音时候会禁用session,然后处理完之后又开启。苹果建议使用AVAudioSessionDelegate的代理类来reactive(重新激活)session。
苹果的六个audio session category作用:
1:Three for playback
2:One for recording
3:One that supports playback and recording—that need not occur simultaneously
4:One for offline audio processing
以下是六个category:
1:AVAudioSessionCategoryAmbient(或者使用kAudioSessionCategory_AmbientSound)
2:AVAudioSessionCategorySoloAmbient(或者使用kAudioSessionCategory_SoloAmbientSound)
3:AVAudioSessionCategoryPlayback(或者使用kAudioSessionCategory_MediaPlayback)
4:AVAudioSessionCategoryRecord(或者使用kAudioSessionCategory_RecordAudio)
5:AVAudioSessionCategoryPlayAndRecord(或者使用kAudioSessionCategory_PlayAndRecord)
6:AVAudioSessionCategoryAudioProcessing(或者使用kAudioSessionCategory_AudioProcessing)
可以在viewdidiload方法中查看这些属性的值。
Audio Session Category最好在启动的时候设置,然后不要改变它。
Audio中断的处理方式:
1:使用AV Foundation framework里面定义的delegate方法处理
2:使用C语言的回调函数处理
What needs to happen during an audio session interruption
处理中断的技术:
1:AV Foundation framework的AVAudioPlayer和AVAudioRecorder类
2:Audio Queue Services, I/O audio unit
3:OpenAL
4:System Sound Services
An audio session gets interrupted
AVAudioSessionDelegate的两个方法来处理:beginInterruption和endInterruption
AVAudioRecorder和AVAudioPlayback的代理也提供
audioPlayerBeginInterruption、 audioPlayerEndInterruption、audioRecorderBeginInterruption、audioRecorderEndInterruption
使用c语言的回调来处理中断
//The interruption callback declaration typedef void (*AudioSessionInterruptionListener) ( void *inClientData, UInt32 inInterruptionState ); //两个inInterruptionState,kAudioSessionBeginInterruption和kAudioSessionEndInterruption
An audio hardware route:是一个有线电子通道的音频信号,类似耳机拔插或者介入其他硬件设备
void MyPropertyListener ( void *inClientData, AudioSessionPropertyID inID, UInt32 inDataSize, const void *inData );
audio session API可以指定硬件的采样频率和I/O缓冲区。已到达优化的作用,设置属性AudioSessionSetProperty值kAudioSessionProperty_PreferredHardwareSampleRate和kAudioSessionProperty_PreferredHardwareIOBufferDuration,最好是在inactive状态就设置好了
可以查询硬件的特征,通过访问属性kAudioSessionProperty_-
CurrentHardwareSampleRate、kAudioSessionProperty_-
CurrentHardwareOutputVolume、kAudioSessionProperty_-
CurrentHardwareOutputLatency、kAudioSessionProperty_-
AudioInputAvailable,这些属性改变时候都会有事件,可以自定义callback函数处理
处理音乐和视频
ipod音乐:MPMusicPlayerController类,是系统默认的一个audio session
视频:MPMoviePlayerController类,是系统默认的一个audio session,但是要设置useApplicationAudioSession为NO。
它们都需要配置audio session
Configuring audio sessions when using a movie player
附件是sample code
发表评论
-
URL System Programming Guide
2014-11-11 09:44 1180支持五种协议:ftp:// http:// ... -
Runtime programming guide
2014-10-26 01:23 1078objective-c有两个版本的ru ... -
OpenGL Programming Guide
2013-04-16 10:10 0XXXXXX -
Location Awareness Programming Guide
2013-04-14 12:19 0两个核心的framework: Cor ... -
Event programming guide
2013-04-09 19:02 2055Phone中处理触摸屏的操作,在3.2之前是主要使用的是由UI ... -
Instruments User Guide
2013-04-02 19:32 0打开Instruments方式: 1:Xcode > O ... -
CFNetwork Programming Guide
2013-04-01 20:40 4205CFNetwork封装了具体的网路实现,可以通过CFxxx等a ... -
bundle programing guide
2013-03-31 10:50 3353CF 意思是Core Foundation bundle在i ... -
Core Data Tutorial
2013-03-20 15:20 1451core data支持IOS 3以后的系统。 Core Dat ... -
ios 国际化
2013-03-19 16:25 0需要你本身的应用支持国际化,主要是project->in ... -
view controller program guide
2013-03-13 13:22 0navigation controller A view c ... -
ad hoc证书
2013-02-28 23:22 1600iOS证书分2种,1种是开发证书,用来给你(开发人员)做真机测 ... -
iOS App Programming Guide
2013-03-13 11:24 2626用户界面的选择: 1:堆积方式:sdk提供的控件,你一个一个往 ... -
使用vpn在mac
2013-02-25 19:25 0http://blog.sina.com.cn/s/blog_ ... -
为APNS制作和生成证书
2013-02-25 17:32 0首先制作一个证书申请文件(.csr)文件,然后创建一个appi ... -
安装苹果的ipa文件到iphone
2013-02-22 17:29 3270苹果的ipa文件安装方式有好多种,我介绍的是最常用的安装ipa ... -
About the Tools Workflow for iOS
2013-02-26 21:51 2102查看自己的开发角色是agent、admin、member。 只 ... -
基本概念
2013-02-21 22:27 0ios开发准备流程:http://hi.baidu.com/s ... -
About the iOS Technologies(关于 iOS 技术简介)
2013-02-21 14:30 940官方文档:https://developer.apple.co ... -
Doxygen for Xcode
2013-02-21 10:53 1824IOS Developer Library 中的article ...
相关推荐
Learning Core Audio A Hands on Guide to Audio Programming for Mac and iOS
Learning Core Audio A Hands-On Guide to Audio Programming for Mac and iOS.pdf iOS音视频开发必读书籍
Raspberry Pi GPU Audio Video Programming 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,...
Getting Started with C++ Audio Programming for Game Developers is a quick and practical introduction to the most important audio programming topics that any game developer is expected to know....
Raspberry Pi GPU Audio Video Programming
Beginning Game Audio Programming 游戏音频程序设计 游戏开发
Game Audio Programming Principles and Practices 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如...
Learning Core Audio A Hands-On Guide to Audio Programming for Mac and iOS 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn...
Audio DDK User Guide.chmAudio DDK User Guide.chmAudio DDK User Guide.chm
Part One - Audio Engine Basics Chapter 2 - Introduction to DirectAudio Chapter 3 - Wave Audio Playback Chapter 4 - Loading WAV Files Chapter 5 - Control Freak Chapter 6 - MIDI Playback ...
Beginning.Game.Audio.Programming电子书,英文版CHM格式
Raspberry Pi GPU Audio Video Programming scratches his itch and since he had to learn a lot about RPi GPU programming, he might as well share it with you. What started as a side issue turned into a ...
The following sections provide a guide on how to program the USB audio software platform including instructions for building and running programs and creating your own custom USB audio applications.
Hack Audio:An Introduction to Computer Programming and Digital Signal Processing in Matlab 2019 Hack Audio:An Introduction to Computer Programming and DSP in Matlab.part1.rar (15 MB, 下载次数: 237...
Audio and Video Support 46 Integration with the Hardware and System Applications 46 Chapter 3 Implementing Common Application Behaviors 49 Preserving the State of Your Application’s User Interface 49...
无论游戏有多么扣人心弦,无论可视化效果有多么逼真,如果缺少了背景音效,自然会显得美中不足。现在,技术上的新发展使你能够在声音方面做一些以前无法完成的事情,但是这也需要有一个向导来带你走过技术上的困难。...
New Realities in Audio_A Practical Guide for VR New Realities in Audio_A Practical Guide for VR
PSKEY_USR_ CSR的官方文档,主要是介绍...This document is intended to be used in conjunction with the Audio Sink Application User Guide and the Audio Sink Application Configuration User Guide documents.