Page 1 of 1

Playing Mp3 files without InitMovie()

Posted: Tue Dec 28, 2010 6:40 am
by Fou-Lu
Hi Everybody,

Maybe this is an off-topic issue, I am not really sure.

First of all, I really can't use InitMovie since I'm translating my application to C++. (hence the "off-topic")

I've already found a topic describing how to load and play mp3 files using the Media Control Interface (MCI). I found it really weird to send a string as a parameter even when you just want to stop the file from playing. :?
Well, it does work, but I feel there might be another better way.

As far as I know, PureBasic uses DirectShow to implement the Movie commands. I'm still reading about DirectShow, but it seems really hard to use!

Could you give me some advice on which is the better way to handle mp3 files, please?
I'm not worried specifically about code, just the most efficient techniques. :wink:

Re: Playing Mp3 files without InitMovie()

Posted: Tue Dec 28, 2010 8:51 am
by inc.
Do search in here for Directshow and youll find a topic where an include shows you the low level approach of direct show programming.

Re: Playing Mp3 files without InitMovie()

Posted: Wed Dec 29, 2010 5:41 am
by Fou-Lu
Thanks inc.! I am more familiar with PB code them C++, understanding your code will be a lot easier than the other examples I found. :)

Anyway, I am still wondering if using DirectShow is indeed the best aproach. What I am developing is a game, and DirectX Documentation makes a real confusion when it comes to DirectShow and games:
DirectShow is no longer recommended for game development. All of the DirectShow components (headers, libraries, utilities, tools, and samples) were removed from the DirectX SDK in the April 2005 release.
That makes me think DirectShow is not a good idea. But then:
DirectSound does not natively support MP3 decoding. You can decode the files in advance yourself (using an ACM codec of a DirectShow filter), or else just use DirectShow itself, which can do the decode for you; you can then copy the resulting PCM audio data into your DirectSound buffers.
Now, I don't even know for sure if I should use mp3 files in a game to begin with. :\

inc, you seem to have some experience with DirectShow, would you recommend using it in a game?