How to programmatically crossfade between songs

不想你离开。 提交于 2019-12-11 09:44:52

问题


I am working on a music player for the iPhone, and I would like to crossfade between songs. I know this is possible because My DJ does it...I can't find any documentation and don't even know where to begin on it. Can anyone give me a starting point or example code?

Thanks.


回答1:


One option is to convert both songs into raw (linear PCM) samples. Then build your own mixer function or audio unit where the mix ratio of each sample comes from a ramp or custom mix curve function. Feed the output to the RemoteIO audio unit.




回答2:


I was able to solve it by using AVPlayer instead of MPMusicPlayerController.



来源:https://stackoverflow.com/questions/8744736/how-to-programmatically-crossfade-between-songs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!