Hallo liebe Foren Mitglieder !
Eines vorweg, ich bin im PureBasic Programmieren noch ein Anfänger !
Könnte sich bitte einer mal von Euch mein Programm ansehen.
Was ich gerne möchte, ist das ich im Explorergadget ein MP3 File auswähle und über die LibZ abspiele.
Das File wird wohl geladen (Änderung der Bitrate wird angezeigt) aber alles andere nicht bzw. das Stück wird nicht abgespielt.
Ich habe das Programm von TS-Soft (Original Programm funktioniert Klasse von Thomas) für mich umgeschrieben.
Aber nun geht gar nichts mehr...
Code: Alles auswählen
EnableExplicit
XIncludeFile "E:\purebasic\libzplay_include.pbi"
Define hZPlay, File.s,eventid,bpm
Define ID3.TID3InfoExW
Define TSI.TStreamInfo
Define links,rechts,amplilinks
Define Event,bpm_f,rea_bpm,nLeftAmp,nrightAmp,fase
OpenWindow(0, #PB_Ignore, #PB_Ignore, 1024, 768,"Demo ZPlay Lib." , #PB_Window_SystemMenu)
ButtonGadget(12,800,345,80,20,"FFT_Area_Line")
ButtonGadget(20,800,365,80,20,"FFT_Area_Bar")
TextGadget(0, 5, 10, 190, 20, "Album:" + #TAB$ + ID3\Genre)
TextGadget(1, 5, 30, 210, 20, "" );+ #TAB$ + TSI\BitRate)
TextGadget(2, 5, 50, 300, 20, "Title:" + #TAB$ + ID3\Title)
TextGadget(3, 5, 70, 20, 12, "")
TextGadget(4, 5, 92, 20, 12, "")
TextGadget(8,5,550,100,20,"")
TextGadget(9,5,570,100,20,"")
TextGadget(10,120,550,100,20,"")
ProgressBarGadget(6,40,70,500,25,0,100,#PB_ProgressBar_Smooth)
SetGadgetColor(6, #PB_Gadget_FrontColor,RGB($00,$FF,$00))
SetGadgetColor(6, #PB_Gadget_BackColor,RGB($10,$77,$00))
ProgressBarGadget(7,40,95,500,25,0,100,#PB_ProgressBar_Smooth)
ProgressBarGadget(9,40,550,300,20,0,400,#PB_ProgressBar_Smooth)
SetGadgetColor(7, #PB_Gadget_FrontColor,RGB($66,$cc,$33))
SetGadgetColor(7, #PB_Gadget_BackColor,RGB($00,$FF,$00))
ExplorerTreeGadget(30, 600, 10, 280, 280, "*.mp3;*.mp3")
hZPlay = zplay_CreateZPlay()
Repeat
EventID = WaitWindowEvent()
File= GetGadgetText(30)
If hzplay
zplay_OpenFile(hZPlay, File, #sfMp3)
zplay_Play(hZPlay)
zplay_LoadID3W(hZPlay, #id3Version2, @ID3 )
zplay_GetStreamInfo(hZPlay,@TSI)
; EndIf
AddWindowTimer(0, 1, 90)
zplay_SetFFTGraphParam(hZPlay, #gpGraphType, #gtarealeftontop)
zplay_SetFFTGraphParam(hZPlay, #gpcolor1, RGB($00,$33,$33))
zplay_SetFFTGraphParam(hZPlay, #gpFFTPoints, 512)
zplay_SetFFTGraphParam(hZPlay, #gpHorizontalScale, #gsLinear)
zplay_SetFFTGraphParam(hzplay, #gpTransparency,10)
zplay_SetFFTGraphParam(hZPlay, #gpWindow, #FWHann)
zplay_setplayervolume(hzplay,100,100) ; Ändern für Balance einstellung.. wäre ne Idee
EndIf
bpm= zplay_DetectFileBpm(hzplay,File,#sfmp3,#dmAutoCorrelation )
zplay_DrawFFTGraphOnHWND(hZPlay, WindowID(0), 5, 145, 400, 150)
zplay_GetVUData(hzplay,@links,@rechts)
zplay_SetFFTGraphParam(hzplay, #gpTransparency,20)
SetGadgetText(3,""+ Str(links))
SetGadgetText(4,"" + Str(rechts))
SetGadgetState(6, links)
SetGadgetState(7, rechts)
SetGadgetText(1,"Bitrate : "+ #TAB$ + TSI\BitRate+" kbps")
SetGadgetText(8,"Mouse x " +Str(WindowMouseX(0)))
SetGadgetText(9,"Mouse y " + File)
SetGadgetText(10,"BPM " +Str(bpm))
;EndIf
Select EventGadget()
Case 12
zplay_SetFFTGraphParam(hZPlay, #gpGraphType, #gtarealeftontop)
Case 20
zplay_SetFFTGraphParam(hZPlay, #gpGraphType, #gtBarsleftontop)
EndSelect
Until EventID=#PB_Event_CloseWindow
zplay_Close(hZPlay)
zplay_DestroyZPlay(hZPlay)
Vielen Dank