问题
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