尝试实现 AVAudioplayer 并获取播放音乐的一些计量数据,但仍然获得值 -160。 看起来很容易使用,只需启用 Meter,然后在计时器下拾取数据,但目前还没有结果。
playerAV = [[AVAudioPlayer alloc] initWithContentsOfURL:outURL error:nil]; playerAV.delegate = self; playerAV.meteringEnabled = YES; [playerAV prepareToPlay]; [playerAV play]; NSLog(@"Peak left: %f Avg right: %f", [playerAV peakPowerForChannel:0],[playerAV averagePowerForChannel:1]);
欢迎任何想法。
最佳答案
您正在调用updateMeters
吗? ?两者的文档 peakPowerForChannel:
和 averagePowerForChannel:
说:
To obtain a current [...] value, you must call the
updateMeters
method before calling this method.
关于objective-c - AVAudioPlayer 仪表值仍然 - 160,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6089718/