GP2X Sdl Test Program Thingy


Guyfawkes

Certified Idiot :)
Joined
Jan 11, 2004
Messages
795
Age
47
Location
London, UK
Website
www.emuholic.com
I released a little program with source code that I originally wrote to test out some of the SDL functions and extra Libraries such as SDL_TTF, SDL_Image, SDL_Mixer to see if they are working correctly with my dev setup.

No idea if it will be of any use to people but it makes a nice little first program to compile and test your dev setup and also to maybe learn how to setup a program to run on the GP2X and PC. I will add this to my GP2X User Guide on the next update.

So far it does a little test for the following:

SDL_TTF - True Type Font text
SDL_Mixer - WAV, MOD and OGG playback. OGG playback has volume and pause controls. MOD Playback seems to be slow at the moment, possible bug when compiling for GP2X?
SDL_Image - PNG, BMP and JPEG display with and without transparency
Input - GP2X and PC simulated buttons, useful when testing on PC
SDL Timer - Small example to make a timer

If you do want to test a certain function just comment out the functions code and it should run fine. Dont forget to copy the /sdltest folder to your SD Card otherwise it wont run correctly, I also added a GPE if you just want to check it out without compiling. Thanks to Rlyeh for his GPE Compressor.

Hopefully someone will find this useful in one way or another, you can download it from GP2X Archive here.

NOTE: I made a mistake in the source and uploaded a new version (just waiting for it to be verified by the GP2X Archive admin), if the download is named sdltest.rar there is a missing line of text in the source, add the following to line 399:

Code:
if(option==6){TestSDLMixerMOD();}

If the filename is sdltest-v10.rar then you wont need to do this.

[UPDATE] Nearly forgot, I have nearly finished porting Bunny Traps to the GP2X, should be released later today or tomorrow.
 
Thank you very much, Guyfawkes. Great work!

Which libraries are you using? I'm using Theoddbot ones (latest beta) and even though SDL_mixer works, there's a latency of almost 1 second when playing OGG files. To avoid that latency in my game, I changed the Mix_OpenAudio call so that it looked like this:
Code:
Mix_OpenAudio(22050, AUDIO_S16, 2, 128)
As you'll notice, I've reduced chunksize a lot. This way there's no latency, but it sounds mono and it's not as loud as it should be (the OGG I'm using is stereo and it sounds properly when played from GP2X music player). I've tried replacing that call and use yours instead, but same results...
 
Im also using theoddbot ones, beta 2 release.

I havent looked too much into the SDL_Mixer side of things as yesterday when I was writing the code I was half deaf due to standing next to great big speakers at full volume all night at a club :) I had to get someone else to listen to the OGG playback to check it out.

From some earlier tests I think that reducing the chunksize made the MOD file play a lot more distorted than it currently is (listen about 30 seconds into the MOD). I will check this out if I get some time later on as I am sure reducing the chunksize messed things up on the PC build so I think its a case of finding the right settings for the GP2X. I will also try with some other OGG test files (left and right seperate audio etc) to see any other problems.
 
Back
Top