- freezer simple player
- version 1.0.0
- copyright @ freezerlab 2009
nah oke kita mulai langsung aja yep
#SingleInstance Forcenah itu main scriptnya. tapi gak berhenti sampai disitu aja. kita masih butuh 1 file lagi
FileInstall, SoundFunctions.ahk, SoundFunctions.ahk, 0
FileInstall, Filter.ini, Filter.ini, 0
SetBatchLines -1
#NoEnv
SetTimer, UpdateSound,5000
SetTimer, UpdateTime,100
SetTimer,UpdateProgress,1000
SetTimer,CheckStatus,100
SoundGet, MV
RSound := Round(MV)
playing = 0
IniRead, Filter, Filter.ini, Config, F
SetTitleMatchMode, 3
gui, color, black
gui, font, cwhite
Gui, Add, Picture, x6 y155 w20 h20 gStopF, %A_ScriptDir%\fmp-stop-o.bmp
Gui, Add, Picture, x46 y155 w20 h20 gPauseF, %A_ScriptDir%\fmp-pause-o.bmp
Gui, Add, Picture, x26 y155 w20 h20 gResumeF, %A_ScriptDir%\fmp-play-o.bmp
Gui, Add, Progress, x66 y155 w220 h20 -Smooth hwndhwnd vProgress Range1-100 vProgress, 0
Gui, Add, Slider, x410 y5 w20 h150 vertical vVSlider Range0-100 gVolumeC AltSubmit invert, %MV%
Gui, Add, Text, x296 y157 w60 h20 vSongTime, 0:0 of 0:0
Gui, Add, Text, x356 y157 w60 h20 vVText, volume`:%RSound%
Gui, Add, StatusBar, x6 y70 w270 h20 vapdet, Not Playing A File
gui, font, cblue
Gui, Add, ListView, grid x6 y5 w400 h150 gPlayLV vLV, Name|Type|Dir
LV_ModifyCol(1, "200 Text")
LV_ModifyCol(2, "45 Integer Right")
LV_ModifyCol(3, "150 Integer Right")
Menu, MyContextMenu, Add, OPEN, OpenMF
Menu, MyContextMenu, Add, ADD TO LIST, AddC
Menu, MyContextMenu, Add, CLEAR, EC
Menu, MyContextMenu, Default, Open
Gui, Show, x195 y115 h200 w425, freezer source player
Return
UpdateClock:
If cTime = %A_Now%
exit
else
cTime := A_Now
SetTimer, UpdateClock, OFF
FormatTime, Time, , HH:mm:ss
GuiControl, , Time , %Time%
SetTimer, UpdateClock, 10
Return
GuiClose:
exitapp
return
GuiContextMenu: ; Launched in response to a right-click or press of the Apps key.
if A_GuiControl <> LV ; Display the menu only for clicks inside the ListView.
return
; Show the menu at the provided coordinates, A_GuiX and A_GuiY. These should be used
; because they provide correct coordinates even if the user pressed the Apps key:
Menu, MyContextMenu, Show, %A_GuiX%, %A_GuiY%
return
;Sound Controls
UpdateSound:
Gui, Submit, NoHide
SoundGet, MVU
RSound := Round(MVU)
Guicontrol,,VSlider,%MVU%
GuiControl,,VText,Volume`:%RSound%
return
VolumeC:
Gui, Submit, NoHide
SoundSet,%VSlider%,master
GuiControl,, VText,Volume`:%VSlider%
Return
;Sound Controls
OpenMF:
CheckSong := Sound_Status(hSound)
If CheckSong = playing
{
Sound_Stop(hSound)
playing = 0
}
Gui, +OwnDialogs
FileSelectFile, Filetoplay, 3, , Select Media File,Audio %Filter%
If Filetoplay =
msgbox,No File Selected
filename=
sleep 100
SplitPath, Filetoplay, filename
sleep 100
hSound := Sound_Open(Filetoplay)
If Not hSound
return
playing = 1
Sound_Play(hSound)
Guicontrol,,Progress,0
Guicontrol,% "+Range1-" Sound_Length(hSound) / 1000,Progress
SplitPath, Filetoplay, filename
SB_SetText("Now Playing " filename)
return
StopF:
Sound_Stop(hSound)
playing = 0
Guicontrol,,Progress,0
GuiControl,,SongTime,0:0 of 0:0
SB_SetText("Not Playing A File")
return
PauseF:
Sound_Pause(hSound)
return
ResumeF:
Sound_Resume(hSound)
return
UpdateTime:
If playing = 0
return
If(Sound_Pos(hSound) = Sound_Length(hSound))
return
GuiControl,,SongTime,% Tohhmmss(Sound_Pos(hSound)) . " of " . Tohhmmss(Sound_Length(hSound))
return
UpdateProgress:
If playing = 0
return
If(Sound_Pos(hSound) = Sound_Length(hSound))
return
Guicontrol,,Progress,% (Sound_Pos(hSound) / 1000)
Return
CheckStatus:
Status := Sound_Status(hSound)
If Status = stopped
{
sleep 1500
Guicontrol,,Progress,0
Guicontrol,,SongTime,0:0 of 0:0
SB_SetText("Not Playing A File")
}
return
PlayLV:
LV_GetText(filetoplaylv, A_EventInfo, 3)
CheckSong := Sound_Status(hSound)
If CheckSong = playing
{
Sound_Stop(hSound)
playing = 0
}
hSound := Sound_Open(filetoplaylv)
If Not hSound
return
playing = 1
Sound_Play(hSound)
Guicontrol,,Progress,0
Guicontrol,% "+Range1-" Sound_Length(hSound) / 1000,Progress
SplitPath, filetoplaylv, filenamelv
SB_SetText("Now Playing " filenamelv)
return
UpdateLV:
Gui, Submit, NoHide
LV_Delete()
Loop, %Directory%\*.*
LV_Add("", A_LoopFileName, A_LoopFileSizeMB, A_LoopFileExt,A_LoopFileFullPath)
LV_ModifyCol()
LV_ModifyCol(2,"Integer")
return
AddC:
FileSelectFile, FileToAdd, 3,%A_Desktop% , Select Media File,Audio %Filter%
If FileToAdd =
{
msgbox, No File Selected
return
}
SplitPath, FileToAdd, FTDName,,EXT
LV_Add("",FTDName,EXT,FileToAdd)
LV_ModifyCol()
return
EC:
LV_Delete()
return
#Include SoundFunctions.ahk
^h::
IfWinExist, freezer source player
WinHide, freezer source player
else
WinShow, freezer source player
return
soundfunctions.ahk
Sound_Open(File, Alias=""){oke selesai.. moga itu bisa lo cerna semua yeh
IfNotExist, %File%
{
ErrorLevel = 2
Return 0
}
If Alias =
{
Random, rand, 10, 10000000000000000000000000000000000000
Random, randd, 10, 10000000000000000000000000000000000000
Alias = AutoHotkey%rand%%randd%
}
Loop, %File%
File_Short = %A_LoopFileShortPath%
r := Sound_SendString("open " File_Short " alias " Alias)
If r
{
ErrorLevel = 1
Return 0
}Else{
ErrorLevel = 0
Return %Alias%
}
}
Sound_Close(SoundHandle){
r := Sound_SendString("close " SoundHandle)
Return NOT r
}
Sound_Play(SoundHandle, Wait=0){
If(Wait <> 0 AND Wait <> 1)
Return 0
If Wait
r := Sound_SendString("play " SoundHandle " wait")
Else
r := Sound_SendString("play " SoundHandle)
Return NOT r
}
Sound_Stop(SoundHandle){
r := Sound_SendString("seek " SoundHandle " to start")
r2 := Sound_SendString("stop " SoundHandle)
If(r AND r2)
{
Return 0
}Else{
Return 1
}
}
Sound_Pause(SoundHandle){
r := Sound_SendString("pause " SoundHandle)
Return NOT r
}
Sound_Resume(SoundHandle){
r := Sound_SendString("resume " SoundHandle)
Return NOT r
}
Sound_Length(SoundHandle){
r := Sound_SendString("set time format miliseconds", 1)
If r
Return 0
r := Sound_SendString("status " SoundHandle " length", 1, 1)
Return %r%
}
Sound_Seek(SoundHandle, Hour, Min, Sec){
milli := 0
r := Sound_SendString("set time format milliseconds", 1)
If r
Return 0
milli += Sec * 1000
milli += Min * 1000 * 60
milli += Hour * 1000 * 60 * 60
r := Sound_SendString("seek " SoundHandle " to " milli)
Return NOT r
}
Sound_Status(SoundHandle){
Return Sound_SendString("status " SoundHandle " mode", 1, 1)
}
Sound_Pos(SoundHandle){
r := Sound_SendString("set time format miliseconds", 1)
If r
Return 0
r := Sound_SendString("status " SoundHandle " position", 1, 1)
Return %r%
}
Sound_SeekSeconds(SoundHandle, Sec){
r := Sound_SendString("seek " SoundHandle " to " Sec)
Return NOT r
}
Sound_SetBass(SoundHandle){
r := Sound_SendString("setaudio " SoundHandle " bass to 1000")
Return
}
Sound_SendString(string, UseSend=0, ReturnTemp=0){
If UseSend
{
VarSetCapacity(stat1, 32, 32)
DllCall("winmm.dll\mciSendStringA", "UInt", &string, "UInt", &stat1, "Int", 32, "Int", 0)
}Else{
DllCall("winmm.dll\mciExecute", "str", string)
}
If(UseSend And ReturnTemp)
Return stat1
Else
Return %ErrorLevel%
}
Tohhmmss(milli){
min := Floor(milli / (1000 * 60))
hour := Floor(milli / (1000 * 3600))
sec := Floor(Floor(milli/1000) - (min * 60))
Return min ":" sec
}
kalopun belom lo bisa komen di bawah
Tidak ada komentar:
Posting Komentar