获取系统卷的iOS [英] Get System Volume iOS

查看:159
本文介绍了获取系统卷的iOS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的情况很简单:
我需要打一个警告信号,并要确保用户将听到它,所以我要来检查系统音量。

My case is simple: I need to play a warning signal and want to make sure the user will hear it, so I want to check the system volume.

我怎样才能找出当前的系统卷是什么?

How can I find out what the current system volume is?

推荐答案

音频会话可以提供输出音量(iOS版> = 6.0)。

The audio session can provide output volume (iOS >= 6.0).

float vol = [[AVAudioSession sharedInstance] outputVolume];
NSLog(@"output volume: %1.2f dB", 20.f*log10f(vol+FLT_MIN));

这篇关于获取系统卷的iOS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