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/