
homy
Members-
Posts
13 -
Joined
-
Last visited
homy's Achievements

Seeker (1/7)
0
Reputation
-
AutoIt Help -> Search $ES_AUTOVSCROLL -> Topic "GUI control styles" -> #include <EditConstants.au3>
-
I like it. For me, seekbar, volume and playlist view are missing, but it's a good work Maybe something like this .... Added registered message: - WM_DRAWITEM with ownerdrawn style on ctrl buttons to avoid painting controls - WM_NCHITTEST to move gui ControlEvents can be polled as usualy with a GUIGetMessage() Hope it could help #cs Copyright information You are free to use this source in your project under the condition 1) You credit me (monoceres) inside your application 2) You keep this copyright notice inside your source 3) You do not use this in any illegal way Otherwise you are free to code as you will, good luck :) // Andreas Karlsson (monoceres @ AutoIt forums) #ce #cs read me Do not create regular controls, the redraw function WILL overdraw them All GDI+ resources are loaded at once in the GDI+ startup sequence To do custom drawings (like adding stuff to the display) draw your things into the $backbuffer graphics object inside the redraw function All your drawings must be done before the _GDIplus_GraphicsImageDrawRect($graphics... call ; The main loop should only be used for input and status updating ; If you add GDI+ resources be sure to release them in the close() function #ce #include <GDIPlus.au3> #include <windowsconstants.au3> #include <winapi.au3> #include <GUIConstantsEx.au3> #include <misc.au3> #include <ButtonConstants.au3> Global Const $width = 300 Global Const $height = 500 Global Const $wheelouterr = 200 Global Const $wheelinnerr = 100 Global $bgcolor = "0xFF050505" Global $fgcolor = "0xFFFFA0A0" Global $wheelcolor="0xFFFF5555" Global $user32 = DllOpen("user32.dll") Global $battery_percent = 100 GUIRegisterMsg($WM_DRAWITEM, "WM_DRAWITEM") ; Register before GUISetState() GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") ; Window moving #Region GUI creation ;~ Opt("GUIOnEventMode", 1) Opt("MouseCoordMode",2) $hwnd = GUICreate("iPod", $width, $height, -1, -1, $WS_POPUP) GUISetOnEvent($GUI_EVENT_CLOSE, "close") _GuiRoundCorners($hwnd, 0, 0, 20, 20) GUICtrlCreateLabel("test", $width / 2, $height - $wheelouterr - 50) $nMenu = GUICtrlCreateButton("", 125,265,50,20) GUICtrlSetStyle($nMenu, $BS_OWNERDRAW) ; Make button ownerdrawn to get WM_DRAWITEM message before painting controls $nPrevious = GUICtrlCreateButton("", 60,340,30,20) GUICtrlSetStyle($nPrevious, $BS_OWNERDRAW) $nNext = GUICtrlCreateButton("", 208,340,30,20) GUICtrlSetStyle($nNext, $BS_OWNERDRAW) $nPlay = GUICtrlCreateButton("", 135,410,30,20) GUICtrlSetStyle($nPlay, $BS_OWNERDRAW) GUISetState() #EndRegion #Region GDI+ startup _GDIPlus_Startup() $graphics = _GDIPlus_GraphicsCreateFromHWND($hwnd) $bitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics) $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap) $backgroundbrush=_GDIPlus_BrushCreateSolid($bgcolor) $brush = _GDIPlus_BrushCreateSolid($fgcolor) $wheelbrush=_GDIPlus_BrushCreateSolid($wheelcolor) $image=_GDIPlus_ImageLoadFromFile(@ScriptDir&"\glass.png") $overlay=_GDIPlus_ImageLoadFromFile(@ScriptDir&"\over.png") $white=_GDIPlus_BrushCreateSolid(0x99F0F0F0) $blackpen=_GDIPlus_PenCreate("0xFF000000",1) $batterycolor=_GDIPlus_BrushCreateSolid(0xFF00EF00) $rect=_GDIPlus_RectFCreate(0,0,$width,$height) ; Elements x,y,width,height $arial=_GDIPlus_FontFamilyCreate("Arial") $arialmedium=_GDIPlus_FontCreate($arial,16) $arialsmall=_GDIPlus_FontCreate($arial,14) $format=_GDIPlus_StringFormatCreate() _GDIPlus_StringFormatSetAlign($format,1) $blackbrush = _GDIPlus_BrushCreateSolid("0xFF222222") _AntiAlias($backbuffer, 4) #EndRegion ; All the resources are loaded, we can finally draw the iPod for the first time _ReDraw() ; Calls the function when redrawing is needed GUIRegisterMsg($WM_PAINT, "_ReDraw") Do Sleep(25) $Msg=GUIGetMsg() switch $Msg Case $nPrevious MsgBox(0, "Info", "Previous Button pressed") Case $nMenu MsgBox(0, "Info", "Menu Button pressed") Case $nNext MsgBox(0, "Info", "Next Button pressed") Case $nPlay MsgBox(0, "Info", "Play Button pressed") Case $GUI_EVENT_CLOSE close() EndSwitch #Region Battery usage $battery_percent-=0.02 If $battery_percent<0 Then $battery_percent=100 EndIf #EndRegion ; Draw the updated scene _ReDraw() Until False Func close() #Region Clean up _GDIPlus_BrushDispose($blackbrush) _GDIPlus_BrushDispose($brush) _GDIPlus_ImageDispose($image) _GDIPlus_BitmapDispose($bitmap) _GDIPlus_GraphicsDispose($graphics) _GDIPlus_GraphicsDispose($backbuffer) _GDIPlus_ImageDispose($overlay) _GDIPlus_BrushDispose($backgroundbrush) _GDIPlus_BrushDispose($white) _GDIPlus_BrushDispose($wheelbrush) _GDIPlus_StringFormatDispose($format) _GDIPlus_FontDispose($arialmedium) _GDIPlus_FontDispose($arialsmall) _GDIPlus_FontFamilyDispose($arial) _GDIPlus_PenDispose($blackpen) _GDIPlus_BrushDispose($batterycolor) _GDIplus_Shutdown() #EndRegion Exit EndFunc ;==>close Func _AntiAlias($hGraphics, $iMode) Local $aResult $aResult = DllCall($ghGDIPDll, "int", "GdipSetSmoothingMode", "hwnd", $hGraphics, "int", $iMode) If @error Then Return SetError(@error, @extended, False) Return SetError($aResult[0], 0, $aResult[0] = 0) EndFunc ;==>_AntiAlias Func _ReDraw() _GDIPlus_GraphicsClear($backbuffer, $bgcolor) _GDIPlus_GraphicsDrawImageRect($backbuffer,$overlay,0,0,$width,$height) _SetClipCircle($backbuffer, $width / 2 - $wheelouterr / 2, $height - $wheelouterr - 50, $wheelouterr, $wheelouterr) _GDIPlus_GraphicsFillEllipse($backbuffer, $width / 2 - $wheelouterr / 2, $height - $wheelouterr - 50, $wheelouterr, $wheelouterr, $wheelbrush) #Region Menu text DllStructSetData($rect,1,$width / 2 - $wheelouterr / 2) DllStructSetData($rect,2,$height - $wheelouterr - 50+15) ; Y offset DllStructSetData($rect,3,$wheelouterr) _GDIPlus_GraphicsDrawStringEx($backbuffer,"Menu",$arialsmall,$rect,$format,$white) DllStructSetData($rect,1,$width / 2 - $wheelouterr / 2+50+25) DllStructSetData($rect,2,$height - $wheelouterr - 50+15+50+22) ; Y offset DllStructSetData($rect,3,$wheelouterr) _GDIPlus_GraphicsDrawStringEx($backbuffer,">>I",$arialmedium,$rect,$format,$white) DllStructSetData($rect,1,$width / 2 - $wheelouterr / 2-50-25) DllStructSetData($rect,2,$height - $wheelouterr - 50+15+50+22) ; Y offset DllStructSetData($rect,3,$wheelouterr) _GDIPlus_GraphicsDrawStringEx($backbuffer,"I<<",$arialmedium,$rect,$format,$white) DllStructSetData($rect,1,$width / 2 - $wheelouterr / 2) DllStructSetData($rect,2,$height - $wheelouterr +110) ; Y offset DllStructSetData($rect,3,$wheelouterr) _GDIPlus_GraphicsDrawStringEx($backbuffer,"I>II",$arialmedium,$rect,$format,$white) #EndRegion ; Draws the background into the inner circle _SetClipCircle($backbuffer, $width / 2 - $wheelinnerr / 2, ($height - $wheelouterr - 50) + $wheelouterr / 2 - $wheelinnerr / 2, $wheelinnerr, $wheelinnerr) _GDIPlus_GraphicsFillRect($backbuffer,0,0,$width,$height,$backgroundbrush) _GDIPlus_GraphicsDrawImageRect($backbuffer,$overlay,0,0,$width,$height) ; Make sure we doesn't draw outside the display area _SetRoundedRectClip($backbuffer, 25, 25, $width-25*2, 175, 10) _GDIplus_GraphicsFillRect($backbuffer,0,0,$width,$height,$brush) ; Display text goes here DllStructSetData($rect,1,25) DllStructSetData($rect,2,25+10) ; Y offset DllStructSetData($rect,3,$width-25*2) _GDIPlus_GraphicsDrawStringEx($backbuffer,"iPod"&@CRLF&"AutoIt version",$arialmedium,$rect,$format,$blackbrush) ; Battery drawing _GDIPlus_GraphicsFillRect($backbuffer,(($width-25*2)+25)-30,25+5,20*($battery_percent/100),10,$batterycolor) _GDIPlus_GraphicsDrawRect($backbuffer,(($width-25*2)+25)-30,25+5,20,10,$blackpen) _GDIPlus_GraphicsFillRect($backbuffer,(($width-25*2)+25)-30+20,30+3,2,5,$blackbrush) _GDIPlus_GraphicsDrawImageRect($backbuffer,$image,25,25,$width-25*2,175) _ResetClip($backbuffer) _GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height) Return $GUI_RUNDEFMSG EndFunc ;==>_ReDraw Func _GuiRoundCorners($h_win, $i_x1, $i_y1, $i_x3, $i_y3) Local $XS_pos, $XS_ret, $XS_ret2 $XS_pos = WinGetPos($h_win) $XS_ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $XS_pos[2], "long", $XS_pos[3], "long", $i_x3, "long", $i_y3) If $XS_ret[0] Then $XS_ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $XS_ret[0], "int", 1) EndIf EndFunc ;==>_GuiRoundCorners Func _SetRoundedRectClip($g, $x, $y, $w, $h, $r) $Path = DllStructCreate("dword") DllCall($ghGDIPDll, "none", "GdipCreatePath", "int", 0, "int", DllStructGetPtr($Path)) $pointer = DllStructGetData($Path, 1) DllCall($ghGDIPDll, "none", "GdipAddPathArc", "int", $pointer, "float", $x, "float", $y, "float", $r, "float", $r, "float", 180, "float", 90) DllCall($ghGDIPDll, "none", "GdipAddPathArc", "int", $pointer, "float", $x + ($w - $r - 1), "float", $y, "float", $r, "float", $r, "float", 270, "float", 90) DllCall($ghGDIPDll, "none", "GdipAddPathArc", "int", $pointer, "float", $x + ($w - $r - 1), "float", $y + ($h - $r - 1), "float", $r, "float", $r, "float", 0, "float", 90) DllCall($ghGDIPDll, "none", "GdipAddPathArc", "int", $pointer, "float", $x, "float", $y + ($h - $r - 1), "float", $r, "float", $r, "float", 90, "float", 90) $aResult = DllCall($ghGDIPDll, "int", "GdipSetClipPath", "hwnd", $g, "ptr", $pointer, "int", 0) EndFunc ;==>_SetRoundedRectClip Func _ResetClip($g) DllCall($ghGDIPDll, "none", "GdipResetClip","hwnd",$g) EndFunc Func _GDIPlus_StringFormatSetAlign($hStringFormat, $iFlag) Local $aResult $aResult = DllCall($ghGDIPDll, "int", "GdipSetStringFormatAlign", "ptr", $hStringFormat, "short", $iFlag) If @error Then Return SetError(@error, @extended, 0) If $aResult[0] = 0 Then Return SetError(0, 0, 1) Return SetError(1, 0, 0) EndFunc ;==>_GDIPlus_StringFormatSetAlign Func _SetClipCircle($hGraphics, $x, $y, $width, $height) ;Create struct to hold pointer to Path object $Path = DllStructCreate("dword") ;Create Path object, store pointer to it DllCall($ghGDIPDll, "none", "GdipCreatePath", "int", 0, "int", DllStructGetPtr($Path)) ;Retrieve pointer from struct $pointer = DllStructGetData($Path,1) DllCall($ghGDIPDll, "none", "GdipAddPathEllipseI","int", $pointer,"int",$x,"int",$y,"int",$width,"int",$height) $aResult = DllCall($ghGDIPDll, "int", "GdipSetClipPath", "hwnd", $hGraphics, "ptr", $pointer,"int",0) If @error Then Return SetError(@error, @extended, False) Return SetError($aResult[0], 0, $aResult[0] = 0) EndFunc Func WM_DRAWITEM($hWnd, $Msg, $wParam, $lParam) ; Intercept message and abort redraw of controls return 1 EndFunc Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam) if ($hWnd = $hwnd) and ($iMsg = $WM_NCHITTEST) then Return $HTCAPTION EndFunc
-
The error occure when I run the SG-Menu.exe, not builder.
-
Same error with the new exe, running on a XP pro SP2.
-
for me, with "the initial build and the resulting menu" as said in the readme.
-
It's funny, working with me. Your dlls are in the scriptdir, used fonctions from my files have been copied in the script or the include is done ?
-
lol I think that you don't missed anything. It was an error when I wrote my dllcall and it worked as it so I did not ask myself about that. pfiu, sorry for my poor english, it was a long time without practice.
-
oops, bad line ... $stream = DllCall($dllbass, "dword", "BASS_StreamCreateFile", "long", 0, "str", $file, "long", 0, "long", 0, "long", 0x200000); ouverture du fichier
-
The dll need a GUI to be initialsed with, and you will play a channel, returned by then BasStreamCreateFile fonction. _BassStop stop the channel play and _BassEnd() without parameter unload dlls. $dumy=guicreate("") _BassInit("bass.dll", "tags.dll", "bass_fx.dll", $dumy) $test=_BassStreamCreateFile("c:\record\part1two.mp3") _BassPlay($test) Sleep(20000) _BassStop($test) _BassEnd()
-
Try this. #include <GUIConstants.au3> Global $dllbass = DllOpen(@ScriptDir & "\bass.dll") $file="Apocalypse Please.mp3" $form1 = GUICreate("dummy") DllCall($dllbass, "short", "BASS_Init", "int", -1, "long", 44100, "long", 0, "long", $form1, "long", "NULL"); initialisation de la dll $bass_error = DllCall($dllbass, "int", "BASS_ErrorGetCode") ConsoleWrite("bass error" & $bass_error[0] & @CRLF) $stream=DllCall($dllbass,"hwnd","BASS_StreamCreateURL","str",$url,"dword",0,"dword",0,"ptr","NULL","dword",0) $bass_error = DllCall($dllbass, "int", "BASS_ErrorGetCode") ConsoleWrite("bass error" & $bass_error[0] & @CRLF) ConsoleWrite($stream[0]&@CR) If $bass_error[0] = 0 Then DllCall($dllbass,"short","BASS_ChannelPlay","hwnd",$stream[0],"long",0x40000) $bass_error = DllCall($dllbass, "int", "BASS_ErrorGetCode") ConsoleWrite("bass" & $bass_error[0] & @CRLF) EndIf while 1 sleep(100) WEnd
-
I use also "tags.dll" to retrieve informations and "Bass_FX.dll" to modify pitch or tempo of the channel you are playing, add FX like chorus, reverb or flanger...
-
I did not use "BASS_MusicLoad" that is use for mod music like mo3 or mode format, but "BASS_StreamCreateFile" used for multimedia files such as mp3 or ogg.
-
Take a look at this. It's a bit confused, and there is a lot of work remaining but it may help #include <Array.au3> Global $DllBass Global $DllBassTags Global $DllBassFx Global $BASS_FXPARAMEQ $BASS_FXPARAMEQ=DllStructCreate("float fCenter;float fBandwidth;float fGain") ;=============================================================================== ; ; Function Name: _BassInit ; Description:: Initialise la dll ; Parameter(s): $dll1 - Chemin de la dll "bass.dll" ; $dll2 - Chemin de la dll "tags.dll" ; $dll3 - Chemin de la dll "bass_fx.dll" ; $Hwnd - Handle de la GUI à laquelle on "raccroche" la dll ; Requirement(s): AutoIt 3.2 ++ ; Return Value(s): 1 - Success ; 0 - Failure ; Author(s): Homy ; ;=============================================================================== Func _BassInit($dll1, $dll2, $dll3, $Hwnd) Local $error If Not FileExists($dll1) Then Return 0 If Not FileExists($dll2) Then Return 0 If Not FileExists($dll3) Then Return 0 $DllBass = DllOpen($dll1) $DllBassTags = DllOpen($dll2) $DllBassFx = DllOpen($dll3) dllCall($DllBass, "short", "BASS_Init", "int", -1, "long", 44100, "long", 0, "long", $Hwnd, "long", "NULL"); initialisation de la dll $error = dllcall($DllBass, "int", "BASS_ErrorGetCode"); gestion code erreur If $error[0] = 0 Then Return 1 Return 0 EndFunc ;==>_BassInit ;=============================================================================== ; ; Function Name: _BassEnd ; Description:: Fin ; Parameter(s): none ; Requirement(s): AutoIt 3.2 ++ ; Return Value(s): none ; Author(s): Homy ; ;=============================================================================== Func _BassEnd() DllClose($DllBass) DllClose($DllBassTags) DllClose($DllBassFx) EndFunc ;==>_BassEnd ;=============================================================================== ; ; Function Name: _BassPluginLoad ; Description:: Charge un plugin pour la dll ; Parameter(s): $plugin - Chemin du plugin ; Requirement(s): AutoIt 3.2 ++ ; Return Value(s): 1 - Success ; 0 - Failure ; Author(s): Homy ; ;=============================================================================== Func _BassPluginLoad($plugin) Local $error, $hplugin If Not FileExists($plugin) Then Return 0 $hplugin=dllcall($DllBass, "hwnd", "BASS_PluginLoad", "str", $plugin, "long", 0) $error = dllcall($DllBass, "int", "BASS_ErrorGetCode"); gestion code erreur If $error[0] = 0 Then Return $hplugin[0] Return 0 EndFunc ;==>_BassPluginLoad ;=============================================================================== ; ; Function Name: _BassStreamCreateFile ; Description:: Créé un channel a partir d'un fichier ; Parameter(s): $dll - Chemin de la dll "bass.dll" ; $plugin - Chemin du plugin ; Requirement(s): AutoIt 3.2 ++ ; Return Value(s): handle du channel - Success ; 0 - Failure ; Author(s): Homy ; ;=============================================================================== Func _BassStreamCreateFile($sFile) Local $error, $stream If Not FileExists($sFile) Then Return 0 $stream = DllCall($DllBass, "hwnd", "BASS_StreamCreateFile", "long", 0, "str", $sFile, "long", 0, "long", 0, "long", 0x200000+128) $stream = DllCall($DllBassFx, "dword", "BASS_FX_TempoCreate", "dword", $stream[0], "dword", 0x10000) $error = dllcall($DllBass, "int", "BASS_ErrorGetCode"); gestion code erreur If $error[0] = 0 Then Return $stream[0] Return 0 EndFunc ;==>_BassStreamCreateFile ;=============================================================================== ; ; Function Name: _BassPlay ; Description:: Play ; Parameter(s): $Hwnd - handle du channel ; Requirement(s): AutoIt 3.2 ++ ; Return Value(s): None ; Author(s): Homy ; ;=============================================================================== Func _BassPlay($Hwnd) DllCall($DllBass, "short", "BASS_ChannelPlay", "hwnd", $Hwnd, "long", 0) EndFunc ;==>_BassPlay ;=============================================================================== ; ; Function Name: _BassPause ; Description:: Pause ; Parameter(s): $Hwnd - handle du channel ; Requirement(s): AutoIt 3.2 ++ ; Return Value(s): None ; Author(s): Homy ; ;=============================================================================== Func _BassPause($Hwnd) DllCall($DllBass, "short", "BASS_ChannelPause", "hwnd", $Hwnd) EndFunc ;==>_BassPause ;=============================================================================== ; ; Function Name: _BassStop ; Description:: Stop et libère la mémoire ; Parameter(s): $Hwnd - handle du channel ; Requirement(s): AutoIt 3.2 ++ ; Return Value(s): None ; Author(s): Homy ; ;=============================================================================== Func _BassStop($Hwnd) DllCall($DllBass, "short", "BASS_ChannelStop", "hwnd", $Hwnd) ; stop DllCall($DllBass, "short", "BASS_StreamFree", "hwnd", $Hwnd) ; libère la mémoire du stream EndFunc ;==>_BassStop ;=============================================================================== ; ; Function Name: _BassSetVolume ; Description:: regle le volume de 0 à 100 ; Parameter(s): $sVol - volume ; Requirement(s): AutoIt 3.2 ++ ; Return Value(s): None ; Author(s): Homy ; ;=============================================================================== Func _BassSetVolume($sVol) If $sVol >= 0 And $sVol <= 100 Then DllCall($DllBass, "long", "BASS_SetVolume", "dword", $sVol) return $sVol EndIf return 0 EndFunc ;==>_BassSetVolume ;=============================================================================== ; ; Function Name: _BassSetPosition ; Description:: gere la position dans le channel ; Parameter(s): $Hwnd - handle du channel ; $sPos - position en secondes ; Requirement(s): AutoIt 3.2 ++ ; Return Value(s): None ; Author(s): Homy ; ;=============================================================================== Func _BassSetPosition($Hwnd, $sPos) Local $temp, $error $temp = DllCall($DllBass, "dword", "BASS_ChannelSeconds2Bytes", "hwnd", $Hwnd, "float", $sPos) $error = dllcall($DllBass, "int", "BASS_ErrorGetCode"); gestion code erreur If Not $error[0] = 0 Then return 0 DllCall($DllBass, "int", "BASS_ChannelSetPosition", "hwnd", $Hwnd, "int64", $temp[0]) $error = dllcall($DllBass, "int", "BASS_ErrorGetCode"); gestion code erreur If $error[0] = 0 Then return 1 Return 0 EndFunc ;==>_BassSetPosition ;=============================================================================== ; ; Function Name: _BassGetPositionByte ; Description:: récupere la position dans le channel en bytes ; Parameter(s): $Hwnd - handle du channel ; Requirement(s): AutoIt 3.2 ++ ; Return Value(s): position en bytes dans le channel ; Author(s): Homy ; ;=============================================================================== Func _BassGetPosition($Hwnd) Local $Ret $Ret = dllcall($DllBass, "dword", "BASS_ChannelGetPosition", "hwnd", $Hwnd) Return $Ret[0] EndFunc ;==>_BassGetPosition ;=============================================================================== ; ; Function Name: _BassByte2Sec ; Description:: transforme une longueur/position en byte en secondes ; Parameter(s): $Hwnd - handle du channel ; $Length - durée en bytes ; Requirement(s): AutoIt 3.2 ++ ; Return Value(s): ; Author(s): Homy ; ;=============================================================================== Func _BassByte2Sec($Hwnd,$Length) Local $Ret $Ret = DllCall($DllBass, "float", "BASS_ChannelBytes2Seconds", "hwnd", $Hwnd, "int64", $Length) Return int($Ret[0]) EndFunc ;==>_BassGetPosition ;=============================================================================== ; ; Function Name: _BassChannelGetLength ; Description:: Donne la durée du fichier en bytes ; Parameter(s): $Hwnd - Handle du channel ouvert ; Requirement(s): AutoIt 3.2 ++ ; Return Value(s): ; Author(s): Homy ; ;=============================================================================== Func _BassChannelGetLength($Hwnd) local $Ret $Ret = dllcall($DllBass, "dword", "BASS_ChannelGetLength", "hwnd", $Hwnd) Return $Ret[0] EndFunc ;==>_BassChannelGetLength ;=============================================================================== ; ; Function Name: _BassChannelFormatDuree ; Description:: Formate la durée en mm:ss ; Parameter(s): $iDuree - Duree a convertir ; Requirement(s): AutoIt 3.2 ++ ; Return Value(s): ; Author(s): Homy ; ;=============================================================================== Func _BassChannelFormatDuree($iDuree) Return StringFormat("%02d:%02d", int($iDuree / 60), Int($iDuree) - (Int(Int($iDuree) / 60) * 60)) EndFunc ;=============================================================================== ; ; Function Name: _BassSetTempo ; Description:: Gere le tempo du channel ; Parameter(s): $Hwnd - Handle du channel ouvert ; $sTempo - tempo -95% à +5000% ; Requirement(s): AutoIt 3.2 ++ ; Return Value(s): none ; Author(s): Homy ; ;=============================================================================== Func _BassSetTempo($Hwnd, $sTempo) If $sTempo >= -95 and $sTempo <= 5000 Then DllCall($DllBassFx, "long", "BASS_FX_TempoSet", "hwnd", $Hwnd, "float", $sTempo, "float", 0, "float", -100) Return 1 EndIf return 0 EndFunc ;==>_BassSetTempo ;=============================================================================== ; ; Function Name: _BassSetPitch ; Description:: Gere le pitch du channel ; Parameter(s): $Hwnd - Handle du channel ouvert ; $sPitch - pitch -60 à +60 demin tons ; Requirement(s): AutoIt 3.2 ++ ; Return Value(s): none ; Author(s): Homy ; ;=============================================================================== Func _BassSetPitch($Hwnd, $sPitch) If $sPitch >= -60 and $sPitch <= 60 Then DllCall($DllBassFx, "long", "BASS_FX_TempoSet", "hwnd", $Hwnd, "float", -100, "float", 0, "float", $sPitch) Return 1 EndIf return 0 EndFunc ;==>_BassSetPitch ;=============================================================================== ; ; Function Name: _BassGetTag ; Description:: récupère le tag d'un fichier ; Parameter(s): $sFile - path du fichier a analyser ; Requirement(s): AutoIt 3.2 ++ ; Return Value(s): Array [title,album,artist,année,durée,compositeur,track,genre] ; Author(s): Homy ; ;=============================================================================== Func _BassGetTag($sFile) Local $stream, $length, $tag, $aRet $stream = DllCall($DllBass, "hwnd", "BASS_StreamCreateFile", "long", 0, "str", $sFile, "long", 0, "long", 0, "long", 0x40000); ouverture du fichier $sLength=_BassChannelGetLength($stream[0]) $sLength=_BassByte2Sec($stream[0],$sLength) $sLength=_BassChannelFormatDuree($sLength) $tag = DllCall($DllBassTags, "str", "TAGS_Read", "hwnd", $stream[0], "str", "%IFV2(%TITL,%ICAP(%TITL),No Title)" _ &chr(1)&"%IFV2(%ALBM,%ICAP(%ALBM),No Album)"&chr(1)&"%IFV2(%ARTI,%ICAP(%ARTI),No Artist)"&chr(1)&"%IFV2(%YEAR,%YEAR,--)" _ &chr(1)&"%IFV1(%COMP,%COMP)"&chr(1)&"%IFV1(%TRCK,%TRCK)"&chr(1)&"%IFV1(%GNRE,%GNRE)") If $tag[0]="" Then $tag[0]="No Title"&chr(1)&"No Album"&chr(1)&"No Artist"&Chr(1)&"--"&chr(1)&chr(1)&chr(1) $tag[0] = StringReplace($tag[0],"|"," ") $tag[0] = StringReplace($tag[0],"'"," ") $tag[0] = StringReplace($tag[0],'"'," ") $tag[0] = StringReplace($tag[0], "No Title", StringTrimRight(StringRight($sfile, StringLen($sfile) - StringInStr($sfile, "\", 0, -1)), 4)) $tag[0] = StringReplace($tag[0], "No Artist","/") $tag[0] = StringReplace($tag[0], "No Album","/") $aRet=stringsplit($tag[0],Chr(1)) _ArrayDelete($aRet,0) _ArrayInsert($aRet,4,$slength) DllCall($DllBass, "short", "BASS_StreamFree", "hwnd", $stream) Return $aRet EndFunc ;=============================================================================== ; ; Function Name: _BassEqualizerInit ; Description:: Créé une bande d'equalizer lié au channel ; Parameter(s): $hwnd - handle du channel ; $fCenter - fréquence centrale ; $fBandwidth - largeur de bande ; $fGain - gain ; Requirement(s): AutoIt 3.2 ++ ; Return Value(s): handle de l'equalizer ; Author(s): Homy ; ;=============================================================================== Func _BassEqualizerInit($hwnd,$fCenter,$fBandwidth,$fGain) local $hfxtemp DllStructSetData($BASS_FXPARAMEQ,"fCenter",$fCenter) DllStructSetData($BASS_FXPARAMEQ,"fBandwidth",$fBandwidth) DllStructSetData($BASS_FXPARAMEQ,"fGain",$fGain) $hfxtemp=DllCall($DllBass,"hwnd","BASS_ChannelSetFX","hwnd",$hwnd,"dword",7,"int",0) DllCall($DllBass,"int","BASS_FXSetParameters","hwnd",$hfxtemp[0],"ptr",DllStructGetPtr($BASS_FXPARAMEQ)) Return $hfxtemp[0] EndFunc ;=============================================================================== ; ; Function Name: _BassEqualizer ; Description:: ùat à jour une bande d'équalizer ; Parameter(s): $hwnd - handle du channel de la bande ; $fCenter - fréquence centrale ; $fGain - gain ; Requirement(s): AutoIt 3.2 ++ ; Author(s): Homy ; ;=============================================================================== Func _BassEqualizer($hwnd,$fGain,$fCenter) DllStructSetData($BASS_FXPARAMEQ,"fGain",$fGain) DllStructSetData($BASS_FXPARAMEQ,"fCenter",$fCenter) DllCall($DllBass,"int","BASS_FXSetParameters","hwnd",$hwnd,"ptr",DllStructGetPtr($BASS_FXPARAMEQ)) EndFunc ;=============================================================================== ; ; Function Name: _BassStreamCreateUrl ; Description:: Créé un channel a partir d'une Url ; Parameter(s): $sUrl -url du stream ; Requirement(s): AutoIt 3.2 ++ ; Return Value(s): handle du channel - Success ; 0 - Failure ; Author(s): Homy ; ;=============================================================================== Func _BassStreamCreateUrl($sUrl) Local $error, $stream $stream=DllCall($Dllbass,"hwnd","BASS_StreamCreateURL","str",$sUrl,"dword",0,"dword",0,"ptr","NULL","dword",0) $error = dllcall($DllBass, "int", "BASS_ErrorGetCode"); gestion code erreur If $error[0] = 0 Then Return $stream[0] Return 0 EndFunc ;==>_BassStreamCreateFile