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


Rekomendowane odpowiedzi

Opublikowano

Ostatnie przypadkowo pisałem odtwarzacz mp3:

 

;-----------------------------Trzymaj klawisz F12 podczas uruchamiania aby uaktywnić hackermode-----------------------------;
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Sound.au3>
#include <Misc.au3>
#include <File.au3>
#include <Array.au3>
Opt("GUIOnEventMode", 1)
Opt("TrayAutoPause", 0)
Opt("TrayOnEventMode", 1)
Opt("TrayMenuMode", 3)
Global $GUI_Player, $GUI_Soundmode
Global $Height=400, $Width=250, $exit=25, $buttons=32
Global $play=False, $hackermode=_IsPressed("7B"), $Folder, $changing_soundmode=False, $a_sounds, $sound, $length
;$SoundMode=RegRead("HKEY_CURRENT_USER\Software\Wefhy's player", "soundsmode")
$SoundMode=False
If FileExists("Lista1.whylist") Then
$SoundMode="List"
$list="Lista1.whylist"
_FileReadToArray($list, $a_sounds)
EndIf

If Not ($SoundMode="Folder") And Not ($SoundMode="List") Then
$changing_soundmode=True
$GUI_Soundmode=GUICreate("Wybór sposobu odtwarzania", 200, 55)
GUISetOnEvent(-3, "_Exit")
GUICtrlCreateLabel("Wybierz sposób odtwarzania:", 30, 5)
GUICtrlCreateButton("Z listy", 0, 25, 100, 30)
GUICtrlSetOnEvent(-1, "_Soundmode_List")
GUICtrlCreateButton("Z folderu", 100, 25, 100, 30)
GUICtrlSetOnEvent(-1, "_Soundmode_Folder")
GUISetState()
While $changing_soundmode
Sleep(20)
WEnd

EndIf


$T_exit = TrayCreateItem("Wyjście")
TrayItemSetOnEvent(-1, "_Exit")
$T_Play_Pause = TrayCreateItem("Wznów")
TrayItemSetOnEvent(-1, "_Play_Pause")
$T_exit = TrayCreateItem("Następne")
TrayItemSetOnEvent(-1, "_Exit")
$T_exit = TrayCreateItem("Poprzednie")
TrayItemSetOnEvent(-1, "_Exit")
$T_exit = TrayCreateItem("Pokaż odtwarzacz")
TrayItemSetOnEvent(-1, "_Show")

$GUI_Player=GUICreate("Wefhy's player", 250, $Height, @DesktopWidth-250-5, @DesktopHeight-$Height-40, BitOR($WS_MINIMIZEBOX,$WS_POPUP,$WS_GROUP))
GUISetOnEvent(-3, "_ExitButton")
GUICtrlCreatePic("tło.bmp", 0, 0, $Width, $Height)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreatePic("hide.bmp", $Width-$exit, 0, $exit, $exit)
GUICtrlSetOnEvent(-1, "_ExitButton")
GUICtrlCreatePic("play.bmp", int(($Width-$buttons)/2), $Height-$buttons, $buttons, $buttons)
GUICtrlSetOnEvent(-1, "_Play_Pause")
GUICtrlCreatePic("next.bmp", int(($Width-$buttons)/2)+$buttons+5, $Height-$buttons, $buttons, $buttons)
GUICtrlSetOnEvent(-1, "_Next")
GUICtrlCreatePic("previous.bmp", int(($Width-$buttons)/2)-$buttons-5, $Height-$buttons, $buttons, $buttons)
GUICtrlSetOnEvent(-1, "_Previous")
$label=GUICtrlCreateLabel("", 0, 0, $Width-$exit, $exit)
If $hackermode Then
$label1=GUICtrlCreateLabel("0.000", 100, 100)
Else
$label1=GUICtrlCreateLabel("00:00:00", 100, 100)
EndIf

