我正在尝试制作一个测量房间噪音水平的应用程序。我该怎么做?
我尝试使用 avrecorder 来启用计量,但当我尝试运行我的应用程序时,它显示平均功率和峰值功率均为 -160,完全静音
这是我更新仪表的功能
func micLevels() {
recorder.updateMeters()
print("meters should be updated")
self.meteringLabel.text = String(recorder.peakPowerForChannel(0))
}
无论如何,计量标签.text 都是-160。我用 NSTimer 调用这个函数
最佳答案
尝试在主线程中更新文本:
dispatch_async(dispatch_get_main_queue(), ^{
self.meteringLabel.text = String(recorder.peakPowerForChannel(0))
});
关于ios - 如何快速显示计量值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34689477/