This is gonna be a quickie because well..Fmod is as easy as taking a !@#$% after not pissing for 2 days straight.
Alright, first of all, go download the Fmod library for Windows. That's usually a good start. Fire up ye olde compiler, and add the proper dlls and such to the solution (the same way we did with openGL, if you've read my tutorial.). Got it? Good, let's get some code going.
First thing you'll want to do is include the hpp file so..
#include "fmod.hpp"
If you don't know what this means, then go learn your damn C++ first!
Next you'll need to create a pointer to the System class, which we'll do by..
FMOD::System * system;
This is not going to be initialized like a normal pointer, I.E we won't be calling new on it. Instead, we'll pass it to a function..
FMOD::System_Create(&system);
system->init(100, FMOD_INIT_NORMAL, 0);
easy enough, right? This sets it up for you. Honestly, I have no idea what the hell these parameters do, but they work.
Alright, no you need a few things. You need a sound pointer and a channel pointer. We'll do that like so..
FMOD::Sound *sound;
FMOD::Channel *channel;
The sound is where we'll be storing the sound file, and the channel is what will be what is essentially playing the sound.
now depending on whether or not your sound is going to stream, you're going to use one of two functions. Streaming is typically
more CPU intensive (check me on that someone? I may be confusing streams with sounds.)
Should you choose to use a stream...
system->createStream("sound.ogg", FMOD_DEFAULT,0,&sound);
and if a sound..
system->createSound("sound.wav", FMOD_DEFAULT,0,&sound);
from that, I hope you see the difference between the two. Take note of the first parameter. The stream uses an ogg, while the sound
uses a wav. Things like background music are good for streams, while quick sound effects are good for sounds.
and now for actually playing the sound you've loaded..
system->playSound(FMOD_CHANNEL_FREE, sound, 0, &channel);
The sound is played on the specified channel, so if you want the sound to shut the hell up..
channel->stop();
and that's it! When you're done with your program, clean up your mess, and you're done.
sound->release();
system->release();
This was pretty simple, Fmod is straight forward. See if you can make this modular or even class based on your own. It makes it
really easy to manage.