'  ##############
' # test35.bas #
'##############
' short test for:
' fbs_Set_LoadCallback() for fbs_Load_MODFile()


#include "../inc/fbsound.bi"
const data_path = "../data/"
const mod_file ="jimi.mod"

' only if not same as exe path
' fbs_Set_PlugPath("./")

sub LoadCB(percent as integer)
  locate 1,1
  if percent<100 then
    print "loading '" & mod_file & "' " & percent & "% ..."
  else
    print "loading '" & mod_file & "' 100% done."
  end if
end sub
'
' main
'
dim as integer hWave
dim as integer ms
dim as double  t
fbs_Init

fbs_Set_LoadCallback @LoadCB
fbs_Enable_LoadCallback
print "loading '" & mod_file & "'"
t=timer()
fbs_Load_MODFile(data_path & mod_file,@hWave)
t=timer()-t
fbs_Get_WaveLength(hWave,@ms)
print "Processing time of the Wave renderer " & t & " seconds !"
print "for " & ms/1000 & " seconds audio 'not bad'" 

fbs_Play_Wave(hWave)
while fbs_Get_PlayingSounds()=0:sleep 10:wend

print "wait on end of sound or press any key ..."
while inkey()="" and fbs_Get_PlayingSounds()
  sleep 100
wend


