🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

m3 with OpenAL

Started by
2 comments, last by Aran 21 years, 4 months ago
i know how to play wav files with openal but now i want to play mp3 files. How can i do this with openal?
Advertisement
In a word: you can''t. You''ll have to use DirectShow for mp3 playback in Windows - I have no clue how you can play them in Linux.

Crispy
"Literally, it means that Bob is everything you can think of, but not dead; i.e., Bob is a purple-spotted, yellow-striped bumblebee/dragon/pterodactyl hybrid with a voracious addiction to Twix candy bars, but not dead."- kSquared
You find a library to decode the MP3 file into PCM data, and then you feed it to OpenAL by queuing buffers of the data to a source. I''ve done this with Ogg Vorbis (using Vorbisfile) quite successfully.

Libraries for decoding MP3''s: libmad (GPL; MPEG audio), SMPEG (LGPL; MPEG audio and possibly video), mpeglib (GPL; MPEG audio and video).

Many MPEG audio plug-ins/decoders in *nix use libmad (my engine will eventually use it for its MP3 decoder; but I''m very happy with Ogg Vorbis, so I''ve delayed coding it in for a while). Beware the restrictions the GPL places on the rights it gives you though.

quote: Original post by Null and Void
Beware the restrictions the GPL places on the rights it gives you though.


This is precisely why you should stick to DirectShow in Windows - there are no legal questions. In *nix''es it''s probably a slightly different matter. Additionally, if you really really really want to play MP3''s in your program and you''re not willing to deal with DirectX, port your audio engine to another library, such as bass(.dll) or fmod. Unless you''re going to commerialize your project, these will do quite nicely for you.

Crispy

"Literally, it means that Bob is everything you can think of, but not dead; i.e., Bob is a purple-spotted, yellow-striped bumblebee/dragon/pterodactyl hybrid with a voracious addiction to Twix candy bars, but not dead."- kSquared

This topic is closed to new replies.

Advertisement