Jump to content
Sign in to follow this  
ashley

sound functions

Recommended Posts

Smooth progress bar only works in Windows Classic theme.


"be smart, drink your wine"

Share this post


Link to post
Share on other sites

new version pbar replaced with slider...

#include <GUIConstants.au3>
#include <Sound.au3>
$sound = "NONE"

SoundSetWaveVolume(100)
#Region ### START Koda GUI section ### Form=c:\documents and settings\windows\desktop\mplayer\gui.kxf
$AForm1 = GUICreate("Ashley's MediaPlayer", 633, 447, 193, 115)
$AGroup1 = GUICtrlCreateGroup("", 136, 384, 369, 57)
$Play = GUICtrlCreateButton("Play", 144, 400, 57, 33, $BS_DEFPUSHBUTTON)
$Stop = GUICtrlCreateButton("Stop", 360, 400, 57, 33, $BS_DEFPUSHBUTTON)
$Open = GUICtrlCreateButton("open", 424, 400, 59, 33, $BS_DEFPUSHBUTTON)
$Pause = GUICtrlCreateButton("Pause", 208, 400, 59, 33, $BS_DEFPUSHBUTTON)
$Made = GUICtrlCreateLabel("Made by Ashley", 272, 400, 79, 17)
$loop = GUICtrlCreateCheckbox("loop", 288, 416, 49, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Nowplaying = GUICtrlCreateLabel("Now playing:", 8, 336, 65, 17)
$edit = GUICtrlCreateInput("NONE", 72, 336, 113, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
$Duration = GUICtrlCreateLabel("Duration:", 536, 384, 47, 17, BitOR($SS_CENTERIMAGE,$WS_BORDER,$WS_CLIPSIBLINGS))
$ALabel1 = GUICtrlCreateLabel("This is a pre release...", 160, 64, 318, 41)
GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif")
$ALabel2 = GUICtrlCreateLabel("Some Functions do not work...", 110, 159, 439, 41)
GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif")
$Slider = GUICtrlCreateSlider(40, 360, 542, 21, BitOR($TBS_BOTH,$TBS_NOTICKS,$WS_BORDER,$WS_CLIPSIBLINGS))
GUISetState(@SW_SHOW)
Local $s, $SL
#EndRegion ### END Koda GUI section ###
AdlibEnable("Progress")

While 1
    $msg = GUIGetMsg()

  Select
        Case $msg = $GUI_EVENT_CLOSE
        Exit
        
        Case $msg = $stop
            GUICtrlSetData($Duration, "Stopping")
            Sleep(1000)
            _SoundStop($s)
            GUICtrlSetData($Duration, "Stopped")
            
        Case $msg = $open
            GUICtrlSetData($Duration, "Open")
            $sound=FileOpenDialog("Open Music File","C:\Documents and Settings\Windows\My Documents\My Music","Music Files(*.mp3;*.wav;*.wma;*.cda)",3)
            $s = _SoundOpen($sound)
            $SL = _SoundLength($s, 2)
            GUICtrlSetData($Duration, "")
            GUICtrlSetData($edit, $sound)
            
            
        Case $msg = $play
            If GUICtrlRead($Duration) = "Stopped" Or GUICtrlRead($Duration) = "" Then
                GUICtrlSetData($Duration, "Playing")
            ElseIf GUICtrlRead($Duration) = "Paused" Then
                GUICtrlSetData($Duration, "Playing")
            EndIf
            _SoundPlay($s)

;pause                
        Case $msg = $Pause  
            If GUICtrlRead($Duration) = "Playing" Then
                Sleep(100)
                GUICtrlSetData($Duration, "Pausing") 
                Sleep(300)              
                _SoundPause($s)
                Sleep(100)
                GUICtrlSetData($Duration, "Paused")    
            EndIf
        
endselect
WEnd

Func progress()
    GUICtrlSetData($Slider,_SoundPos($s, 2)/ $SL * 100);move the progress bar as the song progresses
EndFunc
any more ways to make it better...

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...