I get this error when i run the code below: "Compile Error: Unable to convert from 'Int' to 'TGadget'", says win=CreateWindow("XMPlayer",100,100,300,190,0,1 | WINDOW_ACCEPTFILES) is the culprit.. Can you help me out here?
Framework brl.system Import brl.win32maxgui Import brl.bank Import pub.fmod Import brl.timer Import brl.max2d Import brl.maxgui Import BRL.D3D7Max2D Strict 'vars Local button:TGadget[5] Local win:TGAdget Local ofile:String Local music:Int Local pause:Byte Local vol:TGadget Local mainvol:Int=8 Local volvol:Int=mainvol*255/10 Local panel:TGadget Local snamepos:Byte Ptr Local sname:String Local lab:TGadget[8] Local gfx:TGadget Local spec:Byte Ptr Local pnt:Float Local bnk:TBank Local yp:Int 'main window win=CreateWindow("XMPlayer",100,100,300,190,0,1 | WINDOW_ACCEPTFILES) If fsound_init(22000,256,0) = True Else Notify("Can't init sound",True) EndIf 'gadgets button[0]=CreateButton("Open File",5,60,60,20,win) button[1]=CreateButton("Pause/Play",70,60,70,20,win) vol=CreateSlider(145,60,150,30,win,SLIDER_HORIZONTAL|SLIDER_TRACKBAR) SetSliderRange(vol,0,10) SetSliderValue(vol,mainvol) panel=CreatePanel(5,90,285,60,win,PANEL_GROUP) panel.settext("Info") lab[0]=CreateLabel("Name: ",10,105,40,20,win) lab[1]=CreateLabel("N/A",45,105,160,20,win) lab[2]=CreateLabel("Pattern: ",10,125,45,20,win) lab[3]=CreateLabel("",55,125,20,20,win) lab[4]=CreateLabel("Channels: ",80,125,50,20,win) lab[5]=CreateLabel("",140,125,15,20,win) lab[6]=CreateLabel("BMP: ",165,125,30,20,win) lab[7]=CreateLabel("",200,125,20,20,win) gfx=CreateCanvas(5,5,285,50,win) CreateTimer( 60 ) FSOUND_DSP_SetActive(FSOUND_DSP_GetFFTUnit(),True) 'mainloop Repeat WaitEvent() Select EventID() Case EVENT_WINDOWACCEPT ofile = EventText() If ofile <>"" fmusic_stopsong(music) music=fmusic_loadsong(ofile.ToCString()) If music > 0 fmusic_playsong(music) FMUSIC_SetMasterVolume(music,volvol) snamepos=FMUSIC_GetName(music) lab[1].settext(sname.FromCString(snamepos)) Else Notify("Can't Load Song",True) EndIf EndIf Case EVENT_WINDOWCLOSE FSOUND_DSP_SetActive(FSOUND_DSP_GetFFTUnit(),False) fsound_close() End Case EVENT_GADGETACTION Select EventSource() Case button[0] ofile=RequestFile("Select Soundfile To Open","SoundFile:xm,mod,s3m,it,mid,rmi,sgt,fsb") If ofile <>"" fmusic_stopsong(music) music=fmusic_loadsong(ofile.ToCString()) If music > 0 fmusic_playsong(music) FMUSIC_SetMasterVolume(music,volvol) snamepos=FMUSIC_GetName(music) lab[1].settext(sname.FromCString(snamepos)) Else Notify("Can't Load Song",True) EndIf EndIf Case button[1] pause=1-pause FMUSIC_SetPaused(music,pause) Case vol mainvol=SliderValue(vol) volvol=mainvol*255/10 FMUSIC_SetMasterVolume(music,volvol) EndSelect Case EVENT_TIMERTICK RedrawGadget gfx spec = FSOUND_DSP_GetSpectrum() If music > 0 lab[3].settext(FMUSIC_GetPattern(music)) lab[5].settext(FMUSIC_GetNumChannels(music)) lab[7].settext(FMUSIC_GetBPM(music)) EndIf Case EVENT_GADGETPAINT Local g=CanvasGraphics(gfx) SetGraphics g Cls If music > 0 bnk=CreateStaticBank(spec,512*4) For Local x:Int=0 To 285 yp=(PeekFloat(bnk,x*4)*500) SetColor (x/8*32,x/8*16,(128)+x/8*2) DrawLine x,50-yp,x,50 Next EndIf Flip() End Select Forever