使用 RemoteIO 的虚拟仪器应用程序记录功能
我正在为 iOS 开发一个虚拟乐器应用程序,并尝试实现录音功能,以便该应用程序可以录制和播放用户用乐器制作的音乐。我目前正在使用基于 OpenAL 的 CocosDenshion 声音引擎(以及我自己的一些涉及淡入淡出等的技巧)。根据我在网上的研究,我似乎有两个选择:
- 记录用户的输入(即以什么音量播放哪些音符),以便应用程序可以重新创建声音(但这不能共享/通过电子邮件发送)。
- 使用 AudioUnits 和 AudioUnits 破解我自己的低级声音引擎特别是 RemoteIO,以便我手动混合所有声音并手动填充最终输出缓冲区,因此可以将所述缓冲区保存到文件中。这将能够通过电子邮件等共享。
我已经实现了一个 RemoteIO 回调来渲染输出缓冲区,希望它能给我以前在缓冲区中播放的数据,但可惜缓冲区总是全 00。
所以我的问题是:有没有比上面的选项 2 更简单的方法来嗅探/聆听我的应用程序发送到扬声器的内容?
预先感谢您的帮助!
I'm developing a virtual instrument app for iOS and am trying to implement a recording function so that the app can record and playback the music the user makes with the instrument. I'm currently using the CocosDenshion sound engine (with a few of my own hacks involving fades etc) which is based on OpenAL. From my research on the net it seems I have two options:
- Keep a record of the user's inputs (ie. which notes were played at what volume) so that the app can recreate the sound (but this cannot be shared/emailed).
- Hack my own low-level sound engine using AudioUnits & specifically RemoteIO so that I manually mix all the sounds and populate the final output buffer by hand and hence can save said buffer to a file. This will be able to be shared by email etc.
I have implemented a RemoteIO callback for rendering the output buffer in the hope that it would give me previously played data in the buffer but alas the buffer is always all 00.
So my question is: is there an easier way to sniff/listen to what my app is sending to the speakers than my option 2 above?
Thanks in advance for your help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为你应该使用remoteIO,几个月前我有一个类似的项目,并希望尽可能避免remoteIO和音频单元,但最终,在我编写了大量代码并阅读了来自第三方库的大量文档(包括cocosdenshion)无论如何我最终还是使用了音频设备。更重要的是,它的设置和使用并不难。但是,如果您正在寻找一个库来为您完成大部分工作,那么您应该寻找一个编写了核心音频而不是开放式音频的库。
I think you should use remoteIO, I had a similar project several months ago and wanted to avoid remoteIO and audio units as much as possible, but in the end, after I wrote tons of code and read lots of documentations from third party libraries (including cocosdenshion) I end up using audio units anyway. More than that, it's not that hard to set up and work with. If you however look for a library to do most of the work for you, you should look for one written a top of core audio not open al.
您可能想看看 AudioCopy 框架。它可以满足您似乎正在寻找的很多功能,并且可以使您免于重新发明一些轮子。
You might want to take a look at the AudioCopy framework. It does a lot of what you seem to be looking for, and will save you from potentially reinventing some wheels.