Alors je poste sur ce forum car je suis bloquer depuis maintenant 3 jours (comme vous le voyez je suis nouveau).
Alors pour la lecture c'est bon ça fonctionne mais maintenant le problème est que quand je lance ma musique pas moyen de la stopper et d'en lancer une autre.
J'ai tout sauf que la musique ne se lance pas.
Bon voici le code:
► Afficher le texte
Code : Tout sélectionner
#include <GUIConstantsEx.au3>
#include <GDIPlus.au3>
#include <StaticConstants.au3>
#include <ButtonConstants.au3>
#include <GuiSlider.au3>
#Include <GuiListBox.au3>
#include <Sound.au3>
#include <SliderConstants.au3>
#include <ProgressConstants.au3>
#Include <GuiListView.au3>
#Region ### START Koda GUI section ### Form=
Global $Form1 = GUICreate("Lecteur MUBY", 511, 309, 192, 124)
Global $Button1 = GUICtrlCreateButton("PLAY", 8, 192, 115, 49)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
Global $Button2 = GUICtrlCreateButton("PAUSE", 120, 192, 113, 49)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
Global $Slider1 = GUICtrlCreateSlider(352, 192, 150, 45)
Global $Label1 = GUICtrlCreateLabel("VOLUME", 408, 176, 55, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
Global $Button5 = GUICtrlCreateButton("AJOUTER MUSIQUE", 368, 120, 137, 49)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
Global $Button7 = GUICtrlCreateButton("LANCER", 368, 8, 137, 49)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
Global $Progress1 = GUICtrlCreateProgress(8, 256, 494, 41, $PBS_SMOOTH)
GUICtrlSetColor(-1, 0x00FF00)
Global $Button3 = GUICtrlCreateButton("RETIRER MUSIQUE", 368, 64, 137, 49)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
Global $Button4 = GUICtrlCreateButton("STOP", 232, 192, 121, 49)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
Global $List1 = GUICtrlCreateList("", 8, 8, 353, 175)
GUICtrlSetData(-1, "C:\Users\utilisateur\Desktop\Lecture, film, musique\Musique\Black Eyed Peas - Meet me Halfway.mp3|C:\Users\utilisateur\Music\MP3 Rocket\Dub Incorporation - Murderer ( With Lyrics ).mp3|C:\Users\utilisateur\Shared\Dub Incorporation - My Freestyle.mp3|C:\Users\utilisateur\Shared\Dub Incorporation - Rudeboy.mp3|C:\Users\utilisateur\Shared\Keen"&Chr(39)&"V - A L"&Chr(39)&"horizontal.mp3|C:\Users\utilisateur\Shared\Keen"&Chr(39)&"V - Explique moi.mp3|C:\Users\utilisateur\Shared\Keen"&Chr(39)&"v - La Cigathèque.mp3|C:\Users\utilisateur\Shared\Keen"&Chr(39)&"V - Plaisir Charnel.mp3|C:\Users\utilisateur\Shared\Keen"&Chr(39)&"v désenchanté.mp3")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$souce = ""
$sound = 0
$vol = 100
$volume = ""
$zic = GUICtrlRead($List1)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Slider1
SoundSetWaveVolume(GUICtrlRead($slider1))
Case $Button5
$source = FileOpenDialog("Ouvrir:",@DesktopDir&'\',"mp3 (*.mp3)|wav (*.wav)|wma (*.wma)|a52 (*.a52)|acc (*.acc)|ac3 (*.ac3)|ogg (*.ogg)|flac (*.flac)|mp1 (*.mp1)|mp2 (*.mp2)|mp4 (*.mp4)|oga (*.oga)",9)
If $source = "" Then MsgBox(16,"titre","Erreur, aucune musique n'a été choisis !")
If $source <> "" Then
GUICtrlSetState($Button1, $GUI_ENABLE)
EndIf
IniWrite("Musique.ini", "Musique", "musique", $source & "|")
Case $Button1
Local $Selected = _GUICtrlListBox_GetText($List1, _GUICtrlListBox_GetCurSel($List1))
If $Selected == 0 Then ContinueLoop
If $sound = 0 Then
$sound = _SoundOpen($Selected)
If _SoundPlay($sound) <> 0 Then
$current_length = _SoundLength($sound, 2)
AdlibRegister("Update_Progress1", 1000)
EndIf
ElseIf _SoundStatus($sound) = "paused" Then
_SoundResume($sound)
EndIf
Case $Button2
If $sound<> 0 Then
_SoundPause($sound)
Endif
Case $Button4
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)
GuiCtrlSetData($Progress1, 0)
$source=""
EndFunc
EndFuncCordialement,
MeGaTrOn




