AudioUnits 和 MPMusicPlayerController
我的应用程序正在利用 AudioUnit
功能为节拍器应用程序产生短促的声音。 一切运行良好。
现在我想从设备上的 iTunes 库播放 MP3,我使用 MPMusicPlayerController
来播放。
到这里为止没有问题,MP3 播放正常。但此后我再也无法调用我的 AudioUnit 声音了。我对其进行了调试,音频缓冲区的回调再也不会出现,因此我认为 AUGraph 已停止,但它表明它仍在运行。
有人有主意吗? MPMusicPlayerController
是否刚刚停止了图表?以及如何防止这种情况发生?
感谢您的任何提示, 安德烈亚斯
My App is utilizing the AudioUnit
functionality to produce short sounds for a metronome application.
All is running fine.
Now I want to play an MP3 from the iTunes Lib on the Device and I use MPMusicPlayerController
for it.
No probs until here, the MP3 plays fine. But afterwards I can never again invoke my AudioUnit
sounds again. I debugged it that far that the callback for the Audio buffers never ever appears again so I think the AUGraph
has been stopped but it signals that it is still running.
Anyone having an idea? Did the MPMusicPlayerController
just stop the Graph? And how to prevent that?
Thanks for any hint,
Andreas
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从这个doc,“音乐播放器(MPMusicPlayerController 类的实例)始终使用系统提供的音频会话。” 据我所知,您的应用程序无法访问系统提供的音频会话。因此,MPMusicPlayerController 音频和您的应用程序音频不可能同时播放。
要同时播放 iPod 库和节拍器中的 MP3,请执行以下操作:
From this doc, "Music players (instances of the MPMusicPlayerController class) always use a system-supplied audio session." Your application can't access system-supplied audio sessions as far as I know. Therefore, it's not possible for MPMusicPlayerController audio and your app audio to be played simultaneously.
In order to play an MP3 from the iPod library and your metronome simultaneously, do the following: