Je veux dire que quand on va cherche une musique en bas vous pouvez choisir quelle format vous pouvez prendre ok ?
Avant je pouvez choisir tout ça d'un coups : mp1 (*.mp1)|mp2 (*.mp2)|mp3 (*.mp3)|mp4 (*.mp4)|avi (*.avi)|wav (*.wav)|wma (*.wma)|a52 (*.a52)|acc (*.acc)|ac3 (*.ac3)|ogg (*.ogg)|flac (*.flac)|oga (*.oga)
Or maintenant il ce met automatiquement sur MP1 ( le 1er de la liste ) et moi je veux retrouvé que l'on a pas a changer de MP1 à MP3.
► Afficher le texte
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <SliderConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Sound.au3>
;===========================================================================================
;===========================================================================================
$titre = "Média Player Autoit"
Break("enable")
;===========================================================================================
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate($titre, 438, 101, 410, 438)
$Button1 = GUICtrlCreateButton("...", 8, 64, 41, 33, $WS_GROUP)
GUICtrlSetFont(-1, 12, 800, 0, "Comic sans MS")
$Button2 = GUICtrlCreateButton("Play", 56, 64, 49, 33, $WS_GROUP)
GUICtrlSetFont(-1, 11, 800, 0, "Comic sans MS")
$Button3 = GUICtrlCreateButton("Pause", 112, 64, 49, 33, $WS_GROUP)
GUICtrlSetFont(-1, 11, 800, 0, "Comic sans MS")
$Button4 = GUICtrlCreateButton("Son Favoris", 352, 8, 81, 25, $WS_GROUP)
GUICtrlSetFont(-1, 10, 800, 0, "Comic sans MS")
$Button5 = GUICtrlCreateButton("Jouer Son", 352, 40, 81, 25, $WS_GROUP)
GUICtrlSetFont(-1, 10, 800, 0, "Comic sans MS")
$Label2 = GUICtrlCreateLabel("Volume :", 224, 72, 53, 25)
GUICtrlSetFont(-1, 10, 800, 0, "Comic sans MS")
$Label3 = GUICtrlCreateLabel("Musique :", 8, 40, 178, 25)
$Slider1 = GUICtrlCreateSlider(272, 72, 161, 25)
$Button6 = GUICtrlCreateButton("Stop", 168, 64, 49, 33, $WS_GROUP)
GUICtrlSetFont(-1, 11, 800, 0, "Comic sans MS")
$Progress1 = GUICtrlCreateProgress(8, 8, 334, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
;===========================================================================================
;===========================================================================================
$size = ""
$souce = ""
$sound = 0
$vol = 100
$volume = ""
;===========================================================================================
;===========================================================================================
; GUIctrlsetdata($label3,"Musique :" & (StringTrimRight($split[$split[0]], 4))
; $size = FileGetSize($source)
; GUICtrlSetData($Label3,"Poids Son : "& $size & " bytes")
Global $current_length=1
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Slider1
SoundSetWaveVolume(GUICtrlRead($slider1))
Case $Button1
$source = FileOpenDialog("Ouvrir:",@DesktopDir&'\',"mp1 (*.mp1)|mp2 (*.mp2)|mp3 (*.mp3)|mp4 (*.mp4)|avi (*.avi)|wav (*.wav)|wma (*.wma)|a52 (*.a52)|acc (*.acc)|ac3 (*.ac3)|ogg (*.ogg)|flac (*.flac)|oga (*.oga)",1)
If @error Then
MsgBox(16,$titre,"Erreur, aucun son n'a été choisi !")
Else
$split = StringSplit($Source , "\")
GUIctrlsetdata($label3,"Musique :" & StringTrimRight($split[$split[0]],4))
EndIf
GUICtrlSetState($Button2,$GUI_ENABLE)
GUICtrlSetState($Button1,$GUI_DISABLE)
Case $Button2
If $sound = 0 Then
$sound = _SoundOpen($source)
if _SoundPlay($sound) <> 0 Then
$current_length=_SoundLength($sound, 2)
AdlibRegister("Update_Progress1",1000)
GUICtrlSetState($Button2,$GUI_DISABLE)
GUICtrlSetState($Button3,$GUI_ENABLE)
EndIf
ElseIf _SoundStatus($sound) = "paused" Then
_SoundResume($sound)
GUICtrlSetState($Button2,$GUI_DISABLE)
GUICtrlSetState($Button3,$GUI_ENABLE)
EndIf
Case $Button3
If $sound<> 0 Then
_SoundPause($sound)
GUICtrlSetState($Button3,$GUI_DISABLE)
GUICtrlSetState($Button2,$GUI_ENABLE)
Endif
Case $Button4
If $source = "" Then MsgBox(16,$titre,"Erreur, aucun son n'a été choisis !")
If $source <> "" Then
FileDelete(@ScriptDir&"\Média Player List.dll")
FileWrite(@ScriptDir&"\Média Player List.dll", $source)
MsgBox(64,$titre,"Votre son à été marqué comme favoris.")
EndIf
Case $Button5
$source = FileRead(@ScriptDir&"\Média Player List.dll")
If FileExists(@ScriptDir&"\Média Player List.dll") = 0 Then MsgBox(16,$titre,"Erreur, aucun son n'est définis comme favoris !")
If FileExists(@ScriptDir&"\Média Player List.dll") = 1 Then
If FileExists($source) = 0 Then MsgBox(16,$titre,"Erreur, le son définis comme favoris n'existe pas ou plus !")
If FileExists($source) = 1 Then
$sound = 0
$sound = $source
SoundPlay($sound)
EndIf
EndIf
If $source = "" Then MsgBox(16,$titre,"Erreur, aucun son n'a été choisis !")
If $source <> "" Then
$size = FileGetSize($source)
GUICtrlSetData($Label3,"Poids Son : "& $size & " bytes")
EndIf
Case $Button6
stop_chanson()
EndSwitch
WEnd
Func Update_Progress1()
local $staus,$position
If IsArray($sound) Then
$position=_SoundPos($sound, 2)
If $position>=$current_length Then
stop_chanson()
Return
EndIf
$status=_SoundStatus ( $sound )
Select
Case $status="playing"
$percent = Round(($position/$current_length)*100)
;ConsoleWrite ($status&" "&$percent&@CRLF)
GuiCtrlSetData($Progress1, $percent)
Case $status="stoped"
stop_chanson()
Return
Case Else
Return
EndSelect
EndIf
EndFunc
Func stop_chanson()
AdlibUnRegister("Update_Progress1")
$sound=0
_SoundStop($sound)
_SoundClose($sound)
;GuiCtrlSetData($Progress1, 0)
GUICtrlSetState($Button1,$GUI_ENABLE)
GUICtrlSetState($Button2,$GUI_DISABLE)
GUICtrlSetState($Button3,$GUI_DISABLE)
GuiCtrlSetData($Progress1, 0)
$source=""
EndFunc