GP2X Problems With Sdl_mixer


Trenki

Member
Joined
Jun 15, 2006
Messages
114
Age
41
Location
South Tyrol, Italy
Website
www.trenki.net
Hi!

I have a problem with SDL_Mixer! The first problem is on Windows with the current 1.2.7 release of SDL_mixer. If I try to load an ogg file in the following program it causes an access violation in the line Mix_LoadMUS! Others seem to have the same problem but I couldn't find a solution googling.

The other problem I have is on the GP2X. After wrestling with a lot of undefined references I managed to compile it changing the order in which the libraries are specified in the command line. Now the following program compiles but with this warning:

c:/devkitGP2X/lib\libmikmod.a(mdriver.o): In function `MD_DropPrivileges':
../playercode/mdriver.c:919: warning: Using 'getpwnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking


In the end when I run it with an ogg or a wav file it seems to load it since the line "failed to load music" is not print to the telnet console but it also does not play any sound and the application also doesn't quit.
When trying to quit the program using Ctrl-C it does not react for a while and eventually aborts execution with the message:

Fatal signal: Segmentation Fault (SDL Parachute Deployed)
*** glibc detected *** double free or corruption (!prev): 0x002330b0 ***
Aborted


So here is the test program I used and compiled with devkitGP2X. If anyone has a solution to the windows and GP2X problem please tell me.

CODE
#include "SDL.h"
#include "SDL_mixer.h"

int main(int ac, char *av[])
{
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO);
SDL_SetVideoMode(320, 240, 16, SDL_HWSURFACE);

Mix_OpenAudio(MIX_DEFAULT_FREQUENCY, MIX_DEFAULT_FORMAT,
MIX_DEFAULT_CHANNELS, 4096*4);

Mix_Music *m = Mix_LoadMUS("LoopyMusic.wav");
if (m){
Mix_PlayMusic(m, 1);
while (Mix_PlayingMusic());
} else {
printf("failed loading music!");
}

Mix_FreeMusic(m);
Mix_CloseAudio();

SDL_Quit();
}
 
I also have a problem that sound isn't played... :S I should really Telnet and look for messages I guess...

Can't say I know what's going wrong there. hmmm although it looks like you are mixing to many samples for the GP2X
I have this in my Music SDL_Mixer interface class:
CODE

Music::Music()
{
music = NULL;
#ifdef GP2X
Mix_OpenAudio(MIX_DEFAULT_FREQUENCY, AUDIO_S16, MIX_DEFAULT_CHANNELS, 128);// Initialize SDL_mixer for GP2X,.
#endif

#ifdef WIN32
Mix_OpenAudio(MIX_DEFAULT_FREQUENCY, AUDIO_S16, MIX_DEFAULT_CHANNELS, 4096);// Initialize SDL_mixer for PC.
#endif
numLoops = -1; // default loop forever;
}
 
@PokeParadox: 4096 samples are definitly not to many for the GP2X. But I think 128 is way to small. This way you may hear only fragments of sounds because the buffer runs out before it can be filled anew.

I now copied Guyfawkes' sdl-libs-211006.zip from the gp2x archive into my devkitgp2x directory and used the SDL_mixer library supplied with it. Now it runs my code example without any problems.

But now there is another problem: The SDL_Mixer library supplied in the sdl-libs-211006.zip used libmad.
libmad is GPL!!! so linking to SDL_Mixer which uses the GPL'ed libmad automatically requires one to also GPL its own source!! This is not acceptable.

Tomorrow i will try to compile the SDL_mixer source from the original SDL Website and see if It solves the problem without requireing libmad and if it also solves the access violation problem when playing oggs in windows.
 
I've now tried to compile SDL_mixer 1.2.6 from source without libmad but with tremor using patch from the archive bit I don't get it to work. It fails at compiling. Does anyone have a statically precompiled SDL_mixer that uses tremor but is not linked libmad?

Edit: The build said error at the last line when it wanted to compile playwave but libSDL_mixer was compiled successfully without libmad so that's all i need. Now I still need to get ogg playback working on windows without an access violation.
 
You got it working ok now? If not, let me know. I had this sort of issue when getting MIDI music working with libSDL_mixer, and had to compile my own static lib as well.
 
Yes I got it working on the GP2X.
@PokeParadox: I tested with various numbers of samples. 4096 was to large an made my graphics stutter. I used 512 and that works fine.

For the Windows version 1.2.7 I still get the crash. I contacted Sam Lantinga about this and he said he will look into this. Meanwhile I use 1.2.6 on windows which works.
 
Back
Top