文档章节

iOS 播放系统声音&系统声音大全

大番薯
 大番薯
发布于 2016/03/26 15:10
字数 1029
阅读 24
收藏 0

在app开发中使用系统音效有震动,声音类。

设置方法如下

步骤1 添加所需库文件,即“AudioToolbox.framework

步骤2 在使用类中添加头文件,即“#import <AudioToolbox/AudioToolbox.h>

步骤3 使用

3-0 定义

SystemSoundID soundID;

3-1 震动 

soundID = kSystemSoundID_Vibrate;

AudioServicesPlaySystemSound(soundID)

3-2 系统声音播放

soundID = 1000;

AudioServicesPlaySystemSound(soundID)

3-3 系统声音停止

AudioServicesRemoveSystemSoundCompletion(soundID);


其中audioID就是你需要打开系统声音的id号:附上系统对应提示音对照表:

There are some predefined system sounds, for the system sound ID in the range 1000 to 2000 (decimal), as shown below (from 2.0 to 5.0 beta). The system sounds are all stored in/System/Library/Audio/UISounds/.


Sound ID File name (iPhone) File name (iPod Touch) Category Note
1000 new-mail.caf new-mail.caf MailReceived 收到邮件
1001 mail-sent.caf mail-sent.caf MailSent 发送邮件
1002 Voicemail.caf Voicemail.caf VoicemailReceived 收到语音邮件
1003 ReceivedMessage.caf ReceivedMessage.caf SMSReceived 收到短信
1004 SentMessage.caf SentMessage.caf SMSSent 发送短信
1005 alarm.caf sq_alarm.caf CalendarAlert 日历提醒
1006 low_power.caf low_power.caf LowPower 电量低
1007 sms-received1.caf sms-received1.caf SMSReceived_Alert 收到短信警报
1008 sms-received2.caf sms-received2.caf SMSReceived_Alert  
1009 sms-received3.caf sms-received3.caf SMSReceived_Alert  
1010 sms-received4.caf sms-received4.caf SMSReceived_Alert  
1011 - - SMSReceived_Vibrate 收到短信震动
1012 sms-received1.caf sms-received1.caf SMSReceived_Alert  
1013 sms-received5.caf sms-received5.caf SMSReceived_Alert  
1014 sms-received6.caf sms-received6.caf SMSReceived_Alert  
1015 Voicemail.caf Voicemail.caf - Available since 2.1
1016 tweet_sent.caf tweet_sent.caf SMSSent Available since 5.0
1020 Anticipate.caf Anticipate.caf SMSReceived_Alert Available since 4.2
1021 Bloom.caf Bloom.caf SMSReceived_Alert Available since 4.2
1022 Calypso.caf Calypso.caf SMSReceived_Alert Available since 4.2
1023 Choo_Choo.caf Choo_Choo.caf SMSReceived_Alert Available since 4.2
1024 Descent.caf Descent.caf SMSReceived_Alert Available since 4.2
1025 Fanfare.caf Fanfare.caf SMSReceived_Alert Available since 4.2
1026 Ladder.caf Ladder.caf SMSReceived_Alert Available since 4.2
1027 Minuet.caf Minuet.caf SMSReceived_Alert Available since 4.2
1028 News_Flash.caf News_Flash.caf SMSReceived_Alert Available since 4.2
1029 Noir.caf Noir.caf SMSReceived_Alert Available since 4.2
1030 Sherwood_Forest.caf Sherwood_Forest.caf SMSReceived_Alert Available since 4.2
1031 Spell.caf Spell.caf SMSReceived_Alert Available since 4.2
1032 Suspense.caf Suspense.caf SMSReceived_Alert Available since 4.2
1033 Telegraph.caf Telegraph.caf SMSReceived_Alert Available since 4.2
1034 Tiptoes.caf Tiptoes.caf SMSReceived_Alert Available since 4.2
1035 Typewriters.caf Typewriters.caf SMSReceived_Alert Available since 4.2
1036 Update.caf Update.caf SMSReceived_Alert Available since 4.2
1050 ussd.caf ussd.caf USSDAlert USSD警报
1051 SIMToolkitCallDropped.caf SIMToolkitCallDropped.caf SIMToolkitTone  
1052 SIMToolkitGeneralBeep.caf SIMToolkitGeneralBeep.caf SIMToolkitTone  
1053 SIMToolkitNegativeACK.caf SIMToolkitNegativeACK.caf SIMToolkitTone  
1054 SIMToolkitPositiveACK.caf SIMToolkitPositiveACK.caf SIMToolkitTone  
1055 SIMToolkitSMS.caf SIMToolkitSMS.caf SIMToolkitTone  
1057 Tink.caf Tink.caf PINKeyPressed  
1070 ct-busy.caf ct-busy.caf AudioToneBusy There was no category for this sound before 4.0.
1071 ct-congestion.caf ct-congestion.caf AudioToneCongestion There was no category for this sound before 4.0.
1072 ct-path-ack.caf ct-path-ack.caf AudioTonePathAcknowledge There was no category for this sound before 4.0.
1073 ct-error.caf ct-error.caf AudioToneError There was no category for this sound before 4.0.
1074 ct-call-waiting.caf ct-call-waiting.caf AudioToneCallWaiting There was no category for this sound before 4.0.
1075 ct-keytone2.caf ct-keytone2.caf AudioToneKey2 There was no category for this sound before 4.0.
1100 lock.caf sq_lock.caf ScreenLocked  
1101 unlock.caf sq_lock.caf ScreenUnlocked  
1102 - - FailedUnlock  
1103 Tink.caf sq_tock.caf KeyPressed  
1104 Tock.caf sq_tock.caf KeyPressed  
1105 Tock.caf sq_tock.caf KeyPressed  
1106 beep-beep.caf sq_beep-beep.caf ConnectedToPower  
1107 RingerChanged.caf RingerChanged.caf RingerSwitchIndication  
1108 photoShutter.caf photoShutter.caf CameraShutter  
1109 shake.caf shake.caf ShakeToShuffle Available since 3.0
1110 jbl_begin.caf jbl_begin.caf JBL_Begin Available since 3.0
1111 jbl_confirm.caf jbl_confirm.caf JBL_Confirm Available since 3.0
1112 jbl_cancel.caf jbl_cancel.caf JBL_Cancel Available since 3.0
1113 begin_record.caf begin_record.caf BeginRecording Available since 3.0
1114 end_record.caf end_record.caf EndRecording Available since 3.0
1115 jbl_ambiguous.caf jbl_ambiguous.caf JBL_Ambiguous Available since 3.0
1116 jbl_no_match.caf jbl_no_match.caf JBL_NoMatch Available since 3.0
1117 begin_video_record.caf begin_video_record.caf BeginVideoRecording Available since 3.0
1118 end_video_record.caf end_video_record.caf EndVideoRecording Available since 3.0
1150 vc~invitation-accepted.caf vc~invitation-accepted.caf VCInvitationAccepted Available since 4.0
1151 vc~ringing.caf vc~ringing.caf VCRinging Available since 4.0
1152 vc~ended.caf vc~ended.caf VCEnded Available since 4.0
1153 ct-call-waiting.caf ct-call-waiting.caf VCCallWaiting Available since 4.1
1154 vc~ringing.caf vc~ringing.caf VCCallUpgrade Available since 4.1
1200 dtmf-0.caf dtmf-0.caf TouchTone  
1201 dtmf-1.caf dtmf-1.caf TouchTone  
1202 dtmf-2.caf dtmf-2.caf TouchTone  
1203 dtmf-3.caf dtmf-3.caf TouchTone  
1204 dtmf-4.caf dtmf-4.caf TouchTone  
1205 dtmf-5.caf dtmf-5.caf TouchTone  
1206 dtmf-6.caf dtmf-6.caf TouchTone  
1207 dtmf-7.caf dtmf-7.caf TouchTone  
1208 dtmf-8.caf dtmf-8.caf TouchTone  
1209 dtmf-9.caf dtmf-9.caf TouchTone  
1210 dtmf-star.caf dtmf-star.caf TouchTone  
1211 dtmf-pound.caf dtmf-pound.caf TouchTone  
1254 long_low_short_high.caf long_low_short_high.caf Headset_StartCall  
1255 short_double_high.caf short_double_high.caf Headset_Redial  
1256 short_low_high.caf short_low_high.caf Headset_AnswerCall  
1257 short_double_low.caf short_double_low.caf Headset_EndCall  
1258 short_double_low.caf short_double_low.caf Headset_CallWaitingActions  
1259 middle_9_short_double_low.caf middle_9_short_double_low.caf Headset_TransitionEnd  
1300 Voicemail.caf Voicemail.caf SystemSoundPreview  
1301 ReceivedMessage.caf ReceivedMessage.caf SystemSoundPreview  
1302 new-mail.caf new-mail.caf SystemSoundPreview  
1303 mail-sent.caf mail-sent.caf SystemSoundPreview  
1304 alarm.caf sq_alarm.caf SystemSoundPreview  
1305 lock.caf sq_lock.caf SystemSoundPreview  
1306 Tock.caf sq_tock.caf KeyPressClickPreview The category was SystemSoundPreview before 3.2.
1307 sms-received1.caf sms-received1.caf SMSReceived_Selection  
1308 sms-received2.caf sms-received2.caf SMSReceived_Selection  
1309 sms-received3.caf sms-received3.caf SMSReceived_Selection  
1310 sms-received4.caf sms-received4.caf SMSReceived_Selection  
1311 - - SMSReceived_Vibrate  
1312 sms-received1.caf sms-received1.caf SMSReceived_Selection  
1313 sms-received5.caf sms-received5.caf SMSReceived_Selection  
1314 sms-received6.caf sms-received6.caf SMSReceived_Selection  
1315 Voicemail.caf Voicemail.caf SystemSoundPreview Available since 2.1
1320 Anticipate.caf Anticipate.caf SMSReceived_Selection Available since 4.2
1321 Bloom.caf Bloom.caf SMSReceived_Selection Available since 4.2
1322 Calypso.caf Calypso.caf SMSReceived_Selection Available since 4.2
1323 Choo_Choo.caf Choo_Choo.caf SMSReceived_Selection Available since 4.2
1324 Descent.caf Descent.caf SMSReceived_Selection Available since 4.2
1325 Fanfare.caf Fanfare.caf SMSReceived_Selection Available since 4.2
1326 Ladder.caf Ladder.caf SMSReceived_Selection Available since 4.2
1327 Minuet.caf Minuet.caf SMSReceived_Selection Available since 4.2
1328 News_Flash.caf News_Flash.caf SMSReceived_Selection Available since 4.2
1329 Noir.caf Noir.caf SMSReceived_Selection Available since 4.2
1330 Sherwood_Forest.caf Sherwood_Forest.caf SMSReceived_Selection Available since 4.2
1331 Spell.caf Spell.caf SMSReceived_Selection Available since 4.2
1332 Suspense.caf Suspense.caf SMSReceived_Selection Available since 4.2
1333 Telegraph.caf Telegraph.caf SMSReceived_Selection Available since 4.2
1334 Tiptoes.caf Tiptoes.caf SMSReceived_Selection Available since 4.2
1335 Typewriters.caf Typewriters.caf SMSReceived_Selection Available since 4.2
1336 Update.caf Update.caf SMSReceived_Selection Available since 4.2
1350 - - RingerVibeChanged  
1351 - - SilentVibeChanged  
4095 - - Vibrate There was no category for this sound before 2.2.
In the SDK this is the constant kSystemSoundID_Vibrate.

