PocketMatrix forums

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

Hekkus Sound System Question

I have just downloaded the hekkus sound system but I am unsure of how to integrate it into my existing Gapidraw app.

Which lib and/or dll files do I need? Where do I place them? And what modifications to my existing .c and .h files do I need to make.

I realise this is a pretty vague question but any general ideas would be useful. I only ask because there doesn't seem to be much documentation with the download.

Thanks.
Hi gevans,

I'm Thomas, the hekkus developer. I suggest you to download the samples on hekkus download page, you will find a minimal gapidraw application that show you how to integrate sound on your GD based game.

I have just added a sample for gd204. Johan have enhanced the GD framework and I have used it to create a simple subclass that initialize the sound stuff without touching it. On the new sample you can find this header file CGapiHekkusApplication.h, add it to your project and derive your game class to this new class and you have added sound to your game!
But this only works with the new frameworks that comes with gd204.

The Hekkus package have all you need to add sound on your game, hekkus is not compiled as a dll but is a static lib. You only have to add hss.lib to your project (and winmm.lib if you compile your game for a desktop version), you can find all the precompiled libs on the hekkus lib directory.

Well, if you need some other help to use hekkus with your game feel free to send me a mail at gersen@shlzero.com
To expand on what Thomas wrote...

I was unaware of the new class he put together actually, so I can tell you how to integrate it with GD 2.04 without using that class... Note that there are a few parts that you could do differently, but this is one approach...

I'm going to assume that you are using VC++6.0 and that you have a main header file where your game class is defined...

(1) Add the path to the Hekkus headers to your project by going to Projects...Settings...C++...Preprocessor and add the path to the Additional Include Directories box. Be sure you do this setting for All Configurations to save yourself some trouble.

(2) Add the path to the Hekkus lib file appropriate for each build you want to have available by going to Projects...Settings...Link...Input and add the path to the Additional Library Path box. Remember, you'll have to do this for each build you want to do.

(3) While still on that tab, add winmm.lib to the Object/Library Modules box. You might have to add a path to this as well, although on my system I didn't have to, so VC++ knew where to find it on it's own.

That should be it for project configuration. Now, on to the code...

(1) In your main header file, do an #include "HSS.h" and add #pragma comment(lib, "hss.lib") as well. You most likely have a #pragma for the GD lib file, just throw it in after that.

(2) Define a property in your game class as follows:

Sound sndHekkus;

Name it whatever you wish of course.

(3) In your game class' InitInstance method implementation, add:

sndHekkus.open( 11025, 8, false, 0, 8 );

Of course, change the parameters as appropriate.

(4) In your game class' ExitInstance method implementation, add:

sndHekkus.close();

(5) In your game class' onMinimize method implementation, add:

sndHekkus.suspend();

(6) In your game class' onRestore method implementation, add:

sndHekkus.resume();

That should do it, you should be able to use Hekkus now in your game.

As Thomas alluded to, the only thing you should have to do differently if you are using eVC++ is to not bother with winmm.lib.

All in all I'd say if you want to have the easiest time of it, use Thomas' class. If you want to stay with a more decoupled approach (i.e., keep GD and Hekkus as separate as possible), you can add it yourself as per the above instructions. I personally prefer that approach, that way I don't have to wait for Thomas to update his class should a newer version of GD break it in some way, but if your going to count on anyone, Thomas and Johan are very good choices, so I wouldn't worry too much either way.
Thank you both for your replies - I now have sound in my game. I was using the minimal example and I thought I had everything in place when I wrote the first post but I had forgotten the calls to CGapiHekkusApplication::InitInstance() and CGapiHekkusApplication::ExitInstance(). Once I had added those it all worked perfectly.

Just one more question though - does the call to CGapiHekkusApplication::ExitInstance release the resources used by Hekkus or do I have to do that manually?

Gersen - thanks for an excellent engine. I can't believe how well it works with no noticeable loss in performance on my Orange SPV!!
Thanks for your consideration about Hekkus gevans :)

About your question, no hekkus doesn't release any resource automatically so you have to do it manually.
how does hekkus compare to fmod. I paid some amount of money and did the sharware license for fmod. How does hekkus compare? Also is there a website for hekkus?
I think that statement about not releasing resources could be a little misleading for some... Gersen, correct me if I'm wrong, but Hekkus won't release YOUR resources, right? By "your resources" I mean the resources a person's application uses... What I mean is, it won't automatically release any SoundFX or Module objects I create, but anything internal like mixing buffers and the like it does release, right?

