Ok, I've quickly put together a small FMOD CE wrapper, for anyone who wants to implement sound and music support in their game. The reason I'm putting it online here is because someone else was having difficulties using fmodce, it's pretty straight forward but the code might give you a jumpstart.
You can download the source for the wrapper class here
And you can find the needed fmod/fmodce libs here
(I used the FMOD CE 3.51 small)
Instructions:
1. Unzip the FMOD CE libs and insert them into your project, in eVC do this by selecting:
Project->Settings->Link and add the right lib to the list for every processor you wish to build for.
2. Copy the header files (fmod.h and fmod_errors.h)
to the same directory you copy Sound.h in.
3. You can only have one instance of the sound class, you have to retrieve it before you can use it. To play a mod file you do this
Wherever you call the Sound::GetSound() it will always return the same instance so you can trigger samples or start/stop playing a mod from any class you want.
There are lots of things that can be improved and added in the class, if anyone makes changes to it I would love to see it. Suggestions and comments are also always welcome :)
last note, with this class it's possible to replace the FMOD lib by lets say MikMod or something else at any time without having to dig your way through lots of files. I just picked FMOD CE because at the moment I'm extremely lazy and don't feel like checking out the other sound libs, must be because of the extremely nice weather over here :)
ow another last note, I'm only using the GetFullPath() function from PocketFrog, otherwise it's completely independent to the graphics lib. so you can pretty much use it any app you want if you just replace these calls.
You can download the source for the wrapper class here
And you can find the needed fmod/fmodce libs here
(I used the FMOD CE 3.51 small)
Instructions:
1. Unzip the FMOD CE libs and insert them into your project, in eVC do this by selecting:
Project->Settings->Link and add the right lib to the list for every processor you wish to build for.
2. Copy the header files (fmod.h and fmod_errors.h)
to the same directory you copy Sound.h in.
3. You can only have one instance of the sound class, you have to retrieve it before you can use it. To play a mod file you do this
- Code:
#include "Sound.h"
...
Sound * sound = Sound::GetSound();
sound->LoadMod(_T("sound\\song.xm"));
sound->PlayMod();
Wherever you call the Sound::GetSound() it will always return the same instance so you can trigger samples or start/stop playing a mod from any class you want.
There are lots of things that can be improved and added in the class, if anyone makes changes to it I would love to see it. Suggestions and comments are also always welcome :)
last note, with this class it's possible to replace the FMOD lib by lets say MikMod or something else at any time without having to dig your way through lots of files. I just picked FMOD CE because at the moment I'm extremely lazy and don't feel like checking out the other sound libs, must be because of the extremely nice weather over here :)
ow another last note, I'm only using the GetFullPath() function from PocketFrog, otherwise it's completely independent to the graphics lib. so you can pretty much use it any app you want if you just replace these calls.