Skocz do zawartości
  • 👋 Witaj na MPCForum!

    Przeglądasz forum jako gość, co oznacza, że wiele świetnych funkcji jest jeszcze przed Tobą! 😎

    • Pełny dostęp do działów i ukrytych treści
    • Możliwość pisania i odpowiadania w tematach
    • System prywatnych wiadomości
    • Zbieranie reputacji i rozwijanie swojego profilu
    • Członkostwo w jednej z największych społeczności graczy

    👉 Dołączenie zajmie Ci mniej niż minutę – a zyskasz znacznie więcej!

    Zarejestruj się teraz

Odtwarzacz muzyki dla początkujących


tapne

Rekomendowane odpowiedzi

Opublikowano

Witam, jest to kolejny kod dla początkujących. Dziś pokażę odtwarzacz muzyki. Czemu go pokazuję ? Sam jak zaczynałem chciałem zrobić taki sam, ale jakoś mi nie szło : D

 

A więc, aby zrobić playliste trzeba wrzucić pliki mp3 do folderu "SoundM", który powinien się utworzyć w folderze w którym znajduję się skrypt.

 

 

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <SliderConstants.au3>
#include <Sound.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
Global $file
$Form1 = GUICreate("Odtwarzacz by Mr. Emsi", 421, 315, 192, 124)
$Group1 = GUICtrlCreateGroup("Przyciski do odtw.", 0, 0, 273, 73)
$Button1 = GUICtrlCreateButton("Odtwarzaj", 8, 24, 75, 25)
$Button2 = GUICtrlCreateButton("Pauza", 96, 24, 75, 25)
$Button3 = GUICtrlCreateButton("Stop", 184, 24, 75, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Label1 = GUICtrlCreateLabel("00:00:00", 296, 24, 45, 17)
$Label2 = GUICtrlCreateLabel("-", 340, 19, 20, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label4 = GUICtrlCreateLabel("00:00:00", 352, 24, 45, 17)
$Slider1 = GUICtrlCreateSlider(8, 104, 174, 45)
$Label3 = GUICtrlCreateLabel("Głosnosc", 48, 80, 50, 17)
$Button4 = GUICtrlCreateButton("Ładuj pliki", 216, 96, 147, 25)
$List1 = GUICtrlCreateList("", 24, 160, 353, 110)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
If FileExists("SoundM")=0 Then
DirCreate("SoundM")
EndIf
While 1
$glos = IniRead("SoundM\glosnosc.ini", "glosnosc", "glosnosc", "")
SoundSetWaveVolume($glos)
$trwa = _SoundPos($file)
$glos1 = GUICtrlRead($Slider1)
IniWrite("SoundM\glosnosc.ini", "glosnosc", "glosnosc", $glos1)
If GUICtrlRead($Label1) = $trwa Then
Else
 GUICtrlSetData($Label1, $trwa)
EndIf
$dl = _SoundLength($file)
If GUICtrlRead($Label4) = $dl Then
 Else
GUICtrlSetData($Label4, $dl)
EndIf
$nMsg = GUIGetMsg()
Switch $nMsg
 Case $GUI_EVENT_CLOSE
  Exit
 Case $Button4
  $folmuz = "SoundM"
  $search = FileFindFirstFile($folmuz&"\*.mp3")
  while 2
   $pliki = FileFindNextFile($search)
   If @error Then  ExitLoop
   GUICtrlSetData($List1, $pliki)
  WEnd
 Case $Button1
  odtwarzaj()
 case $Button2
  palza()
 Case $Button3
  stop()

EndSwitch
WEnd
Func odtwarzaj()
$file = $folmuz&"\"&GUICtrlRead($List1)
_SoundPlay($file)
EndFunc
Func palza()
_SoundPause($file)
EndFunc
Func stop()
_SoundStop($file)
EndFunc

 

 

 

wybaczcie, że kod jest tak trochę pomieszany :<

ale myślę że ktoś z niego zaczerpnie wiedzę

 

Jak zwykle zgadzam się na edycję kodu i po edycji przypisanie sobie autorstwa : )

Zarchiwizowany

Ten temat przebywa obecnie w archiwum. Dodawanie nowych odpowiedzi zostało zablokowane.

×
×
  • Dodaj nową pozycję...