本文转载自:http://blog.csdn.net/potato512/article/details/39433543

大番薯
粉丝 0
博文 167
码字总数 0
作品 0
深圳
私信 提问
iOS 8.1 将修复大批用户遇到的蓝牙连接问题

自从 iOS 8 发布以来, 到最新的 8.0.2 正式版, 已经有大批用户在苹果官方技术支持社区报告, 他们连接车载蓝牙设备遇到连接问题. 包括丰田, 日产, 雪佛兰, 大众, 奥迪, 宝马, 奔驰, 以及第三方...

oschina
2014/10/05
3.1K
7
cocos2d-js在微信里面不能播放音乐啊????

谁有经验的来。 我用cocos js自带的引擎播放的,桌面浏览器有效,微信里面打开就没声音了。 ios和Android的微信都没有声音,wp的有。 我试着用html的audio标签去播放,结果和用cocos js自带引...

OSC首席键客
2014/11/27
1K
2
iOS的webView中有视频,比如爱奇艺主页,点击播放后有声音,但不弹出系统视频播放器

iOS的webView中有视频,比如爱奇艺主页,点击播放后有声音,但不弹出系统视频播放器。 有声音说明播放了,但是为什么没有弹出系统的视频播放器,我单独写了一个demo,同样的方法和网址,就可...

