[EX] Faire le ménage (dans ses mp3) avec Bass.dll

Partagez vos scripts, et vos applications AutoIt.
Règles du forum
.
Répondre
illwind33
Niveau 2
Niveau 2
Messages : 15
Enregistré le : sam. 27 févr. 2016 18:42
Localisation : toulouse
Status : Hors ligne

[EX] Faire le ménage (dans ses mp3) avec Bass.dll

#1

Message par illwind33 »

Bonjour,

Mise à jour nov 2016

l'idée c'est de charger un répertoire de mp3 à trier pour faire un bestoff, éliminer des morceaux tout en faisant autre chose.
Je suis dans mon vrai travail
ce morceau je le veux dans mon bestoff
J'appuie sur la hotkey
J'accède à mon utilitaire
Re-appuie sur la hotkey, je retourne à mon vrai travail

double clic sur l'icone de la barre de notification:
récupère provisoirement la Hotkey (j'en ai besoin ailleurs)
tout le reste est fonctionnel sauf la Hotkey qui commute entre ce prg et le prg précédent

double clic --> joue l'item
Clic droit dans la listview --> mediainfo, clic l'efface (kill focus)
double Clic Droit --> renomme le fichier surligné
voir WMI_notify / Case $g_hListView

F2 renomme le fichier joué
pour les autres fonctions voir le menu

si vous utilisez des dll 64b, compilez en 64b
pour faire simple copier toutes vos dll dans le @ScriptDir
ne mélangez pas des ddl 32b et 64b dans le même rep


Perso je l'ai intégré dans Freecommander, pour les autres j'ai ajouté une fonct SelectFolder()
créez un raccourci sur le bureau et glissez un mp3 sur le raccourci, je récupère le path

J'ai repris le 'look and feel' de 1by1 the directory player http://mpesch3.de1.cc/
GUISetAccelerators:

SPACE       pause/play
UP          -1 dans la listview
DOWN     +1
PGUP     -10
PGDN     +10
LEFT     -20 sec dans le morceau
RIGHT    +20 sec
NUMPAD1     deplace dans .\1\
NUMPAD2  copie dans .\2\
NUMPADDOT   corbeille
F5          recharge le répertoire
F7          compacte l'interface

----------------------
dir /b
bass.dll
bassac3.dll
bassape.dll
bassflac.dll
bassmpc.dll
bassopus.dll
basswma.dll
discogs.ico
MediaInfo.dll
Rapetou.au3
Rapetou.exe
RapetouRes.dll
Bass.dll
http://www.un4seen.com/

fichier icon Ressource.dll
Créer un fichier ressource icon
https://www.autoitscript.fr/forum/viewt ... f=11&t=310

60Mo d'icones android (licence Apache)
https://design.google.com/icons/#ic_arrow_downward

A Bientôt

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=discogs.ico
#AutoIt3Wrapper_UseX64=y
#AutoIt3Wrapper_Run_Tidy=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
;#AutoIt3Wrapper_Res_File_Add=RapetouRes.dll

#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <GuiToolbar.au3>
#include <GuiToolTip.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiComboBox.au3>
#include <String.au3>
#include <File.au3>
#include <Date.au3>
#include <Misc.au3>
#include <TrayConstants.au3>
#include <_ID3_v3.4.au3> ; réparer les variables non déclarées
;https://www.autoitscript.com/forum/topic/43950-id3-udf-id3v1-id3v2-mp3-tags/

;---------------------------------------------------
;créer un raccourci sur le bureau et glisser un mp3 dessus, je recupere le path

;double clic sur l'icone de la barre de notification:
;récupère provisoirement la Hotkey (j'en ai besoin ailleurs)
;tout le reste est fonctionnel sauf la Hotkey qui commute entre ce prg et le prg precedent
;
;double clic --> joue l'item
;Clic droit dans la listview --> mediainfo, reclic l'efface (kill focus)
;doucle Clic Droit --> renomme le fichier surligné
;voir Case $hWndListView
;
;F2 renomme le fichier joué
;pour les autres fonctions voir le menu
;
;si vous utilisez des dll 64b, compilez en 64b
;pour faire simple copier toutes vos dll dans le @ScriptDir
;NE mélangez PAS des ddl 32b et 64b dans le même rep
;
;BASS http://www.un4seen.com/ BASS.dll et les add-ons(si vous avez des .ape .mpc ...)
;
;MediaInfo http://mediaarea.net/fr/MediaInfo
;installer mediainfo puis copier la ddl dans @ScriptDir
;
;RapetouRes.dll ressource d'icones pour la GUI
;https://www.autoitscript.fr/forum/viewtopic.php?f=11&t=310&sid=22b45f07f64b3bf6b508f81047b0cce0
;https://design.google.com/icons/#ic_arrow_downward , 60Mo d'icones android tres beau pas cher (licence Apache)
;---------------------------------------------------

Opt('MustDeclareVars', 1)
Opt("GUIOnEventMode", 1)
Opt("GUICloseOnESC", 0)
Opt("TrayMenuMode", 3) ; The default tray menu items will not be shown and items are not checked when selected. These are options 1 and 2 for TrayMenuMode.
Opt("TrayOnEventMode", 1)

Global Const $g_RessourceIcon = @ScriptDir & "\RapetouRes.dll"
Global $g_hGui, $g_hListView, $g_hToolbar, $g_hToolTip, $g_hold_win_active
Global $g_iWGui, $g_iHGui
Global $g_hBassDll, $g_hstream = 0, $g_song, $g_idx_song = 0, $g_idx_old_song
Global $g_hrename, $g_idRename
Global $g_TrayPause = False

If _VersionCompare(@AutoItVersion, "3.3.0.0") = -1 Then Erreur_Fatale('Ancienne version AutoIt ' & @AutoItVersion)

Charge_dll()

If Not @Compiled Then
   FileChangeDir('E:\mp3\rap\')
Else
   SelectFolder()
EndIf

Tray()

HotKeySet('{!}', 'ActiveMoi')
HotKeySet('²', 'ActiveMoi')

Gui()
Loaded()
GUISetState(@SW_SHOW, $g_hGui)

$g_song = _GUICtrlListView_GetItemText($g_hListView, 0)
Play($g_song)

While 1
   Switch BASS_ChannelIsActive() ;_STOPPED = 0 _PLAYING = 1 _STALLED(bloque) = 2  _PAUSED = 3
      Case 0, 2
         $g_hstream = 0
         AuSuivant()
         ContinueLoop
   EndSwitch

   If @error Then
      Switch @error
         Case 5 ;invalid handle
            ;PARCE que BASS_StreamCreateFile avec flag $BASS_STREAM_AUTOFREE
            ;en fait je n'en suis pas si sur
            AuSuivant()
            ContinueLoop
         Case Else
            ;$BASS_ERROR_NOTAVAIL = 37 ;requested data is not available
            wt(@ScriptLineNumber & ': ' & @error, 'ChannelIsActive')
      EndSwitch
   EndIf

   ;AuFaitOnEnEstOuLa()
   Sleep(1000)
WEnd

Func Play($file)
   $g_hstream = BASS_StreamCreateFile($file)
   If @error Then
      Switch @error
         Case 2
            Erreur_Non_Fatale('cant open the file: ' & $file, $g_hGui)
            BougeDeLa('H') ; comme HS
         Case 41
            Erreur_Non_Fatale('unsupported file format: ' & $file, $g_hGui)
            BougeDeLa('H') ; comme HS
            ;l'efface du listview
         Case Else
            wt(@ScriptLineNumber & ': ' & @error, 'StreamCreateFile')
      EndSwitch
   EndIf

   Bass_ChannelPlay()
   If @error Then
      Switch @error
         Case 9
            wt(@ScriptLineNumber & ': $BASS_Start has not been successfully called', 'ChannelPlay')
         Case Else
            wt(@ScriptLineNumber & ': ' & @error, 'ChannelPlay')
      EndSwitch
   EndIf

   WinSetTitle($g_hGui, '', StringRegExpReplace($file, "(.*)\..*", "${1}")) ;supprime l'ext

   _GUICtrlListView_SetItemSelected($g_hListView, $g_idx_song, True, True)
   _GUICtrlListView_SetItemImage($g_hListView, $g_idx_old_song, 0) ;pause
   _GUICtrlListView_SetItemImage($g_hListView, $g_idx_song, 1) ;play
   _GUICtrlListView_EnsureVisible($g_hListView, $g_idx_song + 1) ; scrolle le listview

EndFunc   ;==>Play

Func Seek($sec)
   Local $inc = BASS_ChannelSeconds2Bytes($sec)
   If @error Then wt(@ScriptLineNumber & ': ' & @error, 'ChannelSeconds2Bytes')
   Local $iLength = BASS_ChannelGetLength() ; fichier decompresse (~wav)
   If @error Then wt(@ScriptLineNumber & ': ' & @error, 'ChannelGetLength')
   Local $icurrent = BASS_ChannelGetPosition() + $inc
   If @error Then wt(@ScriptLineNumber & ': ' & @error, 'ChannelGetPosition')

   If StringRegExp(Byte2Kilo($icurrent), 'TB|PB') = 1 Then ;" B", " KB", " MB", " GB", " TB", " PB"
      Erreur_Non_Fatale('Deplacement impossible pour' & $g_song, $g_hGui)
      Return
   EndIf

   BASS_ChannelSetPosition($icurrent)
   If @error Then
      Switch @error
         Case 7 ;invalid position
            AuSuivant()
            Return
         Case Else
            wt(@ScriptLineNumber & ': ' & @error, 'ChannelSetPosition')
      EndSwitch
   EndIf

   cw(Byte2Kilo($icurrent) & '/' & Byte2Kilo($iLength)) ;fichier decompresse (~wav)

   AuFaitOnEnEstOuLa()
EndFunc   ;==>Seek

Func Forward()
   Seek(+20) ; secondes
EndFunc   ;==>Forward

Func Backward()
   Seek(-20)
EndFunc   ;==>Backward

Func Copie()
   Local $source = _GUICtrlListView_GetItemText($g_hListView, $g_idx_song)
   Local $dest
   If FileCopy(@WorkingDir & '\' & $source, @WorkingDir & '\2\' & $dest, 1 + 8) = 0 Then Erreur_Non_Fatale('FileCopy' & @LF & $source, $g_hGui)
   AuSuivant()
EndFunc   ;==>Copie

;-------------------------
Func BougeDeLa($flag) ;Rap
   Local $dest, $source = _GUICtrlListView_GetItemText($g_hListView, $g_idx_song)

   If $g_hstream > 0 Then BASS_StreamFree()
   If @error Then wt(@ScriptLineNumber & ': ' & @error, 'StreamFree')

   Switch $flag
      Case 'M' ;deplace dans @WorkingDir\1\
         If FileMove(@WorkingDir & '\' & $source, @WorkingDir & '\1\' & $dest, 1 + 8) = 0 Then Erreur_Non_Fatale('FileMove' & @LF & $source, $g_hGui)
      Case 'D'
         If FileRecycle($source) = 0 Then Erreur_Non_Fatale('FileRecycle' & @LF & $source, $g_hGui)
      Case 'H' ; comme HS
         ;l'effacer de la listview
         Erreur_Non_Fatale('Effacé de la Listview' & @LF & $source, $g_hGui)
   EndSwitch

   _GUICtrlListView_DeleteItem($g_hListView, $g_idx_song)
   $g_idx_song -= 1 ; autrement ca saute un item
   AuSuivant()
EndFunc   ;==>BougeDeLa

Func MoveIt() ; ILikeToMoveIt() ;techno
   BougeDeLa('M')
EndFunc   ;==>MoveIt

Func KillMe() ; PleaseKillMe() ;punk
   BougeDeLa('D')
EndFunc   ;==>KillMe
;-------------------------

Func Restart()
   Bass_ChannelPlay(1) ;restart
   If @error Then wt(@ScriptLineNumber & ': ' & @error, 'ChannelPlay')
EndFunc   ;==>Restart

Func Pause()
   ;STOPPED = 0 PLAYING = 1 STALLED(bloque) = 2  PAUSED = 3
   Switch BASS_ChannelIsActive()
      Case 1
         If @error Then wt(@ScriptLineNumber & ': ' & @error, 'ChannelIsActive')
         BASS_ChannelPause()
         If @error Then wt(@ScriptLineNumber & ': ' & @error, 'ChannelPause')
      Case 3
         If @error Then wt(@ScriptLineNumber & ': ' & @error, 'ChannelIsActive')
         Bass_ChannelPlay(0)
         If @error Then wt(@ScriptLineNumber & ': ' & @error, 'ChannelPlay')
   EndSwitch
EndFunc   ;==>Pause

Func UpAndDown($pas) ;Techno
   Local $max = _GUICtrlListView_GetItemCount($g_hListView)
   If $max = 0 Then
      Erreur_Non_Fatale("Quand yana plus, yana encore", $g_hGui) ; Leo Ferre et Stromae
      JeTireMaReverence()
   EndIf

   $g_idx_old_song = $g_idx_song ; pour SetItemImage play/pause
   $g_idx_song = $g_idx_song + $pas

   If $g_idx_song < 0 Then $g_idx_song = 0
   If $g_idx_song > $max - 1 Then
      BASS_Stop()
      Return
   EndIf

   $g_song = _GUICtrlListView_GetItemText($g_hListView, $g_idx_song)

   If $g_hstream > 0 Then BASS_StreamFree()
   If @error Then
      Switch @error
         Case 5 ;invalid handle
            wt(@ScriptLineNumber & ': ' & @error, 'StreamFree')
         Case Else
            ;$BASS_ERROR_NOTAVAIL = 37 ;requested data is not available
            wt(@ScriptLineNumber & ': ' & @error, 'StreamFree')
      EndSwitch
   EndIf

   Play($g_song)
EndFunc   ;==>UpAndDown

Func AuFaitOnEnEstOuLa($titre = $g_song)
   If (BASS_ChannelIsActive()) <> 1 Then Return ;_PLAYING = 1
   If @error Then Return

   Local $millisec, $sec, $Min, $Hour, $Time
   Local $current = BASS_ChannelGetPosition()
   If @error Then wt(@ScriptLineNumber & ': ' & @error, 'ChannelGetPosition')

   $millisec = BASS_ChannelBytes2Seconds($current) * 1000
   If @error Then wt(@ScriptLineNumber & ': ' & @error, 'ChannelBytes2Seconds')

   _TicksToTime($millisec, $Hour, $Min, $sec)
   $Time = StringFormat("%02i:%02i", $Min, $sec)

   WinSetTitle($g_hGui, '', $Time & ' ' & StringRegExpReplace($titre, "(.*)\..*", "${1}")) ;supprime l'ext
EndFunc   ;==>AuFaitOnEnEstOuLa

Func ListView_DBLCLK($idx) ;joue l'item double cliqué
   $g_idx_old_song = $g_idx_song ;pour SetItemImage play/pause
   $g_idx_song = $idx
   $g_song = _GUICtrlListView_GetItemText($g_hListView, $g_idx_song)

   If $g_hstream > 0 Then BASS_StreamFree()
   If @error Then wt(@ScriptLineNumber & ': ' & @error, 'StreamFree')

   Play($g_song)
EndFunc   ;==>ListView_DBLCLK

;-------------------------
Func PlusDix()
   UpAndDown(+10)
EndFunc   ;==>PlusDix

Func MoinsDix()
   UpAndDown(-10)
EndFunc   ;==>MoinsDix

Func Prec()
   UpAndDown(-1)
EndFunc   ;==>Prec

Func AuSuivant() ;Brel
   UpAndDown(+1)
EndFunc   ;==>AuSuivant
;-------------------------

Func MonteLeSon() ; emission TV fr4
   Local $f = BASS_GetVolume()
   If $f < 0.9 Then $f += 0.05
   BASS_SetVolume($f)
   ;cw($f)
EndFunc   ;==>MonteLeSon

Func BaisseLabatJour() ;0 --> 1  ;baisse un peu l'abat jour chanson des annees 50
   ; 20 ;an illegal parameter was specified
   Local $f = BASS_GetVolume()
   If $f > 0.1 Then $f -= 0.05
   BASS_SetVolume($f)
   ;cw($f)
EndFunc   ;==>BaisseLabatJour

Func Ren() ; utilisé par F2
   NewThing($g_song)
EndFunc   ;==>Ren

Func NewThing_A_Voir() ; essai de renommage directement dans la listview
   Local $T = _GUICtrlListView_HitTest($g_hListView)
   If $T[0] = -1 Then Return
   Local $hEditLabel = _GUICtrlListView_EditLabel($g_hListView, $T[0])
   cw($hEditLabel)
EndFunc   ;==>NewThing_A_Voir

Func NewThing($ssource = $g_song) ;Free Jazz
   ;50 lignes pour renommer un fichier, ca me tue
   Local $MODIFIED = FileGetTime($ssource, 0, 1), $CREATED = FileGetTime($ssource, 1, 1) ; je garde la meme date
   Local $spattern = '(.*)(\..*)'
   Local $sname = StringRegExpReplace($ssource, $spattern, "${1}")
   Local $sext = StringRegExpReplace($ssource, $spattern, "${2}")
   Local $hDLL = DllOpen("user32.dll")
   Local $sdest, $i
   Local $T = WinGetPos($g_hGui)
   Local $ilarg = _GUICtrlListView_GetColumnWidth($g_hListView, 0)

   WinMove($g_hrename, '', $T[0], $T[1] + 80, $ilarg + 5, Default)
   GUISetState(@SW_SHOW, $g_hrename) ; on ouvre une fenetre volante
   GUICtrlSetData($g_idRename, $sname)

   If $ssource = $g_song Then
      If $g_hstream > 0 Then BASS_StreamFree()
      If @error Then wt(@ScriptLineNumber & ': ' & @error, 'StreamFree')
   EndIf

   Opt("GUIOnEventMode", 0) ; on passe en MessageLoop
   Opt("GUICloseOnESC", 1) ;ferme la fenetre avec ESC
   While 1
      If GUIGetMsg() = $GUI_EVENT_CLOSE Then ; on annule
         DllClose($hDLL)
         GUISetState(@SW_HIDE, $g_hrename)
         Opt("GUIOnEventMode", 1) ; on repasse en OnEvent
         Opt("GUICloseOnESC", 0)
         Return
      EndIf

      If _IsPressed('0d', $hDLL) Then ; Enter
         While _IsPressed('0d', $hDLL)
            Sleep(250)
         WEnd

         $sname = GUICtrlRead($g_idRename, 0)
         $sname = StringStripWS($sname, 7)
         $sname = _StringProper($sname)

         $i = 0
         While 1 ;renomme en incrementant si existe déjà
            $sdest = $i = 0 ? @WorkingDir & '\' & $sname & $sext : @WorkingDir & '\' & $sname & ' ' & StringFormat("%02d", $i) & $sext
            If FileMove($ssource, $sdest, 0) = 0 Then
               $i += 1
               If $i > 99 Then ExitLoop 1
               ContinueLoop
            Else
               ExitLoop 2
            EndIf
         WEnd
      EndIf
      Sleep(20)
   WEnd
   DllClose($hDLL)

   ID3Write($sdest)
   FileSetTime($sdest, $MODIFIED, 0)
   FileSetTime($sdest, $CREATED, 1)

   Loaded() ; je recharge les mp3, c'est plus simple pour faire correspondre la listview avec le contenu du rep

   GUISetState(@SW_HIDE, $g_hrename)
   Opt("GUIOnEventMode", 1) ; on repasse en OnEvent
   Opt("GUICloseOnESC", 0)

EndFunc   ;==>NewThing

Func Mini() ;ToutEstMiniDansNotreVie Dutronc
   ;recadre en largeur en fonction du dernier button 1009
   ;recadre en hauteur en fonction de la Toolbar
   Local $T = WinGetPos($g_hGui), $ihaut, $ilarg
   Select
      Case $T[3] > 80
         ControlHide($g_hGui, '', $g_hListView)
         $T = ControlGetPos($g_hGui, '', $g_hListView)
         $ihaut = $T[1] + 40
         $T = _GUICtrlToolbar_GetButtonRect($g_hToolbar, 1009)
         $ilarg = $T[2] + 5
         WinMove($g_hGui, '', Default, Default, $ilarg, $ihaut)
      Case Else
         $ilarg = _GUICtrlListView_GetColumnWidth($g_hListView, 0)
         WinMove($g_hGui, '', Default, Default, $ilarg + 5, $g_iHGui)
         ControlShow($g_hGui, '', $g_hListView)
   EndSelect
EndFunc   ;==>Mini

Func Gui()

   Local $T, $idmenu, $idPlay, $i, $aid, $aid1, $akey, $akey1, $shelp, $sfonct
   Local $idListView, $hImage_toolbar, $hImage_listview

   ;Local $style=BitOR($WS_SYSMENU,$WS_CAPTION)
   ;Local $style=BitOR($WS_CAPTION , $WS_POPUPWINDOW)
   Local $style = $DS_MODALFRAME
   ;Local $exstyle= $WS_EX_CLIENTEDGE
   ;Local $exstyle= $WS_EX_STATICEDGE
   ;Local $exstyle= $WS_EX_WINDOWEDGE
   Local $exstyle = $WS_EX_TOOLWINDOW

   $g_iWGui = 500
   $g_iHGui = @DesktopHeight - 31
   $g_hGui = GUICreate('', $g_iWGui, $g_iHGui, 1, 1, $style, $exstyle)
   ;$g_hGui = GUICreate('', $g_iWGui, $g_iHGui, 1, 1)
   GUISetIcon($g_RessourceIcon, 11)

   ;------------------------
   $idmenu = GUICtrlCreateMenu("Menu") ; permet de lier des AccelKeys

   $idPlay = GUICtrlCreateMenuItem("Restart", $idmenu)
   GUICtrlSetOnEvent(-1, "Restart")

   $aid = '$idPause,$idPrec,$idAuSuivant,$idBackward,$idForward,$idMoinsDix,$idPlusDix'
   $akey = 'SPACE,     UP,     DOWN,     LEFT,    RIGHT,        PGUP,       PGDN'

   $aid1 = '$idRen,$idDiscogs,$idID3,$idLoaded,$idMini,$idMoveIt,$idCopie,$idKillMe,$idMonteLeSon,$idBaisseLabatJour'
   $akey1 = 'F2,    F3,       F4,     F5,      F7,     NUMPAD1,   NUMPAD2,NUMPADDOT,NUMPAD0       ,NUMPAD9,'

   $aid = $aid & ',' & $aid1
   $akey = $akey & ',' & $akey1

   $aid = StringSplit($aid, ',', 2)
   $akey = StringSplit($akey, ',', 2)

   For $i = 0 To UBound($aid) - 1
      $akey[$i] = _StringProper(StringStripWS($akey[$i], 7))
      $shelp = ' (' & $akey[$i] & ')'
      $sfonct = StringRegExpReplace($aid[$i], '\$id(.*)', "${1}") ;$idPause --> Pause....$idReload --> Reload
      $aid[$i] = GUICtrlCreateMenuItem($sfonct & $shelp, $idmenu)
      GUICtrlSetOnEvent(-1, $sfonct)
   Next

   Dim $aAccelKeys[UBound($akey)][2]
   For $i = 0 To UBound($akey) - 1
      $aAccelKeys[$i][0] = '{' & $akey[$i] & '}' ; SPACE --> {SPACE}
      $aAccelKeys[$i][1] = $i + $idPlay + 1 ; --> pause(space)=5,6.....16
   Next

   ;They are only active when the GUI specified in the function is active
   If GUISetAccelerators($aAccelKeys) = 0 Then Erreur_Fatale('
je me suis emmêlée dans mes AccelKeys')

   ;GUISetState(@SW_SHOW, $g_hGui)
   ;AD($aAccelKeys)

   GUICtrlCreateMenuItem('
', $idmenu)
   GUICtrlCreateMenuItem("Exit", $idmenu)
   GUICtrlSetOnEvent(-1, "JeTireMaReverence")
   ;GUISetOnEvent($GUI_EVENT_CLOSE, "JeTireMaReverence")
   ;------------------------

   $g_hToolbar = _GUICtrlToolbar_Create($g_hGui)
   $g_hToolTip = _GUIToolTip_Create($g_hToolbar)
   _GUICtrlToolbar_SetToolTips($g_hToolbar, $g_hToolTip)

   ;------------------------
   ;Add Icons from dll to ImageList

   $hImage_toolbar = _GUIImageList_Create(16, 16, 5, 3)

   ;creer une dll de ressource icones
   ;https://design.google.com/icons/#ic_arrow_downward , 60Mo d'
icones android tres beau pas cher (licence Apache)
   ;https://www.autoitscript.fr/forum/viewtopic.php?f=11&t=310&sid=22b45f07f64b3bf6b508f81047b0cce0

   _GUIImageList_AddIcon($hImage_toolbar, $g_RessourceIcon, 7) ; play  d4d0c8
   _GUIImageList_AddIcon($hImage_toolbar, $g_RessourceIcon, 4) ; pause
   _GUIImageList_AddIcon($hImage_toolbar, $g_RessourceIcon, 9) ; up
   _GUIImageList_AddIcon($hImage_toolbar, $g_RessourceIcon, 2) ; Down
   _GUIImageList_AddIcon($hImage_toolbar, $g_RessourceIcon, 0) ; Backward
   _GUIImageList_AddIcon($hImage_toolbar, $g_RessourceIcon, 3) ; Forward
   _GUIImageList_AddIcon($hImage_toolbar, $g_RessourceIcon, 6) ; Pgup
   _GUIImageList_AddIcon($hImage_toolbar, $g_RessourceIcon, 5) ; Pgdwn
   _GUIImageList_AddIcon($hImage_toolbar, $g_RessourceIcon, 8) ; Reload
   _GUIImageList_AddIcon($hImage_toolbar, $g_RessourceIcon, 1) ; Compact

   ;OU dll system il y a 1000 icones mais rien sur les Forward Pgdwn

;~    _GUIImageList_AddIcon($hImage_toolbar, "mmcndmgr.dll", 32) ; play
;~    _GUIImageList_AddIcon($hImage_toolbar, "mmcndmgr.dll", 101) ;pause
;~     _GUIImageList_AddIcon($hImage_toolbar, "mmcndmgr.dll", 57) ;up
;~     _GUIImageList_AddIcon($hImage_toolbar, "mmcndmgr.dll", 48) ;down
;~     _GUIImageList_AddIcon($hImage_toolbar, "wmploc.dll", 201)  ;left
;~     _GUIImageList_AddIcon($hImage_toolbar, "wmploc.dll", 200)  ;right
;~    _GUIImageList_AddIcon($hImage_toolbar, "netshell.dll", 149) ;pgup
;~    _GUIImageList_AddIcon($hImage_toolbar, "netshell.dll", 150) ;pgdwn
;~     _GUIImageList_AddIcon($hImage_toolbar, "mmcndmgr.dll", 31) ;reload
;~    _GUIImageList_AddIcon($hImage_toolbar, "mmcndmgr.dll", 30) ;compact

   _GUICtrlToolbar_SetImageList($g_hToolbar, $hImage_toolbar)

   For $i = 0 To 9
      _GUICtrlToolbar_AddButton($g_hToolbar, 1000 + $i, $i) ;je l'ai cherche un moment celle la (elimine 10 lignes illisibles)
   Next
   ;-----------------------------

   Local $iStyle = BitOR($LVS_EDITLABELS, $LVS_REPORT, $LVS_SINGLESEL, $LVS_SHOWSELALWAYS, $LVS_NOCOLUMNHEADER)
   Local $iexStyle = BitOR($LVS_EX_GRIDLINES, $LVS_EX_FLATSB)
   $idListView = _GUICtrlListView_Create($g_hGui, '', 1, t($g_hToolbar), $g_iWGui - 1, $g_iHGui - 80, $iStyle)
   $g_hListView = ControlGetHandle($g_hGui, '', $idListView)
   ;_GUICtrlListView_SetExtendedListViewStyle($g_hListView, $iexStyle)

   _GUICtrlListView_AddColumn($g_hListView, 'col1', $g_iWGui - 10)

   $hImage_listview = _GUIImageList_Create(16, 16, 5, 3)
   _GUIImageList_AddIcon($hImage_listview, "mmcndmgr.dll", 34) ;pause
   _GUIImageList_AddIcon($hImage_listview, "mmcndmgr.dll", 32) ;play
   _GUICtrlListView_SetImageList($g_hListView, $hImage_listview, 1) ;Image list with small icons
   ;------------------------

   ;fenetre volante
   $g_hrename = GUICreate("Renomme", $g_iWGui - 10, 30, 1, 1, -1, -1, $g_hGui)
   $g_idRename = GUICtrlCreateInput('', 1, 1, $g_iWGui - 20, -1)

   GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
   ;GUISetState(@SW_SHOW, $g_hGui)
   ;wt()
EndFunc   ;==>Gui

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
   #forceref $hWnd, $iMsg, $iwParam

   Local $tNMHDR, $hWndFrom
   $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
   $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))

   ;cw($hWndFrom & @TAB & $g_hToolbar)
   Switch $hWndFrom
      Case $g_hToolbar
         Local $tNMTOOLBAR = DllStructCreate($tagNMTOOLBAR, $ilParam)
         Local $iItem = DllStructGetData($tNMTOOLBAR, "iItem")
         Local $icode = DllStructGetData($tNMTOOLBAR, "Code")
         Switch $icode
            Case $NM_CLICK ; $NM_LDOWN ;$TBN_BEGINDRAG
               Switch $iItem
                  Case 1000
                     Restart()
                  Case 1001
                     Pause()
                  Case 1002
                     Prec()
                  Case 1003
                     AuSuivant()
                  Case 1004
                     Backward()
                  Case 1005
                     Forward()
                  Case 1006
                     MoinsDix()
                  Case 1007
                     PlusDix()
                  Case 1008
                     Loaded()
                  Case 1009
                     Mini()
               EndSwitch
         EndSwitch

         ;cw($hWndFrom & @TAB & $g_hTooltip)
      Case $g_hToolTip
         Local $tInfo = DllStructCreate($tagNMTTDISPINFO, $ilParam)
         Local $icode = DllStructGetData($tInfo, "Code")
         Local $iItem = DllStructGetData($tInfo, "IDFrom")

         Switch $icode
            Case $TTN_GETDISPINFOW
               Local $stext
               Switch $iItem
                  Case 1000
                     $stext = "Restart"
                  Case 1001
                     $stext = "Pause"
                  Case 1002
                     $stext = "Prec"
                  Case 1003
                     $stext = "Suiv"
                  Case 1004
                     $stext = "-20s"
                  Case 1005
                     $stext = "+20s"
                  Case 1006
                     $stext = "-10"
                  Case 1007
                     $stext = "+10"
                  Case 1008
                     $stext = "Recharge Rep"
                  Case 1009
                     $stext = "Mini"
               EndSwitch
               DllStructSetData($tInfo, "aText", $stext)
         EndSwitch

         ;cw($hWndFrom & @TAB & $g_hListView)
      Case $g_hListView
         Local $icode = DllStructGetData($tNMHDR, "Code")
         Local $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
         Local $index = DllStructGetData($tInfo, "Index")
         Local $iItem = DllStructGetData($tInfo, "Item")

         Switch $icode
            Case $NM_DBLCLK
               ListView_DBLCLK($index) ; joue l'item

            Case $NM_RDBLCLK
               ToolTip('')
               Local $source = _GUICtrlListView_GetItemText($g_hListView, $index)
               NewThing($source) ;renomme

            Case $NM_KILLFOCUS, $LVN_ITEMCHANGED
               ToolTip('')

            Case $NM_CLICK
               If $iItem = -1 Then ToolTip("")

            Case $NM_RCLICK
               If $iItem = -1 Then ToolTip("")
               ToolTip(MediaInfo($index))
         EndSwitch
   EndSwitch
   Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_NOTIFY

Func TrayEvent()
   Local $iState
   Switch @TRAY_ID
      Case $TRAY_EVENT_PRIMARYDOUBLE ;récupère provisoirement les Hotkeys
         Switch $g_TrayPause
            Case False
               $g_TrayPause = True
               TraySetState($TRAY_ICONSTATE_FLASH)
               HotKeySet('{!}')
               HotKeySet('²')
            Case True
               $g_TrayPause = False
               TraySetState($TRAY_ICONSTATE_STOPFLASH)
               HotKeySet('{!}', 'ActiveMoi')
               HotKeySet('²', 'ActiveMoi')
         EndSwitch

;~       Case $TRAY_EVENT_PRIMARYDOWN ; Show/Hide la fenetre
;~          $iState = WinGetState($g_hGui, '')
;~          ;cw('WinGetState'&@TAB&$iState)
;~          Switch BitAND($iState, 2)
;~             Case False
;~                WinSetState($g_hGui, '', @SW_SHOW)
;~                ;TraySetState($TRAY_ICONSTATE_STOPFLASH)
;~             Case True
;~                WinSetState($g_hGui, '', @SW_HIDE)
;~                ;TraySetState($TRAY_ICONSTATE_FLASH)
;~          EndSwitch
   EndSwitch
EndFunc   ;==>TrayEvent

Func Tray()
   TraySetClick(8) ;8 = Pressing secondary mouse button  mouseclicks will display the tray menu
   TrayCreateItem("Aide")
   TrayItemSetOnEvent(-1, "Aide")
   TrayCreateItem("")
   TrayCreateItem("Quitter")
   TrayItemSetOnEvent(-1, "JeTireMaReverence")
   TraySetOnEvent($TRAY_EVENT_PRIMARYDOUBLE, "TrayEvent")
   TraySetOnEvent($TRAY_EVENT_PRIMARYDOWN, "TrayEvent")
   TraySetState($TRAY_ICONSTATE_SHOW)
   TraySetIcon($g_RessourceIcon, -12) ; un superbe icon de chez Discogs
   ;Passing a positive number will reference the string equivalent icon name.
   ;Passing a negative number causes 1-based "index" behaviour. Some Dll can have icon extracted just with negative numbers.
EndFunc   ;==>Tray

Func Aide()
   MsgBox($MB_SYSTEMMODAL, "", "AutoIt tray menu example." & @CRLF & @CRLF & _
         "Version: " & @AutoItVersion)
EndFunc   ;==>Aide

Func JeTireMaReverence() ; Sablon Trénet
   BASS_PluginFree(0)
   DllCall($g_hBassDll, "int", "BASS_Free")
   Exit
EndFunc   ;==>JeTireMaReverence

Func ActiveMoi()
   ;commute entre ce prg et le prg precedent
   Local $h = WinGetHandle("[active]")
   If $h <> $g_hGui Then
      $g_hold_win_active = $h
      WinActivate($g_hGui)
   Else
      WinActivate($g_hold_win_active)
   EndIf
EndFunc   ;==>ActiveMoi

Func Loaded() ;Velvet Underground
   Local $ilarg, $T = '*.mp3;*.mp4;*.m4a;*.aac;*.ogg;*.flac;*.wma;*.ac3;*.ape;*.mpc;*.opus'
   $T = _FileListToArrayRec(@WorkingDir, $T, 1, 0, 1, 0)
   If Not IsArray($T) Then Erreur_Fatale('Pas de ' & $T & ' dans ' & @WorkingDir)
   _ArrayDelete($T, 0)
   _ArrayColInsert($T, 1) ; pour _GUICtrlListView_AddArray ????????

   _GUICtrlListView_DeleteAllItems($g_hListView)
   _GUICtrlListView_AddArray($g_hListView, $T)

   _GUICtrlListView_SetItemSelected($g_hListView, $g_idx_song, True, True) ; garder l'item joué avant le reload
   _GUICtrlListView_SetItemImage($g_hListView, $g_idx_song, 1) ;play

   _GUICtrlListView_SetColumnWidth($g_hListView, 0, $LVSCW_AUTOSIZE)
   $ilarg = _GUICtrlListView_GetColumnWidth($g_hListView, 0)
   WinMove($g_hGui, '', Default, Default, $ilarg + 10, Default) ; redimmensionne la Gui en fonction de la largeur de la listview

   Return
EndFunc   ;==>Loaded

Func Discogs()
   Local $pattern, $artist, $title, $url

   If StringInStr($g_song, ' - ') Then ;Cure - 1015 Saturday Night (Live).m4a
      $pattern = '(.*) - (.*)\..*'
      $artist = StringRegExpReplace($g_song, $pattern, "${1}")
      $title = StringRegExpReplace($g_song, $pattern, "${2}")
      $title = StringStripWS($title, 7)
      $url = 'https://www.discogs.com/fr/search/?type=release&release_title=' & $title & '&artist=' & $artist
      ShellExecute($url)
   Else ; Lucky Star.mp3
      $pattern = '(.*)\..*'
      $title = StringRegExpReplace($g_song, $pattern, "${1}")
      $url = 'https://www.discogs.com/fr/search/?q=' & $title
      ShellExecute($url)
   EndIf
   ;https://www.discogs.com/fr/search/?q=Superfunk Lucky Star
   ;http://api.discogs.com/database/search?type=release&release_title=untrue&artist=burial
   ;https://www.discogs.com/fr/search/?type=release&release_title=I Want You&artist=Bob Dylan|

EndFunc   ;==>Discogs

Func ID3Write($file)
   ;ID3 functions only works with mp3 files
   ;E:\mp3\rap\Mr Vegas And Opal - Talk Di Tings.mp3
   Local $pattern = '.*\\(.*) - (.*)(\..*)'
   Local $artist = StringRegExpReplace($file, $pattern, "${1}")
   If @extended = 0 Then Return ; si le nom n'est pas formaté "Artiste - titre"
   Local $title = StringRegExpReplace($file, $pattern, "${2}")
   Local $ext = StringRegExpReplace($file, $pattern, "${3}")
   If $ext <> '.mp3' Then Return

   cw(_ID3ReadTag($file, 1)) ;function must be used first in order to use other ID3.au3 functions.
   _ID3SetTagField("TPE1", $artist)
   _ID3SetTagField("TIT2", $title)
   _ID3WriteTag($file)
EndFunc   ;==>ID3Write

Func BassTags($sFile)
   ;je préfère MediaInfo, c'était pour voir si les add-on fonctionnaient
   Local $stagsID3, $sdll = @ScriptDir & '\tags.dll', $hDLL = DllOpen($sdll)
   If $hDLL = -1 Then
      cw(Arch32_64($sdll))
      Erreur_Non_Fatale('Could not initialize ' & $sdll, WinGetHandle("[active]"))
      Return SetError(1)
   EndIf

   ;Bass_Tags_Read ($hBassTagsDll,$hHandle, $sFMT)
   $stagsID3 = Bass_Tags_Read($hDLL, $g_hstream, _
         "%IFV1(%ARTI,%ARTI)" & @LF & _
         "%IFV1(%TITL,%TITL)" & @LF & _
         "%IFV1(%ALBM,%ALBM)" & @LF & _
         "%IFV1(%YEAR,%YEAR)" & @LF & _
         "%IFV1(%GNRE,%GNRE)")
   cw(Bass_Tags_GetLastErrorDesc($hDLL))

   If StringRegExp($stagsID3, '([[:alpha:]])', 0) = 0 Then Return SetError(1) ; si aucune lettre

   Return $stagsID3
EndFunc   ;==>BassTags

Func MediaInfo($index)
   Local $sFile = _GUICtrlListView_GetItemText($g_hListView, $index)

   Local $T, $sdll = @ScriptDir & '\MediaInfo.dll', $hDLL = DllOpen($sdll)
   If $hDLL = -1 Then
      cw(Arch32_64($sdll))
      Erreur_Non_Fatale('Could not initialize ' & $sdll, WinGetHandle("[active]"))
      Return SetError(1, 0, 0)
   EndIf

   $T = DllCall($hDLL, "ptr", "MediaInfo_New")
   DllCall($hDLL, "int", "MediaInfo_Open", "ptr", $T[0], "wstr", $sFile)
   DllCall($hDLL, "wstr", "MediaInfo_Option", "ptr", 0, "wstr", "Complete", "wstr", "")
   $T = DllCall($hDLL, "wstr", "MediaInfo_Inform", "ptr", $T[0], "int", 0)
   DllClose($hDLL)
   If Not IsArray($T) Then Return SetError(1, 0, 0)
   Return $T[0]
EndFunc   ;==>MediaInfo

Func ID3()
   ;Local $stagsID3 = BassTags($g_song)
   Local $stagsID3 = MediaInfo($g_song)
   If @error Then Return
   Local $T = WinGetPos($g_hGui)
   ToolTip($stagsID3, $T[0], $T[1], '', 3, 4 + 1)
EndFunc   ;==>ID3

Func Arch32_64($sFile)
   ;https://www.autoitscript.com/forum/topic/144318-how-to-tell-if-a-exe-or-dll-is-x64-or-x86/

   Local $hFile = FileOpen($sFile, 16)
   If $hFile = -1 Then Return SetError(1, 0, 0)

   Local $string = BinaryToString(FileRead($hFile, 2))

   If $string <> "MZ" Then
      wt(@ScriptLineNumber & ': ' & $sFile & '= ' & $string, 'Arch32_64')
      FileClose($hFile)
      Return SetError(1, 0, 0)
   EndIf

   FileSetPos($hFile, 60, 0)
   Local $sz_type = FileRead($hFile, 4)
   FileSetPos($hFile, Number($sz_type) + 4, 0)
   $sz_type = FileRead($hFile, 2)

   FileClose($hFile)

   Switch $sz_type
      Case "0x6486"
         Return 'amd64'
      Case "0x0002"
         Return 'ia64'
      Case "0x4C01"
         Return 'i386'
   EndSwitch

   Return SetError(1, 0, 0)
EndFunc   ;==>Arch32_64

Func Charge_dll()
   ;fonctionne avec les dll 32b et 64b de 2016
   ;http://www.un4seen.com/

   Local $T, $i, $element
   Local $sdll = @ScriptDir & '\bass.dll'
   Local $sArch = Arch32_64($sdll)
   Select
      Case $sArch = 'i386' And @AutoItX64
         Erreur_Fatale($sdll & ' est en 32b --> compiler en 32b')
      Case $sArch = 'amd64' And Not @AutoItX64
         Erreur_Fatale($sdll & ' est en 64b --> compiler en 64b')
   EndSelect

   $g_hBassDll = DllOpen($sdll)
   If $g_hBassDll = -1 Then Erreur_Fatale('Could not initialize ' & $sdll)

   BASS_Init()
   If @error Then wt(@ScriptLineNumber & ': ' & @error, 'Init')

   ;---------------------------
   ;vous pouvez les éliminer ces plugins
   $T = 'ac3,ape,flac,mpc,opus,wma'
   $T = StringSplit($T, ',', 2)
   For $i = 0 To UBound($T) - 1
      $T[$i] = @ScriptDir & '\bass' & $T[$i] & '.dll' ; Renommer les ddl bass_ac3.dll --> bassac3.dll
      ;cw($T[$i]&@TAB&Arch32_64($T[$i]))
   Next
   For $element In $T
      BASS_PluginLoad($element)
      If @error Then Erreur_Non_Fatale('Could not initialize ' & $element, WinGetHandle("[active]"))
   Next
   ;-----------------------------
EndFunc   ;==>Charge_dll

;----------------------------
; Fonctions récupérées dans l'UDF BASS.au3
; Author ........: Brett Francis (BrettF)
;https://autoit.de/index.php/Thread/26550-Bass-dll-UDF-Version-10-Download/

Func BASS_ErrorGetCode($appelant)
   Local $T = DllCall($g_hBassDll, "int", "BASS_ErrorGetCode")
   If @error Then Return SetError(1, 0, -1)
   cw($appelant & @TAB & 'ErrorGetCode: ' & $T[0])
   Return $T[0]
EndFunc   ;==>BASS_ErrorGetCode

Func BASS_ChannelGetLength() ; du fichier decompressé (=wav)
   Local $BASS_POS_BYTE = 0
   Local $T = DllCall($g_hBassDll, "uint64", "BASS_ChannelGetLength", "DWORD", $g_hstream, "DWORD", $BASS_POS_BYTE)
   If @error Then Return SetError(1, 1, 0)
   If $T = -1 Then Return SetError(BASS_ErrorGetCode('ChannelGetLength'), 0, 0)
   Return $T[0]
EndFunc   ;==>BASS_ChannelGetLength

Func BASS_ChannelSeconds2Bytes($pos, $appelant = @ScriptLineNumber)
   Local $T = DllCall($g_hBassDll, "uint64", "BASS_ChannelSeconds2Bytes", "dword", $g_hstream, "double", $pos)
   If $T[0] = 0 Then Return SetError(BASS_ErrorGetCode('ChannelSeconds2Bytes ' & $appelant), 0, 0)
   Return $T[0]
EndFunc   ;==>BASS_ChannelSeconds2Bytes

Func BASS_ChannelBytes2Seconds($pos, $appelant = @ScriptLineNumber)
   Local $T = DllCall($g_hBassDll, "double", "BASS_ChannelBytes2Seconds", "dword", $g_hstream, "uint64", $pos)
   If $T[0] = 0 Then Return SetError(BASS_ErrorGetCode('ChannelSeconds2Bytes ' & $appelant), 0, 0)
   Return $T[0]
EndFunc   ;==>BASS_ChannelBytes2Seconds

Func BASS_ChannelSetPosition($pos, $appelant = @ScriptLineNumber)
   Local $BASS_POS_BYTE = 0
   Local $T = DllCall($g_hBassDll, "int", "BASS_ChannelSetPosition", "DWORD", $g_hstream, "uint64", $pos, "DWORD", $BASS_POS_BYTE)
   If $T[0] = 0 Then Return SetError(BASS_ErrorGetCode('ChannelSetPosition ' & $appelant), 0, 0)
   Return $T[0]
EndFunc   ;==>BASS_ChannelSetPosition

Func BASS_ChannelGetPosition($appelant = @ScriptLineNumber)
   Local $BASS_POS_BYTE = 0
   Local $T = DllCall($g_hBassDll, "uint64", "BASS_ChannelGetPosition", "DWORD", $g_hstream, "DWORD", $BASS_POS_BYTE)
   If $T[0] = 0 Then Return SetError(BASS_ErrorGetCode('ChannelGetPosition ' & $appelant), 0, 0)
   Return $T[0]
EndFunc   ;==>BASS_ChannelGetPosition

Func Bass_ChannelPlay($restart = 1)
   Local $T = DllCall($g_hBassDll, "int", "BASS_ChannelPlay", "dword", $g_hstream, "int", $restart) ;
   If $T[0] = 0 Then Return SetError(BASS_ErrorGetCode('ChannelPlay'), 0, 0)
   Return $T[0]
EndFunc   ;==>Bass_ChannelPlay

Func BASS_ChannelIsActive($appelant = @ScriptLineNumber)
   Local $T = DllCall($g_hBassDll, "int", "BASS_ChannelIsActive", "DWORD", $g_hstream)
   If $T[0] = 0 Then Return SetError(BASS_ErrorGetCode('ChannelIsActive ' & $appelant), 0, 0)
   ;cw($appelant)
   Return $T[0]
EndFunc   ;==>BASS_ChannelIsActive

Func BASS_Stop()
   Local $T = DllCall($g_hBassDll, "int", "BASS_Stop")
   If $T[0] = 0 Then Return SetError(BASS_ErrorGetCode('Stop'), 0, 0)
   Return $T[0]
EndFunc   ;==>BASS_Stop

Func BASS_Pause()
   Local $T = DllCall($g_hBassDll, "int", "BASS_Pause")
   If $T[0] = 0 Then Return SetError(BASS_ErrorGetCode('Pause'), 0, 0)
   Return $T[0]
EndFunc   ;==>BASS_Pause

Func BASS_ChannelPause()
   Local $T = DllCall($g_hBassDll, "int", "BASS_ChannelPause", "DWORD", $g_hstream)
   If $T[0] = 0 Then Return SetError(BASS_ErrorGetCode('ChannelPause'), 0, 0)
   Return $T[0]
EndFunc   ;==>BASS_ChannelPause

Func BASS_Init()
   Local $T = DllCall($g_hBassDll, "int", "BASS_Init", "int", -1, "dword", 44100, "dword", 0, "hwnd", 0, "ptr", 0)
   ;cw('Init: '&@error&@TAB&$T[0])
   If $T[0] = 0 Then Return SetError(BASS_ErrorGetCode('Init'), 0, 0)
EndFunc   ;==>BASS_Init

Func BASS_SetVolume($volume)
   Local $T = DllCall($g_hBassDll, "int", "BASS_SetVolume", "float", $volume)
   If $T[0] = 0 Then Return SetError(BASS_ErrorGetCode('SetVolume'), 0, 0)
   Return $T[0]
EndFunc   ;==>BASS_SetVolume

Func BASS_GetVolume()
   Local $T = DllCall($g_hBassDll, "float", "BASS_GetVolume")
   If $T[0] = 0 Then Return SetError(BASS_ErrorGetCode('SetVolume'), 0, 0)
   Return $T[0]
EndFunc   ;==>BASS_GetVolume

Func BASS_StreamCreateFile($file)
   Local $BASS_STREAM_AUTOFREE = 0x40000, $BASS_UNICODE = 0x80000000
   Local $mem = False, $offset = 0, $length = 0
   Local $tpFile = "wstr"
   Local $T = DllCall($g_hBassDll, "dword", "BASS_StreamCreateFile", "int", $mem, $tpFile, $file, "uint64", $offset, "uint64", $length, "DWORD", BitOR($BASS_STREAM_AUTOFREE, $BASS_UNICODE))
   ;cw('StreamCreateFile: '&@error&@TAB&$T[0] & ',' & $T[1] & ',' & $T[2] & ',' & $T[3]& ',' & $T[4]& ',' & $T[5])
   If $T[0] = 0 Then Return SetError(BASS_ErrorGetCode('StreamCreateFile'), 0, 0)
   Return $T[0]
EndFunc   ;==>BASS_StreamCreateFile

Func BASS_StreamFree($appelant = @ScriptLineNumber)
   Local $T = DllCall($g_hBassDll, "int", "BASS_StreamFree", "dword", $g_hstream)
   If $T[0] = 0 Then Return SetError(BASS_ErrorGetCode('StreamFree ' & $appelant), 0, 0)
   $g_hstream = 0
   Return $T[0]
EndFunc   ;==>BASS_StreamFree

Func BASS_PluginLoad($file, $flags = 0)
   Local $BASS_UNICODE = 0x80000000
   Local $T = DllCall($g_hBassDll, "dword", "BASS_PluginLoad", "wstr", $file, "dword", BitOR($flags, $BASS_UNICODE))
   If @error Then Return SetError(1, 1, 0)
   If $T[0] = 0 Then Return SetError(BASS_ErrorGetCode('PluginLoad'), 0, 0)
   Return $T[0]
EndFunc   ;==>BASS_PluginLoad

Func BASS_PluginFree($handle = 0)
   Local $T = DllCall($g_hBassDll, "int", "BASS_PluginFree", "dword", $handle)
   If @error Then Return SetError(1, 1, 0)
   If $T = 0 Then Return SetError(BASS_ErrorGetCode('PluginFree'), 0, 0)
   Return $T[0]
EndFunc   ;==>BASS_PluginFree

Func Bass_Tags_Read($hBassTagsDll, $hHandle, $sFMT)
   Local $_bTags_Ret_ = DllCall($hBassTagsDll, "str", "TAGS_Read", "dword", $hHandle, "str", $sFMT)
   If @error Then Return SetError(1, @error, 0)
   Return $_bTags_Ret_[0]
EndFunc   ;==>Bass_Tags_Read

Func Bass_Tags_GetLastErrorDesc($hBassTagsDll)
   Local $_bTags_Ret_ = DllCall($hBassTagsDll, "str", "TAGS_GetLastErrorDesc")
   If @error Then Return SetError(1, @error, 0)
   Return $_bTags_Ret_[0]
EndFunc   ;==>Bass_Tags_GetLastErrorDesc


;-------------------
Func Erreur_Non_Fatale($message, $hWnd) ; attache a la fenetre
   Local $T = WinGetPos($hWnd)
   Run('rundll32 user32.dll,MessageBeep')
   ToolTip($message, $T[0], $T[1] + 100, '', 3, 4 + 1)
   Sleep(5000)
   ToolTip('')
EndFunc   ;==>Erreur_Non_Fatale

Func Erreur_Fatale($message)
   ToolTip($message, 1, 1, '', 1, 1)
   Run('rundll32 user32.dll,MessageBeep')
   Sleep(10 * 1000)
   ToolTip('')
   JeTireMaReverence()
EndFunc   ;==>Erreur_Fatale

Func AD($T, $line = @ScriptLineNumber)
   If Not IsArray($T) Then Return
   _ArrayDisplay($T, $line)
EndFunc   ;==>AD

Func cw($texte = @ScriptLineNumber, $ligne = @ScriptLineNumber)
   ConsoleWrite(StringFormat("%04d", $ligne) & @TAB & '|')
   ConsoleWrite($texte)
   ConsoleWrite('|' & @LF)
EndFunc   ;==>cw

Func wt($texte = @ScriptLineNumber, $titre = @ScriptLineNumber)
   If MsgBox(1, $titre, '|' & $texte & '|') <> 1 Then JeTireMaReverence()
EndFunc   ;==>wt

Func Byte2Kilo($iBytes)
   Local $i, $T[6] = [" B", " KB", " MB", " GB", " TB", " PB"]
   While $iBytes > 1023
      $i += 1
      $iBytes /= 1024
   WEnd
   Return Round($iBytes, 2) & $T[$i]
EndFunc   ;==>Byte2Kilo

Func t($id) ; positionner des GUIControl relativement a d'autres
   ;$g_hListView = _GUICtrlListView_Create($g_hGui, '', 1, t($g_hToolbar), $W - 1, $H - 50, $iStyle)
   Local $T = ControlGetPos($g_hGui, '', $id)
   Return $T[1] + $T[3] + 5
EndFunc   ;==>t

Func SelectFolder()
   Local $path
   If $CmdLine[0] > 0 Then ; glisser un mp3 sur le raccourci, je recupere le path
      FileChangeDir(StringRegExpReplace($CmdLine[1], "(.*\\).*", "${1}"))
   Else
      $path = FileSelectFolder("Select a folder", "")
      If @error Then
         MsgBox($MB_SYSTEMMODAL, "", "No folder was selected.")
      Else
         FileChangeDir($path)
      EndIf
   EndIf
EndFunc   ;==>SelectFolder

;------------------------------

; ===============================================================================================================================
; Error codes returned by $BASS_ErrorGetCode
; ===============================================================================================================================
;$BASS_OK = 0 ;all is OK
;$BASS_ERROR_MEM = 1 ;memory error
;$BASS_ERROR_FILEOPEN = 2 ;can;t open the file
;$BASS_ERROR_DRIVER = 3 ;can;t find a free sound driver
;$BASS_ERROR_BUFLOST = 4 ;the sample buffer was lost
;$BASS_ERROR_HANDLE = 5 ;invalid handle
;$BASS_ERROR_FORMAT = 6 ;unsupported sample format
;$BASS_ERROR_POSITION = 7 ;invalid position
;$BASS_ERROR_INIT = 8 ;$BASS_Init has not been successfully called
;$BASS_ERROR_START = 9 ;$BASS_Start has not been successfully called
;$BASS_ERROR_ALREADY = 14 ;already initialized/paused/whatever
;$BASS_ERROR_NOCHAN = 18 ;can;t get a free channel
;$BASS_ERROR_ILLTYPE = 19 ;an illegal type was specified
;$BASS_ERROR_ILLPARAM = 20 ;an illegal parameter was specified
;$BASS_ERROR_NO3D = 21 ;no 3D support
;$BASS_ERROR_NOEAX = 22 ;no EAX support
;$BASS_ERROR_DEVICE = 23 ;illegal device number
;$BASS_ERROR_NOPLAY = 24 ;not playing
;$BASS_ERROR_FREQ = 25 ;illegal sample rate
;$BASS_ERROR_NOTFILE = 27 ;the stream is not a file stream
;$BASS_ERROR_NOHW = 29 ;no hardware voices available
;$BASS_ERROR_EMPTY = 31 ;the MOD music has no sequence data
;$BASS_ERROR_NONET = 32 ;no internet connection could be opened
;$BASS_ERROR_CREATE = 33 ;couldn;t create the file
;$BASS_ERROR_NOFX = 34 ;effects are not available
;$BASS_ERROR_NOTAVAIL = 37 ;requested data is not available
;$BASS_ERROR_DECODE = 38 ;the channel is a "decoding channel"
;$BASS_ERROR_DX = 39 ;a sufficient DirectX version is not installed
;$BASS_ERROR_TIMEOUT = 40 ;connection timedout
;$BASS_ERROR_FILEFORM = 41 ;unsupported file format
;$BASS_ERROR_SPEAKER = 42 ;unavailable speaker
;$BASS_ERROR_VERSION = 43 ;invalid BASS version (used by add-ons)
;$BASS_ERROR_CODEC = 44 ;codec is not available/supported
;$BASS_ERROR_ENDED = 45 ;the channel/file has ended
;$BASS_ERROR_UNKNOWN = -1 ;some other mystery problem

message original:
Le seul player que je connaisse qui permet d'effacer/copier/déplacer c'est:
1by1 the directory player http://mpesch3.de1.cc/
J'étais parti sur un utilitaire qui ramène tous les menus dont j'ai besoin (effacer,copier,déplacer) sur le NUMPAD de mon portable (WinMenuSelectItem).
Malheureusement les menus se trouve dans le context menu:
https://www.autoitscript.com/forum/topi ... t-menu-ite
Je me retrouve à faire des controlsend et des clipget et je n'aime pas ça
Je suis donc reparti 'from scratch' avec l'UDF Bass et GUISetAccelerators

rapetou_hc_00combinec.jpg
RapetouRes_dll+ico.zip
(12.01 Kio) Téléchargé 190 fois
Modifié en dernier par illwind33 le lun. 07 nov. 2016 13:43, modifié 7 fois.
Avatar du membre
orax
Modérateur
Modérateur
Messages : 1479
Enregistré le : lun. 23 mars 2009 04:50
Localisation : ::1
Status : Hors ligne

Re: Faire le ménage (dans ses mp3)

#2

Message par orax »

ça peut intéresser le forum ?
si oui peut-on uploader un fichier ressource icon de 35ko ?
Oui, aucun problème. :wink:
De petits détails peuvent faire toute la différence. — Quand la boule de neige commence à rouler… poussez-la. (Columbo)
illwind33
Niveau 2
Niveau 2
Messages : 15
Enregistré le : sam. 27 févr. 2016 18:42
Localisation : toulouse
Status : Hors ligne

Re: [EX] Faire le ménage (dans ses mp3) avec Bass.dll

#3

Message par illwind33 »

Bonjour,

Quand j'ai collé mon code, ça m'a donné ça:
le 8 c'est un mot réservé?
_GUIImageList_AddIcon($hImage_toolbar, $RessourceIcon, 5) ; Pgdwn
    _GUIImageList_AddIcon($hImage_toolbar, $RessourceIcon,[b] <img class=\"smilies\" src=\"./images/smilies/icon_cool.gif\" alt=\"8)\" title=\"Cool\" /> ;[/b] Reload
    _GUIImageList_AddIcon($hImage_toolbar, $RessourceIcon, 1) ; Compact
   
   
     If FileCopy($source, $dest, 1 + [b]<img class=\"smilies\" src=\"./images/smilies/icon_cool.gif\" alt=\"8)\" title=\"Cool\" />[/b] = 0 Then
        Erreur_Non_Fatale('FileCopy' & @LF & $source & @LF & $dest, $hGui)
        Return
    EndI
A+
Avatar du membre
orax
Modérateur
Modérateur
Messages : 1479
Enregistré le : lun. 23 mars 2009 04:50
Localisation : ::1
Status : Hors ligne

Re: [EX] Faire le ménage (dans ses mp3) avec Bass.dll

#4

Message par orax »

Pour pouvoir écrire « 8) » sans que ça affiche l'image « 8) » il faut cocher la case Désactiver les émoticônes.
De petits détails peuvent faire toute la différence. — Quand la boule de neige commence à rouler… poussez-la. (Columbo)
Avatar du membre
Tlem
Site Admin
Site Admin
Messages : 11773
Enregistré le : ven. 20 juil. 2007 21:00
Localisation : Bordeaux
Status : Hors ligne

Re: [EX] Faire le ménage (dans ses mp3) avec Bass.dll

#5

Message par Tlem »

Sinon, il suffit d'utiliser la balise de code comme je viens de la faire dans le message de illwind33. ^^
Thierry

Rechercher sur le forum ----- Les règles du forum
Le "ça ne marche pas" est une conséquence commune découlant de beaucoup trop de raisons potentielles ...

Une idée ne peut pas appartenir à quelqu'un. (Albert Jacquard) tiré du documentaire "Copié n'est pas volé".
illwind33
Niveau 2
Niveau 2
Messages : 15
Enregistré le : sam. 27 févr. 2016 18:42
Localisation : toulouse
Status : Hors ligne

Re: [EX] Faire le ménage (dans ses mp3) avec Bass.dll

#6

Message par illwind33 »

Bonjour,

Mise à jour:

j'ai modifié le 1° post

fonctionne en 32b ou 64b avec les dernières dll

j'ai sortie les fonctions qui m’intéressait de l''UDF:
------------------------------------
;----------------------------
; Fonctions récupérées dans l'UDF BASS.au3
; Author ........: Brett Francis (BrettF)
;https://autoit.de/index.php/Thread/26550-Bass-dll-UDF-Version-10-Download/

Func BASS_ErrorGetCode($appelant)
   Local $T = DllCall($g_hBassDll, "int", "BASS_ErrorGetCode")
   If @error Then Return SetError(1, 0, -1)
   cw($appelant & @TAB & 'ErrorGetCode: ' & $T[0])
   Return $T[0]
EndFunc   ;==>BASS_ErrorGetCode

Func Bass_ChannelPlay($restart = 1)
   Local $T = DllCall($g_hBassDll, "int", "BASS_ChannelPlay", "dword", $g_hstream, "int", $restart) ;
   If $T[0] = 0 Then Return SetError(BASS_ErrorGetCode('ChannelPlay'), 0, 0)
   Return $T[0]
EndFunc   ;==>Bass_ChannelPlay
..
..
..
..
Func BASS_PluginLoad($file, $flags = 0)
   Local $BASS_UNICODE = 0x80000000
   Local $T = DllCall($g_hBassDll, "dword", "BASS_PluginLoad", "wstr", $file, "dword", BitOR($flags, $BASS_UNICODE))
   If @error Then Return SetError(1, 1, 0)
   If $T[0] = 0 Then Return SetError(BASS_ErrorGetCode('PluginLoad'), 0, 0)
   Return $T[0]
EndFunc   ;==>BASS_PluginLoad

une fonction qui peut servir ailleurs:
Func Arch32_64($sFile)
   ;https://www.autoitscript.com/forum/topic/144318-how-to-tell-if-a-exe-or-dll-is-x64-or-x86/

   Local $hFile = FileOpen($sFile, 16)
   If $hFile = -1 Then Return SetError(1, 0, 0)

   Local $string = BinaryToString(FileRead($hFile, 2))

   If $string <> "MZ" Then
      wt(@ScriptLineNumber & ': ' & $sFile & '= ' & $string, 'Arch32_64')
      FileClose($hFile)
      Return SetError(1, 0, 0)
   EndIf

   FileSetPos($hFile, 60, 0)
   Local $sz_type = FileRead($hFile, 4)
   FileSetPos($hFile, Number($sz_type) + 4, 0)
   $sz_type = FileRead($hFile, 2)

   FileClose($hFile)

   Switch $sz_type
      Case "0x6486"
         Return 'amd64'
      Case "0x0002"
         Return 'ia64'
      Case "0x4C01"
         Return 'i386'
   EndSwitch

   Return SetError(1, 0, 0)
EndFunc   ;==>Arch32_64
j'ai 'nettoyé' le WM_notify de l'help autoit
avant ça prennait la journée pour trouver ce qui ne fonctionnait pas, maintenant ça me prend 5 mn
je l'utilise tel quel dans tous les prg qui ont besoin de wm_notify
Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
   #forceref $hWnd, $iMsg, $iwParam

   Local $tNMHDR, $hWndFrom
   $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
   $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))

   ;cw($hWndFrom & @TAB & $g_hToolbar)
   Switch $hWndFrom
      Case $g_hToolbar
         Local $tNMTOOLBAR = DllStructCreate($tagNMTOOLBAR, $ilParam)
         Local $iItem = DllStructGetData($tNMTOOLBAR, "iItem")
         Local $icode = DllStructGetData($tNMTOOLBAR, "Code")
         Switch $icode
            Case $NM_CLICK ; $NM_LDOWN ;$TBN_BEGINDRAG
               Switch $iItem
                  Case 1000
                     Restart()
                  Case 1001
                     Pause()
                  Case 1002
                     Prec()
                  Case 1003
                     AuSuivant()
                  Case 1004
                     Backward()
                  Case 1005
                     Forward()
                  Case 1006
                     MoinsDix()
                  Case 1007
                     PlusDix()
                  Case 1008
                     Loaded()
                  Case 1009
                     Mini()
               EndSwitch
         EndSwitch

         ;cw($hWndFrom & @TAB & $g_hTooltip)
      Case $g_hToolTip
         Local $tInfo = DllStructCreate($tagNMTTDISPINFO, $ilParam)
         Local $icode = DllStructGetData($tInfo, "Code")
         Local $iItem = DllStructGetData($tInfo, "IDFrom")

         Switch $icode
            Case $TTN_GETDISPINFOW
               Local $stext
               Switch $iItem
                  Case 1000
                     $stext = "Restart"
                  Case 1001
                     $stext = "Pause"
                  Case 1002
                     $stext = "Prec"
                  Case 1003
                     $stext = "Suiv"
                  Case 1004
                     $stext = "-20s"
                  Case 1005
                     $stext = "+20s"
                  Case 1006
                     $stext = "-10"
                  Case 1007
                     $stext = "+10"
                  Case 1008
                     $stext = "Recharge Rep"
                  Case 1009
                     $stext = "Mini"
               EndSwitch
               DllStructSetData($tInfo, "aText", $stext)
         EndSwitch

         ;cw($hWndFrom & @TAB & $g_hListView)
      Case $g_hListView
         Local $icode = DllStructGetData($tNMHDR, "Code")
         Local $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
         Local $index = DllStructGetData($tInfo, "Index")
         Local $iItem = DllStructGetData($tInfo, "Item")

         Switch $icode
            Case $NM_DBLCLK
               ListView_DBLCLK($index) ; joue l'item

            Case $NM_RDBLCLK
               ToolTip('')
               Local $source = _GUICtrlListView_GetItemText($g_hListView, $index)
               NewThing($source) ;renomme

            Case $NM_KILLFOCUS, $LVN_ITEMCHANGED
               ToolTip('')

            Case $NM_CLICK
               If $iItem = -1 Then ToolTip("")

            Case $NM_RCLICK
               If $iItem = -1 Then ToolTip("")
               ToolTip(MediaInfo($index))
         EndSwitch
   EndSwitch
   Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_NOTIFY
A+
Répondre