Playback system sound and custom sound effects in iOS development

Source: Internet
Author: User
Tags uikit

The demand is roughly divided into three kinds:

1. Vibration

2. System sound effects (no need to provide audio files)

3. Custom sound effects (audio files required)

Encapsulation of my tool class:

////WQPLAYSOUND.H//Wqsound////Created by Read Alizarin on 12-7-20. Copyright (c) 2012 __mycompanyname__.    
All rights reserved. #import <UIKit/UIKit.h> #import <AudioToolbox/AudioToolbox.h> @interface WQPL    
aysound:nsobject {Systemsoundid soundid;    
        
/** * @brief Initialize the playback vibration effect * @return Self * *-(ID) initforplayingvibrate; /** * @brief initialization for playback system sound (without providing audio files) * * @param resourcename system Sound Name * @param type system sound type * * @re    
        
Turn Self * *-(ID) Initforplayingsystemsoundeffectwith: (NSString *) resourcename ofType: (NSString *) type; /** * @brief Initialize for playback of specific audio files (audio files are required) * * @param filename Audio file name (added in project) * * @return Self * *-(ID)    
        
Initforplayingsoundeffectwith: (NSString *) filename;    
        
/** * @brief Play sound effects * * (void) plays; @end 

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/OS/extra/

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.