GP32 SEF FILES!!


TheMrCul

Still Fresh
Joined
Apr 18, 2003
Messages
52
Please help me!
If I convert my sounds to c source code and include them into my main .fxe file the sounds work almost fine (except for the annoying clicking sound)
but,
if I convert them to .sef files and load them into an unsigned short pointer (unsigned short*) I either get silence or servere static. I've also tried converting them into raw format but when the game tries to load or play them (i'm not sure which) it stalls the GP32.

What am I doing wrong?
Both are exactly the same except that one has the c source code built-in to the .fxe and the other loads the sef files seperately from the main .fxe file.
here is my code:

GpPcmInit(PCM_M22,PCM_8BIT);

GpFatInit();


//Initialise
F_HANDLE fh;
ERR_CODE err;
unsigned long n_size,n_read;
char * app_path;
flag = 1;

#if GP_DBG
GpAppPathSet("gp:\\game\0", 20);
#endif
app_path = GpAppPathGet(NULL);

//clean the screen
GpRectFill(NULL, &gpDraw[0], 0, 0, 320, 240, 0x00);
GpRectFill(NULL, &gpDraw[1], 0, 0, 320, 240, 0x00);

//Load the Rain Fade in Sound
err = GpFileOpen("gp:\\Game\\GpThug\\Sound\\Intro\\RainFade.snd",OPEN_R,&fh);
err = GpFileRead(fh, & n_size, 4, & n_read);
err = GpFileRead(fh, & n_size, 4, & n_read);
RainFade = (unsigned short *)gp_mem_func.malloc(n_size);
err = GpFileRead(fh, RainFade, n_size, & n_read);
GpFileClose(fh);

GpPcmPlay((unsigned short*)RainFade, sizeof(RainFade), 0);
 
Yo!

The sound clicking sound is due to the header, you have to remove it by yourself
(it was the reason for me).

for the silence :

GpPcmPlay((unsigned short*)RainFade, sizeof(RainFade), 0);

is bad, use :

GpPcmPlay((unsigned short*)RainFade, n_size, 0);

instead (because sizeof(RainFade) == sizeof(unsigned short*) == 4)

Thor
 
Sound header and size infomation have already been removed by reading 4 bytes twice. Perhaps clicking comes from using GpRectFill. It interferes with sound output, causing a clicking noise. It was explained somewhere in this board.
 
Thanks for your help rtb7 and Alex, the sounds play now. If I take out the lines of code for GpRectFill(); the sound doesn't click! What I did was get a double for loop to build full screen white and black pictures and I now use Gpbitblt to clear the screen using the pictures I built within the program (a couple of bytes) instead of including or loading a full screen picture (76kb). so happy! Thanks guys!
 
Back
Top