单个歌曲的多个音量控制
我正在创建一个使用两首歌曲的应用程序:一首来自本地文件,一首来自用户的 iPod 库。我想创建一个软件混音工具,这意味着每个音频的音量可以独立设置。我对两个卷都使用了两个 UISlider
。
我想实现一种交叉淡入淡出类型的行为,这意味着如果一个组件的组件设置为最大值,则另一个音频的组件设置为零。我该如何实施?
I am creating an application that uses two songs: one from a local file and one from the user's iPod library. I would like to create a software mixing tool, meaning that the volume of each audio can be set independently. I using two UISlider
s for both volumes.
I would like to implement a cross-fade type of behavior, meaning that if the component of one component is set to maximum, the component of the other audio is set to zero. How do I implement this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以设置与库中歌曲音量相关的滑块 current_value ,以及 MAX_Slider_Value - current_Value 本地文件中歌曲的音量,我认为这可以解决问题
You can set the slider current_value related to volume of song from library, and MAX_Slider_Value - current_Value the volume of song from local file, I think this can do the trick
您可以使用键值编码 (KVC) 和键值观察 (KVO) 来实现这种行为。如果第一个滑块的值发生更改,请相应更改第二个滑块的值。但请确保您不触发任何 KVO 通知,否则您将陷入无限循环。
You would implement this kind of behavior by using key-value-coding (KVC) and key-value-observing (KVO). If the value of the first slider is changed, change the value of the second one appropriately. But make sure you do not fire any KVO notifications, otherwise you are trapped in an infinite loop.