(I know, it's kind of a silly question because we'd all be hammering you by now if it wasn't releasing it's own internal resources, but someone might have this question based on your statement a post or two ago :) )

How does Hekkus compare to FMod? FMod costs money for commercial apps, Hekkus does not. What more do you need to know?!? :)

Seriously though, I think it's fair to say, and Gersen I think would probably agree, FMod is more advanced and feature-rich than Hekkus is at this point. I guess if you need or want the absolute king of sound libraries, at this point you'd probably have to go with FMod.

Give Hekkus time though... I've watched this thing grow in under a year into something that is really excellent, and I think it's only going to get better.

At this point, it's a low-cost, open-source, excellent-performing, easy-to-use, cross-platform library, and those are all very important considerations.

Do you need Ogg Vorbis support? Sorry, FMod it is. Need spectrum analysis, recording capabilities or DSP effects? Ok, Hekkus isn't going to do it for you. But if you don't need those things, Hekkus will do the job very nicely.

Gersen, do you have a development map for Hekkus at this point that you could share with us? I know for myself, there are a couple of features I'd love to see Hekkus have sooner rather than later, and I'm wondering what your plans are and if perhaps a Hekkus wish-list thread might be something that would be helpful?
fzammetti wrote:
I think that statement about not releasing resources could be a little misleading for some... Gersen, correct me if I'm wrong, but Hekkus won't release YOUR resources, right?


Right :)
All internal resources used by Hekkus (mixing buffers and sound driver's stuff) are released with the Sound::close() function that are called on CGapiHekkusApplication::ExitInstance()... You have only to release Music and SoundFX objects that you have allocated for your game. You have to paid attention WHEN you release them, remember that if you release a Music or SoundFX object that are playing your game will crash and burn! So stop it before release it.

fzammetti wrote:
Seriously though, I think it's fair to say, and Gersen I think would probably agree, FMod is more advanced and feature-rich than Hekkus is at this point. I guess if you need or want the absolute king of sound libraries, at this point you'd probably have to go with FMod.

Give Hekkus time though... I've watched this thing grow in under a year into something that is really excellent, and I think it's only going to get better.

At this point, it's a low-cost, open-source, excellent-performing, easy-to-use, cross-platform library, and those are all very important considerations.

Do you need Ogg Vorbis support? Sorry, FMod it is. Need spectrum analysis, recording capabilities or DSP effects? Ok, Hekkus isn't going to do it for you. But if you don't need those things, Hekkus will do the job very nicely.


I absolutely agree :)
If you need some advanced features that Hekkus don't support use fmod! If you need basic features like background music and wave mixing with very low power usage you should try Hekkus. And, of course, it's free.

tedson wrote:
Also is there a website for hekkus?


http://www.shlzero.com
http://www.shlzero.com/hss.asp

fzammetti wrote:
Gersen, do you have a development map for Hekkus at this point that you could share with us? I know for myself, there are a couple of features I'd love to see Hekkus have sooner rather than later, and I'm wondering what your plans are and if perhaps a Hekkus wish-list thread might be something that would be helpful?


Normally I add a new feature when I need it on my game so I don't have a real development map for Hekkus. Someone have asked for wave compression and XM support and I think this are the features that, when I have the time, I want to implement on Hekkus.
I want to release the nokia series 60 port too (but probably not for free) and made a port for Palm and Zaurus. This aren't a problem but I don't have a Palm or a Zaurus... if someone want to contribute... :)
Yes, compressed WAVs is my #1 request.

I was thinking maybe Ogg might be a good choice... plenty of implementations to look at... But if not, ADPCM, MPEG Layer-3 or maybe MobileVoice would be good choices.

Currently I'm having to use ZLib and do a quick uncompress before loading the resources... Not a big deal, but I think something like Ogg would give better results both quality and size-wise, and certainly makes my application code cleaner.

For me at least, everything else comes second to compression, I find Hekkus quite sufficient in every other way.

Actually, MIDI support would be the next thing. I'm a musician myself, but tracking MODs is a huge pain in the a**. MIDI's rather easy though, and even though you don't get something that sounds quite as good, the convenience of it makes it worth it.

Ah, just my $.0000000002 anyway.
Fzammetti, you definatly dont want Midi support, you think you do, but I know you dont :P .

Midi works by having a database of each possible instrument. This requires quite a good bit of storage unless you want some really crappy samples. For example, I have a high quality midi soundbank on my computer that is 50 megs.

I entirely agree with you that protracker mods are not fun to play with, they lack alot of the options midis have.

