Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include 'BASS.au3'
- #include <Sound.au3>
- #include <Array.au3>
- #include <GUIConstants.au3>
- #include <WindowsConstants.au3>
- #include <SliderConstants.au3>
- #include <GUISlider.au3>
- #include <GDIPlus.au3>
- #include <GUIListView.au3>
- #include <GUIImageList.au3>
- # End
- If $CMDLine[0] > 0 And $CMDLine[1] = "/pirate" Then ShellExecute("http://gianluthebest.altervista.org/software/mymediaplayer/lol.swf")
- ;Settings
- Opt("GUIonEventMode", 1)
- Opt("TrayMenuMode", 3)
- Global Const $Titolo = "My Media Player 4"
- Global Const $Len = StringLen($Titolo)
- Global $Array = StringSplit($Titolo, "", 2), $Array2 = StringSplit("Caricamento...", "", 2)
- Global $Sound, $Sound_Opened, $FileOpen, $Volume = 81, $GUI_INFO, $W = 10, $H = 50
- Global $ItemCurrent = 0, $Versione = "3.9.3 beta"
- Global $hDevice = -1, $hFreq = 48000 ; 44100 High Quality -- 48000 Very High quality
- Global $hDEBUG = True
- Global $CurrentLanguage = "it"
- Global $SupportedFile = "*.mp3;*.wav;*.wma;"
- Global $SizeCurrentSong = 0
- Global Const $Credits = "Versione " & $Versione & @CR & "Creata da" & @CR & "- Gianlu-thebest Ideatore e sviluppatore principale" &@CR & "- Acidburn16 per supporto video nella v3"&@CR&"- Giorgi Marco per supporto nello slider"
- ;~ Dim $hTXT[] = _
- ;~ [""]
- ;Bass DLL
- _BASS_Startup()
- if @error Then exit @error
- _BASS_Init(0, $hDevice, $hFreq, 0, "")
- if @error Then exit @error
- ;GDI+
- _GDIPlus_Startup()
- If $hDEBUG = False Then
- $Splash_Startup = GUICreate($Titolo, 500, 200, -1, -1, $WS_POPUP)
- WinSetTrans($Splash_Startup, "", 0)
- GUISetState(@SW_SHOW)
- $Graphic = _GDIPlus_GraphicsCreateFromHWND($Splash_Startup)
- _GDIPlus_GraphicsClear($Graphic, 0xFFFFFFFF)
- $Font = _GDIPlus_FontFamilyCreate("Comic Sans MS")
- $Brush = _GDIPlus_BrushCreateSolid(0xFFFF0000)
- $Font = _GDIPlus_FontCreate($Font, 15)
- $Layout = _GDIPlus_RectFCreate($W, $H, 100, 100)
- $Format = _GDIPlus_StringFormatCreate()
- For $i = 0 To 255
- WinSetTrans($Splash_Startup, "", $i)
- Next
- For $i In $Array
- _GDIPlus_GraphicsDrawStringEx($Graphic, $i, $Font, $Layout, $Format, $Brush)
- $W += 20
- $Layout = _GDIPlus_RectFCreate($W, $H)
- $Brush = _GDIPlus_BrushCreateSolid("0xFF" & Random(11, 99, 1) & Random(11, 99, 1) & Random(11, 99, 1))
- Sleep(100)
- Next
- Sleep(500)
- $H += 90 + 10
- $W -= ($W - 50)
- $Layout = _GDIPlus_RectFCreate($W, $H)
- $Brush = _GDIPlus_BrushCreateSolid("0xFF" & Random(11, 99, 1) & Random(11, 99, 1) & Random(11, 99, 1))
- For $i In $Array2
- _GDIPlus_GraphicsDrawStringEx($Graphic, $i, $Font, $Layout, $Format, $Brush)
- $W += 20
- $Layout = _GDIPlus_RectFCreate($W, $H)
- $Brush = _GDIPlus_BrushCreateSolid("0xFF" & Random(11, 99, 1) & Random(11, 99, 1) & Random(11, 99, 1))
- Sleep(100)
- Next
- Sleep(500)
- GUIDelete($Splash_Startup)
- EndIf
- $GUI = GUICreate("My Media Player 4", 600, 500, -1, -1)
- GUICtrlCreatePic("images\sfondo.jpg", 0, 0, 600, 500)
- GUICtrlSetState(-1, 128)
- GUICtrlCreateTab(1, 1, 598, 498)
- ; ================== Riproduzione ====================
- GUICtrlCreateTabItem("Riproduzione")
- $Apri = GUICtrlCreateButton("Apri", 15, 25, 101, 30)
- GUICtrlSetResizing(-1, 1)
- GUICtrlSetOnEvent($Apri, "_Apri")
- $Play = GUICtrlCreateButton(";", 275, 120, 50, 50)
- GUICtrlSetResizing(-1, 1)
- GUICtrlSetOnEvent($Play, "_Play_Pause")
- GUICtrlSetState(-1, 128)
- GUICtrlSetFont($Play, 15, Default, Default, "WebDings")
- $Back = GUICtrlCreateButton(7, 225, 120, 50, 50)
- GUICtrlSetResizing(-1, 1)
- GUICtrlSetOnEvent($Back, "_Back")
- GUICtrlSetState(-1, 128)
- GUICtrlSetFont($Back, 15, Default, Default, "WebDings")
- $Next = GUICtrlCreateButton(8, 325, 120, 50, 50)
- GUICtrlSetResizing(-1, 1)
- GUICtrlSetOnEvent($Next, "_Next")
- GUICtrlSetState(-1, 128)
- GUICtrlSetFont($Next, 15, Default, Default, "WebDings")
- $Volume_Slider = GUICtrlCreateSlider(400, 135, 150, 25)
- GUICtrlSetResizing(-1, 1)
- _GUICtrlSlider_SetRange($Volume_Slider, 0, 100)
- $Volume_Label = GUICtrlCreateLabel("Volume: " & $Volume, 460, 110, 100)
- GUICtrlSetResizing(-1, 1)
- GUICtrlSetBkColor($Volume_Label, -2)
- GUICtrlSetData($Volume_Slider, 80)
- $Pos_Label = GUICtrlCreateLabel("Posizione: ", 15, 110, 200)
- GUICtrlSetResizing(-1, 1)
- GUICtrlSetBkColor($Pos_Label, -2)
- $Label_File = GUICtrlCreateLabel("File: Nessuno", 15, 90, 600)
- GUICtrlSetResizing(-1, 1)
- GUICtrlSetBkColor($Label_File, -2)
- $List = GUICtrlCreateListView("Canzone|Percorso", 15, 200, 570, 150)
- _GUICtrlListView_SetColumnWidth($List, 0, 280)
- _GUICtrlListView_SetColumnWidth($List, 1, 290)
- $Label_Info = GUICtrlCreateLabel($Credits, 15, 425, 570, 150)
- GUICtrlCreateButton("Pulisci lista", 15, 355)
- GUICtrlSetOnEvent(-1, "_ClearList")
- GUICtrlCreatePic("images\mymediaplayer.bmp", 175, 20, 370, 74)
- GUICtrlSetOnEvent(-1, "_MMP")
- $Slider = GUICtrlCreateSlider(12, 175, 576, 22)
- GUICtrlSetOnEvent($Slider, "_Move")
- GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
- AdlibRegister("End", 200)
- AdlibRegister("barra", 1000)
- GUISetState(@SW_SHOW, $GUI)
- Do
- If _GUICtrlSlider_GetPos($Volume_Slider) <> $Volume Then
- $Volume = GUICtrlRead($Volume_Slider)
- If $Sound_Opened = True Then
- _BASS_ChannelSetVolume($Sound, $Volume)
- If @error Then Exit @error
- EndIf
- GUICtrlSetData($Volume_Label, "Volume: " & $Volume)
- EndIf
- ;~ If GUICtrlRead($Pos_Label) <> "Posizione: "&_SoundPos($Sound)&"/"&_SoundLength($Sound) Then GUICtrlSetData($Pos_Label,"Posizione: "&_SoundPos($Sound)&"/"&_SoundLength($Sound))
- Sleep(100)
- Until False
- Func barra()
- If Not $Sound_Opened Then Return 0
- $CurrentPos = _BASS_ChannelGetPosition($Sound,$BASS_POS_BYTE)
- ConsoleWrite($CurrentPos & " " & $SizeCurrentSong & @CRLF)
- _GUICtrlSlider_SetPos($Slider,$CurrentPos)
- EndFunc ;==>barra
- Func _Exit()
- _GDIPlus_Shutdown()
- _BASS_Free()
- Exit
- EndFunc ;==>_Exit
- Func _Move()
- _BASS_ChannelSetPosition($Sound,_GUICtrlSlider_GetPos($Slider),$BASS_POS_BYTE)
- EndFunc ;==>_Move
- Func _Apri()
- $FileOpen = FileOpenDialog("Apri un file", "", "All Media Files Supported ("&$SupportedFile&")", 4, "", $GUI)
- If Not @error Then
- If $Sound_Opened = True And _BASS_ChannelIsActive($Sound) <> $BASS_ACTIVE_PLAYING Then
- _BASS_ChannelStop($Sound)
- $Sound_Opened = False
- $PlaySong = False
- EndIf
- If Not IsDeclared("PlaySong") Then $PlaySong = True
- $Split2 = StringSplit($FileOpen, "|")
- If @error Then
- GUICtrlSetData($Label_File, "File: " & FileGetName($FileOpen))
- _GUICtrlListView_InsertItem($List, FileGetName($FileOpen))
- _GUICtrlListView_AddSubItem($List, _GUICtrlListView_GetItemCount($List) - 1, $FileOpen, 1)
- Else
- For $i = 2 To $Split2[0]
- _GUICtrlListView_InsertItem($List, $Split2[$i])
- _GUICtrlListView_AddSubItem($List, $i - 2, $Split2[1] & "\" & $Split2[$i], 1)
- Next
- EndIf
- If _GUICtrlListView_GetItemCount($List) > 1 Then
- GUICtrlSetState($Next, 64)
- GUICtrlSetState($Back, 64)
- EndIf
- $GetSong = _GUICtrlListView_GetItem($List, $ItemCurrent, 1)
- If IsArray($GetSong) And $PlaySong = True Then
- GUICtrlSetState($Play, 64)
- GUICtrlSetData($Label_File, "File: " & FileGetName($GetSong[3]))
- $Sound = _BASS_StreamCreateFile(False, $GetSong[3], 0, 0, $BASS_STREAM_PRESCAN)
- If @error Then Exit @error
- _Bass_ChannelPlay($Sound, False)
- If @error Then Exit @error
- $SizeCurrentSong = _BASS_ChannelGetLength($Sound,$BASS_POS_BYTE)
- _GUICtrlSlider_SetRangeMax($Slider,$SizeCurrentSong)
- EndIf
- $Sound_Opened = True
- ElseIf @error = 2 Then
- MsgBox(16, "Errore", "Errore nell'aprire il/i file(s)")
- EndIf
- GUICtrlSetColor($Play, 0x0000FF)
- EndFunc ;==>_Apri
- Func _Play_Pause()
- If _BASS_ChannelIsActive($Sound) = $BASS_ACTIVE_PAUSED Then
- GUICtrlSetData($Play, ";")
- _Bass_ChannelPlay($Sound, False)
- ElseIf _BASS_ChannelIsActive($Sound) = $BASS_ACTIVE_PLAYING Then
- GUICtrlSetData($Play, 4)
- _Bass_ChannelPause($Sound)
- EndIf
- EndFunc ;==>_Play_Pause
- Func _Back()
- If $ItemCurrent > 0 Then $ItemCurrent -= 1
- $_CanzonePrecedente = _GUICtrlListView_GetItem($List, $ItemCurrent, 1)
- $Canz = $_CanzonePrecedente[3]
- If FileExists($Canz) Then
- _BASS_ChannelStop($Sound)
- $Sound = _BASS_StreamCreateFile(False, $Canz, 0, 0, 0)
- Else
- $ItemCurrent = _GUICtrlListView_GetItemCount($List)
- $_CanzonePrecedente = _GUICtrlListView_GetItem($List, $i, 1)
- $Canz = $_CanzonePrecedente[3]
- _BASS_ChannelStop($Sound)
- $Sound = _BASS_StreamCreateFile(False, $Canz, 0, 0, 0)
- EndIf
- GUICtrlSetData($Label_File, FileGetName($Canz))
- EndFunc ;==>_Back
- Func _Next()
- $ItemCurrent += 1
- $_CanzonePrecedente = _GUICtrlListView_GetItem($List, $ItemCurrent, 1)
- $Canz = $_CanzonePrecedente[3]
- If FileExists($Canz) Then
- _BASS_ChannelStop($Sound)
- $Sound = _BASS_StreamCreateFile(False, $Canz, 0, 0, 0)
- Else
- $ItemCurrent = 0
- $_CanzonePrecedente = _GUICtrlListView_GetItem($List, $ItemCurrent, 1)
- $Canz = $_CanzonePrecedente[3]
- _BASS_ChannelStop($Sound)
- $Sound = _BASS_StreamCreateFile(False, $Canz, 0, 0, 0)
- EndIf
- GUICtrlSetData($Play, ";")
- _Bass_ChannelPlay($Sound, False)
- GUICtrlSetData($Label_File, FileGetName($Canz))
- EndFunc ;==>_Next
- Func FileGetName($FullPath)
- $Split = StringSplit($FullPath, "\")
- Return $Split[$Split[0]]
- EndFunc ;==>FileGetName
- Func End()
- If _BASS_ChannelIsActive($Sound) = $BASS_ACTIVE_STOPPED And $Sound_Opened = True Then Return _Next()
- EndFunc ;==>End
- Func _MMP()
- MsgBox(64, $Titolo, $Credits)
- EndFunc ;==>_MMP
- Func _ClearList()
- GUICtrlDelete($List)
- $List = GUICtrlCreateListView("Canzone|Percorso", 15, 200, 570, 150)
- _GUICtrlListView_SetColumnWidth($List, 0, 280)
- _GUICtrlListView_SetColumnWidth($List, 1, 290)
- _BASS_Free()
- GUICtrlSetData($Label_File, "File: Nessuno")
- $ItemCurrent = 0
- EndFunc ;==>_ClearList
- Func FileGetExt($file)
- Return StringRight($file,3)
- EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement