Sign in to follow this  
Followers 0
Alek

Amped

9 posts in this topic

#1 ·  Posted (edited)

I made a little mp3 player with all the standar buttons, playlist function and some button effects

Update:

-removed the drop down button

-moved some buttons and added a button that allows random song choose when a song is done

-added round corners to the gui, found the function here: http://www.autoitscript.com/forum/index.php?showtopic=49276

-hotkeys:

Ctrl+F1 = prev

Ctrl+F2 = Play/Pause

Ctrl+F3 = Stop

Ctrl+F4 = Next

Ctrl+Numpad + = Volum Up

Ctrl+ Numpad - = Volum Down

Update:

-Cleaner??

To Do:

-Drag and Drop

-Movie Player?

-Options like layout and colors

-Cleaner Scirpt

-Drag the songs up and down the list

Why whould i name it Amped, the first name was Amp,

short for Alek's Media/Music/MP3 Player then i thought Amped sounded a bit better

also i had a character in WoW named Amped

#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=Icon2.ico
#AutoIt3Wrapper_outfile=Amped2.exe
#AutoIt3Wrapper_PassPhrase=fallout2
#AutoIt3Wrapper_Res_Comment=Amped - A Autoit Project
#AutoIt3Wrapper_Res_Description=Made By Alek
#AutoIt3Wrapper_Res_Fileversion=0.2.0.0
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#Region
#EndRegion
#include <GUIConstants.au3>
#include <GuiList.au3>
#include <Sound.au3>
#include <File.au3>
#endregion

Opt("MustDeclareVars", 0)

If WinExists("Amped   ") Then Exit

If Not FileExists(@TempDir & "\Amped.ini") Then
    FileWrite(@TempDir & "\Amped.ini", "")
Else
    FileDelete(@TempDir & "\Amped.ini")
    FileWrite(@TempDir & "\Amped.ini", "")
EndIf

#region need to declare variables
$Normal_Color = IniRead(@ScriptDir & "\Config.ini", "Colors", "Normal", "0xcccccc")
$Hover_Color = IniRead(@ScriptDir & "\Config.ini", "Colors", "Hover", "0x9999ff")
$Background_Color = IniRead(@ScriptDir & "\Config.ini", "Colors", "Background", "0x000000")
$LabelText_Color = IniRead(@ScriptDir & "\Config.ini", "Colors", "Text", "0x5555ff")
$ButtonText_Color = IniRead(@ScriptDir & "\Config.ini", "Colors", "Button", "0x000000")
$ListText_Font = IniRead(@ScriptDir & "\Config.ini", "Style", "List Font", "")
$Gui_trans = IniRead(@ScriptDir & "\Config.ini", "Style", "transparency ", "255")
If $Gui_trans > 255 Then $Gui_trans = 255

Dim $Play = "", $Song = "", $Playing = 0,$Pause = 0
Dim $Sliderpos = 0, $Index = 0, $oldposx = 0, $oldposy = 0
Dim $Selected = 0, $oldbutton = 0, $oldvolum = 50, $Random = 0
Dim $Allowd_Filetypes = "*.wav*.mp3*.ogg;*.dct;*.flac;*.au;*.aiff;*.vox;*.raw;*.wma;*.aac;*.atrac;*.ram;*.dss;*.dvf;*.ape;*.mid"

#endregion

