Voici mon deuxième programme AutoIt : AudioLect
A quoi sert-il ?
Il permet de lire des fichiers audio
Comment l'utiliser ?
Lors de la première ouverture, il crée un dossier "Musique" dans son dossier. Il vous dira une erreur. Il vous suffira ensuite d'y mettre vos fichiers audio
Que faut-il pour l'utiliser ?
Il vous suffit d'avoir des fichiers .mp3 et .wav
A quoi il ressemble ?
Screenshot du logiciel :
► Afficher le texte
Le voici :
#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(125, 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 :", 70, 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", "*.mp3;*.wav", 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")
$Number = $Number + 1
If $Number = Ubound($listeFichiers) Then
$Number = 1
EndIf
GUICtrlSetData($Label3,$listeFichiers[$Number])
$Sound = _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
Else
$percent = Round((_SoundPos($sound, 2)/_SoundLength($sound, 2))*100)
GuiCtrlSetData($Progress1, $percent)
EndIf
EndIf
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
If $Set = 0 Then
$Sound = _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($Progress1,0)
GUICtrlSetData($Button1,"Jouer")
$Set = 0
EndIf
Case $Button4
If $Set <> 0 Then
_SoundClose($Sound)
GUICtrlSetData($Progress1,0)
EndIf
$Number = $Number + 1
If $Number = Ubound($listeFichiers) Then
$Number = 1
EndIf
GUICtrlSetData($Label3,$listeFichiers[$Number])
Case $Button3
If $Set <> 0 Then
_SoundClose($Sound)
GUICtrlSetData($Progress1,0)
EndIf
$Number = $Number - 1
If $Number = 0 Then
$Number = Ubound($listeFichiers)-1
EndIf
GUICtrlSetData($Label3,$listeFichiers[$Number])
Case $Slider1
SoundSetWaveVolume(GUICtrlRead($Slider1))
EndSwitch
WEnd
#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(125, 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 :", 70, 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", "*.mp3;*.wav", 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")
$Number = $Number + 1
If $Number = Ubound($listeFichiers) Then
$Number = 1
EndIf
GUICtrlSetData($Label3,$listeFichiers[$Number])
$Sound = _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
Else
$percent = Round((_SoundPos($sound, 2)/_SoundLength($sound, 2))*100)
GuiCtrlSetData($Progress1, $percent)
EndIf
EndIf
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
If $Set = 0 Then
$Sound = _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($Progress1,0)
GUICtrlSetData($Button1,"Jouer")
$Set = 0
EndIf
Case $Button4
If $Set <> 0 Then
_SoundClose($Sound)
GUICtrlSetData($Progress1,0)
EndIf
$Number = $Number + 1
If $Number = Ubound($listeFichiers) Then
$Number = 1
EndIf
GUICtrlSetData($Label3,$listeFichiers[$Number])
Case $Button3
If $Set <> 0 Then
_SoundClose($Sound)
GUICtrlSetData($Progress1,0)
EndIf
$Number = $Number - 1
If $Number = 0 Then
$Number = Ubound($listeFichiers)-1
EndIf
GUICtrlSetData($Label3,$listeFichiers[$Number])
Case $Slider1
SoundSetWaveVolume(GUICtrlRead($Slider1))
EndSwitch
WEnd
Bien sur,
32bits : http://www.mediafire.com/download/ttern ... ioLect.Exe
64bits : http://www.mediafire.com/download/c3skx ... 64bits.Exe
Bonne journée