Jump to content

White Shark Audio Player


Recommended Posts

Here's an improved version which supports recursive file search :)

CODE
#cs ----------------------------------------------------------------------------

Authors: Lord_Blackout & Sir_Nazgul & L|M|TER

Script Function: Audio Player

Script Version: 1.1

#ce ----------------------------------------------------------------------------

#include <Sound.au3>

#include <ButtonConstants.au3>

#include <EditConstants.au3>

#include <GUIConstants.au3>

#include <ProgressConstants.au3>

#include <SliderConstants.au3>

#include <StaticConstants.au3>

#include <WindowsConstants.au3>

#include <File.au3>

#include <ExtProp.au3>

#include "recursive.au3"

Global $Slider_volume, $Casella1, $Casella2, $Durata_ms, $Tempo_ms, $Percentuale

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

#Region ### START Koda GUI section ###

$Form1_1 = GUICreate(".:.:. White Shark Corporation .:.:.", 781, 460, 122, 187)

GUISetBkColor(0x000000)

$Label1 = GUICtrlCreateLabel("White Shark Audio Player", 176, 16, 412, 31)

GUICtrlSetFont(-1, 20, 800, 0, "Lucida Console")

GUICtrlSetColor(-1, 0x00FF00)

$Scegli = GUICtrlCreateInput("Scegli un file audio...", 48, 64, 561, 21)

$Sfoglia = GUICtrlCreateButton("Sfoglia...", 640, 64, 81, 21)

$Play = GUICtrlCreateButton("Play", 48, 104, 121, 33)

GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")

$Stop = GUICtrlCreateButton("Stop", 328, 104, 113, 33)

GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")

$Durata = GUICtrlCreateInput("Durata totale", 608, 104, 113, 21)

$Tempo = GUICtrlCreateInput("Tempo trascorso", 608, 136, 113, 21)

$Label2 = GUICtrlCreateLabel("Durata totale:", 520, 105, 83, 20)

GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")

GUICtrlSetColor(-1, 0x00FF00)

$Label3 = GUICtrlCreateLabel("Tempo trascorso:", 493, 137, 110, 20)

GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")

GUICtrlSetColor(-1, 0x00FF00)

$Pausa = GUICtrlCreateButton("Pausa", 192, 104, 113, 33)

GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")

$Slider = GUICtrlCreateSlider(40, 200, 265, 33)

GUICtrlSetBkColor(-1,0x000000)

$Volume = GUICtrlCreateLabel("Volume", 152, 176, 50, 20)

GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")

GUICtrlSetColor(-1, 0x00FF00)

$Label4 = GUICtrlCreateLabel("+", 288, 176, 13, 24)

GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")

GUICtrlSetColor(-1, 0x00FF00)

$Label5 = GUICtrlCreateLabel("-", 52, 176, 9, 24)

GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")

GUICtrlSetColor(-1, 0x00FF00)

$Mixer = GUICtrlCreateButton("Mixer", 328, 200, 113, 33, 0)

GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")

$Sfuma = GUICtrlCreateLabel("Dissolvi", 348, 153, 52, 20)

GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")

GUICtrlSetColor(-1, 0x00FF00)

$CheckBox1 = GUICtrlCreateCheckbox("CheckBox1", 330, 152, 17, 17)

$Checkbox2 = GUICtrlCreateCheckbox("CheckBox", 50, 152, 17, 17)

$Label6 = GUICtrlCreateLabel("Loop", 68, 153, 35, 20)

GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")

GUICtrlSetColor(-1, 0x00FF00)

$Progress1 = GUICtrlCreateProgress(464, 208, 281, 25)

$Label7 = GUICtrlCreateLabel("Progresso", 576, 176, 67, 20)

GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")

GUICtrlSetColor(-1, 0x00FF00)

$Label8 = GUICtrlCreateLabel("«--??`--·?--»", 24, 24, 139, 19)

GUICtrlSetFont(-1, 11, 400, 0, "Lucida Console")

GUICtrlSetColor(-1, 0x00FF00)

$Label9 = GUICtrlCreateLabel("«--`·--??`--»", 608, 24, 139, 19)

GUICtrlSetFont(-1, 11, 400, 0, "Lucida Console")

GUICtrlSetColor(-1, 0x00FF00)

$playlist = GUICtrlCreateListView("Artist|Title|Album|Path", 16, 256, 746, 182)

GUICtrlSendMsg(-1, 0x101E, 0, 200)

GUICtrlSendMsg(-1, 0x101E, 1, 200)

GUICtrlSendMsg(-1, 0x101E, 2, 200)

GUICtrlSendMsg(-1, 0x101E, 3, 140)

GUICtrlSetColor(-1, 0x00FF00)

