Jump to content

My music player doesn't work!


Recommended Posts

Hours and hours of programming and now doesn't work!?!?!?!

This is the version 1.5 of ToKico Player.

;~ Name: ToKico Player 1.5 (aka SimplePlayer)
;~ Author: ToKicoBrothers
;~            tokico.pt@gmail.com
;~ Description: This is a music player, with a lot of functions.

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

Global $songdrive, $songdir, $songname, $songext, $songalias, $songlength, $songaliaspause, $listgui

$list = $listgui 
$songfile = $songname & "." & $songext
$songpath = GUICtrlRead ($list)

Func Repeat()
    _SoundOpen ( $songpath , $songalias )
    $songlength = _SoundLength ( $songalias , 2 )
    $songposition = _SoundPos ( $songalias , 2 )
    If $songposition = $songlength Then
        PlaySongs()
    EndIf
    _SoundClose ( $songalias )
EndFunc

Func Pause()
    _SoundOpen ($songpath, $songaliaspause)
    _SoundPause ( $songalias)
EndFunc

Func PlaySongs()
    SoundPlay ( $songpath, $list)
    _PathSplit ( $songpath, $songdrive, $songdir, $songname, $songext)
    _SoundOpen ( $songpath, $songalias)
    _SoundLength ( $songalias, 1)
    _SoundClose ( $songalias)
    If _SoundStatus ($songaliaspause) = "paused" Then
        _SoundResume ($songaliaspause)
        _SoundClose ($songaliaspause)
    EndIf
EndFunc

Func OpenSongs()
    $opendir = "C:/"
    $File = FileOpenDialog ( "Open Songs...", $opendir, "Mp3 Files (*.mp3)" , 4 )
    $Text = $File
    $Name = FileGetShortName ($Text, 1)
    GUICtrlSetData ( $list, "" & $Name )
    PlaySongs()
EndFunc

#Region ### START Koda GUI section ###
GUICreate("ToKico Player 1.5", 450, 234, 193, 115)
$listgui = GUICtrlCreateListView("", 8, 8, 233, 217, BitOR($LVS_LIST,$LVS_SINGLESEL,$LVS_SHOWSELALWAYS))
$play = GUICtrlCreateButton("Play", 320, 144, 57, 33, 0)
$pause = GUICtrlCreateButton("Pause", 256, 144, 49, 33, 0)
$stop = GUICtrlCreateButton("Stop", 392, 144, 49, 33, 0)
$repeat = GUICtrlCreateCheckbox("Repeat", 256, 112, 57, 25)
$volume = GUICtrlCreateSlider(248, 200, 193, 25)
GUICtrlSetData(-1, 100)
GUICtrlCreateLabel("Volume", 328, 184, 39, 17)
GUICtrlCreateLabel("ToKico Player 1.5", 296, 8, 105, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$open = GUICtrlCreateButton("Open", 320, 112, 121, 25, 0)
GUICtrlCreateGroup("Music Info.", 256, 32, 185, 73)
GUICtrlCreateInput( $songfile, 264, 48, 169, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
GUICtrlCreateInput( $songlength, 264, 80, 169, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Func SetVolume()
    SoundSetWaveVolume (GuiCtrlRead ($volume))
EndFunc

Func Stop()
    SoundPlay ("")
EndFunc

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $volume
            SetVolume()
        Case $open
            OpenSongs()
        Case $play
            PlaySongs()
        Case $stop
            Stop()
        Case $pause
            Pause()
        Case $repeat
            Repeat()
    EndSwitch
WEnd

I think the functions are OK, the syntax is OK; I don't know what is wrong!

My Scripts: SimplePlayer 1.0 - A very simple music player. PCInfo 1.2 - A script that displays PC information.
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...