我可以使用 monomac 的 OSX AUGraph 吗?
我有一个用 C# 编写的 mp3 播放应用程序,我想将其移植到 OSX。
由于它使用 DirectShow 播放 mp3,我意识到我需要重新编码音频播放部分。我找到了使用 AUGraph 的 Apple 播放文件示例。
http://www.mono-project.com/MonoMac 的 Binding Cocoa 部分提到了“更简单的 AudioToolBox API”。
任何人都可以向我指出使用 C# 中的 AudioToolBox 或最好使用 C# 中的 AUGraph 的示例代码。
将我的代码移植到 monomac 是最好的方法还是我最好尝试一下并在 Objective C 中重新编码。
I have an mp3 playing application written in C# which I would like to port to OSX.
As it uses DirectShow to play mp3 I realise that I will need to recode the audio playback part. I found Apple's playfile sample which uses AUGraph.
The Binding Cocoa section of http://www.mono-project.com/MonoMac mentions the "much simpler AudioToolBox API".
Can anyone point me at sample code for using the AudioToolBox from C# or preferably using AUGraph from C#.
Is porting my code to monomac the best approach or would I be better taking the plunge and recoding in Objective C.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这些是使用 AudioUnit 的一些示例,使用 MonoMac 具有的相同 API,但这些示例使用 MonoTouch 面向 iPhone:
https://github.com/migueldeicaza/MonoTouch.AudioUnit
设置AudioUnit有点麻烦,如果你只想播放MP3文件而不做任何底层处理或应用效果,你可以使用MonoMac .AppKit.NSSound API 代替。
These are some samples of using AudioUnit using the same API that MonoMac has, except that these samples target the iPhone using MonoTouch:
https://github.com/migueldeicaza/MonoTouch.AudioUnit
Setting AudioUnit up is a little cumbersome, if all you want is to play MP3 files without doing any low-level processing or applying effects, you can use the MonoMac.AppKit.NSSound API instead.
您链接的页面确实表明 AudioToolbox(即 CoreAudio)已完全绑定。我不知道任何示例,但移植 C 代码应该不难。
或者,您可以进入 mono-osx 邮件列表并请求 QTKit 的绑定,甚至可以自己进行此绑定。我听说 MonoMac 绑定生成器可以很容易地绑定 Objective-C API。
即使您必须自己进行一些绑定,使用现有的 C# 代码和知识也会更快、更容易。
The page you linked does say that AudioToolbox (i.e. CoreAudio) is fully bound. I don't know of any samples but it shouldn't be hard to port C code.
Alternatively you could go onto the mono-osx mailing list and request a binding of QTKit, or even do this binding yourself. I hear that the MonoMac binding generator makes it quite easy to bind Objective-C APIs.
It's going to be much quicker and easier to use your existing C# code and knowledge, even if you do have to do some bindings yourself.
AUGraph 是 Core Audio 的一部分。它用于组装音频单元图,可用于音频播放。 Core Audio 是一个具有 C API 的低级框架。
也许您可以使用 Mono 的 QTKit(QuickTime 的可可包装)。
在我看来,这始终是使用平台“原生”技术的最佳方法。 (对于 Mac OS X 来说是 Objective-C 和 Cocoa)。
Apple 有一个很好的示例,展示了如何使用 QTKit 创建媒体播放器:
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/QTKitApplicationTutorial/Introduction/Introduction.html%23//apple_ref/doc/uid/TP40008155-CH1-SW1
AUGraph is part of Core Audio. It is used to assemble a graph of Audio units and can be used for audio playback. Core Audio is a low level framework that has a C API.
Maybe you can use QTKit (a cocoa wrapper around QuickTime) from Mono.
In my opinion it is always the best approach to work with a platforms "native" technology. (Which would be Objective-C and Cocoa for Mac OS X).
Apple has a nice sample that shows how to create a media player using QTKit:
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/QTKitApplicationTutorial/Introduction/Introduction.html%23//apple_ref/doc/uid/TP40008155-CH1-SW1