#region GUI
$Form1 = GUICreate("Amped   ", 300, 225, -1, -1, $WS_POPUP, $WS_EX_WINDOWEDGE + $WS_EX_ACCEPTFILES)
GUISetBkColor($Background_Color)
_GuiRoundCorners($Form1, 0, 0, 15, 15)
$Slider1 = GUICtrlCreateSlider(5, 55, 290, 25, $TBS_NOTICKS)
GUICtrlSetResizing(-1, $GUI_DOCKALL)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
GUICtrlSetBkColor(-1, $Background_Color)
$Slider2 = GUICtrlCreateSlider(215, 27, 80, 20, $TBS_NOTICKS)
GUICtrlSetLimit(-1, 1000, 0)
GUICtrlSetData(-1, 500)
GUICtrlSetResizing(-1, $GUI_DOCKALL)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
GUICtrlSetBkColor(-1, $Background_Color)
$Button1 = GUICtrlCreateButton("4", 65, 25, 30, 25, 0)
GUICtrlSetFont(-1, 14, 800, 0, "Webdings")
GUICtrlSetResizing(-1, $GUI_DOCKALL)
GUICtrlSetBkColor(-1, $Normal_Color)
GUICtrlSetColor(-1, $ButtonText_Color)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
$Button2 = GUICtrlCreateButton("7", 35, 25, 30, 25, 0)
GUICtrlSetFont(-1, 14, 400, 0, "Webdings")
GUICtrlSetResizing(-1, $GUI_DOCKALL)
GUICtrlSetBkColor(-1, $Normal_Color)
GUICtrlSetColor(-1, $ButtonText_Color)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
$Button3 = GUICtrlCreateButton("8", 125, 25, 30, 25, 0)
GUICtrlSetFont(-1, 14, 800, 0, "Webdings")
GUICtrlSetResizing(-1, $GUI_DOCKALL)
GUICtrlSetBkColor(-1, $Normal_Color)
GUICtrlSetColor(-1, $ButtonText_Color)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
$Button4 = GUICtrlCreateButton("9", 5, 25, 30, 25, 0)
GUICtrlSetFont(-1, 14, 800, 0, "Webdings")
GUICtrlSetResizing(-1, $GUI_DOCKALL)
GUICtrlSetBkColor(-1, $Normal_Color)
GUICtrlSetColor(-1, $ButtonText_Color)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
$Button5 = GUICtrlCreateButton(":", 155, 25, 35, 25, 0)
GUICtrlSetFont(-1, 14, 800, 0, "Webdings")
GUICtrlSetResizing(-1, $GUI_DOCKALL)
GUICtrlSetBkColor(-1, $Normal_Color)
GUICtrlSetColor(-1, $ButtonText_Color)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
$Button6 = GUICtrlCreateButton("<", 95, 25, 30, 25, 0)
GUICtrlSetFont(-1, 14, 800, 0, "Webdings")
GUICtrlSetResizing(-1, $GUI_DOCKALL)
GUICtrlSetBkColor(-1, $Normal_Color)
GUICtrlSetColor(-1, $ButtonText_Color)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
$Button8 = GUICtrlCreateButton("Open", 5, 80, 40, 20)
GUICtrlSetFont(-1, 9, 800)
GUICtrlSetResizing(-1, $GUI_DOCKALL)
GUICtrlSetBkColor(-1, $Normal_Color)
GUICtrlSetColor(-1, $ButtonText_Color)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
$Button9 = GUICtrlCreateButton("r", 275, 5, 20, 20)
GUICtrlSetFont(-1, 8, 800, 0, "Webdings")
GUICtrlSetResizing(-1, $GUI_DOCKALL)
GUICtrlSetBkColor(-1, $Normal_Color)
GUICtrlSetColor(-1, $ButtonText_Color)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
$Button10 = GUICtrlCreateButton("Save", 45, 80, 40, 20)
GUICtrlSetFont(-1, 9, 800)
GUICtrlSetResizing(-1, $GUI_DOCKALL)
GUICtrlSetBkColor(-1, $Normal_Color)
GUICtrlSetColor(-1, $ButtonText_Color)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
$Button11 = GUICtrlCreateButton("Dir", 85, 80, 30, 20)
GUICtrlSetFont(-1, 9, 800)
GUICtrlSetResizing(-1, $GUI_DOCKALL)
GUICtrlSetBkColor(-1, $Normal_Color)
GUICtrlSetColor(-1, $ButtonText_Color)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
$Button12 = GUICtrlCreateButton("Random", 115, 80, 60, 20)
GUICtrlSetFont(-1, 9, 800)
GUICtrlSetResizing(-1, $GUI_DOCKALL)
GUICtrlSetBkColor(-1, $Normal_Color)
GUICtrlSetColor(-1, $ButtonText_Color)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
$Label1 = GUICtrlCreateLabel("X", 195, 27, 15, 20, $SS_SUNKEN)
GUICtrlSetFont(-1, 12, 800, 0, "Webdings")
GUICtrlSetResizing(-1, $GUI_DOCKALL)
GUICtrlSetBkColor(-1, $Normal_Color)
GUICtrlSetColor(-1, $ButtonText_Color)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
$Label2 = GUICtrlCreateLabel("00:00 /00:00", 220, 83, 75, 17)
GUICtrlSetColor(-1, $LabelText_Color)
GUICtrlSetResizing(-1, $GUI_DOCKALL)
GUICtrlSetFont(-1, 10, 400, 0)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$Label3 = GUICtrlCreateLabel("Alek's Media Player", 5, 5, 145, 20)
GUICtrlSetColor(-1, $LabelText_Color)
GUICtrlSetFont(-1, 12, 400, 0, "Brush Script Std")
GUICtrlSetResizing(-1, $GUI_DOCKALL)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$List1 = GUICtrlCreateList("", 5, 100, 290, 130, $WS_BORDER + $WS_VSCROLL)
GUICtrlSetFont(-1, 10, 400, 0, $ListText_Font)
GUICtrlSetResizing(-1, $GUI_DOCKALL)
GUICtrlSetBkColor(-1, $Background_Color)
GUICtrlSetColor(-1, $LabelText_Color)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)

