iOS调用AudioServicesPlaySystemSound方法播放系统声音

播放系统声音需要导入框架:AudioToolbox.framework

图片看不清请双击查看大图

System Sound ID 介绍如下:

AudioServices

AudioServices is a group of C functions in AudioToolbox for playing short (≤30 seconds) sounds.

Predefined sounds

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 
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.
时间: 2024-12-12 11:43:03

iOS调用AudioServicesPlaySystemSound方法播放系统声音的相关文章

iOS 播放系统声音

准备工作: 找到需要的声音(不要大于30秒),如果是mp3格式,则直接将其后缀名改为.wav: 将声音文件添加到系统中. 第一步:导入  AudioToolbox.framework  文件 第二步:在需要声音的类的.h文件中添加     #import <AudioToolbox/AudioToolbox.h> 同时,声明如下语句 static SystemSoundID shake_sound_male_id = 0; 第三步:编码,如下: 1. 播放震动 AudioServicesPla

OSX/iOS 播放系统声音

系统会自带了些声音,有时候一些操作用必要自己播放一下声音提醒一下,用bash的直接say something就ok了,写代码的时候呢?原来很简单的,一句: [[NSSound soundNamed:@"Hero"] play]; 就ok了其中Hero是文件名,具体都有啥文件名去这里找 /System/Library/Sounds 一般的文件名列表: BassoBlowBottleFrogFunkGlassHeroMorsePingPopPurrSosumiSubmarineTink 哎

iOS 之播放系统声音

导入框架: 代码: [cpp] view plaincopy #import <UIKit/UIKit.h> #import <AudioToolbox/AudioToolbox.h> @interface MsgPlaySound : NSObject { SystemSoundID sound;//系统声音的id 取值范围为:1000-2000 } - (id)initSystemShake;//系统 震动 - (id)initSystemSoundWithName:(NSSt

[iOS]调用layoutSubViews方法(有的时候为啥会调用2遍)

layoutSubviews在以下情况下会被调用: 1.init初始化不会触发layoutSubviews 但是是用initWithFrame 进行初始化时,当rect的值不为CGRectZero时,也会触发 2.addSubview会触发layoutSubviews 3.设置view的Frame会触发layoutSubviews,当然前提是frame的值设置前后发生了变化 4.滚动一个UIScrollView会触发layoutSubviews 5.旋转Screen会触发父UIView上的lay

iOS 系统声音播放

在iOS中可通过两种方式去播放声音: *  播放压缩的声音文件,比如mp3文件,一般使用播放声音中提到的方法,适用于播放时间较长,比如大于30秒,AVAudioPlayer可以提供更多的控制特性,比如暂停等等 *   播放系统声音,比如翻页的哗啦声,应该使用播放系统声音的方法,因为压缩的声音文件比播放wav等非压缩声音文件在播放前消耗更多的处理器资源,这样的声音还要频繁的播放,而且,因为系统声音文件都较小,一般小于30秒,因此即使压缩格式,也不会节省多少存储空间. 播放系统声音:首先要导入系统框

iOS开发系列--音频播放、录音、视频播放、拍照、视频录制

iOS开发系列--音频播放.录音.视频播放.拍照.视频录制 转载:http://www.cnblogs.com/kenshincui/p/4186022.html#avFoundationCamera --iOS多媒体 概览 随着移动互联网的发展,如今的手机早已不是打电话.发短信那么简单了,播放音乐.视频.录音.拍照等都是很常用的功能.在iOS中对于多媒体的支持是非常强大的,无论是音视频播放.录制,还是对麦克风.摄像头的操作都提供了多套API.在今天的文章中将会对这些内容进行一一介绍: 音频 音

iOS开发之音频播放、录音

iOS的音频播放可以分为短音频播放(例如:音效等点缀音频)和长音频播放(例:音乐等主音频).前者不需要对进度.循环等进行控制,而后者需要精确的控制.在iOS中播放这两种音频分别使用AudioToolbox.framework和AVFoundation.framework来完成. 短音频音效 AudioToolbox.framework是一套基于C语言的框架,使用它来播放音效其本质是将短音频注册到系统声音服务(System Sound Service).System Sound Service是一

iOS开发系列--音频播放、录音、

音频 在iOS中音频播放从形式上可以分为音效播放和音乐播放.前者主要指的是一些短音频播放,通常作为点缀音频,对于这类音频不需要进行进度.循环等控制.后者指的是一些较长的音频,通常是主音频,对于这些音频的播放通常需要进行精确的控制.在iOS中播放两类音频分别使用AudioToolbox.framework和AVFoundation.framework来完成音效和音乐播放. 音效 AudioToolbox.framework是一套基于C语言的框架,使用它来播放音效其本质是将短音频注册到系统声音服务(

iOS调用系统声音和震动

调取系统声音和震动 首先应当引入系统库:AudioToolbox.framework 引用: #import <AudioToolbox/AudioToolbox.h> 1.调用震动: AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); 2,调用系统声音 a.直接调用 AudioServicesPlaySystemSound(1007);//这个声音是是类似于QQ声音的 b.调用更多的系统声音 SystemSoundID sound; N