开发者

Can I use OSX AUGraph from monomac?

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 prefera开发者_如何学Gobly 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.


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