MP3

Started by
13 comments, last by recombinant 18 years ago
Is it possible to use DirectSound to play an MP3 file? If not, can anyone tell me what I should use to play one?
Advertisement
Hello, what's up!

Yes, it's possible. However, if you are making anything commercial, you shouldn't use it because of royalties. I would recommend ogg. I've heard good results using it.

Hope this helps,
exorcist_bob
Simply put:
-DirectSound: write a decoder, play the 'raw' data.
+DirectShow: load up the mp3 and play! =)

Yes, mp3-format is licensed (ka-ching!).
How do you write a decoder? I would think that would be a very difficult thing, but I could be wrong.

Wait, are you saying that I can either decode and play with DirectSound OR use DirectShow to play an MP3 automatically?
An mp3 license is required for encoding, decoding, or distributing files inclusively. It does not matter if Microsoft has a decoder in Windows as part of DirectShow. Microsoft's license only covers Microsoft's use of the decoder, not yours.

Seriously, consider a patent free codec, or be prepared to pay royalties or other headaches.

Here are the current mp3 rates: http://www.mp3licensing.com/royalty/software.html
.
Going with Ogg is probably a good idea, especially for commercial use. I'd also suggest Fmod. Fmod is crazy powerful and really simple to use.
"Game Programming" in an of itself does not exist. We learn to program and then use that knowledge to make games.
Yes, I too recommend Ogg Vorbis. Ogg compresses better than MP3 most of the time, so you get smaller file sizes as well. The only arguments Ogg are portability and quality when converting from mp3. Most mp3 player do not play ogg files, so people aren't usually willing to rip their cds to ogg. Since your music doens't have to be portable, it isn't an issue here. The other argument is probably not an issue either if you're using original music. If you still have the masters, you can encode to ogg no problem, with no loss by encoding from mp3. Of course, most people probably won't even hear the loss of quality, but you'll get lots of angry email from audiophiles.
You can't complain about MP3 and suggest FMOD, it's contradicting the first statement. FMOD is free, but it costs a heck of a lot if you decide to sell your game at all.
I won't be selling this game, so that won't be an issue. So, then how should I work with decoding and playing Ogg files?
Here's an article on using OGG Vorbis with OpenAL. It's very similar to using DirectSound.

I've written code for decoding an OGG into a DirectSound buffer, but it's tied in with the rest of my sound manager code, so it's kinda hard to extract. It's really pretty straightforwards though.

This topic is closed to new replies.

Advertisement