GUICtrlSetBkColor(-1, 0x000000)

$dirbtn = GUICtrlCreateButton("Add dir", 640, 83, 81, 21, 0)

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

AutoItSetOption ( "RunErrorsFatal", 0)

$Percorso = 0

GUICtrlSetData ($Slider, 100)

Dim $DoubleClicked = False, $playlist, $adddir

AdlibEnable("_MyAdlib", 500)

While 1

$nMsg = GUIGetMsg()

Select

Case $nMsg = $GUI_EVENT_CLOSE

_SoundClose ("alias_suono")

Exit

Case $nMsg = $Sfoglia

$Percorso = (FileOpenDialog("Seleziona un file audio", @ScriptDir, "(*.mp3;*.wav;*.wma)") )

GUICtrlSetData ($Scegli, $Percorso)

If $Casella1 = 1 Then

While $Slider_volume > 0

$Slider_volume = $Slider_volume - 1

SoundSetWaveVolume ($Slider_volume)

Sleep (30)

WEnd

EndIf

_SoundClose ("alias_suono")

_SoundOpen ($Percorso, "alias_suono")

Case $nMsg = $Play

If _SoundStatus("alias_suono") = "playing" Then

_SoundStop ("alias_suono")

_SoundPlay ("alias_suono")

ElseIf _SoundStatus("alias_suono") = "paused" Then

_SoundResume ("alias_suono")

Else

_SoundPlay ("alias_suono")

EndIf

Case $nMsg = $Pausa

_SoundPause ("alias_suono")

Case $nMsg = $Stop

If $Casella1 = 1 Then

While $Slider_volume > 0

$Slider_volume = $Slider_volume - 1

SoundSetWaveVolume ($Slider_volume)

Sleep (30)

WEnd

EndIf

_SoundStop ("alias_suono")

Case $nMsg = $Mixer

Run (@WindowsDir & "\system32\sndvol32.exe")

Case $nMsg = $dirbtn

adddir()

EndSelect

If $DoubleClicked Then

DoubleClickFunc()

$DoubleClicked = False

EndIf

WEnd

Func _MyAdlib()

$Slider_volume = GUICtrlRead ($Slider)

$Casella1 = GUICtrlRead ($CheckBox1)

$Casella2 = GUICtrlRead ($CheckBox2)

$Durata_ms = _SoundLength ("alias_suono", 2)

$Tempo_ms = _SoundPos ("alias_suono", 2)

$Percentuale = $Tempo_ms / $Durata_ms * 100

SoundSetWaveVolume ($Slider_volume)

GUICtrlSetData ($Tempo, _SoundPos("alias_suono", 1))

GUICtrlSetData ($Durata, _SoundLength ("alias_suono", 1))

GUICtrlSetData ($Progress1, $Percentuale)

If $Casella2 = 1 Then

If $Tempo_ms = $Durata_ms Then

_SoundPlay ("alias_suono")

EndIf

EndIf

EndFunc

Func WM_NOTIFY($hWnd, $MsgID, $wParam, $lParam)

Local $tagNMHDR, $event, $hwndFrom, $code

$tagNMHDR = DllStructCreate("int;int;int", $lParam)

If @error Then Return 0

$code = DllStructGetData($tagNMHDR, 3)

If $wParam = $playlist And $code = -3 Then $DoubleClicked = True

Return $GUI_RUNDEFMSG

EndFunc ;==>WM_NOTIFY

Func DoubleClickFunc()

If _SoundStatus("alias_suono") = "playing" Then

_SoundStop("alias_suono")

_SoundClose("alias_suono")

EndIf

$dbclick1 = GUICtrlRead(GUICtrlRead($playlist))

$dbclick2 = StringTrimRight($dbclick1, 1)

$dbclick3 = StringSplit($dbclick2, "|")

_SoundOpen($dbclick3[4],"alias_suono")

_SoundPlay("alias_suono")

EndFunc ;==>DoubleClickFunc

Func adddir()

$dir = FileSelectFolder("Select folder",@HomeDrive)

$array = RecursiveFileSearch($dir, "(?i)\.mp3",1)

If IsArray($array) Then

For $i = 1 To $array[0]

TrayTip("Adding files ...","File " & $i & " of " & $array[0],1)

$path = $array[$i]

If StringInStr($path,".mp3") = 0 Then ExitLoop

$artist1 = _GetExtProperty($path, 16) & "|"

$title1 = _GetExtProperty($path, 10) & "|"

$album1 = _GetExtProperty($path, 17) & "|"

GUICtrlCreateListViewItem($artist1 & $title1 & $album1 & $path, $playlist)

Next

Else

MsgBox(32,"Error","Please select a folder")

EndIf

EndFunc

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...