Sign in to follow this  
Followers 0
ashley

Ashley's MediaPlayer

12 posts in this topic

#1 ·  Posted (edited)

Ok im in the middle of making a mediaplayer....

Just so i can learn so more code...

Well here are the working functions:

1)Play button

2)Stop button

3)Pause button

3)Open button

4)Lable that tells u want your doing

5)Time sound has been playing

6)Slider

7)Sound lenth

Broken functions:

1)Loop

2)$trackname

3) $status

4) Listview playlist

Its very basic at the moment im still working on it...

LOTS OF THING DON'T WORK BUT IT'S ONLY A PRE RELEASE

Anyway heres my code:

#include <GUIConstants.au3>
#include <Sound.au3>
$Trackname = ""
#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("", 112, 360, 369, 81)
$Play = GUICtrlCreateButton("Play", 120, 376, 57, 33, $BS_DEFPUSHBUTTON)
$Stop = GUICtrlCreateButton("Stop", 336, 376, 57, 33, $BS_DEFPUSHBUTTON)
$Open = GUICtrlCreateButton("open", 400, 376, 59, 33, $BS_DEFPUSHBUTTON)
$Pause = GUICtrlCreateButton("Pause", 184, 376, 59, 33, $BS_DEFPUSHBUTTON)
$Made = GUICtrlCreateLabel("Made by Ashley", 248, 376, 79, 17)
$Loop = GUICtrlCreateCheckbox("loop", 264, 408, 49, 17)
$Duration = GUICtrlCreateLabel("", 264, 392, 44, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Slider = GUICtrlCreateSlider(48, 336, 542, 21, BitOR($TBS_BOTH,$TBS_NOTICKS,$WS_BORDER,$WS_CLIPSIBLINGS))
$Starttime = GUICtrlCreateLabel("", 8, 336, 36, 17)
$Rtime = GUICtrlCreateLabel("Label2", 592, 336, 36, 17)
$Playlist = GUICtrlCreateListView("Track|Track Lenth|Track destination|Status", 16, 16, 594, 318, BitOR($LVS_REPORT,$LVS_SINGLESEL,$LVS_SHOWSELALWAYS,$WS_BORDER,$WS_CLIPSIBLINGS), BitOR($WS_EX_CLIENTEDGE,$LVS_EX_GRIDLINES))
GUICtrlSendMsg(-1, 0x101E, 0, 105)
GUICtrlSendMsg(-1, 0x101E, 1, 75)
GUICtrlSendMsg(-1, 0x101E, 2, 360)
GUICtrlSendMsg(-1, 0x101E, 3, 50)
GUISetState(@SW_SHOW)
Local $s, $SL
#EndRegion ### END Koda GUI section ###

AdlibEnable("UpdateProgress")


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, "")
            GUICtrlCreateListViewItem($Trackname & "|" & _SoundLength($s, 2) & "|" & $sound & "|" , $Playlist)
            
        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 UpdateProgress()
    GUICtrlSetData($Starttime, _SoundLength($s, 1));change the time for song
    GUICtrlSetData($Slider, _SoundPos($s, 2) / $SL * 100);move the slider as the song progresses
    GUICtrlSetData($Rtime, _SoundPos($s, 2) / $SL * 100);change the time left
EndFunc   ;==>UpdateProgress

Please if you can help in any way please do so...

Edited by ashley

Share this post


Link to post
Share on other sites



Why the sleeps when stopping and pausing? I think it should be instant.


My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.

Share this post


Link to post
Share on other sites

Suggestions, Comments and Complaints

Welcome

Do you really think we need another media player? Especially one that is no where near completion.

Share this post


Link to post
Share on other sites

Do you really think we need another media player? Especially one that is no where near completion.

no but im learning... (still) if u give me a other idea ill stop making this...

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

No need to discourage him . It is a good learning experience. I remember my first media player. That thing sucked some big ole hairy balls but I learned a lot from it. :)

Stuff I found:

- If you just click play with out any songs it still says playing. So make a check if there is a song or not.

- Track Length is displayed in milliseconds, use conversion factors to get it down to minutes and seconds. 1000 milliseconds = 1 second, so divide by 60,000 milliseconds for each minute, then the remainder for seconds. You did it just fine for putting it on the seek bar.

- When showing how far in it is only do second by second not with all the decimals.

- More but I'm to lazy to look :P

Edited by Thatsgreat2345

Share this post


Link to post
Share on other sites

No need to discourage her. It is a good learning experience. I remember my first media player. That thing sucked some big ole hairy balls but I learned a lot from it. :)

Stuff I found:

- If you just click play with out any songs it still says playing. So make a check if there is a song or not.

- Track Length is displayed in milliseconds, use conversion factors to get it down to minutes and seconds. 1000 milliseconds = 1 second, so divide by 60,000 milliseconds for each minute, then the remainder for seconds. You did it just fine for putting it on the seek bar.

- When showing how far in it is only do second by second not with all the decimals.

- More but I'm to lazy to look :P

First of all, Ashley is a he. And I wasn't telling him to stop making it or anything, I just don't see a need to post it here?

Share this post


Link to post
Share on other sites

First of all, Ashley is a he. And I wasn't telling him to stop making it or anything, I just don't see a need to post it here?

... oh wtf that is so misleading. What kind of guy makes their username a chicks name. xD :)

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

... oh wtf that is so misleading. What kind of guy makes their username a chicks name. xD :)

$str = 'A guy guy'

$pq = StringReplace($str, 'u', 'a', 1)

msgbox(0, "", $pq)

exit

but he is not that type of guy, it must be his name

PS: ashley im not talking about you , i was talkin about guys with 'chicks' names

Edited by Gif

Share this post


Link to post
Share on other sites

$str = 'A guy guy'

$pq = StringReplace($str, 'u', 'a', 1)

msgbox(0, "", $pq)

exit

but he is not that type of guy, it must be his name

PS: ashley im not talking about you , i was talkin about guys with 'chicks' names

Good ole stringreplace. I wonder how many people will actually run that to figure out what it actually says.

Share this post


Link to post
Share on other sites

$str = 'A guy guy'

$pq = StringReplace($str, 'u', 'a', 1)

msgbox(0, "", $pq)

exit

but he is not that type of guy, it must be his name

PS: ashley im not talking about you , i was talkin about guys with 'chicks' names

Ashley is my name and i am NOT gay

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