悟空我腿有点酸
2016/06/01
370
0
ios编程 提示声外放

各位大神,我想问一下,ios编程使用系统提示声AudioServicesPlaySystemSound,正常运行,但是插上耳机以后耳机由声音但扬声器没有声音,我想实现插上耳机以后提示声从扬声器播放。。。...

毒蛇
2014/02/25
114
0
zymedia的在使用中碰到的问题

记笔记,免忘记!最近用到了视频插件zyMedia。这个插件的简介地址:https://github.com/ireaderlab/zyMedia 问题一: 首先视频的上方显示的标题,实例是这样写的data-config='{"mediaTitle":...

zilvzsy
2018/05/12
0
0

没有更多内容

加载失败,请刷新页面

加载更多

Linux使用源码包安装软件

前言: 最近整理一些以前的学习笔记。 过去都是存储在本地,此次传到网络留待备用。 源码包 Linux软件多数免费、开源,是开发人员编写的,具有很强可读性的一组相关代码文本。 源码包 --> 编...

迷失De挣扎
今天
2
0
IPv4如何转换为IPv6?

ipv6已经逐渐在应用,现在已经有很多的运营商支持ipv6,前天我们也发布了如何让电脑使用ipv6地址?有很多朋友在问?ipv6有什么作用,它的表示方式是什么,今天我们来一起来详细了解下ipv6相关计...

xiangyunyan
今天
3
0
小白讲网络安全系列

注入攻击防护 XSS注入 SQL注入 命令注入 文件上传 文件解压缩 CSRF防护 对称加密 非对称加密 数字证书 数字签名 完整性校验 消息验证码 单向散列Hash函数 口令单向加密算法 审计日志 认证鉴权...

一刀
今天
2
0
MYSQL 嵌套事务(SAVEPOINT) 与Spring 事务传播

摘要 savepoint 关键字可以实现嵌套事务。结合savepoint关键字,更方便理解spring的事务传播。 事务嵌套 初始化表脚本 drop table t;create table t(a int, primary key(a)); 开启事务 my...

liangxiao
今天
4
0
Chrome OS 更新新版本可让Linux访问USB连接的Android设备

谷歌再次为Chrome OS带来了重大版本更新,使版本号达到了75。本次更新的一大亮点就是允许在Chrome OS上运行的Linux能够识别通过USB方式连接的Android设备,能够让用户使用Linux进行调试等等。...

linuxCool
昨天
17
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部