• Advertisement
Sign in to follow this  

MP3s in C++ **SOLVED**

This topic is 3445 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Alright, I looked into libraries like FMod, but the price and legal information had me actually screaming. I would like to know how to implement .MP3s for my DirectX games, but I think I should dumb down the API fixation and see if I can do it in C++. I imagine a .DLL has to come in, but I have zero knowledge in the subject. That is, of DLLs, and anything related to sound. The only thing I know about DLLs is that there are different calling methods, and with sound... I can hear it. I am really a blank slate to this, and I do not want to be paying, what was it, 3 grand for an FMOD license or conforming to any license standards except my own. Besides, I need the practice. Is there novice reading out there? I don't even know what to look for, even on Google. I have the worst luck of finding stuff that loses me on Google. [Edited by - zyrolasting on November 15, 2008 10:15:52 PM]

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by zyrolasting
Alright, I looked into libraries like FMod, but the price and legal information had me actually screaming.

I would like to know how to implement .MP3s for my DirectX games, but I think I should dumb down the API fixation and see if I can do it in C++.
I imagine a .DLL has to come in, but I have zero knowledge in the subject.
That is, of DLLs, and anything related to sound. The only thing I know about DLLs is that there are different calling methods, and with sound... I can hear it.

I am really a blank slate to this, and I do not want to be paying, what was it, 3 grand for an FMOD license or conforming to any license standards except my own. Besides, I need the practice. Is there novice reading out there? I don't even know what to look for, even on Google. I have the worst luck of finding stuff that loses me on Google.
Do you really need MP3? If you're using DirectX, I believe you can use DirectShow, since that uses the MP3 decoder that comes with the OS.

If you're doing this to play e.g. game music, I'd recommend looking into Ogg Vorbis, which is free to use, has pretty much the same quality and compression as MP3, and is really simple to get working with DirectSound.

Aside from that, FMod is free if your app is free. If you want to make it shareware or more commercial, then you have to pay.

Share this post


Link to post
Share on other sites
Oh, good to know. I actually love Vorbis, It grew on me when messing with conversion tools. I figured MP3 was just easier to implement, given common usage with past engines. Anyway, does DirectShow have any truly notable differences from FMod I should worry about? Again, only interested in the basics: Play, Stop, Pause, Seek. I'm pretty sure I'm not going to shovel 3 grand for that. Not interested in free either; I Intend to get small projects floating around on the net for some green.

Actually... I'm a little confused in the variation of APIs here... I've Seen DirectSound, XAudio, FMOD, and now DirectShow. I've been getting some encouragement from documentation to choose XAudio over DirectSound but... Can I get a little background? I think I should choose the one that balances simplicity and efficiency given my scenario.

Share this post


Link to post
Share on other sites
Quote:
Original post by zyrolasting
Oh, good to know. I actually love Vorbis, It grew on me when messing with conversion tools. I figured MP3 was just easier to implement, given common usage with past engines. Anyway, does DirectShow have any truly notable differences from FMod I should worry about? Again, only interested in the basics: Play, Stop, Pause, Seek. I'm pretty sure I'm not going to shovel 3 grand for that. Not interested in free either; I Intend to get small projects floating around on the net for some green.
As far as I know (Although I may be wrong), there's no open source or free MP3 decoders available, since MP3 has licensing restrictions on it. Personally, I've always found DirectShow a pain in the ass to deal with, and Ogg Vorbis (And FMod) extremely simple.

Quote:
Original post by zyrolasting
Actually... I'm a little confused in the variation of APIs here... I've Seen DirectSound, XAudio, FMOD, and now DirectShow. I've been getting some encouragement from documentation to choose XAudio over DirectSound but... Can I get a little background? I think I should choose the one that balances simplicity and efficiency given my scenario.
I didn't mean to recommend DirectSound; it's just the only sound API I've implemented OGG streaming with.

There's been a few posts in the DirectX Forum about the various audio APIs, although the only one I can find immediately is This one.

Share this post


Link to post
Share on other sites
It's not that I didn't like the look of FMOD, I just prefer to use a sound API that gives me the freedom of use no matter my release. Judging from the link Steve sent me, apparently I would be dealing with extra work just to get something playing on a DirectX sound related API.

I guess I could sacrifice such time if I make a good wrapper code, but is it insanely difficult to make my own library of this? I severely doubt I could do it with my current experience, but it's just something I'd like to do at some point.

I guess if DirectX APIs have less restrictive license agreements, I'll go with them for now. I take it I would use DirectSound for streaming basic sounds, while DirectMusic (Another one I didn't know existed) would be used for background music/Ambient sound.

I hope there are some novice tutorials lying around.

Share this post


Link to post
Share on other sites
After a search, came across this. Apparently MP3 could be converted to a WAV stream through some struct tweaking...

In case you were curious, Steve.

http://www.codeguru.com/forum/archive/index.php/t-370446.html

Share this post


Link to post
Share on other sites
Quote:
Original post by zyrolasting
After a search, came across this. Apparently MP3 could be converted to a WAV stream through some struct tweaking...

In case you were curious, Steve.

http://www.codeguru.com/forum/archive/index.php/t-370446.html
Ah cool, I see - that'll only work for playback though, there's no Win32 decoding functions. And the Win32 audio API isn't really that powerful. Still, if it works, it might be a quick alternative.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement