Problem with miniFMOD for PB
Posted: Mon Mar 06, 2006 10:42 pm
I would like to use the 'minifmod170' library for my application. It sounds pretty interesting and i don't need the bells and whistles of it's bigger brother.
I've downloaded an include version for PB and tried the example file provided in the archive. But it won't compile.
ERROR:
Line 117: FSOUND_File_SetCallbacks() is not a function, an array, or a linked list
It does that for every FSOUND_XXX functions.
Is there any special instruction to tell to the compiler in order to use static libraries properly??
What are callbacks??
What is .XM files? What's special about them?
Will it play MP3/OGG/WMA??
Some tips:
I'm using PureBasic 3.92.
As i understand, i don't need any DLLs...
I've putted the 'minifmod170' library in '.\PureLibraries\UserLibraries'
I'm a beginner.
I'm using 'xmplay.pb' source code as followed...
Other threads discussing about miniFMOD on PB:
http://www.purebasic.fr/english/viewtopic.php?t=9340
http://www.purebasic.fr/english/viewtopic.php?t=13424
http://www.purebasic.fr/english/viewtopic.php?t=10910
Links to different files:
http://purebasic.myftp.org/?filename=fi ... mod170.zip
http://purebasic.myftp.org/?filename=fi ... 170_pb.zip
Thanks in advance!!!
I've downloaded an include version for PB and tried the example file provided in the archive. But it won't compile.

ERROR:
Line 117: FSOUND_File_SetCallbacks() is not a function, an array, or a linked list
It does that for every FSOUND_XXX functions.
Is there any special instruction to tell to the compiler in order to use static libraries properly??
What are callbacks??
What is .XM files? What's special about them?
Will it play MP3/OGG/WMA??
Some tips:
I'm using PureBasic 3.92.
As i understand, i don't need any DLLs...
I've putted the 'minifmod170' library in '.\PureLibraries\UserLibraries'
I'm a beginner.
I'm using 'xmplay.pb' source code as followed...
Code: Select all
;
; PureBasic MiniFMOD v1.70 - xmplay.pb
;
; This simple example shows how to use minifmod with your own
; fileloading callbacks and should be quite self-explanatory.
;
; Use at your own risk!
;
;
; NOTE:
; minifmod is copyright (c) FireLight Technologies 1999-2004
; See http://www.fmod.org For more information
;
;
; minifmod v1.70 for PureBasic v3.92 by traumatic! & AlphaSND
;
#useMemLoad = 0 ; 0 = filecallbacks
; 1 = memorycallbacks
CompilerIf #useMemLoad=1
;
; MEMORY CALLBACKS
;
Structure MEMFILE
Length.l
pos.l
mdata.l
EndStructure
Procedure.l modopenmem(*memfile.MEMFILE)
*memfile = AllocateMemory(SizeOf(MEMFILE))
*memfile\mdata = ?mod
*memfile\Length = ?modend - ?mod
*memfile\pos = 0
ProcedureReturn *memfile
EndProcedure
Procedure.l modclosemem(*memfile.MEMFILE)
FreeMemory(*memfile) : *memfile = #Null
EndProcedure
Procedure.l modreadmem(Buffer.l, size.l, *memfile.MEMFILE)
If *memfile\pos + size >= *memfile\Length
size = *memfile\Length - *memfile\pos
EndIf
CopyMemory(*memfile\mdata+*memfile\pos, Buffer, size)
*memfile\pos + size ; update filepointer position
ProcedureReturn size
EndProcedure
Procedure modseekmem(*memfile.MEMFILE, pos.l, mode.l)
Select mode
Case #SEEK_SET
*memfile\pos = pos
Case #SEEK_CUR
*memfile\pos+pos
EndSelect
If *memfile\pos > *memfile\Length
*memfile\pos = *memfile\Length
EndIf
EndProcedure
Procedure.l modtellmem(*memfile.MEMFILE)
ProcedureReturn *memfile\pos
EndProcedure
CompilerElse
;
; FILE CALLBACKS
;
Procedure.l modopen(name.s)
ProcedureReturn ReadFile(0, name.s)
EndProcedure
Procedure modclose(handle.l)
CloseFile(0)
EndProcedure
Procedure.l modread(Buffer.l, size.l, handle.l)
ProcedureReturn ReadData(Buffer, size)
EndProcedure
Procedure modseek(handle.l, pos.l, mode.l)
Select mode
Case #SEEK_SET
FileSeek(pos)
Case #SEEK_CUR
FileSeek(Loc()+pos)
EndSelect
EndProcedure
Procedure.l modtell(handle.l)
ProcedureReturn Loc()
EndProcedure
CompilerEndIf
;
;
;
OpenConsole()
CompilerIf #useMemLoad = 1
FSOUND_File_SetCallbacks(@modopenmem(), @modclosemem(), @modreadmem(), @modseekmem(), @modtellmem())
mod = FMUSIC_LoadSong("", #Null)
CompilerElse
FSOUND_File_SetCallbacks(@modopen(), @modclose(), @modread(), @modseek(), @modtell())
modfile$ = ProgramParameter()
mod = FMUSIC_LoadSong_(modfile$, #Null)
CompilerEndIf
If mod
PrintN("-------------------------------------------------------------")
PrintN("MINIFMOD for PureBasic example XM player")
PrintN("-------------------------------------------------------------")
FMUSIC_PlaySong(mod)
Repeat
ord.b = FMUSIC_GetOrder(mod) ; get module order
row.b = FMUSIC_GetRow(mod) ; get module row
modtime.f = FMUSIC_GetTime(mod) / 1000.0 ; get module time
ConsoleLocate(0,5) : PrintN("Playing...")
ConsoleLocate(0,7) : PrintN("Order: "+Str(ord)+" | Row: "+Str(row)+" | Time: "+StrF(modtime,2))
ConsoleLocate(0,12): PrintN("Press any key to quit")
Delay(10)
Until Inkey()
FMUSIC_FreeSong(mod)
Else
PrintN("-------------------------------------------------------------")
PrintN("MINIFMOD for PureBasic example XM player")
PrintN("-------------------------------------------------------------")
ConsoleLocate(0,5)
PrintN("Couldn't load XM-file! Syntax: xmplay infile.xm")
Repeat
Delay(10)
Until Inkey()
EndIf
CloseConsole()
End
CompilerIf #useMemLoad = 1
DataSection
mod:
IncludeBinary "infile.xm"
modend:
EndDataSection
CompilerEndIf
; ExecutableFormat=
; EOF
http://www.purebasic.fr/english/viewtopic.php?t=9340
http://www.purebasic.fr/english/viewtopic.php?t=13424
http://www.purebasic.fr/english/viewtopic.php?t=10910
Links to different files:
http://purebasic.myftp.org/?filename=fi ... mod170.zip
http://purebasic.myftp.org/?filename=fi ... 170_pb.zip
Thanks in advance!!!