Quote Originally Posted by WILL
Hey Paul. I've sort of been following the GP2X/JEDI-SDL development from the side-lines. For clarification, are the programs crashing/popping up errors because of the sdl_mixer code in the sdl_mixer.so file it's self?

For PNG what exactly is the Linux solution for this anyhow? I know that for Windows I use PNG with a series of DLL files such as; libpng13.dll, jpeg.dll and of course SDL_image.dll.

Now I'm assuming the PNG issue is directly with SDL_image or is it less obvious than this?


I too am interested in GP2X dev as a portable platform for anything I might release, but like Jason I use PNG for all my graphics and sdl_mixer to play music.

So one more guy routing for ya!
thanks for the encouragement Will

I am experimenting with a simple c library that I am compiling to .o format so I can ]Linking sdlibltest
sdlibltest.o: In function `P$SDLTEST_SHUTDOWN':
sdlibltest.dpr:(.text.n_p$sdltest_shutdown +0x24): undefined reference to `gp2x_Mix_FreeMusic'
sdlibltest.dpr:(.text.n_p$sdltest_shutdown +0x28): undefined reference to `gp2x_Mix_CloseAudio'
sdlibltest.o: In function `P$SDLTEST_OPENAUDIO$$BOOLEAN':
sdlibltest.dpr:(.text.n_p$sdltest_openaudi o$$boolean+0x50): undefined reference to `gp2x_Mix_OpenAudio'
sdlibltest.o: In function `P$SDLTEST_LOADMUSIC$ANSISTRING$$POINTER':
sdlibltest.dpr:(.text.n_p$sdltest_loadmusi c$ansistring$$pointer+0x28): undefined reference to `gp2x_Mix_LoadMUS'
sdlibltest.o: In function `P$SDLTEST_PLAYMUSIC$POINTER$LONGINT$$LONGINT'&#58 ;
sdlibltest.dpr:(.text.n_p$sdltest_playmusi c$pointer$longint$$longint+0x20): undefined reference to `gp2x_Mix_PlayMusic'
sdlibltest.o: In function `P$SDLTEST_PLAYINGMUSIC$$BOOLEAN':
sdlibltest.dpr:(.text.n_p$sdltest_playingm usic$$boolean+0x10): undefined reference to `gp2x_Mix_PlayingMusic'[/code]

my c library header file (gp2x_sdl_mixer.h)
Code:
#ifndef GP2X_SDL_MIXER
#define GP2X_SDL_MIXER

#include "SDL_mixer.h"

int gp2x_Mix_OpenAudio(int frequency, Uint16 format, int channels, int chunksize);
void gp2x_Mix_CloseAudio(void);
Mix_Music *gp2x_Mix_LoadMUS(const char *file);
int gp2x_Mix_PlayMusic(Mix_Music *music, int loops);
int gp2x_Mix_PlayingMusic(void);
void gp2x_Mix_FreeMusic (Mix_Music *music);

#endif

my c library definitions (gp2x_sdl_mixer.c)
Code:
#include "gp2x_sdl_mixer.h"

int gp2x_Mix_OpenAudio(int frequency, Uint16 format, int channels, int chunksize)
{
    return Mix_OpenAudio(frequency,format,channels,chunksize);
};
void gp2x_Mix_CloseAudio(void)                 
{
    Mix_CloseAudio();
};
Mix_Music *gp2x_Mix_LoadMUS(const char *file)
{
    return Mix_LoadMUS(file);
};
int gp2x_Mix_PlayMusic(Mix_Music *music, int loops)
{
    return Mix_PlayMusic(music,loops);
};
int gp2x_Mix_PlayingMusic(void)
{
    return Mix_PlayingMusic();
};
void gp2x_Mix_FreeMusic (Mix_Music *music)
{
    Mix_FreeMusic(music);
};
My pascal unit that includes the c library (gp2x_sdl_mixer.pas)

Code:
Unit gp2x_sdl_mixer;
{$IFDEF fpc
{$MODE Delphi}
{$ENDIF}

{$link gp2x_sdl_mixer.o}
{$linklib c}

Interface

Uses
    CTypes;

Type
    PMix_Music = Pointer;

Function  gp2x_Mix_OpenAudio(frequency : ctypes.cint32; format : ctypes.cuint16; channels,chunksize : ctypes.cint32) : ctypes.cint32; cdecl; external;
Procedure gp2x_Mix_CloseAudio; CDecl; external;
Function  gp2x_Mix_LoadMUS(Const filename : PChar) : PMix_Music; CDecl; external;
Function  gp2x_Mix_PlayMusic(music : PMix_Music; loops : ctypes.cint32) : ctypes.cint32; CDecl; external;
Function  gp2x_Mix_PlayingMusic : ctypes.cint32; CDecl; external;
Procedure gp2x_Mix_FreeMusic(music : PMix_Music); CDecl; external;

Implementation

End.
I compile the c library to .o by doing this:

Code:
arm-linux-gcc.exe -c gp2x_sdl_mixer.c -Ic:\devkitGP2X\include\SDL
When I try and use the unit in a program like so and link in the library I get the errors I posted

Code:
Uses
    SysUtils,
    SDL,
{$IFNDEF gp2x}
    SDL_Mixer
{$ELSE}
    gp2x_sdl_mixer
{$ENDIF}
    ;
Code:
Function  OpenAudio : Boolean;
Begin
{$IFDEF gp2x}
    Result := gp2x_Mix_OpenAudio(22050, AUDIO_S16, 2, 4096) = 0; // Initialize SDL_mixer
{$ELSE}
    Result := Mix_OpenAudio(22050, AUDIO_S16, 2, 4096) = 0;      // Initialize SDL_mixer
{$ENDIF}
    If Not Result Then
    Begin
        Log('Mix_OpenAudio failed: ' + SDL_GetError);
        Exit;
    End;
    Log('Mix_OpenAudio...');
End;
{..............................................................................}

{..............................................................................}
Procedure CloseAudio;
Begin
{$IFDEF gp2x}
    gp2x_Mix_CloseAudio;
{$ELSE}
    Mix_CloseAudio;
{$ENDIF}
End;
{..............................................................................}

{..............................................................................}
Function  LoadMusic(Const filename : AnsiString) : PMix_Music;
Begin
{$IFDEF gp2x}
    Result := gp2x_Mix_LoadMUS(PChar(filename));
{$ELSE}
    Result := Mix_LoadMUS(PChar(filename));
{$ENDIF}
End;
{..............................................................................}

{..............................................................................}
Function  PlayMusic(music : PMix_Music; loops : Integer) : Integer;
Begin
{$IFDEF gp2x}
    Result := gp2x_Mix_PlayMusic(music,loops);
{$ELSE}
    Result := Mix_PlayMusic(music,loops);
{$ENDIF}
End;
{..............................................................................}

{..............................................................................}
Function  PlayingMusic : Boolean;
Begin
{$IFDEF gp2x}
    Result := gp2x_Mix_PlayingMusic = 1;
{$ELSE}
    Result := Mix_PlayingMusic = 1;
{$ENDIF}
End;
{..............................................................................}

{..............................................................................}

any ideas?
cheers,
Paul