PocketMatrix forums

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

Sound in Gapidraw? Hekkus? fmod?

I am using VS.NET2003 & EVC++ 4 to develop for the pocket pc. I havent started playing with sound yet but i thought of getting some feedback on it before i did.

i have searched the forum and i found that people use the Hekkus Sound System with GapiDraw. There is an explanation in this thread how to use that system so i am pretty sure i will be able to set it up to work. However that thread was written a year ago,does it work with the latest verstion of gapidraw?

Also did anyone use fmodwith Gapidraw? I have made a simple game in the past and i used fmod for sound and i am familiar with it thats why i consider it. Any pros or cons for using Hekkus or fmod?

Any info will be apreciated
That thread should still be valid, although some of the method names have changed. I don't think you'll have any problem updating it though, just open up the latest Hekkus docs and you should be able to get sound integrated in about 10 minutes, if that.

I've only ever used Hekkus (and my own engine that I stopped developing in favor of Hekkus), so I can't comment on FMod (I glanced at it a while back, but that's about it). I think Hekkus is fantastic, so to me there's no need to look any further, unless there's something you really need that it doesn't support.
hmmm everything compiles but i hear not sound. am i doing someting wrong? here are some bits of code where hekkus was added. i am compiling this on xp, i did not try for the ppc yet.

#include "HSS.h"
#pragma comment(lib, "hss.lib")


hssSound sound; //hekkus sound
hssSpeaker speaker;//hekkus speaker


HRESULT CMyApplication::InitInstance()
speaker.open( 11025, 8, false, 0, 8 );

HRESULT CMyApplication::ExitInstance()
speaker.close();


HRESULT CMyApplication::OnMinimize()
speaker.suspend();

HRESULT CMyApplication::OnRestore()
speaker.resume();


MyPlayer::MyPlayer(HINSTANCE hInstance)
sound.load(hInstance, IDR_SND_EXPLOSION);

speaker.playSound(&sound;);
Not sure if it matters, but try adding:

speaker.volumeMusics(64);
speaker.volumeSounds(64);

...after you open speaker. I thought it defaults to 32, medium, but maybe it doesn't. I'm actually not sure if my code sets volumes before playing anything, I might have without thinking about it so never saw a problem. Otherwise, check the return code from the sound.load() call and see what you have. Possibly the sound isn't even loading.
hmm tried the

speaker.volumeMusics(64);
speaker.volumeSounds(64);

but still nothing. i wish there was a minimal project with sound working but the ones that are on hekkus site are for previous versions of gapidraw. I'll search a bit more and see what i can find
thanks fzammetti, i found the problem

changed the code

Code:
sound.load(hInstance, IDR_SND_EXPLOSION);


with

Code:

sound.load(_T("explosion.wav"));


anyone knwos why it does not work when using resources??? I use resources to include my sprites in gapidraw and i dont have a problem. I saw that code by using resources in a hekkus gapidraw 2 sample project. Maybe the code is diferent now to get it working with resources???[/code]
Hekkus definately works with resources as I'm using it that way in Baseball Today. Be sure you have the right hInstance passed in the load method. I'm using m_hInstance supplied by GapiDraw.
ppcStudios , well can you post the exact line of code which use have and uses resources? is it with the latest hekkus version?

Below is some of my code, as you can see hInstance is passed over to the apropriate place from gapidraw, if i use the same hInstance passed to create a surface i do not have a problem. So my guess is that the code i use to load a sound using resources is not ok.

Code:
HRESULT CMyApplication::CreateVidMemSurfaces(CGapiDisplay* pDisplay, HINSTANCE hInstance)
{
pGamePlayer = new MyPlayer(hInstance) ; // the player object
pGameEnemy = new MyEnemy(hInstance) ; // the player object

//1// sound.load(hInstance, IDR_SND_EXPLOSION); // does not work

//...other code
}

//constructor of the object MyPlane
MyPlayer::MyPlayer(HINSTANCE hInstance)
{
sound.load(_T("explosion.wav")); // works but not with resources
//2// sound.load(hInstance, IDR_SND_EXPLOSION); // does not work
// ...other code
}
Here's code from me loading a resource...

hssSound* laser;
laser->load(m_config.hInstance, SFX_LASER);
Hi,
I also had a problem of that kind with hekkus but it was with a .mod file.
I found that on the hekkus forum on www.shlzero.com:
"When you add on your .rc file a .mod set it of type PTMOD
ie
IDR_MOD PTMOD DISCARDABLE "ars.mod" "
Maybe it is the same problem that you have...
anyway you can check the forum on hekkus website or directly ask Thomas who developped hekkus, he is very friendly and answers very quickly.
Vincent.
Yes, Hekkus works with resource, just pay some attention on how you define your wave and module on the resource file

How can I add a .mod on my resource file?

on your resource.h file define a unique value
#define IDR_MOD_MYMUSIC 150
(150 is an example, use a different value for every module)

on your resource.rc file add your module file and set it to PTMOD type
IDR_MOD_MYMUSIC PTMOD DISCARDABLE "path\\mymodule.mod"

How can I add a .wav on my resource file?

on your resource.h file define a unique constant
#define IDR_WAVE_MYWAVE 151
(151 is an example, use a different value for every samples)

on your resource.rc file add your module file and set it to WAVE type
IDR_WAVE_MYWAVE WAVE DISCARDABLE "path\\mywave.wav"

thats all, if you still have problems feel free to contact me.
thanks for the repiles guys, but i still dont get it to work


in the resource.h file i have

#define IDR_WAVE_EXPLOSION 118

in the resource.rc file i have

IDR_WAVE_EXPLOSION WAVE DISCARDABLE "explosion.wav"


Instead of 118 thre was a negative value so i changed it to 118, also in the rc file all that was missing was the word DISCARDABLE.
You might want to delete that wav resource from your resource table, save your project and exit. Start eVC back up and import the wav resource again. It sounds as though you entered the resource by hand into the .rc file and the resource compiler was getting confused.
What return code are you getting when loading the resource? If I remember correctly, Thomas added a little more info in the latest version(s) with regard to return codes...
Thanks guys, now it works. Probably i needed to reload everything. Also it might have been the negative number that vs studio desided to assign to the resource or that DISCARDABLE i have added(thaever that does or means), nothing else changed in my code regarding sound.

Many thanks again for the help. As soon as i have someting playable i will post it here. Basicly the game i am making is for my university MSc dissertation, game scaling in particular. Nothing earth breaking thought, just enought code to pass my disseration. After that i will certainly work on it to make a nice game and hopefully release it.
InexorableTash · 28 Jul 2004, 05:07 UTC
Paris wrote:that DISCARDABLE i have added(thaever that does or means)


See http://weblogs.asp.net/oldnewthing/archive/0001/01/01/66159.aspx for an explanation of what DISCARDABLE means. (Short answer: nothing)

RaymondC's blog should be required reading for anyone who touches a Win32 API.