Jump to content

Recommended Posts

Posted

Hello, Im kinda new to Autoit iv been messing around for a few weeks and decided that I wanted to make a Media Player (Mainly Music), and Iv been stuck on how in the world can I detect if a song is playing or ISENT playing, any help would be great! and thanks for taking them time to read this!

Oh.... here is my code, Ill post it all because im not sure what parts you want :"> :

#include <GUIConstants.au3>

GUICreate("Beta", 400, 400)

$Play = GuiCtrlCreateButton("Play", 5, 5, 50, 20)
$Stop = GuiCtrlCreateButton("Stop", 56, 5, 50, 20)
$SongTitleBox = GuiCtrlCreateLabel("Song", 0, 50, 400, 50, 0x1000)

GUISetState(@SW_SHOW)

While 1
  $msg = GUIGetMsg()

  Select

    Case $msg = $Play
    $Song = FileOpenDialog("Select Song...", "C:\Program Files\AMusic", "Music (*.Wav;*.Mp3)", 1 + 2 )
    GUICtrlSetData($SongTitleBox, $Song)
    ControlDisable ( "", "", $Play)
    SoundPlay ($Song, 0)

    Case $msg = $Stop
    GUICtrlSetData($SongTitleBox, "")
    ControlEnable ( "", "", $Play )
    SoundPlay ("", 0)

    Case $msg = $GUI_EVENT_CLOSE
      ExitLoop
  EndSelect
WEnd
Posted (edited)

you can't only using SoundPlay...

use the beta functions:

_SoundPlay()

_SoundPause()

_SoundStop()

_SoundSeek()

_SoundPos()

to see if the song is still playing do:

if (_SoundPos() <= 0) Then $SOUND_IS_NOT_PLAYING = TRUE
Edited by CHRIS95219

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