IOS growth path-use the system's default sound and Vibration

Source: Internet
Author: User

Import framework:

Code:

# Import <uikit/uikit. h> # import <audiotoolbox/audiotoolbox. h> @ interface msgplaysound: nsobject {systemsoundid sound; // system sound id value range: 1000-2000}-(ID) initsystemshake; // system vibration-(ID) initsystemsoundwithname :( nsstring *) soundname soundtype :( nsstring *) soundtype; // initialize the system sound-(void) play; // play @ end

# Import "msgplaysound. H "@ implementation msgplaysound-(ID) initsystemshake {self = [Super init]; If (Self) {sound = ksystemsoundid_vibrate; // vibrate} return self;}-(ID) initsystemsoundwithname :( nsstring *) soundname soundtype :( nsstring *) soundtype {self = [Super init]; If (Self) {nsstring * Path = [nsstring stringwithformat: @ "/system/library/Audio/uisounds/% @. % @ ", soundname, soundtype]; // [[nsbundle bundl Ewithidentifier: @ "com. apple. uikit "] pathforresource: soundname oftype: soundtype]; // obtain the apple framework Resource uikit. framework to retrieve the path of the system sound to be played. // [[nsbundle mainbundle] urlforresource: @ "tap" withextension: @ "AIF"]; get custom sound if (PATH) {osstatus error = audioservicescreatesystemsoundid (cfurlref) [nsurl fileurlwithpath: path], & Sound); If (error! = Kaudioservicesnoerror) {// when a sound is obtained, the following error occurs: Sound = nil ;}}return self ;}- (void) Play {audioservicesplaysystemsound (sound );}

Apple system default sound Name Description: (this description comes from the http://bbs.weiphone.com/read-htm-tid-6262661.html)

1. The audio format is MP3 or m4r and needs to be converted to the caf format (you can convert it to aif or aiff first, and then modify the suffix)
2. The path is in/System/Library/Audio/UISounds. To change the path, replace it with the following list:
3. Detailed List:
Information
ReceivedMessage. caf -- receives the message and plays it only when the text message interface is opened.
Sms-received1.caf ------- sanquanyin
Sms-received2.caf ------- Guan zhongqin
Sms-received3.caf ------- glass
Sms-received4.caf ------- circle
Sms-received5.caf ------- ringtones
Sms-received6.caf ------- e-music
SentMessage. caf -------- send message

Email
Mail-sent.caf-send mail
New-mail.caf ----- receive new mail

Phone number
Dtmf-0.caf ---------- dial panel 0 buttons
Dtmf-1.caf ---------- dial Panel 1 button
Dtmf-2.caf ---------- dial panel 2 buttons
Dtmf-3.caf ---------- dial panel 3 buttons
Dtmf-4.caf ---------- dial panel 4 buttons
Dtmf-5.caf ---------- dial Panel 5 buttons
Dtmf-6.caf ---------- dial Panel 6 buttons
Dtmf-7.caf ---------- dial Panel 7 buttons
Dtmf-8.caf ---------- dial Panel 8 buttons
Dtmf-9.caf ---------- dial panel 9 buttons
Dtmf-pound.caf --- dial panel # buttons
Dtmf-star.caf ------ dial panel * buttons
Voicemail. caf ----- new voice mail

Enter device sound prompt
Tock. caf ------------------------- click the keyboard
Begin_record.caf ----------- start recording
Begin_video_record.caf -- start recording
PhotoShutter. caf ------------ shutter sound
End_record.caf ------------ End recording
End_video_record.caf ----- end video

Others
Beep-beep.caf-charging, deregistering, and connecting to computers
Lock. caf ------------ lock the mobile phone
Shake. caf --------- "this is not clear yet"
Unlock. caf -------- slide to unlock
Low_power.caf -- Low Power prompt

Voice Control
Jbl_ambiguous.caf -- find multiple matches
Jbl_begin.caf ------ waiting for user input
Jbl_cancel.caf ----- cancel
Jbl_confirm.caf ---- run
Jbl_no_match.caf --- no matching found

Calendar
Alarm. caf-calendar reminder

IPod Touch 1G
Sq_alarm.caf
Sq_beep-beep.caf
Sq_lock.caf
Sq_tock.caf

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.