ios里调音量大小和静音。
代码如下:
void playSound(NSString* myString) {
CFBundleRef mainBundle = CFBundleGetMainBundle();
NSString *string = myString;
CFURLRef soundFileURLRef;
soundFileURLRef = CFBundleCopyResourceURL(mainBundle,
(__bridge CFStringRef) string, CFSTR ("wav"), NULL);
UInt32 soundID;
AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
AudioServicesPlaySystemSound(soundID);
}
代码运行后不能改变设备的声音也不能静音。不知道该怎么实现了。
你看看这个监听事件
http://www.cnblogs.com/weilaikeji/archive/2013/03/10/2952828.html