Désolé de vous importunez encore une fois mais je bosse sur un lecteur de musique. Aucune erreur lors du test du code mais la musique de se lance pas.
Voici le code :
Code : Tout sélectionner
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <SliderConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <File.au3>
#include <Sound.au3>
#Region ### START Koda GUI section ### Form=
Global $Form1 = GUICreate("AudioLect", 346, 236, 192, 124)
Global $Label1 = GUICtrlCreateLabel("AudioLect", 88, 8, 175, 45)
GUICtrlSetFont(-1, 30, 400, 0, "Modern No. 20")
Global $Button1 = GUICtrlCreateButton("Jouer", 88, 200, 75, 25)
Global $Button2 = GUICtrlCreateButton("Stop", 184, 200, 75, 25)
Global $Button3 = GUICtrlCreateButton("Précédent", 8, 200, 75, 25)
Global $Button4 = GUICtrlCreateButton("Suivant", 264, 200, 75, 25)
Global $Progress1 = GUICtrlCreateProgress(24, 112, 294, 17, BitOR($PBS_SMOOTH, $WS_BORDER))
GUICtrlSetColor(-1, 0x00FF00)
GUICtrlSetBkColor(-1, 0xFFFFFF)
Global $Slider1 = GUICtrlCreateSlider(112, 144, 150, 45)
GUICtrlSetData(-1, 50)
Global $Label2 = GUICtrlCreateLabel("Musique :", 32, 80, 50, 17)
Global $Label3 = GUICtrlCreateLabel("Musique", 88, 80, 300,17)
Global $Label4 = GUICtrlCreateLabel("Volume :", 56, 152, 45, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
If FileExists(@ScriptDir & "\Musique") = 0 Then
DirCreate(@ScriptDir & "\Musique")
EndIF
$listeFichiers = _FileListToArrayRec(@ScriptDir&"\Musique", "*", 1, 0, 1, 0)
If @error Then Exit MsgBox($MB_SYSTEMMODAL, "AudioLect", "ERREUR : " & @error & @CRLF & "Il n'y a peut être pas de fichier")
Dim $Number = 1
Dim $Set = 0
Dim $Sound
GUICtrlSetData($Label3,$listeFichiers[$Number])
While 1
If $Set <> 0 Then
If _SoundLength($Sound) = _SoundPos($Sound) Then
$Set = 0
_SoundClose($Sound)
GUICtrlSetData($Button1,"Jouer")
Else
$pos = _SoundPos($Sound)*100/_SoundLength($Sound)
GUICtrlSetData($Progress1,$pos)
EndIf
EndIf
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
If $Set = 0 Then
$aSound = _SoundOpen(@ScriptDir &"\Musique\"&$listeFichiers[$Number])
If @error = 2 Then
MsgBox($MB_SYSTEMMODAL, "Error", "Ce fichier n'existe pas")
Else
_SoundPlay($Sound)
$Set = 1
GUICtrlSetData($Button1, "Pause")
EndIf
ElseIf $Set = 1 Then
_SoundPause($Sound)
GUICtrlSetData($Button1, "Reprise")
$Set = 2
Else
_SoundResume($Sound)
GUICtrlSetData($Button1, "Pause")
$Set = 1
EndIf
Case $Button2
If $Set <> 0 Then
_SoundClose($Sound)
GUICtrlSetData($Button1,"Jouer")
$Set = 0
EndIf
Case $Button4
$Number = $Number + 1
If $Number = Ubound($listeFichiers) Then
$Number = 1
EndIf
GUICtrlSetData($Label3,$listeFichiers[$Number])
Case $Button3
$Number = $Number - 1
If $Number = 0 Then
$Number = Ubound($listeFichiers)-1
EndIf
GUICtrlSetData($Label3,$listeFichiers[$Number])
Case $Slider1
SoundSetWaveVolume(GUICtrlRead($Slider1))
EndSwitch
WEnd