As Gerson was saying he might impliment XM's which pretty much kick ass. They have pretty much the same feature set of midi's, but they come with the samples they need built in. Since they are built into the music file like mods are, you can decide on the quality you want the sound to be.

An XM can sound much better than midi since it comes with its own samples, and should sound the same no matter what sound card is playing it.
I know what your saying, and I totally agree. However, and maybe you can point me in a better direction that what I've seen... Is it any easier to make XMs than MODs? I mean, I've played with about 10 different trackers, and they are all complicated as hell and don't really let me just plug in a keyboard and record, as I can do with Cakewalk to create MIDIs. This is really my biggest concern, because I've seen some relatively small MIDI sound banks that don't sound horrendous (and many players let you not have a complete 128 sample library and instead let you only use the ones you need).
Try the ModPlug traker, it can easily convert from a standard midi to an XM,s3m, and a few others. It will also convert to a protraker mod, but unfortunatly since the featureset is very small it doesnt always work very well.

I have found that a midi converts very well over to a s3m, and a XM shouldnt be any different really.
I played with that one, and it was the most coherent of the bunch. However, converting over didn't seem to work very well at all. Concievably though I was trying to go to MOD, which as you say doesn't work too well (I read that a bunch of times too). I'll give it a shot again though, but if Hekkus doesn't support XM it won't do me much good. (Hey Gersen: HINT-HINT! :) )
I don't like midi, writing a midi player is a very horrible thing and I don't want to have nightmare every night... :)

Converting midi to a module format (mod, s3m, xm...) is an horrible thing too, so don't do that please :)

However if you want ot do it (why?) mod format give you the worst conversion quality because it don't support some type of effect that midi support. XM instead is the best choice for this operation, but normally you give a file that are very big compared to the midi file.

I only can suggest to search for a good tracker man and tell him if he can write some mod music for your game... I have do that and the result are very, very good :D
I hear you Gersen, I wouldn't want to write a MIDI player either (although I just may...)

I can't seem to get ModPlug to conert a MIDI file anyay (Actually, I can't even get it to PLAY one right, I think there's no sample data, but I'm just guessing), so I probably won't bother going down that route either.

I don't want to go find a MOD man though, (a) because I can't afford to pay him and (b) being a musician myself, it seems like such a waste.

Now, if you'd be kind enough to add MP3, WMA or Ogg support to Hekkus, I can just record as WAVs and go with that :)

(No pressure :) )
Uhm, MP3, Ogg, WMA support... Uhm, you should consider to learn how to write a mod, believe me :)

Ogg are a good music format, have good performance and is open and free. But for now you can't play a background ogg file (or mp3 or wma) and get a good framerate, ppc aren't fast enought.
Really? I'm surprised to hear that. But, I accept your expertise in the matter. Maybe I'll put in a day next weekend and try and figure out the MOD trackers then.
Fzam, you have to get the modplug quickstart package, comes with samples and is easy to use.
gerson, dont protraker mods have a set tempo? Thats a big problem I have with them. .s3m and .it support a wider range of functions, but Im sure they are harder to decode. Mods are great, its just that the standard protracker .mod format is kind of aggervating to work with.
ProTracker mods support set tempo effect. This effetc is the same on XM module. Someone don't know but XM is a superset of protracker module. XM means eXtended Module and the format that it extend is the ProTracker standard.
Thanks Anon, I didn't have that, I just downloaded it and I'll play with it tomorrow.

** Edit 10 minutes later...

Anon, it doesn't include samples... Do you know if they changed it for maybe some legal reason or perhaps I got something wrong?

Alternatively... All I'm looking for is a simple General MIDI sound bank to use... If anyone has one they can toss may way, I would be eternally grateful :)
Fzammetti, Anon was me, I just checked to see what I had vs what you can download from modplug.com. The quickstart package I have seems to be the same size , 2.7 megs.

It automatically loaded samples for me. Its possible it knows how to grab them from my sound card(I have a SB Live).

2.7 megs seems kind of small for comming with samples, but it worked pretty flawless for me.

Oh, and to add to what you said Gerson, I believe all of the mod formats were derived from the protraker format.
I haven't played with Hekkus for a while, I started to add it to my project, but I am getting a linker error.

error LNK2019: unresolved external symbol "public: bool __thiscall Sound::open(unsigned int,unsigned int,bool,unsigned int,unsigned int)" (?open@Sound@@QAE_NII_NII@Z) referenced in function "public: virtual long __thiscall CMyApplication::InitInstance(void)" (?InitInstance@CMyApplication@@UAEJXZ)


