Jump to content

Recommended Posts

Posted

im making a media player... but the sound funjctions dont work dose anybody know why...

here is my script

#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)
GUISetBkColor(0xA6CAF0)
$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)
$AProgress1 = GUICtrlCreateProgress(16, 361, 590, 15, $PBS_SMOOTH)
GUICtrlSetData(-1, 0)
GUICtrlSetColor(-1, 0xFF0000)
$Nowplaying = GUICtrlCreateLabel("Now playing:", 24, 384, 65, 17)
$edit = GUICtrlCreateInput($sound, 8, 408, 113, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
$Duration = GUICtrlCreateLabel("", 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")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $msg = GUIGetMsg()

  Select
        Case $msg = $GUI_EVENT_CLOSE
        Exit
        
        Case $msg = $stop
            GUICtrlSetData($Duration, "Stoping")
            Sleep(1000)
            _SoundStop($sound)
            GUICtrlSetData($Duration, "Stoped")
            
        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)
            GUICtrlSetData($Duration, "")
            GUICtrlSetData($edit, $sound)
            
            
        Case $msg = $play
            GUICtrlSetData($Duration, "Starting")
            Sleep(100)
            _SoundPlay($sound)
            GUICtrlSetData($Duration, "Playing")

        ;make a pause button
        Case $msg = $Pause  
        If $Duration = "Playing" Then ;playing
            GUICtrlSetData($Duration, "Pausing")    
            _SoundPause($sound)
            $audstatus = "Paused"
        EndIf
        
endselect
WEnd

Please please help

Posted

$s = _SoundOpen($Sound)

_SoundPlay($s)

#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)
GUISetBkColor(0xA6CAF0)
$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)
$AProgress1 = GUICtrlCreateProgress(16, 361, 590, 15, $PBS_SMOOTH)
GUICtrlSetData(-1, 0)
GUICtrlSetColor(-1, 0xFF0000)
$Nowplaying = GUICtrlCreateLabel("Now playing:", 24, 384, 65, 17)
$edit = GUICtrlCreateInput($sound, 8, 408, 113, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
$Duration = GUICtrlCreateLabel("", 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")
GUISetState(@SW_SHOW)
Local $s
#EndRegion ### END Koda GUI section ###

While 1
    $msg = GUIGetMsg()

  Select
        Case $msg = $GUI_EVENT_CLOSE
        Exit
        
        Case $msg = $stop
            GUICtrlSetData($Duration, "Stoping")
            Sleep(1000)
            _SoundStop($s)
            GUICtrlSetData($Duration, "Stoped")
            
        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)
            GUICtrlSetData($Duration, "")
            GUICtrlSetData($edit, $sound)
            
            
        Case $msg = $play
            GUICtrlSetData($Duration, "Starting")
            Sleep(100)
            $s = _SoundOpen($sound)
            _SoundPlay($s)
            GUICtrlSetData($Duration, "Playing")

       ;make a pause button
        Case $msg = $Pause  
        If $Duration = "Playing" Then;playing
            GUICtrlSetData($Duration, "Pausing")    
            _SoundPause($s)
            $audstatus = "Paused"
        EndIf
        
endselect
WEnd
Posted

Look, this is a very very simple player I made. Maybe it can help you find your problem: (it works by the way)

#include <GUIConstants.au3>
#include <Sound.au3>

$GUIWidth = 220
$GUIHeight = 100

Global $sonido

GUICreate("Player", $GUIWidth, $GUIHeight)
;~ GUICtrlCreateLabel($duracion,0,20)
$play=GUICtrlCreateButton("Play",5,70,100)
$stop=GUICtrlCreateButton("Stop",110,70,100)
$examinar=GUICtrlCreateButton("Open...",110,20,60)
$input=GUICtrlCreateInput("",2,20,100)

GUISetState()
While 1
   $msg = GUIGetMsg()
   Select
    Case $msg = $GUI_EVENT_CLOSE
         Exit
     Case $msg = $play
         detener()
         $sonido=_SoundOpen(GUICtrlRead($input))
         reproducir()
    Case $msg=$stop
         detener()
    Case $msg = $examinar
         $abrir = FileOpenDialog("Open file...",@MyDocumentsDir,"All files (*.*)")
         If @error <> 1 Then GuiCtrlSetData($input,$abrir)
   EndSelect
WEnd

Func reproducir()
_SoundOpen(Guictrlread($input)) 
_SoundPlay($sonido)
EndFunc

Func detener()
_SoundStop($sonido)
_SoundClose($sonido)
EndFunc
Posted

Look, this is a very very simple player I made. Maybe it can help you find your problem: (it works by the way)

#include <GUIConstants.au3>
#include <Sound.au3>

$GUIWidth = 220
$GUIHeight = 100

Global $sonido

GUICreate("Player", $GUIWidth, $GUIHeight)
;~ GUICtrlCreateLabel($duracion,0,20)
$play=GUICtrlCreateButton("Play",5,70,100)
$stop=GUICtrlCreateButton("Stop",110,70,100)
$examinar=GUICtrlCreateButton("Open...",110,20,60)
$input=GUICtrlCreateInput("",2,20,100)

GUISetState()
While 1
   $msg = GUIGetMsg()
   Select
    Case $msg = $GUI_EVENT_CLOSE
         Exit
     Case $msg = $play
         detener()
         $sonido=_SoundOpen(GUICtrlRead($input))
         reproducir()
    Case $msg=$stop
         detener()
    Case $msg = $examinar
         $abrir = FileOpenDialog("Open file...",@MyDocumentsDir,"All files (*.*)")
         If @error <> 1 Then GuiCtrlSetData($input,$abrir)
   EndSelect
WEnd

Func reproducir()
_SoundOpen(Guictrlread($input)) 
_SoundPlay($sonido)
EndFunc

Func detener()
_SoundStop($sonido)
_SoundClose($sonido)
EndFunc
sorry i need pause...
Posted

$s = _SoundOpen($Sound)

_SoundPlay($s)

#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)
GUISetBkColor(0xA6CAF0)
$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)
$AProgress1 = GUICtrlCreateProgress(16, 361, 590, 15, $PBS_SMOOTH)
GUICtrlSetData(-1, 0)
GUICtrlSetColor(-1, 0xFF0000)
$Nowplaying = GUICtrlCreateLabel("Now playing:", 24, 384, 65, 17)
$edit = GUICtrlCreateInput($sound, 8, 408, 113, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
$Duration = GUICtrlCreateLabel("", 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")
GUISetState(@SW_SHOW)
Local $s
#EndRegion ### END Koda GUI section ###

While 1
    $msg = GUIGetMsg()

  Select
        Case $msg = $GUI_EVENT_CLOSE
        Exit
        
        Case $msg = $stop
            GUICtrlSetData($Duration, "Stoping")
            Sleep(1000)
            _SoundStop($s)
            GUICtrlSetData($Duration, "Stoped")
            
        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)
            GUICtrlSetData($Duration, "")
            GUICtrlSetData($edit, $sound)
            
            
        Case $msg = $play
            GUICtrlSetData($Duration, "Starting")
            Sleep(100)
            $s = _SoundOpen($sound)
            _SoundPlay($s)
            GUICtrlSetData($Duration, "Playing")

      ;make a pause button
        Case $msg = $Pause  
        If $Duration = "Playing" Then;playing
            GUICtrlSetData($Duration, "Pausing")    
            _SoundPause($s)
            $audstatus = "Paused"
        EndIf
        
endselect
WEnd
that makes everything but the pause work...
Posted

thatks everybody so far but now i need the pause fuction and the progress bar to work

the progress need to show how long left...

Take some time and attempt to find out how to do this first, then post it later if you need help. Also, do a search in the Example Scripts forum, your script has been done a few times already.

www.itoady.com

A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding

Posted

Take some time and attempt to find out how to do this first, then post it later if you need help. Also, do a search in the Example Scripts forum, your script has been done a few times already.

i did seqarch but none of the seeam to work for me...

Posted

hey! Why is my player not working anymore? It used to play mp3's, wma's and everything! now it only plays wav's :shock: the weird thing, is that even the compiled version that I had doesn't work either... why? :?

Posted

hey! Why is my player not working anymore? It used to play mp3's, wma's and everything! now it only plays wav's :shock: the weird thing, is that even the compiled version that I had doesn't work either... why? :?

Why? Perhaps those files are not associated with correct MCI drivers anymore. Or maybe you have in some way uninstalled necessary audio codecs. Try installing one maybe it will correct your problem.

[font="Comic Sans MS"]-ronriel[/font][topic="48542"]r4r media player[/topic][topic="80836"]OCR & Paste[/topic]

Posted

ah yeah, I thought so. I tried it on another computer and it works. Winamp works perfect though...

Posted

i did seqarch but none of the seeam to work for me...

Yeah, you did some search but did not read what you've found.

Anyway, here's an example:

#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)
GUISetBkColor(0xA6CAF0)
$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)
$AProgress1 = GUICtrlCreateProgress(16, 361, 590, 15, $PBS_SMOOTH)
GUICtrlSetData(-1, 0)
GUICtrlSetColor(-1, 0xFF0000)
$Nowplaying = GUICtrlCreateLabel("Now playing:", 24, 384, 65, 17)
$edit = GUICtrlCreateInput($sound, 8, 408, 113, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
$Duration = GUICtrlCreateLabel("", 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")
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
                GUICtrlSetData($Duration, "Paused") 
                _SoundPause($s)
            EndIf
        
endselect
WEnd
Func progress()
    GUICtrlSetData($AProgress1,_SoundPos($s, 2)/ $SL * 100);move the progress bar as the song progresses
EndFunc

Pause and progress bar should work.

[font="Comic Sans MS"]-ronriel[/font][topic="48542"]r4r media player[/topic][topic="80836"]OCR & Paste[/topic]

Posted

Yeah, you did some search but did not read what you've found.

Anyway, here's an example:

#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)
GUISetBkColor(0xA6CAF0)
$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)
$AProgress1 = GUICtrlCreateProgress(16, 361, 590, 15, $PBS_SMOOTH)
GUICtrlSetData(-1, 0)
GUICtrlSetColor(-1, 0xFF0000)
$Nowplaying = GUICtrlCreateLabel("Now playing:", 24, 384, 65, 17)
$edit = GUICtrlCreateInput($sound, 8, 408, 113, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
$Duration = GUICtrlCreateLabel("", 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")
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
                GUICtrlSetData($Duration, "Paused") 
                _SoundPause($s)
            EndIf
        
endselect
WEnd
Func progress()
    GUICtrlSetData($AProgress1,_SoundPos($s, 2)/ $SL * 100);move the progress bar as the song progresses
EndFunc

Pause and progress bar should work.

thanks but the progress bar is not smooth... do u know why i have asked it to be...

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
  • Recently Browsing   0 members

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