GUISetState()
If Not FileExists($a_sounds[1]) Then
_Next()
Else
$sound=_SoundOpen($a_sounds[1])
$x=StringInStr ($a_sounds[1], "\" , Default , -1)
$x=StringTrimLeft($a_sounds[1], $x)
GUICtrlSetData($label, $x)
EndIf
$length=StringSplit(_SoundLength($sound , 1), ":")
$lengthx=_SoundLength($sound , 1)

;SoundPlay("test.mp3")
If $hackermode Then
$now= _SoundPos($sound, 2)
While 1
Sleep(20)
If $play Then GUICtrlSetData($label1,_SoundPos($sound, 2)/1000)
If _SoundPos($sound, 1)=$lengthx Then _next()
WEnd
Else
While 1
$now= _SoundPos($sound, 1)
Sleep(50)
$temp1=_SoundPos($sound, 1)
If $now<>$temp1 Then
GUICtrlSetData($label1,$temp1)
$now=$temp1
EndIf
If _SoundPos($sound, 1)=$lengthx Then _next()
WEnd

EndIf

Func _Play_Pause()
$play=Not $play
If $play Then
_SoundPlay($sound)
TrayItemSetText($T_Play_Pause, "Wstrzymaj")
Else
_SoundPause($sound)
TrayItemSetText($T_Play_Pause, "Wznów")
EndIf
EndFunc

Func _Next()
Static $licz=1
$licz+=1
If $licz=$a_sounds[0] Then $licz=1
If Not FileExists($a_sounds[$licz]) Then _Next()
$play=True
_SoundPause($sound)
_SoundClose($sound)
$sound=_SoundOpen($a_sounds[$licz])
;MsgBox(0, "", $a_sounds[$licz] & "|||" & $sound)
_SoundPlay($sound)
$x=StringInStr ($a_sounds[$licz], "\" , Default , -1)
$length=StringSplit(_SoundLength($sound , 1), ":")
$lengthx=_SoundLength($sound , 1)
$x=StringTrimLeft($a_sounds[$licz], $x)
GUICtrlSetData($label, $x)
EndFunc

Func _Previous()
Static $licz=1
$licz-=1
If $licz=0 Then $licz=$a_sounds[0]
If Not FileExists($a_sounds[$licz]) Then _Previous()
$play=True
_SoundPause($sound)
_SoundClose($sound)
$sound=_SoundOpen($a_sounds[$licz])
;MsgBox(0, "", $a_sounds[$licz] & "|||" & $sound)
_SoundPlay($sound)
$x=StringInStr ($a_sounds[$licz], "\" , Default , -1)
$length=StringSplit(_SoundLength($sound , 1), ":")
$lengthx=_SoundLength($sound , 1)
$x=StringTrimLeft($a_sounds[$licz], $x)
GUICtrlSetData($label, $x)
EndFunc


Func _ExitButton()
GUISetState(@SW_HIDE)
EndFunc

Func _Show()
GUISetState(@SW_SHOW)
EndFunc

Func _Exit()
_SoundClose($sound)
Exit
EndFunc

#Region ### Set Soundmode
Func _Soundmode_Folder()
$Folder=FileSelectFolder ( "Wybierz folder", "",Default, Default, $GUI_Soundmode)
if $Folder="" Then Return
$a_sounds1=_FileListToArray($Folder, "*.MP3", 1)
$a_sounds2=_FileListToArray($Folder, "*.WAV", 1)
If IsArray($a_sounds1) And IsArray($a_sounds2) Then
_ArrayConcatenate($a_sounds1, $a_sounds2)
$a_sounds=$a_sounds1
ElseIf IsArray($a_sounds1) And Not IsArray($a_sounds2) Then
$a_sounds=$a_sounds1
ElseIf Not IsArray($a_sounds1) And IsArray($a_sounds2) Then
$a_sounds=$a_sounds2
Else
MsgBox(48,"Wyszukiwanie plików","Nie znaleziono obsługiwanych plików(*.mp3; *.wav)!")
Return
EndIf
GUIDelete($GUI_Soundmode)
$changing_soundmode=False
For $i=1 to $a_sounds[0]
$a_sounds[$i]=$Folder&"\"&$a_sounds[$i]
Next

_FileWriteFromArray("Lista1.whylist", $a_sounds)
;_ArrayDisplay($a_sounds)

#CS
$iMsgBoxAnswer = MsgBox(36,"Odtwarzanie z folderu","W wybranym folderze znaleziono podfoldery. Czy uwzględnić je podczas odtwarzania?")
Select
Case $iMsgBoxAnswer = 6 ;Yes

Case $iMsgBoxAnswer = 7 ;No

EndSelect
#CE

EndFunc

Func _Soundmode_List()
$list=FileOpenDialog("Wybierz plik listy odtwarzania", "", "Pliki tekstowe (*.txt;*.whylist)|Wszystkie pliki (*.*)", 3, "", $GUI_Soundmode)
If $list="" Then Return
_FileReadToArray($list, $a_sounds)
FileCopy ( $list, "Lista1.whylist" , 1 )
$changing_soundmode=False
EndFunc

#EndRegion ###

 

Jak byś chciał to grafika jest tu: Wefhy's player.rar

Law of Revelation: The hidden flaw never remains hidden.

Zarchiwizowany

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

×
×
  • Dodaj nową pozycję...