If FileExists(@ScriptDir & "\Playlist.amped") Then
    FileDelete(@TempDir & "\Amped.ini")
    $songs = IniReadSection(@ScriptDir & "\Playlist.amped", "Songs")
    If Not @error Then
        FileWrite(@TempDir & "\Amped.ini", FileRead(@ScriptDir & "\Playlist.amped"))
        For $q = 1 To $songs[0][0]
            GUICtrlSetData($List1, $songs[$q][0])
        Next
        _GUICtrlListSelectIndex($List1, 0)
    EndIf
EndIf

WinSetTrans($Form1, "", 0)
GUISetState(@SW_SHOW, $Form1)
For $x = 0 To $Gui_trans Step 5
    WinSetTrans($Form1, "", $x)
    Sleep(1)
Next
WinActivate($Form1)

#endregion
Do
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $Button1
            _Pause()
        Case $Button2
            _Fastplay(0)
        Case $Button3
            _Fastplay(1)
        Case $Button4
            _Skip(1)
        Case $Button5
            _Skip(0)
        Case $Button6
            _Stop()
        Case $Button8
            _GetFiles()
        Case $Button9
            _SoundClose($song)
            For $x = $Gui_trans To 0 Step - 5
                WinSetTrans($Form1, "", $x)
                Sleep(1)
            Next
            Exit
        Case $Button10
            _SavePlaylist()
        Case $Button11
            _FileFinder()
        Case $Button12
            If $Random = 1 Then
                GUICtrlSetColor($Button12, $ButtonText_Color)
                $Random = 0
            ElseIf $Random = 0 Then
                GUICtrlSetColor($Button12, 0x00ff00)
                $Random = 1
            EndIf
        Case $GUI_EVENT_DROPPED
            _Getdropedfile()
    EndSwitch
    _GuiRunWhileMoveing($Form1)
    _Misc()
Until $nMsg = $Button9

Func _Misc()
    _Searchcontrol()
    _Listcontrol()
    If GUICtrlRead($Slider2) <> $oldvolum Then
        _Volumcontrol()
    EndIf
    _Songcontrol()
    Effects()
    _Hotkeys()
EndFunc   ;==>_Misc

Func _play()
    If $Song <> "" And _GUICtrlListCount($List1) > 0 Then
        _SoundStop($Song)
        _SoundClose($song)
    EndIf
    GUICtrlSetData($Button1, ";")
    $Play = IniRead(@TempDir & "\amped.ini", "Songs", _GUICtrlListGetText($List1, _GUICtrlListSelectedIndex($List1)), "")
    If FileExists($Play) Then
        $Song = _SoundOpen($Play)
        _SoundPlay($Song)
        _Volumcontrol()
        GUICtrlSetLimit($Slider1, _SoundLength($Song, 2) / 1000, 0)
        GUICtrlSetData($Slider1, 0)
        $Playing = 1
    Else
        $Selected = _GUICtrlListSelectedIndex($List1)
        IniDelete(@TempDir & "\Amped.ini", "Songs", _GUICtrlListGetText($List1, _GUICtrlListSelectedIndex($List1)))
        _GUICtrlListDeleteItem($List1, _GUICtrlListSelectedIndex($List1))
    EndIf
EndFunc   ;==>_play

Func _Pause()
    If GUICtrlRead($Button1) = ";" And $Song <> "" And GUICtrlRead($List1) <> "" Then
        _SoundPause($Song)
        $Pause = 1
        GUICtrlSetData($Button1, "4")
    ElseIf GUICtrlRead($List1) <> "" Then
        If $Pause = 1 Then
            _SoundResume($Song)
            $Pause = 0
            GUICtrlSetData($Button1, ";")
        Else
            _play()
        EndIf
    EndIf
