Author Topic: Ogg decoder question  (Read 2295 times)

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Ogg decoder question
« on: November 05, 2009, 02:16:43 pm »
Chris,

You mentioned in a previous thread ("Random Questions") that "I went with ogg because it is free, open source, gaining in popularity, compresses well, and because I found a great decoder for it in C#."

I'm working on a project with some sound effects/music and can use .wav (or even .mp3) now but would like to use .ogg.  I've found a few c++ dll's for decoding ogg but would prefer to use 100% C# (or at least 100% managed code).  Did you find one like that? 

I could just write my own C# decoder but I'm trying to suppress the urge to do-it-myself on everything ;)  As it is the porting from .NET to Mono was sadly easy because I was hardly using any advanced .NET stuff outside C# itself.

Thanks,
Keith
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline Volatar

  • Hero Member Mark III
  • *****
  • Posts: 1,055
  • Patient as a rock

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: Ogg decoder question
« Reply #2 on: November 05, 2009, 09:54:21 pm »
Does this help?

http://www.google.com/search?source=ig&hl=en&rlz=&q=C%23+ogg&btnG=Google+Search&aq=f&oq=&aqi=g3g-m1

Actually, going through those results is what I had done a while back, and it's shockingly poor for what it looks like on the surface.  Basically, all of the C# ogg decoders are pretty old and/or incomplete, or don't really work, etc.  What I'm using is this: http://oggvorbisdecoder.codeplex.com/

That's a C# wrapper for the official C/C++ ogg libraries, and it's quite well done.  The original ogg libraries are 32bit only, I should warn you, so if your application tries to P/Invoke into those from a 64bit architecture when compiled to Any CPU or 64bit CPU, it will fail.  So you'd want to either compile your application to 32bit (which I have done for AI War for a variety of performance reasons, and of course it still works great on 64bit systems), or you'll want to recompile the basic ogg libraries for both 32 and64 bit versions.

Or if you want a native C# solution, you'd probably have to code it yourself.  As I recall, the source for the official C/C++ libraries is open source, so it shouldn't be that huge of a hassle.  Was more of a hassle than I wanted to go through at the time, though.
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: Ogg decoder question
« Reply #3 on: November 05, 2009, 10:14:26 pm »
Yea, the google approach doesn't yield very good results, I tried ;)

Thanks very much, Chris, that's exactly the info I was looking for.  Basically it means I should write my own library because I don't want to rely on a P/Invoke (cross-platform stuff, x64, OSX, Linux, whatever).  Knowing is half the battle ;)
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: Ogg decoder question
« Reply #4 on: November 05, 2009, 10:15:35 pm »
No problem!  Yeah, I found nothing good that was C# native and that still had a living link (a lot of 404s from google, indirectly or otherwise).
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline Volatar

  • Hero Member Mark III
  • *****
  • Posts: 1,055
  • Patient as a rock
Re: Ogg decoder question
« Reply #5 on: November 05, 2009, 10:48:59 pm »
Yea, the google approach doesn't yield very good results, I tried ;)

No problem then, just trying to be helpful  ;)

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: Ogg decoder question
« Reply #6 on: November 05, 2009, 10:49:40 pm »
Yea, the google approach doesn't yield very good results, I tried ;)

No problem then, just trying to be helpful  ;)

 ;D
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!