【发布时间】:2011-10-14 20:27:10
【问题描述】:
在我的应用程序中,我使用 AVAudioPlayer 对象来保存 mp3 文件。有好几次我希望在播放文件时降低它们的音量。
我了解我应该做的一些事情,但我不明白我如何定义持续时间以及我如何命令某些事情只会在该持续时间内发生。
我正在寻找这样的东西:
AVAudioPlayer * aud1 = [I have a method to get the file];
AVAudioPlayer * aud2 = [I have a method to get the file];
NSTimeInterval * aud1_ti = aud1.duration //I haven't tried this yet - is this the right way to get the mp3 play duration?
[aud1 play];
[aud2 play];
while (aud1_ti)
aud2.volume = 0.5;
aud2.volume = 1.0
用语言来说——我希望在播放 aud1 时,将 aud2 音量减半;一旦文件结束,aud2 音量将恢复到满级。我无法从文档中了解如何做到这一点。
有人可以帮忙吗?
【问题讨论】:
标签: ios avaudioplayer volume duration