Hi all
Just wondered if there were any plans to support loading of MOD files (Soundtracker/Protracker) as this is a really great way to get small tunes onto GP2X :)
Use the fmod dll. On GP2X it might work with PLAYMUSIC - not tested, though.
Hi, thanks for the reply!
Any chance you could help me out with this? I presuming I'd need to use inline ASM or C++ to interface with the DLL but wouldn't know where to start. Help much appreciated :)
There is already a wrapper for Win32: See samples\_PROJECTS_\FMod
Thanks for the tip :)
Unfortunately the FMOD example doesn't work on the latest demo SDK even on Windows :
*** Configuration: WIN32 ***
precompiling:
GPC - GLBasic Precompiler V.2007.159 - 2D, WIN32
"fmod_player.gbas"(8) error : redefinition as different type
Any ideas?
Also, I don't believe there is FMOD for GP2X...?
Hi
I got that Premium SDK, and it works fine on my Windows System. But when i change it into a Demo Version (delete keycode ) :D, it doesn't work anymore. I guess, that you must buy it.:D
Cheers
Oh. How can that be? I thought the demo is fully featured!? I have to see.
I've the full version (5.047) and the example doesn't work :wah:
Works fine for me !
I dont have any errors/massages on the Compilerwindow...
So it works very well ;)
That's not fair!
Uhm.. Impossible. Please give the exact example, and the compiler output.
Here it is:
// --------------------------------- //
// Project: fmod_player
// Start: Tuesday, May 09, 2006
// IDE Version: 3.118
snd$ = "rb_1.it"
good = FMod_Load(snd$)
FMod_Play()
WHILE TRUE
PRINT "PLAY: "+snd$ + " returns: "+good, 100,100
PRINT "IsFinished: " + FMod_IsFinished(), 100, 120
PRINT "click mouse to stop", 100,140
IF MOUSEAXIS(3) THEN BREAK
SHOWSCREEN
WEND
FMod_Stop()
INLINE
DECLARE_ALIAS(FMUSIC_LoadSong, "fmod.dll", "_FMUSIC_LoadSong@4", (const char* name), void*);
DECLARE_ALIAS(FMUSIC_PlaySong, "fmod.dll", "_FMUSIC_PlaySong@4", (void* pMod), char);
DECLARE_ALIAS(FMUSIC_FreeSong, "fmod.dll", "_FMUSIC_FreeSong@4", (void* pMod), char);
DECLARE_ALIAS(FSOUND_Init, "fmod.dll", "_FSOUND_Init@12", (int, int, unsigned int), char);
DECLARE_ALIAS(FSOUND_Close, "fmod.dll", "_FSOUND_Close@0", (void), void);
DECLARE_ALIAS(FMUSIC_IsFinished, "fmod.dll", "_FMUSIC_IsFinished@4", (void* pMod), char);
void* g_pFMod = 0;
// need this for ESC-exits
struct FMOD_killer {~FMOD_killer() {IF (g_pFMod) FMod_Stop();} } g_Fmod_killa;
ENDINLINE
FUNCTION FMod_Load: fname$
GLOBAL fmod_init
LOCAL good
IF fmod_init = FALSE
fmod_init=TRUE
ENDIF
FMod_Stop()
INLINE
if(FSOUND_Init) FSOUND_Init(44100,64,0);
if(FMUSIC_LoadSong)
g_pFMod = FMUSIC_LoadSong(fname_Str.c_str());
if(g_pFMod) good = true;
ENDINLINE
RETURN good
ENDFUNCTION
FUNCTION FMod_Play:
INLINE
if(FMUSIC_PlaySong && g_pFMod)
FMUSIC_PlaySong(g_pFMod);
ENDINLINE
ENDFUNCTION
FUNCTION FMod_Stop:
INLINE
if(FMUSIC_FreeSong && g_pFMod)
FMUSIC_FreeSong(g_pFMod);
g_pFMod = 0;
if(FSOUND_Close)
FSOUND_Close();
fmod_init=FALSE;
ENDINLINE
ENDFUNCTION
FUNCTION FMod_IsFinished:
INLINE
char ok=1;
if(FMUSIC_IsFinished && g_pFMod)
ok = FMUSIC_IsFinished(g_pFMod);
return ok ? TRUE : FALSE;
ENDINLINE
RETURN TRUE
ENDFUNCTION
The compiler says "fmod_player.gbas"(8) error : redefinition as different type. The line it points to is the first one after the first INLINE command. DECLARE_ALIAS(FMUSIC_LoadSong, "fmod.dll", "_FMUSIC_LoadSong@4", (const char* name), void*);
Ooops. That one.
There's a single file that gives you the fmod function. Just include that one.
In yous sample, the main function was not closed, yet. Thus:
// --------------------------------- //
// Project: fmod_player
// Start: Tuesday, May 09, 2006
// IDE Version: 3.118
snd$ = "rb_1.it"
good = FMod_Load(snd$)
FMod_Play()
WHILE TRUE
PRINT "PLAY: "+snd$ + " returns: "+good, 100,100
PRINT "IsFinished: " + FMod_IsFinished(), 100, 120
PRINT "click mouse to stop", 100,140
IF MOUSEAXIS(3) THEN BREAK
SHOWSCREEN
WEND
FMod_Stop()
FUNCTION end_main_foo:
ENDFUNCTION
INLINE
DECLARE_ALIAS(FMUSIC_LoadSong, "fmod.dll", "_FMUSIC_LoadSong@4", (const char* name), void*);
DECLARE_ALIAS(FMUSIC_PlaySong, "fmod.dll", "_FMUSIC_PlaySong@4", (void* pMod), char);
DECLARE_ALIAS(FMUSIC_FreeSong, "fmod.dll", "_FMUSIC_FreeSong@4", (void* pMod), char);
DECLARE_ALIAS(FSOUND_Init, "fmod.dll", "_FSOUND_Init@12", (int, int, unsigned int), char);
DECLARE_ALIAS(FSOUND_Close, "fmod.dll", "_FSOUND_Close@0", (void), void);
DECLARE_ALIAS(FMUSIC_IsFinished, "fmod.dll", "_FMUSIC_IsFinished@4", (void* pMod), char);
void* g_pFMod = 0;
// need this for ESC-exits
struct FMOD_killer {~FMOD_killer() {if (g_pFMod) FMod_Stop();} } g_Fmod_killa;
ENDINLINE
FUNCTION FMod_Load: fname$
GLOBAL fmod_init
LOCAL good
IF fmod_init = FALSE
fmod_init=TRUE
ENDIF
FMod_Stop()
INLINE
if(FSOUND_Init) FSOUND_Init(44100,64,0);
if(FMUSIC_LoadSong)
g_pFMod = FMUSIC_LoadSong(fname_Str.c_str());
if(g_pFMod) good = true;
ENDINLINE
RETURN good
ENDFUNCTION
FUNCTION FMod_Play:
INLINE
if(FMUSIC_PlaySong && g_pFMod)
FMUSIC_PlaySong(g_pFMod);
ENDINLINE
ENDFUNCTION
FUNCTION FMod_Stop:
INLINE
if(FMUSIC_FreeSong && g_pFMod)
FMUSIC_FreeSong(g_pFMod);
g_pFMod = 0;
if(FSOUND_Close)
FSOUND_Close();
fmod_init=FALSE;
ENDINLINE
ENDFUNCTION
FUNCTION FMod_IsFinished:
INLINE
char ok=1;
if(FMUSIC_IsFinished && g_pFMod)
ok = FMUSIC_IsFinished(g_pFMod);
return ok ? TRUE : FALSE;
ENDINLINE
RETURN TRUE
ENDFUNCTION
works
I simply can't get it to work! The same error reappears.
QuoteOoops. That one.
'That' one was the original example of the fmod player you provided with GLBasic!
QuoteThere's a single file that gives you the fmod function. Just include that one.
What do you mean by 'include'? I copied the code you given here into a SINGLE gbas file (the original example consisted of 2 seperate gbas files). So this is not the right way?
The 2 file way is the best. One file for your game, the other file, untouched, as a library for the fmod wrapper. If you copy all in one file, make sure you indicate where the main game function ends, by writing a dummy function at the end. In my case "end_main_foo".
The "samples/_projects_/fmod_player.gbap" project works for me...
What i have to do using a gbas file as library?
As mod.
Only rightklick in right window in the file menu?
Or how i have zu insert this lib/mod/orwhatever?
right click in the file menu: Insert file, locate the file, press OK.
If it's in the file list, it will be compiled and used.
like the entity sys in german forum from you?and after compiling the commands are available?
You must not compile!
Lets see how it works:
If you have a couple of functions on a GBAS, and you include thisone to youre project(GBAP) , you can see all functions from the GBAS on the "Code-Completion"-Popup!
No chance. I would really like to know what I still make wrong! Now, I have 2 files again. The first one (main program) contains exactly this:
// --------------------------------- //
// Project: fmod_player
// Start: Tuesday, May 09, 2006
// IDE Version: 3.118
snd$ = "rb_1.it"
good = FMod_Load(snd$)
FMod_Play()
WHILE TRUE
PRINT "PLAY: "+snd$ + " returns: "+good, 100,100
PRINT "IsFinished: " + FMod_IsFinished(), 100, 120
PRINT "click mouse to stop", 100,140
IF MOUSEAXIS(3) THEN BREAK
SHOWSCREEN
WEND
FMod_Stop()
FUNCTION end_main_foo:
ENDFUNCTION
the rest is in the other file:
INLINE
DECLARE_ALIAS(FMUSIC_LoadSong, "fmod.dll", "_FMUSIC_LoadSong@4", (const char* name), void*);
DECLARE_ALIAS(FMUSIC_PlaySong, "fmod.dll", "_FMUSIC_PlaySong@4", (void* pMod), char);
DECLARE_ALIAS(FMUSIC_FreeSong, "fmod.dll", "_FMUSIC_FreeSong@4", (void* pMod), char);
DECLARE_ALIAS(FSOUND_Init, "fmod.dll", "_FSOUND_Init@12", (int, int, unsigned int), char);
DECLARE_ALIAS(FSOUND_Close, "fmod.dll", "_FSOUND_Close@0", (void), void);
DECLARE_ALIAS(FMUSIC_IsFinished, "fmod.dll", "_FMUSIC_IsFinished@4", (void* pMod), char);
void* g_pFMod = 0;
// need this for ESC-exits
struct FMOD_killer {~FMOD_killer() {IF (g_pFMod) FMod_Stop();} } g_Fmod_killa;
ENDINLINE
FUNCTION FMod_Load: fname$
GLOBAL fmod_init
LOCAL good
IF fmod_init = FALSE
fmod_init=TRUE
ENDIF
FMod_Stop()
INLINE
if(FSOUND_Init) FSOUND_Init(44100,64,0);
if(FMUSIC_LoadSong)
g_pFMod = FMUSIC_LoadSong(fname_Str.c_str());
if(g_pFMod) good = true;
ENDINLINE
RETURN good
ENDFUNCTION
FUNCTION FMod_Play:
INLINE
IF(FMUSIC_PlaySong && g_pFMod)
FMUSIC_PlaySong(g_pFMod);
ENDINLINE
ENDFUNCTION
FUNCTION FMod_Stop:
INLINE
IF(FMUSIC_FreeSong && g_pFMod)
FMUSIC_FreeSong(g_pFMod);
g_pFMod = 0;
IF(FSOUND_Close)
FSOUND_Close();
fmod_init=FALSE;
ENDINLINE
ENDFUNCTION
FUNCTION FMod_IsFinished:
INLINE
char ok=1;
IF(FMUSIC_IsFinished && g_pFMod)
ok = FMUSIC_IsFinished(g_pFMod);
RETURN ok ? TRUE : FALSE;
ENDINLINE
RETURN TRUE
ENDFUNCTION
But I always get the "redefinition as different type - error". My understanding tells me that the error should be in the concerning line and nowhere else. Normally the inline stuff is for professionals only but in the case that the complete code is given - then I can't accept when it doesn't work. The only reason why this won't run could be the fact that I have only the 2D and NET feature, not the SDK premium.
struct FMOD_killer {~FMOD_killer() {IF (g_pFMod) FMod_Stop();} } g_Fmod_killa;
The 'IF' became capital letters - might be a bug in the editor.
Same here:
IF(FMUSIC_PlaySong && g_pFMod)
and here:
IF(FSOUND_Close)
and here:
IF(FMUSIC_IsFinished && g_pFMod)
ok = FMUSIC_IsFinished(g_pFMod);
RETURN ok ? TRUE : FALSE;
The RETURN is capitals, too. In C++ (INLINE) all commands must be small letters. Sorry.
All commands inside the inline blocks are small letters now. To me every mint green colored word is a command so I changed also the "DECLARE_ALIAS" to small letters. But... oh no! Same error again.
No, DECLARE_ALIAS must be capitals. You'd better copy the samples from the program's directory to your homepath again. The examples I shipped work.
IMO this is very confusing! I have the feeling to be messed around and that there's something that I don't know! By the way, the gp2x cpu-clock sample doesn't work also. My compiler won't handle any inline s*. Am I really so stupid to be unable to do what anybody else tried successfully!? I am very sorry, Gernot, but this is a thing that makes me really angry.
Now I will copy the original samples...
inline usually is bad. If it doesn't work, however, it's not satisfying. I think the editor is messing with pasted code again. I'll check that out for you.
[edit]
Checked this out:
http://www.glbasic.com/forum/viewtopic.php?pid=6874#p6874
and it compiles fine for me on both, win32, and GP2X.
What errors do you get?
Using the new copied sample doesn't make any difference so the problem isn't solved. What are the conditions GLBasic needs to compile C++ code correctly? Any special files in the windows system dir I don't have?
QuoteChecked this out:
http://www.glbasic.com/forum/viewtopic. … 6874#p6874
and it compiles fine for me on both, win32, and GP2X.
What errors do you get?
I tried that and got "redefinition as different type". If this is really a bug in the editor then I wonder why it works fine for others.
OK, please write down bit by bit what you did. Maybe your copy/paste differs from mine.
Quite simple. I did all by mouse. At first I marked the code in the board's code view window by dragging the mouse over it, then the copy command from the context window (right mouse button). And in the GLBasic editor I did a right click in the text window and then 'Paste'. That's all I did.
...yes I know, with the Strg + A shortcut I would ensure that the entire code will marked.
...and you only marked last thread's code-section. I don't say you're stupid, I just want to be very sure. The problem cannot be reproduced here. I'll try some more, though.
Quote...and you only marked last thread's code-section.
Yes.