AudioServices

Jump to: navigation, search

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/.

1015Voicemail.cafVoicemail.caf-Available since 2.1
1070ct-busy.cafct-busy.cafAudioToneBusyThere was no category for this sound before 4.0.
1074ct-call-waiting.cafct-call-waiting.cafAudioToneCallWaitingThere was no category for this sound before 4.0.
1071ct-congestion.cafct-congestion.cafAudioToneCongestionThere was no category for this sound before 4.0.
1073ct-error.cafct-error.cafAudioToneErrorThere was no category for this sound before 4.0.
1075ct-keytone2.cafct-keytone2.cafAudioToneKey2There was no category for this sound before 4.0.
1072ct-path-ack.cafct-path-ack.cafAudioTonePathAcknowledgeThere was no category for this sound before 4.0.
1113begin_record.cafbegin_record.cafBeginRecordingAvailable since 3.0
1117begin_video_record.cafbegin_video_record.cafBeginVideoRecordingAvailable since 3.0
1005alarm.cafsq_alarm.cafCalendarAlert 
1108photoShutter.cafphotoShutter.cafCameraShutter 
1106beep-beep.cafsq_beep-beep.cafConnectedToPower 
1114end_record.cafend_record.cafEndRecordingAvailable since 3.0
1118end_video_record.cafend_video_record.cafEndVideoRecordingAvailable since 3.0
1102--FailedUnlock 
1256short_low_high.cafshort_low_high.cafHeadset_AnswerCall 
1258short_double_low.cafshort_double_low.cafHeadset_CallWaitingActions 
1257short_double_low.cafshort_double_low.cafHeadset_EndCall 
1255short_double_high.cafshort_double_high.cafHeadset_Redial 
1254long_low_short_high.caflong_low_short_high.cafHeadset_StartCall 
1259middle_9_short_double_low.cafmiddle_9_short_double_low.cafHeadset_TransitionEnd 
1115jbl_ambiguous.cafjbl_ambiguous.cafJBL_AmbiguousAvailable since 3.0
1110jbl_begin.cafjbl_begin.cafJBL_BeginAvailable since 3.0
1112jbl_cancel.cafjbl_cancel.cafJBL_CancelAvailable since 3.0
1111jbl_confirm.cafjbl_confirm.cafJBL_ConfirmAvailable since 3.0
1116jbl_no_match.cafjbl_no_match.cafJBL_NoMatchAvailable since 3.0
1306Tock.cafsq_tock.cafKeyPressClickPreviewThe category was SystemSoundPreview before 3.2.
1103Tink.cafsq_tock.cafKeyPressed 
1104Tock.cafsq_tock.cafKeyPressed 
1105Tock.cafsq_tock.cafKeyPressed 
1006low_power.caflow_power.cafLowPower 
1000new-mail.cafnew-mail.cafMailReceived 
1001mail-sent.cafmail-sent.cafMailSent 
1057Tink.cafTink.cafPINKeyPressed 
1107RingerChanged.cafRingerChanged.cafRingerSwitchIndication 
1350--RingerVibeChanged 
1100lock.cafsq_lock.cafScreenLocked 
1101unlock.cafsq_lock.cafScreenUnlocked 
1109shake.cafshake.cafShakeToShuffleAvailable since 3.0
1351--SilentVibeChanged 
1051SIMToolkitCallDropped.cafSIMToolkitCallDropped.cafSIMToolkitTone 
1052SIMToolkitGeneralBeep.cafSIMToolkitGeneralBeep.cafSIMToolkitTone 
1053SIMToolkitNegativeACK.cafSIMToolkitNegativeACK.cafSIMToolkitTone 
1054SIMToolkitPositiveACK.cafSIMToolkitPositiveACK.cafSIMToolkitTone 
1055SIMToolkitSMS.cafSIMToolkitSMS.cafSIMToolkitTone 
1003ReceivedMessage.cafReceivedMessage.cafSMSReceived 
1007sms-received1.cafsms-received1.cafSMSReceived_Alert 
1008sms-received2.cafsms-received2.cafSMSReceived_Alert 
1009sms-received3.cafsms-received3.cafSMSReceived_Alert 
1010sms-received4.cafsms-received4.cafSMSReceived_Alert 
1012sms-received1.cafsms-received1.cafSMSReceived_Alert 
1013sms-received5.cafsms-received5.cafSMSReceived_Alert 
1014sms-received6.cafsms-received6.cafSMSReceived_Alert 
1020Anticipate.cafAnticipate.cafSMSReceived_AlertAvailable since 4.2
1021Bloom.cafBloom.cafSMSReceived_AlertAvailable since 4.2
1022Calypso.cafCalypso.cafSMSReceived_AlertAvailable since 4.2
1023Choo_Choo.cafChoo_Choo.cafSMSReceived_AlertAvailable since 4.2
1024Descent.cafDescent.cafSMSReceived_AlertAvailable since 4.2
1025Fanfare.cafFanfare.cafSMSReceived_AlertAvailable since 4.2
1026Ladder.cafLadder.cafSMSReceived_AlertAvailable since 4.2
1027Minuet.cafMinuet.cafSMSReceived_AlertAvailable since 4.2
1028News_Flash.cafNews_Flash.cafSMSReceived_AlertAvailable since 4.2
1029Noir.cafNoir.cafSMSReceived_AlertAvailable since 4.2
1030Sherwood_Forest.cafSherwood_Forest.cafSMSReceived_AlertAvailable since 4.2
1031Spell.cafSpell.cafSMSReceived_AlertAvailable since 4.2
1032Suspense.cafSuspense.cafSMSReceived_AlertAvailable since 4.2
1033Telegraph.cafTelegraph.cafSMSReceived_AlertAvailable since 4.2
1034Tiptoes.cafTiptoes.cafSMSReceived_AlertAvailable since 4.2
1035Typewriters.cafTypewriters.cafSMSReceived_AlertAvailable since 4.2
1036Update.cafUpdate.cafSMSReceived_AlertAvailable since 4.2
1307sms-received1.cafsms-received1.cafSMSReceived_Selection 
1308sms-received2.cafsms-received2.cafSMSReceived_Selection 
1309sms-received3.cafsms-received3.cafSMSReceived_Selection 
1310sms-received4.cafsms-received4.cafSMSReceived_Selection 
1312sms-received1.cafsms-received1.cafSMSReceived_Selection 
1313sms-received5.cafsms-received5.cafSMSReceived_Selection 
1314sms-received6.cafsms-received6.cafSMSReceived_Selection 
1320Anticipate.cafAnticipate.cafSMSReceived_SelectionAvailable since 4.2
1321Bloom.cafBloom.cafSMSReceived_SelectionAvailable since 4.2
1322Calypso.cafCalypso.cafSMSReceived_SelectionAvailable since 4.2
1323Choo_Choo.cafChoo_Choo.cafSMSReceived_SelectionAvailable since 4.2
1324Descent.cafDescent.cafSMSReceived_SelectionAvailable since 4.2
1325Fanfare.cafFanfare.cafSMSReceived_SelectionAvailable since 4.2
1326Ladder.cafLadder.cafSMSReceived_SelectionAvailable since 4.2
1327Minuet.cafMinuet.cafSMSReceived_SelectionAvailable since 4.2
1328News_Flash.cafNews_Flash.cafSMSReceived_SelectionAvailable since 4.2
1329Noir.cafNoir.cafSMSReceived_SelectionAvailable since 4.2
1330Sherwood_Forest.cafSherwood_Forest.cafSMSReceived_SelectionAvailable since 4.2
1331Spell.cafSpell.cafSMSReceived_SelectionAvailable since 4.2
1332Suspense.cafSuspense.cafSMSReceived_SelectionAvailable since 4.2
1333Telegraph.cafTelegraph.cafSMSReceived_SelectionAvailable since 4.2
1334Tiptoes.cafTiptoes.cafSMSReceived_SelectionAvailable since 4.2
1335Typewriters.cafTypewriters.cafSMSReceived_SelectionAvailable since 4.2
1336Update.cafUpdate.cafSMSReceived_SelectionAvailable since 4.2
1011--SMSReceived_Vibrate 
1311--SMSReceived_Vibrate 
1004SentMessage.cafSentMessage.cafSMSSent 
1016tweet_sent.caftweet_sent.cafSMSSentAvailable since 5.0
1300Voicemail.cafVoicemail.cafSystemSoundPreview 
1301ReceivedMessage.cafReceivedMessage.cafSystemSoundPreview 
1302new-mail.cafnew-mail.cafSystemSoundPreview 
1303mail-sent.cafmail-sent.cafSystemSoundPreview 
1304alarm.cafsq_alarm.cafSystemSoundPreview 
1305lock.cafsq_lock.cafSystemSoundPreview 
1315Voicemail.cafVoicemail.cafSystemSoundPreviewAvailable since 2.1
1200dtmf-0.cafdtmf-0.cafTouchTone 
1201dtmf-1.cafdtmf-1.cafTouchTone 
1202dtmf-2.cafdtmf-2.cafTouchTone 
1203dtmf-3.cafdtmf-3.cafTouchTone 
1204dtmf-4.cafdtmf-4.cafTouchTone 
1205dtmf-5.cafdtmf-5.cafTouchTone 
1206dtmf-6.cafdtmf-6.cafTouchTone 
1207dtmf-7.cafdtmf-7.cafTouchTone 
1208dtmf-8.cafdtmf-8.cafTouchTone 
1209dtmf-9.cafdtmf-9.cafTouchTone 
1210dtmf-star.cafdtmf-star.cafTouchTone 
1211dtmf-pound.cafdtmf-pound.cafTouchTone 
1050ussd.cafussd.cafUSSDAlert 
1154vc~ringing.cafvc~ringing.cafVCCallUpgradeAvailable since 4.1
1153ct-call-waiting.cafct-call-waiting.cafVCCallWaitingAvailable since 4.1
1152vc~ended.cafvc~ended.cafVCEndedAvailable since 4.0
1150vc~invitation-accepted.cafvc~invitation-accepted.cafVCInvitationAcceptedAvailable since 4.0
1151vc~ringing.cafvc~ringing.cafVCRingingAvailable since 4.0
4095--VibrateThere was no category for this sound before 2.2.

In the SDK this is the constant kSystemSoundID_Vibrate.
1002Voicemail.cafVoicemail.cafVoicemailReceived

上面是相应的列表,他们的调用播放相对照较简单。easy实现!

    AudioServicesPlaySystemSound(id);

直接调用它既能够实现,只是这里的id就是上面的数字id。慢慢熟悉他们的声音吧!

这里我想说明一下,我本来是打算搜索一些系统铃声的信息,而不是提示音,结果碰得到了提示音,就先记录下来,以后用得着,以下我会记录一下怎样在一个app 开发中实现ios系统的铃声!

一些值得參考的网址:

https://github.com/TUNER88/iOSSystemSoundsLibrary

最后附上我的Demo,先说下功能:从sounds.plist文件里读取。来实现提示音列表,点击对应的cell。会播放对应的声音!注意:在模拟器中是无法听到声音的!!

http://download.csdn.net/detail/u012951123/7611073

05-11 21:41