muhmuuh Posted September 14, 2009 Share Posted September 14, 2009 (edited) Hello!I just created my own MP3 player and I wanted to share it I don't know why but _SoundLength doesn't work and I found my own solution to repeat the song. So here it is. Please leave a comment expandcollapse popup#include <GUIConstants.au3> #include <Sound.au3> #include <ButtonConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #NoTrayIcon #Region ### START Koda GUI section ### Global $Form1 = GUICreate("muh's mp3 player", 366, 315, 372, 229) GUISetBkColor(0xA6CAF0) $Button1 = GUICtrlCreateButton("Play", 192, 24, 57, 33, 0) $Button2 = GUICtrlCreateButton("Stop", 296, 24, 57, 33, 0) $Button3 = GUICtrlCreateButton("Player repeat mode", 224, 80, 89, 41, $BS_MULTILINE) $Slider1 = GUICtrlCreateSlider(184, 168, 169, 25) GUICtrlsetBkColor(-1, 0xA6CAF0) GUICtrlSetData(-1, 100) $Label1 = GUICtrlCreateLabel("Volume", 240, 144, 58, 24) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") $Pic1 = GUICtrlCreatePic(@ScriptDir & "\pic.jpg", 8, 8, 169, 241, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) $Label2 = GUICtrlCreateLabel("File selected: ", 8, 264, 387, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $MenuItem3 = GUICtrlCreateMenu("&File") $MenuItem4 = GUICtrlCreateMenuItem("Load file", $MenuItem3) $MenuItem2 = GUICtrlCreateMenu("&Settings") $MenuItem5 = GUICtrlCreateMenuItem("Exit", $MenuItem2) $MenuItem1 = GUICtrlCreateMenu("&Help") $MenuItem6 = GUICtrlCreateMenuItem("About us", $MenuItem1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Global $snd="" Global $rpd=True; true - repeat song, false - dont repeat Global $poss[21] Global $len="a" SoundSetWaveVolume(100) Global $fp="a" While 1 $nMsg = GUIGetMsg() $pos=_SoundPos($snd, 2) ;_SoundLength didn't work for me so here I check if the song has finished to play it again If $pos>0 And $pos==$len Then _SoundStop($snd) If $rpd==True Then _SoundPlay($snd) EndIf EndIf Switch $nMsg Case $GUI_EVENT_CLOSE _SoundClose($snd) Exit Case $MenuItem4 $fp=FileOpenDialog("Music file", @ScriptDir, "MP3 Files (*.mp3)") $snd=_SoundOpen($fp) GUICtrlSetData($Label2, "File selected: " & $fp) Case $Button1 _SoundPlay($snd) $len=_SoundLength($snd, 2) Case $Button2 _SoundStop($snd) Case $Slider1 $vm=GUICtrlRead($Slider1) SoundSetWaveVolume($vm) Case $MenuItem5 _SoundStop($snd) Exit Case $MenuItem6 MsgBox(0, "About us", "This is my first MP3 player yeeeeeey") Case $Button3 $rpd=Not $rpd EndSwitch WEndand here is the pic I usedp.s. Updated muh's player.au3 Edited September 14, 2009 by muhmuuh I ran. I ran until my muscles burned and my veins pumped battery acid. Then I ran some more. Link to comment Share on other sites More sharing options...
Achilles Posted September 14, 2009 Share Posted September 14, 2009 I don't think you're code works with the latest version of AutoIt so if you want people to able to use it you might want to update. My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
muhmuuh Posted September 14, 2009 Author Share Posted September 14, 2009 (edited) I don't think you're code works with the latest version of AutoIt so if you want people to able to use it you might want to update.Thank you. Note taken Btw after I updated to v3.3.0.0 _SoundLength works now Edited September 14, 2009 by muhmuuh I ran. I ran until my muscles burned and my veins pumped battery acid. Then I ran some more. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now