EndFunc   ;==>_Pause

Func _Stop()
    _SoundStop($Song)
    GUICtrlSetData($Slider1, -1)
    GUICtrlSetData($Button1, "4")
EndFunc   ;==>_Stop

Func _Skip($what_way)
    if $Random = 1 Then
        _GUICtrlListSelectIndex($List1, Random(0, _GUICtrlListCount($List1), 1))
    ElseIf $what_way = 1 Then
        If _GUICtrlListSelectedIndex($List1) = 0 Then
            _GUICtrlListSelectIndex($List1, _GUICtrlListCount($List1) - 1)
        Else
            _GUICtrlListSelectIndex($List1, _GUICtrlListSelectedIndex($List1) - 1)
        EndIf
    ElseIf $what_way = 0 Then
        If _GUICtrlListSelectedIndex($List1) = _GUICtrlListCount($List1) - 1 Then
            _GUICtrlListSelectIndex($List1, 0)
        Else
            _GUICtrlListSelectIndex($List1, _GUICtrlListSelectedIndex($List1) + 1)
        EndIf
    EndIf
EndFunc   ;==>_Skip

Func _Fastplay($what_way)
    If $what_way = 1 And $Song <> "" And _GUICtrlListCount($List1) > 0 Then
        GUICtrlSetData($Button1, "4")
        $timer = TimerInit()
        Do
            If TimerDiff($timer) >= 100 Then
                GUICtrlSetData($Slider1, GUICtrlRead($Slider1) + 4)
                _SoundSeek($Song, 0, 0, GUICtrlRead($Slider1))
                _SoundPlay($Song)
                $timer = TimerInit()
            EndIf
            _Misc()
            GUICtrlSetData($Label2, StringTrimLeft(_SoundPos($Song, 1), 3) & " /" & StringTrimLeft(_SoundLength($Song, 1), 3))
        Until GUIGetMsg() = $Button1 Or GUICtrlRead($Slider1) >= _SoundLength($Song, 2) / 1000
        GUICtrlSetData($Button1, ";")
    ElseIf $what_way = 0 And $Song <> "" And _GUICtrlListCount($List1) > 0 Then
        GUICtrlSetData($Button1, "4")
        $timer = TimerInit()
        Do
            If TimerDiff($timer) >= 100 Then
                GUICtrlSetData($Slider1, GUICtrlRead($Slider1) - 4)
                _SoundSeek($Song, 0, 0, GUICtrlRead($Slider1))
                _SoundPlay($Song)
                $timer = TimerInit()
            EndIf
            Sleep(10)
            _Misc()
            GUICtrlSetData($Label2, StringTrimLeft(_SoundPos($Song, 1), 3) & " /" & StringTrimLeft(_SoundLength($Song, 1), 3))
        Until GUIGetMsg() = $Button1 Or GUICtrlRead($Slider1) <= 0
        GUICtrlSetData($Button1, ";")
    EndIf
EndFunc   ;==>_Fastplay

