IOS Playback system Sound

Source: Internet
Author: User
Tags uikit

Import Frame:

Code:

[CPP]View Plaincopy
    1. #import <UIKit/UIKit.h>
    2. #import <AudioToolbox/AudioToolbox.h>
    3. @interface Msgplaysound:nsobject
    4. {
    5. Systemsoundid Sound; //system sound ID value range is: 1000-2000
    6. }
    7. -(ID) initsystemshake; //System Vibration
    8. -(ID) Initsystemsoundwithname: (NSString *) soundname soundtype: (NSString *) Soundtype; //Initialize system sound
    9. -(void) play; //Play
    10. @end

[CPP]View Plaincopy
  1. #import "MsgPlaySound.h"
  2. @implementation Msgplaysound
  3. -(ID) initsystemshake
  4. {
  5. self = [super init];
  6. if (self) {
  7. sound = ksystemsoundid_vibrate; //Vibration
  8. }
  9. return self;
  10. }
  11. -(ID) Initsystemsoundwithname: (NSString *) soundname soundtype: (NSString *) Soundtype
  12. {
  13. self = [super init];
  14. if (self) {
  15. NSString *path = [NSString stringwithformat:@"/system/library/audio/uisounds/%@.%@", SoundName,soundType];
  16. //[[nsbundle bundlewithidentifier:@ "Com.apple.UIKit"]pathforresource:soundname oftype:soundtype];// Get the uikit.framework of the Apple frame resource and remove the path from the system sound you want to play
  17. //[[nsbundle Mainbundle] Urlforresource: @ "tap" withextension: @ "AIF"]; Get a custom sound
  18. if (path) {
  19. Osstatus error = Audioservicescreatesystemsoundid ((cfurlref) [Nsurl Fileurlwithpath:path],&sound];
  20. if (Error! = kaudioservicesnoerror) {//Gets the sound when an error occurs
  21. sound = nil;
  22. }
  23. }
  24. }
  25. return self;
  26. }
  27. -(void) Play
  28. {
  29. Audioservicesplaysystemsound (sound);
  30. }



Apple system default Sound name Description: (this description is from http://bbs.weiphone.com/read-htm-tid-6262661.html)

1. The sound format is MP3 or m4r needs to be converted into CAF format (can be converted to AIF, AIFF, and then modified suffix)
2. The path in/system/library/audio/uisounds, you need to change can be replaced according to the following list
3 Detailed list:
Information
receivedmessage.caf--receives information and plays only when the SMS interface is open.
SMS-RECEIVED1.CAF-------Three Tone
SMS-RECEIVED2.CAF-------Jungzhongchen
SMS-RECEIVED3.CAF-------Glass
SMS-RECEIVED4.CAF-------Horn
SMS-RECEIVED5.CAF-------Ringtones
SMS-RECEIVED6.CAF-------Electronic Music
SENTMESSAGE.CAF--------Send a message

Mail
MAIL-SENT.CAF----Send mail
NEW-MAIL.CAF-----Receive new mail

Phone
DTMF-0.CAF----------Dial Panel 0 button
DTMF-1.CAF----------Dial Panel 1 button
DTMF-2.CAF----------Dial Panel 2 button
DTMF-3.CAF----------Dial Panel 3 button
DTMF-4.CAF----------Dial Panel 4 button
DTMF-5.CAF----------Dial Panel 5 button
DTMF-6.CAF----------Dial Panel 6 button
DTMF-7.CAF----------Dial Panel 7 button
DTMF-8.CAF----------Dial Panel 8 button
DTMF-9.CAF----------Dial Panel 9 button
DTMF-POUND.CAF---dial panel # keys
DTMF-STAR.CAF------Dial Panel * keys
VOICEMAIL.CAF-----New Voice mail

Input Device Sound Tips
TOCK.CAF-----------------------Click on 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

Other
beep-beep.caf--charging, logging off and connecting the computer
LOCK.CAF------------Lock your phone
SHAKE.CAF---------"This is not clear."
UNLOCK.CAF--------Sliding Unlock
low_power.caf--Low Battery tip

Voice control
jbl_ambiguous.caf--found multiple matches
JBL_BEGIN.CAF------Waiting for the user's input
JBL_CANCEL.CAF-----Cancel
JBL_CONFIRM.CAF----Execution
JBL_NO_MATCH.CAF---No match found

Calendar
alarm.caf--Calendar Reminders

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

IOS Playback system Sound

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.