GP32 Need some help...


don

AWSMOE!
Joined
Dec 23, 2003
Messages
635
Location
$$$GERMONEY$$$
Website
gp32.chemicalkungfu.de
Hi,

I got my GP32 nearly 2 weeks ago and already started my first game project, although a very simple one. It is a conversion of the old arcade classic seawolf (more or less). I know my code is ugly and far from being optimized, and that's where i need some help.
I paint the sky and the sea with GpRectFill. And that is obviously a big problem for playing sound. I already bugged some of you people on irc (sorry rlyeh ;) ) but still i did not succeed.
I tried to bypass GpRectFill by using some kind of tile engine to paint the sky and the sea, but it still crackles.

So possibly someone could help me by having a look at the source code:

Seawolf source

or by having a look at the .fxe:

Seawolf.fxe

The source tarball is about 1.5 megs (mostly because of the audio samples, i guess) and already contains the .fxe.

So far, it all worked out really easy, but that sound stuff is bugging me for ages now. I also had a look at CHN's soundbuffer.c, but as you can see in my source code, i am a real lame ass c coder and do not understand soundbuffer.c completely.

Hoping for help,

Regards, Don.
 
Are you sure that your samples are encoded with the correct combination of Quality and Bit Rate? I've read a few posts that say this could cure crackling problems. Try encoding your samples in 8Bit 11Khz Mono and see what happens.
 
All the samples (well apart from the title music one) are 8bit/11khz/mono. They are playing flawless, when i play them without drawing something on screen in between. So I guess the samples are all right.
 
RectFill is most likely causing the problems. Instead of using RectFill, create an image and use memcpy or gpbitblt to draw it on to the surface. This will be a lot faster than rectfill and will do the same job.
 
I fixed the crackling sound by just whacking the clockspeed up a notch.

GpClockSpeedChange (80000000 , 0x48012, 0); //set speed to 80Mhz

I put that in every project I do as standard and I have not had a crackling audio problem since, regardless of how many gprectfills or whatever I use.

Also it works for both the sample rates I like to use, 22,050 8 and 16 bit stereo.

I'd be interested to hear if this solves things for you, although I appreciate it's more of a bodge than a solution ;)

Wub.
 
@Nitro:

I did not try memcpy so far, but gpbitblt did not do the job.

@Wub:

Changing the clock speed indeed worked. I already tried it with 133mhz, that worked well, too. But I think cheap games like mine should not need overclocking. ;) 80mhz seems like a quite good compromise to me. Never thought of 80mhz though.
I think I'll stick with that 80mhz solution until I come across something more clean. Thanks for all support. ;)

Regards,
Don

(Damn, need to adjust game speed now. ;) )
 
I fixed the crackling sound by just whacking the clockspeed up a notch.

GpClockSpeedChange (80000000 , 0x48012, 0); //set speed to 80Mhz

I put that in every project I do as standard and I have not had a crackling audio problem since, regardless of how many gprectfills or whatever I use.

Interesting...as well all know, 40MHz is the default speed. Could it be that the sound code takes the clock speed into account, and fails doing some action (which actually fixes the problem) if it's not the default? Hmm...
 
Aswell as YOU know.
I'm pretty sure that the GP32 starts up at 67mhz.
I have no idea where you got that 40mhz from..
There is a setting in gpstart.c or smth wo you can run your app in 40mhz instead of 67mhz.
Dunno if thats what you're talking about.


And about the crackling sound.
Read the damn samsung documentation some time.
There is a pretty good explanation about the problem over there.
And i assume you won't believe me (as usual) BUT THE PROBLEM _IS_ EXPLAINED THERE!. And they also have some solutions to it.
so, go out and get the users manual for s3c2400x.
 
I don't know if the various gp32 gcc packages floating around have different versions of the files, but my configuration (debian package) has this in initval_port.h -
Code:
#define CHANGE_MCLK  0        	// If the CHANGE_MCLK is zero, the clock speed of process is 40MHz
gpstart.c only tries to set a different clock speed if CHANGE_MCLK!=0, and from tests I've done my apps run faster if I set a clock speed of 67. But maybe my configuration is forcing 40mhz somewhere else?

initval_port.h does also include the line #define DEFAULT_MCLK 67800000, but this value doesn't seem to be used anywhere :blink:
 
Well, i actually dunno about that header.

But, if you write a small test app, which don't use the SDK at all (no gpstart.c etc), you can
read the FCLK from 0x0c7b0000.
I guess it's the FW that writes those values there, but they are also AFAIK needed for the SDK(Timers etc.) so they should be correct.
Anyway, if you read that value you'll probably get 0x040a8bc0(67800000)

---
mithris
 
Aswell as YOU know.
I'm pretty sure that the GP32 starts up at 67mhz.
I have no idea where you got that 40mhz from..
There is a setting in gpstart.c or smth wo you can run your app in 40mhz instead of 67mhz.
Dunno if thats what you're talking about.

I meant 40MHz as the base of the clock, not programs.
 
Back
Top