Jump to content

Music player


au3scr
 Share

Recommended Posts

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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...

Link to comment
Share on other sites

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 !

Link to comment
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
 Share

  • Recently Browsing   0 members

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