Func _GetFiles()
    GUICtrlSetBkColor($Button8, 0xCCCCCC)
    $Filetoplay = FileOpenDialog("Alek's Media Player", "", "Music(*.wav;*.mp3;*.ogg;*.dct;*.flac;*.au;*.aiff;*.vox;*.raw;*.wma;*.aac;*.atrac;*.ram;*.dss;*.dvf;*.ape;*.mid)|Playlist(*.Amped)", 6)
    If Not @error And $Filetoplay <> "" Then
        $test = StringSplit($Filetoplay, ".")
        If $test[$test[0]] = "Amped" Then
            _GUICtrlListClear($List1)
            FileDelete(@TempDir & "\Amped.ini")
            $Filetoplay = StringSplit($Filetoplay, "|")
            $songs = IniReadSection($Filetoplay[1], "Songs")
            FileWrite(@TempDir & "\Amped.ini", FileRead($Filetoplay[1]))
            For $q = 1 To $songs[0][0]
                GUICtrlSetData($List1, $songs[$q][0])
            Next
            _GUICtrlListSelectIndex($List1, 0)
        Else
            $F = StringSplit($Filetoplay, "|")
            If $F[0] = 1 Then
                $t = StringSplit($Filetoplay, "\")
                $t = StringSplit($t[$t[0]], ".")
                If _GUICtrlListFindString($List1, $t[1]) = $LB_ERR Then
                    IniWrite(@TempDir & "\Amped.ini", "Songs", $t[1], $Filetoplay)
                    GUICtrlSetData($List1, $t[1])
                    _GUICtrlListSelectIndex($List1, _GUICtrlListFindString($List1, $t[1], 1))
                EndIf
            Else
                For $y = 2 To $F[0]
                    $t = StringSplit($F[$y], "\")
                    $t = StringSplit($t[$t[0]], ".")
                    If _GUICtrlListFindString($List1, $t[1]) = $LB_ERR Or GUICtrlRead($List1) = "" Then
                        IniWrite(@TempDir & "\Amped.ini", "Songs", $t[1], $F[$y])
                        GUICtrlSetData($List1, $t[1])
                        _GUICtrlListSelectIndex($List1, _GUICtrlListFindString($List1, $t[1], 1))
                    EndIf
                Next
            EndIf
        EndIf
        _play()
    EndIf
EndFunc   ;==>_GetFiles

Func _FileFinder()
    ;this function could use Some ajustments like some kind of array insted of filewrite and fileread
    ;i think it whould be faster but will proberly use more memory
    $Filepath = FileSelectFolder("Alek's Media Player", "")
    If Not $Filepath = "" Then
        $Depthcounter = 0
        FileWrite(@TempDir & "\Temp" & $Depthcounter & ".txt", $Filepath & @CRLF)
        Do
            _Misc()
            $Lines = _FileCountLines(@TempDir & "\Temp" & $Depthcounter & ".txt")
            $Depthcounter += 1
            FileWrite(@TempDir & "\Temp" & $Depthcounter & ".txt", "")
            For $Linecounter = 1 To $Lines
                $Filepath = FileReadLine(@TempDir & "\Temp" & $Depthcounter - 1 & ".txt", $Linecounter)
                $Files = FileFindFirstFile($Filepath & "\*.*")
                While 1
                    _Misc()
                    $File = FileFindNextFile($Files)
                    If @error Then ExitLoop
                    $Filetype = StringSplit($File, ".")
                    If $Filetype[0] = 1 Then
                        FileWrite(@TempDir & "\Temp" & $Depthcounter & ".txt", $Filepath & "\" & $File & @CRLF)
                    ElseIf StringInStr($Allowd_Filetypes, "*." & $Filetype[2], 1) > 1 Then
                        IniWrite(@TempDir & "\Amped.ini", "songs", $Filetype[1], $Filepath & "\" & $File)
                        GUICtrlSetData($List1, $Filetype[1])
                        _GUICtrlListSelectIndex($List1, _GUICtrlListFindString($List1, $Filetype[1], 1))
                    EndIf
                WEnd
            Next
        Until FileRead(@TempDir & "\Temp" & $Depthcounter & ".txt") = ""
        For $x = 0 To $Depthcounter
            FileDelete(@TempDir & "\Temp" & $x & ".txt")
        Next
    EndIf
EndFunc   ;==>_FileFinder

Func _Getdropedfile()
    ;this function could use Some ajustments like some kind of array insted of filewrite and fileread
    ;i think it whould be faster but will proberly use more memory$Filetoplay = @GUI_DragFile
    $Filetoplay = @GUI_DragFile
    $Filetype = StringSplit($Filetoplay, "\")
    $Filetype = StringSplit($Filetype[$Filetype[0]], ".")
    If $Filetype[0] = 2 And StringInStr($Allowd_Filetypes, "*." & $Filetype[2], 1) > 1 Then
        IniWrite(@TempDir & "\Amped.ini", "Songs", $Filetype[1], $Filetoplay)
        GUICtrlSetData($List1, $Filetype[1])
        _GUICtrlListSelectIndex($List1, _GUICtrlListFindString($List1, $Filetype[1], 1))
    Else
        $Depthcounter = 0
        FileWrite(@TempDir & "\Temp" & $Depthcounter & ".txt", $Filetoplay & @CRLF)
        Do
            _Misc()
            $Lines = _FileCountLines(@TempDir & "\Temp" & $Depthcounter & ".txt")
            $Depthcounter += 1
            FileWrite(@TempDir & "\Temp" & $Depthcounter & ".txt", "")
            For $Linecounter = 1 To $Lines
                $Filepath = FileReadLine(@TempDir & "\Temp" & $Depthcounter - 1 & ".txt", $Linecounter)
                $Files = FileFindFirstFile($Filepath & "\*.*")
                While 1
                    _Misc()
                    $File = FileFindNextFile($Files)
                    If @error Then ExitLoop
                    $Filetype = StringSplit($File, ".")
                    If $Filetype[0] = 1 Then
                        FileWrite(@TempDir & "\Temp" & $Depthcounter & ".txt", $Filepath & "\" & $File & @CRLF)
                    ElseIf StringInStr($Allowd_Filetypes, "*." & $Filetype[2], 1) > 1 Then
                        IniWrite(@TempDir & "\Amped.ini", "songs", $Filetype[1], $Filepath & "\" & $File)
                        GUICtrlSetData($List1, $Filetype[1])
                        _GUICtrlListSelectIndex($List1, _GUICtrlListFindString($List1, $Filetype[1], 1))
                    EndIf
                WEnd
            Next
        Until FileRead(@TempDir & "\Temp" & $Depthcounter & ".txt") = ""
        For $x = 0 To $Depthcounter
            FileDelete(@TempDir & "\Temp" & $x & ".txt")
        Next
    EndIf
EndFunc   ;==>_Getdropedfile

Func _SavePlaylist()
    If FileExists(@ScriptDir & "\Playlist.amped") Then
        FileDelete(@ScriptDir & "\Playlist.amped")
        FileWrite(@ScriptDir & "\Playlist.amped", "")
    EndIf
    FileWrite(@ScriptDir & "\Playlist.amped", FileRead(@TempDir & "\Amped.ini"))
EndFunc   ;==>_SavePlaylist

Func Effects()
    $nInfo = GUIGetCursorInfo($Form1)
    If $nInfo[4] <> $oldbutton And $nInfo[4] <> $Slider1 And $nInfo[4] <> $Slider2 And $nInfo[4] <> $List1 And $nInfo[4] <> $Label1 And $nInfo[4] <> $Label2 And $nInfo[4] <> $Label3 Then
        GUICtrlSetBkColor($oldbutton, $Normal_Color)
        GUICtrlSetBkColor($nInfo[4], $Hover_Color)
        $oldbutton = $nInfo[4]
    ElseIf $nInfo[4] <> $oldbutton Then
        GUICtrlSetBkColor($oldbutton, $Normal_Color)
    EndIf
EndFunc   ;==>Effects

Func _Guirunwhilemoveing($Gui)
    $Mouseingui = GUIGetCursorInfo($Gui)
    $Winsize = WinGetPos($Gui)
    While _IsPressed(01)
        if $Mouseingui[0] > 0 and $Mouseingui[0] < $Winsize[2] and $Mouseingui[1] > 0 and $Mouseingui[1] < $Winsize[3] and WinActive($Gui) and $Mouseingui[4] = 0  or $Mouseingui[4] = $Label3 Then
            $Mousepos = MouseGetPos()
            WinMove($Gui,"",$Mousepos[0]-$Mouseingui[0],$Mousepos[1]-$Mouseingui[1])
        EndIf
        _Misc()
    WEnd
EndFunc

Func _Searchcontrol()
    $nInfo = GUIGetCursorInfo($Form1)
    If $nInfo[4] = $Slider1 And _IsPressed(01) And WinActive($Form1) Then
        _SoundPause($Song)
        Do
            $nInfo = GUIGetCursorInfo($Form1)
            If $nInfo[0] <> $oldposx Then
                _SoundSeek($Song, 0, 0, GUICtrlRead($Slider1))
                _SoundPlay($Song)
                Sleep(100)
                $oldposx = $nInfo[0]
            Else
                Sleep(10)
            EndIf
            If GUICtrlRead($Label2) <> StringTrimLeft(_SoundPos($Song, 1), 3) & " /" & StringTrimLeft(_SoundLength($Song, 1), 3) Then
                GUICtrlSetData($Label2, StringTrimLeft(_SoundPos($Song, 1), 3) & " /" & StringTrimLeft(_SoundLength($Song, 1), 3))
            EndIf
        Until _IsPressed(01) = 0
        _SoundPlay($Song)
    EndIf
EndFunc   ;==>_Searchcontrol

Func _Volumcontrol()
    mciSendString ("setaudio " & $Song & " output volume to " & GUICtrlRead($Slider2))
    $oldvolum = GUICtrlRead($Slider2)
EndFunc   ;==>_Volumcontrol

Func _Listcontrol()
    $Selected_Index = _GUICtrlListSelectedIndex($List1)
    If $Selected_Index <> $Selected And GUICtrlRead($Button1) = ";" Then
        _play()
        $Selected = _GUICtrlListSelectedIndex($List1)
    EndIf
    If _IsPressed("2E") And _GUICtrlListSelectedIndex($List1) <> $LB_ERR And WinActive($Form1) Then
        $Deltimer = TimerInit()
        Do
            Sleep(10)
        Until _IsPressed("2E") = 0 Or TimerDiff($Deltimer) > 100
        If $Selected_Index = _GUICtrlListCount($List1) - 1 Then
            $Select = _GUICtrlListCount($List1) - 2
        Else
            $Select = _GUICtrlListSelectedIndex($List1)
        EndIf
        IniDelete(@TempDir & "\Amped.ini", "Songs", _GUICtrlListGetText($List1, $Selected_Index))
        _GUICtrlListDeleteItem($List1, $Selected_Index)
        _GUICtrlListSelectIndex($List1, $Select)
        If _GUICtrlListCount($List1) = 0 Then
            _Stop()
        Else
            _play()
        EndIf
    EndIf
EndFunc   ;==>_Listcontrol

Func _Songcontrol()
    If _SoundPos($Song, 2) = _SoundLength($Song, 2) And GUICtrlRead($Button1) = ";" Then
        GUICtrlSetData($Button1, "4")
        GUICtrlSetData($Slider1, -1)
        _Skip(0)
        _play()
    ElseIf GUICtrlRead($Slider1) <> -1 Then
        $Index = _GUICtrlListSelectedIndex($List1)
        GUICtrlSetData($Slider1, _SoundPos($Song, 2) / 1000)
        If GUICtrlRead($Label2) <> StringTrimLeft(_SoundPos($Song, 1), 3) & " /" & StringTrimLeft(_SoundLength($Song, 1), 3) Then
            GUICtrlSetData($Label2, StringTrimLeft(_SoundPos($Song, 1), 3) & " /" & StringTrimLeft(_SoundLength($Song, 1), 3))
        EndIf
    EndIf
EndFunc   ;==>_Songcontrol

Func _Hotkeys()
    If _IsPressed(11) And _IsPressed("6d") Then
        Sleep(10)
        GUICtrlSetData($Slider2, GUICtrlRead($Slider2) - 10)
    ElseIf _IsPressed(11) And _IsPressed("6b") Then
        Sleep(10)
        GUICtrlSetData($Slider2, GUICtrlRead($Slider2) + 10)
    ElseIf _IsPressed(11) And _IsPressed(70) Then
        Sleep(100)
        _Skip(1)
    ElseIf _IsPressed(11) And _IsPressed(73) Then
        Sleep(100)
        _Skip(0)
    ElseIf _IsPressed(11) And _IsPressed(71) Then
        Do
            Sleep(10)
        Until _IsPressed(71) = 0
        _Pause()
    ElseIf _IsPressed(11) And _IsPressed(72) Then
        Sleep(100)
        _Stop()
    EndIf
EndFunc   ;==>_Hotkeys

Func _GuiRoundCorners($h_win, $i_x1, $i_y1, $i_x3, $i_y3)
    Dim $pos, $ret, $ret2
    $pos = WinGetPos($h_win)
    $ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $pos[2], "long", $pos[3], "long", $i_x3, "long", $i_y3)
    If $ret[0] Then
        $ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $ret[0], "int", 1)
        If $ret2[0] Then
            Return 1
        Else
            Return 0
        EndIf
    Else
        Return 0
    EndIf
EndFunc   ;==>_GuiRoundCorners

Config.ini

[Colors]
#The buttons Normal Color
Normal=0xcccccc

#Button text Color
Button=0x000000

#The buttons color when your cursor is hovering over it
Hover=0x9999ff

#The window background color
Background=0x000000

#The List and Labels text color
Text=0x5555ff

[Style]
List Font=Arno Pro

#Transparency can max be 255
transparency=240

even made a little icon for a exe file ^_^

Compiled Version: Amped.exe

Edited by Alek

[font="Impact"]Never fear, I is here.[/font]

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

Nice gui dude :whistle:

Luv the buttons , backcolor, the dropdown playlist.. looks quite sexy and it's small.

Trival suggestion..

use AdlibDisable() before exit, this way I don't see the error in scites console when I exit your player :lmao:

major suggestion:

do something so the effects don't spike to 100 cpu time while mousing over the buttons.

Cheers

Edit Again: To settle the spiking of 100 cpu time while mousing over the gui..

Use a sleep(10) in the Do loop.

It wasn't the effects causing the spike ...

Edited by smashly

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

GUI was impressive...

(313) : ==> Subscript used with non-Array variable.:

if $nInfo[4] <> $oldbutton and $nInfo[4] <> $Button7 and $nInfo[4] <> $Slider1 and $nInfo[4] <> $Slider2 and $nInfo[4] <> $list1 and $nInfo[4] <> $Label1 and $nInfo[4] <> $Label2 and $nInfo[4] <> $Label3 Then

if $nInfo^ ERROR

Might want to work on that CPU usage, maybe play with _AdlibEnable() instead of the _Misc() function in the loop.

Edit:

Ha! Never read smashly's response... seems he noticed it too.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Another suggestion:

To adjust the volume without globally changing window wav volume.

Func _Volumcontrol()
    If GUICtrlRead($Slider2) <> $oldvolum Then
        mciSendString("setaudio " & $Song & " output volume to " & GUICtrlRead($Slider2))
        $oldvolum = GUICtrlRead($Slider2)
    EndIf
EndFunc
You also need to set the volume slider limit to Max 1000, as setaudio returns of 1000 (1000 being maximum volume, 0 minimum volume.)

To me this seems to make better sense then using autoit SoundSetWaveVolume() function which only sets wav device volume and it does it on a global scale.

Note: myself I associate wav and mp3 to mpegvideo mci device, this way any file plays with the correct codecs that are installed in my pc.. sounds whack , but it works.. yet if i left the wav and mp3 associated with their default mci wavaudio then I get clicks and pops when I play mp3's and it doesn't use the mp3 codec that I want.

Same goes for avi.. use mpegvideo mci device to play avi and it will use the codec I use in my other video players (good), use avi with the avi mci devivce and half my avi play screwy and mci uses ms direct show filter, which sux when you've got custom avi formats.)

Add other formats to the file open filter. sound.au3 can play all formats providing a users pc has the right settings made.

Cheers

Edit: Forgot to mention, the mciSendString() function is part of sound.au3.. so since your using the sound.au3 then you can call the function with all sorts of differant parameters. :whistle:

Edited by smashly

Share this post


Link to post
Share on other sites

thanks all, its now bin updated and should use less cpu and

(313) : ==> Subscript used with non-Array variable.: 
if $nInfo[4] <> $oldbutton and $nInfo[4] <> $Button7 and $nInfo[4] <> $Slider1 and $nInfo[4] <> $Slider2 and $nInfo[4] <> $list1 and $nInfo[4] <> $Label1 and $nInfo[4] <> $Label2 and $nInfo[4] <> $Label3 Then 
if $nInfo^ ERROR

Should not be a problem anymore also i added a config.ini to change the colors


[font="Impact"]Never fear, I is here.[/font]

Share this post


Link to post
Share on other sites

GUI is awesome!!!

But it's not working for me for some reason:

I open an MP3 file and the track slider keeps jumping from the beginning to the end and back - over and over.

And the play button alternates with pause over and over at the same time.

I'm running Windows Vista Ultimate.

Share this post


Link to post
Share on other sites

GUI is awesome!!!

But it's not working for me for some reason:

I open an MP3 file and the track slider keeps jumping from the beginning to the end and back - over and over.

And the play button alternates with pause over and over at the same time.

I'm running Windows Vista Ultimate.

hmm, i had this problem earlyer with it, while runing go to your tempdir and open amped.ini

it should look something like this

[songs]

Song=C:/something/Song.mp3

when i had this problem it lookd like this

[songs]

song=Song

So that the player didn't know where to find the file


[font="Impact"]Never fear, I is here.[/font]

Share this post


Link to post
Share on other sites

Update:

-added Drag and drop

-Fixed some more minor bugs


[font="Impact"]Never fear, I is here.[/font]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0