Jump to content

Recommended Posts

Posted

I need help here, my media player dont work correctly

It plays well wav and mid :) but it dont play mp3 :P

How i make it play mp3?

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

$path = ""
$Paused=False

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 459, 132, 193, 125)
$Play = GUICtrlCreateButton("Play", 16, 96, 75, 25, 0)
$Stop = GUICtrlCreateButton("Stop", 96, 96, 75, 25, 0)
$pause = GUICtrlCreateButton("Pause", 176, 96, 75, 25, 0)
$Slider1 = GUICtrlCreateSlider(8, 32, 446, 29)
$Time = GUICtrlCreateLabel("Time", 16, 64, 27, 17)
$Progress1 = GUICtrlCreateSlider(344, 96, 78, 24,$PBS_SMOOTH ,$WS_EX_ACCEPTFILES )
$Volume = GUICtrlCreateLabel("Volume", 304, 96, 39, 17)
$way = GUICtrlCreateInput ($path,10,10,200,20)
GUISetState(@SW_SHOW)
$filemenu = GUICtrlCreateMenu("File")
$MenuItem3 = GUICtrlCreateMenuItem("Open", $filemenu)
#EndRegion ### END Koda GUI section ###

$i = 50
GUICtrlSetData ($Progress1,$i)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $MenuItem3
            $path = FileOpenDialog("Select file:","", "(*.*)")
            If Not @error Then $Sound= _SoundOpen($path)
        Case $Play
            _SoundPlay($Sound)
        Case $Stop
            _SoundStop($Sound)
        Case $Progress1
            $vol = GUICtrlRead ($Progress1)
            SoundSetWaveVolume ($vol)
        Case $pause
            If $Paused=False Then
                _SoundPause($Sound)
                $Paused=True
            Else
                _SoundResume($Sound)
                $Paused=False
            EndIf
    EndSwitch
WEnd
Posted

It's very very easy !

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

$path = ""
$Paused=False

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 459, 132, 193, 125)
$Play = GUICtrlCreateButton("Play", 16, 96, 75, 25, 0)
$Stop = GUICtrlCreateButton("Stop", 96, 96, 75, 25, 0)
$pause = GUICtrlCreateButton("Pause", 176, 96, 75, 25, 0)
$Slider1 = GUICtrlCreateSlider(8, 32, 446, 29)
$Time = GUICtrlCreateLabel("Time", 16, 64, 27, 17)
$Progress1 = GUICtrlCreateSlider(344, 96, 78, 24,$PBS_SMOOTH ,$WS_EX_ACCEPTFILES )
$Volume = GUICtrlCreateLabel("Volume", 304, 96, 39, 17)
$way = GUICtrlCreateInput ($path,10,10,200,20)
GUISetState(@SW_SHOW)
$filemenu = GUICtrlCreateMenu("File")
$MenuItem3 = GUICtrlCreateMenuItem("Open", $filemenu)
#EndRegion ### END Koda GUI section ###

$i = 50
GUICtrlSetData ($Progress1,$i)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $MenuItem3
            $path = FileOpenDialog("Select file:","", "(*.wav;*.mp3)")
            If Not @error Then $Sound= _SoundOpen($path)
        Case $Play
            _SoundPlay($Sound)
        Case $Stop
            _SoundStop($Sound)
        Case $Progress1
            $vol = GUICtrlRead ($Progress1)
            SoundSetWaveVolume ($vol)
        Case $pause
            If $Paused=False Then
                _SoundPause($Sound)
                $Paused=True
            Else
                _SoundResume($Sound)
                $Paused=False
            EndIf
    EndSwitch
WEnd
Posted

No no, you see.. you can select any type of files, but his computer won't play mp3's (works fine with mine though). If you change _SoundPlay() with SoundPlay() then it works, but then you can't use functions like _SoundPause, _SoundResume, etc...

Posted

So it is strange because with what I replaced on its script everything walks home.

I don't understand in no way what it searches has make then!

PS: Sorry for the english but i'm french

Posted

You can't play mp3 with this ? (changed by me)

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

$path = ""
$Paused=False

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 459, 132, 193, 125)
$Play = GUICtrlCreateButton("Play", 16, 96, 75, 25, 0)
$Stop = GUICtrlCreateButton("Stop", 96, 96, 75, 25, 0)
$pause = GUICtrlCreateButton("Pause", 176, 96, 75, 25, 0)
$Slider1 = GUICtrlCreateSlider(8, 32, 446, 29)
$Time = GUICtrlCreateLabel("Time", 16, 64, 27, 17)
$Progress1 = GUICtrlCreateSlider(344, 96, 78, 24,$PBS_SMOOTH ,$WS_EX_ACCEPTFILES )
$Volume = GUICtrlCreateLabel("Volume", 304, 96, 39, 17)
$way = GUICtrlCreateInput ($path,10,10,200,20)
GUISetState(@SW_SHOW)
$filemenu = GUICtrlCreateMenu("File")
$MenuItem3 = GUICtrlCreateMenuItem("Open", $filemenu)
#EndRegion ### END Koda GUI section ###

$i = 50
GUICtrlSetData ($Progress1,$i)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $MenuItem3
            $path = FileOpenDialog("Select file:","", "(*.wav;*.mp3)")
            If Not @error Then $Sound= _SoundOpen($path)
        Case $Play
            _SoundPlay($Sound)
        Case $Stop
            _SoundStop($Sound)
        Case $Progress1
            $vol = GUICtrlRead ($Progress1)
            SoundSetWaveVolume ($vol)
        Case $pause
            If $Paused=False Then
                _SoundPause($Sound)
                $Paused=True
            Else
                _SoundResume($Sound)
                $Paused=False
            EndIf
    EndSwitch
WEnd

Because for me it's work !

Posted

Dude, that doesn't make any difference... it's not a problem of the FileOpenDialog filter. It's a problem with _SoundPlay().

Posted

So, corrected script walks correctly then you should be able to read your mp3!

but if you cannot play mp3 with this corrected script i can't help you more ! sorry :s

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
×
×
  • Create New...