I cant seem to figure out whats wrong, I have all the files included as well as winmm.lib and hss.lib.

I just tried the same things I did for Vis Stuido.net and it works just fine in EVC.

Anyone have any ideas?
If you are using vs.net remember to recompile the hss.lib. The precompiled version of the lib included on the package are compiled with vs 6.0 and don't works properly on vs.net. I don't know why :?
twelvegames · 05 Sep 2003, 21:42 UTC — Thanks
I wanna say thank you to fzammetti for the quick help to implement HekkusSOund in the Gapi 2.04.

I've included it in few seconds.
twelvegames · 05 Sep 2003, 21:42 UTC — Thanks
I wanna say thank you to fzammetti for the quick help to implement HekkusSOund in the Gapi 2.04.

I've included it in few seconds.
I don't remember helping you, but I'll say your welcome and take credit anyway :)
twelvegames · 05 Sep 2003, 22:41 UTC
I mean the Tutorial you wrote on this Topic.

www.twelvegames.com

info@twelvegames.com

Capoeira Fighter II for PocketPC,Smartphones,PALM
Ok, this is odd... Either you have me confused with someone else (in which case, as I said, I'll be happy to take credit!) or my memory is flaking out worse than my old Palm did. I don't remember writing a tutorial.

Then again, I don't remember much these days, so that's not as odd as it seems.
Twelvegames · 06 Sep 2003, 09:01 UTC
fzammetti wrote:
To expand on what Thomas wrote...

I was unaware of the new class he put together actually, so I can tell you how to integrate it with GD 2.04 without using that class... Note that there are a few parts that you could do differently, but this is one approach...

I'm going to assume that you are using VC++6.0 and that you have a main header file where your game class is defined...

(1) Add the path to the Hekkus headers to your project by going to Projects...Settings...C++...Preprocessor and add the path to the Additional Include Directories box. Be sure you do this setting for All Configurations to save yourself some trouble.

(2) Add the path to the Hekkus lib file appropriate for each build you want to have available by going to Projects...Settings...Link...Input and add the path to the Additional Library Path box. Remember, you'll have to do this for each build you want to do.

(3) While still on that tab, add winmm.lib to the Object/Library Modules box. You might have to add a path to this as well, although on my system I didn't have to, so VC++ knew where to find it on it's own.

That should be it for project configuration. Now, on to the code...

(1) In your main header file, do an #include "HSS.h" and add #pragma comment(lib, "hss.lib") as well. You most likely have a #pragma for the GD lib file, just throw it in after that.

(2) Define a property in your game class as follows:

Sound sndHekkus;

Name it whatever you wish of course.

(3) In your game class' InitInstance method implementation, add:

sndHekkus.open( 11025, 8, false, 0, 8 );

Of course, change the parameters as appropriate.

(4) In your game class' ExitInstance method implementation, add:

sndHekkus.close();

(5) In your game class' onMinimize method implementation, add:

sndHekkus.suspend();

(6) In your game class' onRestore method implementation, add:

sndHekkus.resume();

That should do it, you should be able to use Hekkus now in your game.

As Thomas alluded to, the only thing you should have to do differently if you are using eVC++ is to not bother with winmm.lib.

All in all I'd say if you want to have the easiest time of it, use Thomas' class. If you want to stay with a more decoupled approach (i.e., keep GD and Hekkus as separate as possible), you can add it yourself as per the above instructions. I personally prefer that approach, that way I don't have to wait for Thomas to update his class should a newer version of GD break it in some way, but if your going to count on anyone, Thomas and Johan are very good choices, so I wouldn't worry too much either way.


Here what you wrote.
Oh! That! You called it a tutorial, so I was thinking I wrote something "official" at some point and forgot.

No, I just wrote a post in a message board and forgot :)

Unfortunately, that becomes less and less uncommon as you get older.

As I said at the start, I'm glad I could be of assistance.
Twelvegames · 07 Sep 2003, 12:24 UTC
I hope to help too.Anyway, the Hekkus is really good and simple to use, i've added sound to my new project quickly. I think i will add a Splash screen (with logo) when my game start, this is the minimin i can do for this guy (Sei italiano?).
Anyway it would be great to recieve the Logo.


info@twelvegames.com[/url]
Sì sono italiano :)
E tu? Un italiano a New York? Mandami una mail, mi farebbe piacere scambiare due chiacchere.

gersen@shlzero.com

Well, some little italian spam... :)