监控iPhone麦克风 [英] Monitor iPhone mic

查看:148
本文介绍了监控iPhone麦克风的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 SCListener 获取iPhone的音量,但我想放一个卷上的观察者。所以当它改变时我可以更新屏幕上的音量表。但做类似的事情:

I'm using SCListener to get the iPhone's volume, but I'd like to put an observer on the volume. So when it changes I can update the volume meter on the screen. But doing something like:

SCListener *listener = [SCListener sharedListener];
[listener addObserver:self 
           forKeyPath:@"peakPower" 
              options:NSKeyValueObservingOptionOld 
              context:NULL];

不起作用,因为peakPower不是变量。我如何将观察者放在函数上?或者如何创建一个我可以停止并开始跟踪变量的峰值功率,我可以将观察者放在哪里?

doesn't do the trick because peakPower isn't a variable. How would I put an observer on the function? Or how would a create a listener I could stop and start to keep track of the peak power in a variable I could put an observer on?

在此先感谢您的帮助!

推荐答案

只需设置重复计时器,并在每次计时器触发时读取等级。

Simply set up a repeating timer, and read the levels each time the timer fires.

这篇关于监控iPhone麦克风的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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