PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Sound & Music class

BurningSheep · 02 Aug 2002, 16:02 UTC
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

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.
Conan · 03 Aug 2002, 10:07 UTC — Using FMod
Many thanks, I will give yout wrapper a try. I already downloaded FMod a few weeks ago but have not yet had time to try

update: Just had a read of their licensing arrangements. $100 for 1 shareware title is fine but they reserve the right to determine who is a 'shareware' author. While I must fit now I might not in a few years. This puts me off a bit.
Conan · 06 Aug 2002, 14:21 UTC — getting FMod to build ?
Once I added the correct paths for the source files and the project link option pointing to C:\Windows CE Tools\frog\Fmod\api\x86emu\fmodce.lib I am left with one strange error:-
LINK : fatal error LNK1181: cannot open input file "C:\Windows.obj"
As I can't figure this one out does anyone recognise this error message?
Conan · 20 Sep 2002, 15:13 UTC — Got it working now
Who knows what I did wrong the last time but anyway FMOD is happily working ( as is mikmod ). I will be interested to see the quality/performance differences. If FMOD is much better then I don't mind paying for it as it seems simpler to use.
draklava · 24 Sep 2002, 21:40 UTC — file gone?
the zip file is no longer at that location - can you repost somewhere

thanks!
xpfde · 19 Apr 2003, 10:42 UTC — I cant found it,can u tell us again?
I cant found it,can u tell us again?
Conan · 19 Apr 2003, 14:43 UTC — Burning Sheep's wrapper files
I have the sound.cpp & sound.h referred to if 'BS' does not re-post a link. I can e-mail

ps: you should register :idea:
BurningSheep · 20 Apr 2003, 21:13 UTC
I've not visited this board much for the last couple of months and wont be around much in the near future since i'm working on a lot of other stuff.

Here you can find the wrapper class: http://vulcanus.its.tudelft.nl/robert/PPC/sound.zip. I also updated the original post.