Jump to content

Recommended Posts

hellow guys
I am a blind young man
I started a project to make an audio player
with recorder
I ended the player and i did not know how to recorder
This player is Compatible with the blind and visually impaired and ordinary users
Unfortunately I do not see so I could not merge images and icons

So I hope you will be able to help me in this matter

I will bring you the open source project and please help me to add images, icons and recorder, the project is requires easy access in order to be compatible with the screen readers, Please take this into account.
the software is organized so the recorder is In a special  menu that Contains stop and start and pause and save.
The same is true for player
Please help
And greetings to all

easy player.zip

Link to post
Share on other sites

Thanks for this script.  It was a lot of fun.  The script is doing things that I want to know how to do.  Your examples will help me quickly learn how to do this stuff. :)

(Things that probably aren't an issue anymore)

Spoiler

In easyPlayer.au3: Code had scope issues due to order of includes.  

I replaced Include FileOptions.au3 with File.au3.  Rewrote _FileGetDirPath, _GetFileName using _PathSplit() this was just to make it work.  I'm not sure my changes are the right way to go about things.

In options.au3: $Color_Green was giving me warnings replaced with 0x00C000.

 

Here is an updated example of easyPlayer.au3 in case anyone else wants to pickup with this running at default AutoIt settings.

#RequireAdmin
#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_UseUpx=y
#AutoIt3Wrapper_Res_Comment=easy player
#AutoIt3Wrapper_Res_Description=easy player
#AutoIt3Wrapper_Res_Fileversion=1.5.0.22
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
#AutoIt3Wrapper_Res_LegalCopyright=2017, by nacer baaziz
#AutoIt3Wrapper_Res_Language=1033
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

Global $sound = "", $MusicHandle, $reverb = false, $echo = false, $Chorus = false, $Reverse = false, $ReverbHandle, $EchoHandle, $ChorusHandle, $param

#######
#include <include\Bass.au3>
#include <include\BassConstants.au3>
#include <include\BassFX.au3>
#include <GUIConstants.au3>
#include <File.au3>
#include <include\restart.au3>
#include <include\func.au3>
#include <include\options.au3>
#include <include\Sec2Time.au3>
#include <include\languages.au3>
#include <ColorConstantS.au3>
#include <SliderConstants.au3>
#include <Sound.au3>
#include <ToolTipConstants.au3>
#include <UpDownConstants.au3>
#include <MenuConstants.au3>
#include <MsgBoxConstants.au3>

#include <ProgressConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListBox.au3>
;#include <FileOptions.au3>
########
Opt("GUICloseOnESC", 0)
main()
func main()
    _BASS_Startup(@scriptDir & "\dll\bass.dll")
    If @error = -1 Then
        MsgBox (0, "", "DLL Does not exist?  Please check file exists.")
        Exit
    EndIf

    _BASS_FX_Startup(@scriptDir & "\dll\bass_fx.dll")
    If @error = -1 Then
        MsgBox (0, "", "DLL Does not exist?  Please check file exists.")
        Exit
    EndIf
    _BASS_Init(0, -1, 44100, 0, "")
    If @error Then
        MsgBox(0, "Error", "Could not initialize audio")
        Exit
    EndIf

    ;global $sound = "", $MusicHandle, $reverb = false, $echo = false, $Chorus = false, $Reverse = false, $ReverbHandle, $EchoHandle, $ChorusHandle, $param
    global $file = False, $dir = 0, $filePos
    global $volume = ""
    $volume = RegRead("HKEY_CURRENT_USER\SOFTWARE\easy audio player", "volume")
    if @error then
    $volume = INIRead(@scriptdir&"settings.ini", "settings", "volume", "")
    If @Error then
    $volume = 50
    endIf
    _BASS_ChannelSetVolume($MusicHandle, $volume)
    endIf

    Global $Playing = False, $state = false
    global $sFilePath
    global $vlm = ""
    GUICreate("2")
    global $List = GUICtrlCreateList("", -1, -1, -1, -1)

    ###### command line ######
    If $CmdLine[0] = 0 Then
    $file = False
    ElseIf $CmdLine[0] = 1 Then
    $File = $CmdLine[1]
    $dir = _FileGetDirPath($file)
        _GUICtrlListBox_BeginUpdate($List)
        _GUICtrlListBox_Dir($List, $dir & "\*.mp3")
        _GUICtrlListBox_Dir($List, $dir & "\*.wav")
        _GUICtrlListBox_Dir($List, $dir & "\*.ogg")
        _GUICtrlListBox_Dir($List, $dir & "\*.mp1")
        _GUICtrlListBox_Dir($List, $dir & "\*.mp2")
        _GUICtrlListBox_Dir($List, $dir & "\*.m3u")
        _GUICtrlListBox_Dir($List, $dir & "\*.pls")

        _GUICtrlListBox_endUpdate($List)
    _GUICtrlListBox_SelectString($list, _GetFileName($file))

    $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, 0)
    _BASS_ChannelSetvolume($MusicHandle, $volume)
    _BASS_ChannelPlay($MusicHandle, 1)
    else
       Switch $CmdLine[1]
    Case "-play"

    $File = $CmdLine[2]
    $dir = _FileGetDirPath($file)
        _GUICtrlListBox_BeginUpdate($List)
        _GUICtrlListBox_Dir($List, $dir & "\*.mp3")
        _GUICtrlListBox_Dir($List, $dir & "\*.wav")
        _GUICtrlListBox_Dir($List, $dir & "\*.ogg")
        _GUICtrlListBox_Dir($List, $dir & "\*.mp1")
        _GUICtrlListBox_Dir($List, $dir & "\*.mp2")
        _GUICtrlListBox_Dir($List, $dir & "\*.m3u")
        _GUICtrlListBox_Dir($List, $dir & "\*.pls")

        _GUICtrlListBox_endUpdate($List)
    _GUICtrlListBox_SelectString($list, _GetFileName($file))

    $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, 0)
    _BASS_ChannelSetvolume($MusicHandle, $volume)
    _BASS_ChannelPlay($MusicHandle, 1)
    $Playing = True
    case else
    $file = $file
    endSwitch
    endIf
    ####### command line end #######
    ### check ###
    if not fileExists(@scriptdir & "\" & StringTrimRight(@scriptName, 4) & ".ini") then
    Opt("GUICloseOnESC", 1)
    Options()
    _scriptRestart()
    endIf
        Local $hGUI = GUICreate(_t("10"), 1000, 700)
        GUISetBkColor($COLOR_RED)

    ######### menu bar #######
    $FileMenu = GUICtrlCreateMenu(_t("100"))
        GUICtrlSetBkColor(-1, 0x8080ff)
    #######
    local $opene = GUICtrlCreateMenuItem(_t("101") & "... (ctrl+o)", $FileMenu)
        GUICtrlSetBkColor(-1, 0x8080ff)
    local $openURL = GUICtrlCreateMenuItem("open an url...", $FileMenu)
    local $explore = GUICtrlCreateMenuItem(_t("103") & "... (ctrl+e)", $FileMenu)
    local $ExitItem = GUICtrlCreateMenuItem(_t("102"), $FileMenu)
    #######
    local   $playMenu = GUICtrlCreateMenu(_t("200"))
    ####
    local $play = GUICtrlCreateMenuItem(_t("201") & "... (space)", $playMenu)

    local $stop = GUICtrlCreateMenuItem(_t("202") & "... (ctrl+space)", $playMenu)

    local $FORWARD = GUICtrlCreateMenuItem(_t("203") & "... (right key)", $playMenu)

    local $rearward = GUICtrlCreateMenuItem(_t("204") & "... (left key)", $playMenu)
    local $goto = GUICtrlCreateMenuItem(_t("210") & "... (ctrl+g)", $playMenu)
    local $up = GUICtrlCreateMenuItem(_t("205") & "... (up key)", $playMenu)
    local $down = GUICtrlCreateMenuItem(_t("206") & "... (down key)", $playMenu)
    local $fast = GUICtrlCreateMenuItem("faster", $playMenu)
    local $slow = GUICtrlCreateMenuItem("slowly", $playMenu)
    local $next = GUICtrlCreateMenuItem(_t(208) & "... (tab)", $playMenu)
    local $back = GUICtrlCreateMenuItem(_t(209) & "... (shift+tab)", $playMenu)
    ###
    local $efectMenu = GUICtrlCreateMenu(_t(300))
    local $rev = GUICtrlCreateMenuItem(_t(301) & "...", $efectMenu)
    local $ech = GUICtrlCreateMenuItem(_t(302) & "...", $efectMenu)
    local $chor = GUICtrlCreateMenuItem(_t(303) & "...", $efectMenu)

    ########
    local $toolsmenu = GUICtrlCreateMenu(_t("400"))
    ###########
    local $options = GUICtrlCreateMenuItem(_t("401"), $toolsMenu)
    local $recorderMe = GUICtrlCreateMenuItem("go to recorder mod...", $toolsMenu)
    ##########
    local $helppMenu = GUICtrlCreateMenu(_t("500"))
    ####

    ###
    ##########  menu bar end########
    ###label #####

    local $Label = GUICtrlCreateLabel("", 50, 80, 300, 70)

        GUICtrlSetBkColor(-1, 0xffffff)
    local $My = GUICtrlCreateLabel("welcom to easy player", 50, 10, 150, 50)
    local $Label1 = GUICtrlCreateLabel("00:00:00 / 00:00:00" & @crlf & "0%", 50, 120, 200, 70)
        GUICtrlSetBkColor(-1, 0x5ffffff)


    local $play2 = GUICtrlCreateLabel("play", 0, 200, 100, 50)
    local $stop2 = GUICtrlCreateLabel("stop", 350, 200, 100, 50)
    local $up2 = GUICtrlCreateLabel("volume(up)", 0, 250, 100, 50)
    local $down2 = GUICtrlCreateLabel("volume(down)", 350, 250, 100, 50)
    local $FORWARD2 = GUICtrlCreateLabel("FORWARD", 0, 300, 100, 50)
    local $reaRWARD2 = GUICtrlCreateLabel("reaRWARD", 350, 300, 100, 50)
    local $next2 = GUICtrlCreateLabel("next", 0, 360, 100, 50)

    local $back2 = GUICtrlCreateLabel("back", 350, 360, 100, 50)


    ########### label end########
    $hrecorder = GUICreate("recorder", 700, 700)
    GUICtrlCreateLabel("welcom to audio recorder" & @crlf & "please select your microphone and press start to begin recording." & @crlf & "if you want to stop it press stop, or press pause to pause the recorde." & @crlf & "when you finish your record press save to get your audio file.", 50, 10, 500, 100)
    GUICtrlCreateLabel("microphone", 100, 90, 100, 50)
    $microphone = GUICtrlCreateCombo("", 100, 100, 150, 50, $CBS_DROPDOWNList)
    $rstart = GUICtrlCreateButton("&start", 0, 200, 50, 50)
    $rstop = GUICtrlCreateButton("&stop", 150, 200, 50, 50)
    if $file then
    winSetTitle($hGUI, "", _t(10) & " : " & _GetFileName($file))
    endIf
        GUISetState(@SW_SHOW, $hGUI)
    $volume = RegRead("HKEY_CURRENT_USER\SOFTWARE\easy audio player", "volume")
    if @error then
    $volume = INIRead(@scriptdir&"settings.ini", "settings", "volume", "")
    If @Error then
    $volume = 50
    endIf
    _BASS_ChannelSetVolume($MusicHandle, $volume)
    endIf

    dim $aAccelKeys = [["^o", $opene], ["{space}", $play], ["{up}", $up], ["{down}", $down], ["{right}", $FORWARD], ["{left}", $rearward], ["^+o", $options], ["{tab}", $next], ["+{tab}", $back], ["{enter}", $play], ["!{left}", $back], ["!{right}", $next], ["^{space}", $stop], ["^g", $goto], ["^e", $explore], ["r", $rev], ["e", $ech], ["c", $chor], ["n", $next], ["b", $back], ["^u", $openURL], ["{MEDIA_NEXT}", $next], ["{MEDIA_PREV}", $back], ["{MEDIA_STOP}", $stop], ["{MEDIA_PLAY_PAUSE}", $play]]
        GUISetAccelerators($aAccelKeys, 0)
        While 1


        GUISetAccelerators($aAccelKeys, 0)

            Switch GUIGetMsg()
                Case $GUI_EVENT_CLOSE, $exititem
    _BASS_ChannelStop($MusicHandle)
        _BASS_Free()
                    Exit
    case $explore
    $oPath = _fileGetDirPath($file)
    ShellExecute("explorer.exe","/select, " & $oPath & GUICtrlRead($list))

    case $up, $up2
    if $volume >= 100 then
    $vlm = 100
    else
    $vlm = $volume+10
    endIf
    $volume = $vlm
    INIWrite(@scriptDir&"\" & StringTrimRight(@scriptName, 4) & ".ini", "settings", "volume", $vlm)
    RegWrite("HKEY_CURRENT_USER\SOFTWARE\easy audio player", "volume", "REG_SZ", $vlm)
    _BASS_ChannelSetVolume($MusicHandle, $vlm)

    case $down, $down2

    if $volume <= 0 then
    $vlm = 0
    else
    $vlm = $volume-10
    endIf
    $volume = $vlm
    INIWrite(@scriptDir&"\" & StringTrimRight(@scriptName, 4) & ".ini", "settings", "volume", $vlm)
    RegWrite("HKEY_CURRENT_USER\SOFTWARE\easy audio player", "volume", "REG_SZ", $vlm)
    _BASS_ChannelSetVolume($MusicHandle, $vlm)


                Case $play, $play2
    if not $file then
    $Fileopen = FileOpenDialog("Select Audio file","","Sound Files(*.mp1;*.mp2;*.mp3;*.wav;*.ogg;*.m3u;*.pls)|All siported Files(*.*)")
    if not @error then
    $file = $fileOpen
    $dir = _FileGetDirPath($file)
        _GUICtrlListBox_BeginUpdate($List)
        _GUICtrlListBox_Dir($List, $dir & "\*.mp3")
        _GUICtrlListBox_Dir($List, $dir & "\*.wav")
        _GUICtrlListBox_Dir($List, $dir & "\*.ogg")
        _GUICtrlListBox_Dir($List, $dir & "\*.mp1")
        _GUICtrlListBox_Dir($List, $dir & "\*.mp2")
        _GUICtrlListBox_Dir($List, $dir & "\*.m3u")
        _GUICtrlListBox_Dir($List, $dir & "\*.pls")
        _GUICtrlListBox_endUpdate($List)
    _GUICtrlListBox_SelectString($list, _GetFileName($file))
    $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, 0)
    _BASS_ChannelSetDevice($MusicHandle, 1)
    _BASS_ChannelSetvolume($MusicHandle, $volume)
    autoefect()
    _BASS_ChannelPlay($MusicHandle, 1)
    if @error then
    msgbox(16, "error", @error)
    else
    GUICtrlSetData($label, @crlf & _GetFileName($file) & @crlf & " in progress")
    GUICtrlSetData($PLAy,_t(207) & "... (space)")
    GUICtrlSetData($PLAy2,"&pause")
    $Playing = True
    winSetTitle($hGUI, "", _t(10) & " : " & _GetFileName($file))

    endIf



    winSetTitle($hGUI, "", _t(10) & " : " & _GetFileName($file))
    endIf
    else
    SWITCH _BASS_ChannelIsActive($MusicHandle)
    case 0
    _BASS_ChannelSetDevice($MusicHandle, 1)
    _BASS_ChannelSetvolume($MusicHandle, $volume)

    _BASS_ChannelPlay($MusicHandle, 1)
    GUICtrlSetData($PLAy,_t(207) & "... (space)")
    GUICtrlSetData($PLAy2,"&pause")

    $Playing = True

    case 1
    _BASS_ChannelPause($MusicHandle)
    GUICtrlSetData($PLAY,_t(201) & "... (space)")
    GUICtrlSetData($PLAY2,"play")
    $Playing = False

    case 3
    _BASS_ChannelSetDevice($MusicHandle, 1)
    _BASS_ChannelSetvolume($MusicHandle, $volume)
    _BASS_ChannelPlay($MusicHandle, 0)
    GUICtrlSetData($PLAy,_t(207) & "... (space)")
    GUICtrlSetData($PLAy2,"&pause")

    $Playing = True

    case else
    $Fileopen = FileOpenDialog("Select Audio file","","Sound Files(*.mp1;*.mp2;*.mp3;*.wav;*.ogg;*.m3u;*.pls)|All siported Files(*.*)")
    if not @error then
    $file = $fileOpen
    $dir = _FileGetDirPath($file)
        _GUICtrlListBox_BeginUpdate($List)
        _GUICtrlListBox_Dir($List, $dir & "\*.mp3")
        _GUICtrlListBox_Dir($List, $dir & "\*.wav")
        _GUICtrlListBox_Dir($List, $dir & "\*.ogg")
        _GUICtrlListBox_Dir($List, $dir & "\*.mp1")
        _GUICtrlListBox_Dir($List, $dir & "\*.mp2")
        _GUICtrlListBox_Dir($List, $dir & "\*.m3u")
        _GUICtrlListBox_Dir($List, $dir & "\*.pls")

        _GUICtrlListBox_endUpdate($List)
    _GUICtrlListBox_SelectString($list, _GetFileName($file))
    $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, 0)
    _BASS_ChannelSetDevice($MusicHandle, 1)
    _BASS_ChannelSetvolume($MusicHandle, $volume)
    autoefect()
    _BASS_ChannelPlay($MusicHandle, 1)
    if @error then
    msgbox(16, "error", @error)
    endIf
    GUICtrlSetData($PLAy,_t(207) & "... (space)")
    GUICtrlSetData($PLAy2,"&pause")
    $Playing = True

    endIf
    endSwitch
    endIf
    case $opene

    $Fileopen = FileOpenDialog("Select Audio file","","Sound Files(*.mp1;*.mp2;*.mp3;*.wav;*.ogg;*.m3u;*.pls)|All siported Files(*.*)")
    if not @error then
    $file = $fileOpen
    $dir = _FileGetDirPath($file)
        _GUICtrlListBox_BeginUpdate($List)
        _GUICtrlListBox_Dir($List, $dir & "\*.mp3")
        _GUICtrlListBox_Dir($List, $dir & "\*.wav")
        _GUICtrlListBox_Dir($List, $dir & "\*.ogg")
        _GUICtrlListBox_Dir($List, $dir & "\*.mp1")
        _GUICtrlListBox_Dir($List, $dir & "\*.mp2")
        _GUICtrlListBox_Dir($List, $dir & "\*.m3u")
        _GUICtrlListBox_Dir($List, $dir & "\*.pls")

        _GUICtrlListBox_endUpdate($List)
    _GUICtrlListBox_SelectString($list, _GetFileName($file))

    _BASS_ChannelStop($MusicHandle)
    $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, 0)
    _BASS_ChannelSetDevice($MusicHandle, 1)
    _BASS_ChannelSetvolume($MusicHandle, $volume)
    autoefect()
    _BASS_ChannelPlay($MusicHandle, 1)
    if @error then
    msgbox(16, "error", _BASS_ErrorGetCode())
    else
    GUICtrlSetData($label, @crlf & _GetFileName($file) & @crlf & " in progress")
    GUICtrlSetData($PLAy,_t(207) & "... (space)")
    GUICtrlSetData($PLAy2,"&pause")
    $Playing = True
    winSetTitle($hGUI, "", _t(10) & " : " & _GetFileName($file))

    endIf

    endIf
    case $openUrl
    $url = InputBox("play an url audio", "enter the file url")
    if not @error then
    $MusicHandle = _BASS_StreamCreateURL($url, 0, 0)
    _BASS_ChannelSetvolume($MusicHandle, $volume)
    autoefect()
    _BASS_ChannelPlay($MusicHandle, 0)
    $file = $url
    winSetTitle($hGUI, "", _t(10) & " : " & _GetFileName($file))
    endIf
    Case $STOP, $stop2
    GUICtrlSetData($PLAY,_t("201") & "... (space)")
    GUICtrlSetData($PLAY2,"play")
    $Playing = False
    _BASS_ChannelStop($MusicHandle)
    _BASS_ChannelSetPosition($MusicHandle, 0, $BASS_POS_BYTE)
    GUICtrlSetData($label1, _Sec2Time(Round(_BASS_ChannelBytes2Seconds($MusicHandle, _BASS_ChannelGetPosition($MusicHandle, 0)))) & " / " & _sec2Time(Round(_BASS_ChannelBytes2Seconds($MusicHandle, _BASS_ChannelGetLength($MusicHandle, 0)))) & @crlf & Round((_BASS_ChannelGetPosition($MusicHandle, 0) / _BASS_ChannelGetLength($MusicHandle, 0)) * 100, 0) & "%")
    Case $rearward, $rearward2
    $pos = _BASS_ChannelGetPosition($MusicHandle, $BASS_POS_BYTE)
    if $pos < _BASS_ChannelSeconds2Bytes($MusicHandle, 5) then
    _BASS_ChannelSetPosition($MusicHandle, 0, $BASS_POS_BYTE)
    else
    _BASS_ChannelSetPosition($MusicHandle, $pos-_BASS_ChannelSeconds2Bytes($MusicHandle, 5), $BASS_POS_BYTE)
    endIf
    Case $FORWARD, $FORWARD2

    $pos = _BASS_ChannelGetPosition($MusicHandle, $BASS_POS_BYTE)
    $length = _BASS_ChannelGetLength($MusicHandle, $BASS_POS_BYTE)
    if $pos+_BASS_ChannelSeconds2Bytes($MusicHandle, 5) >= $length then
    _BASS_ChannelSetPosition($MusicHandle, $length, $BASS_POS_BYTE)
    else
    _BASS_ChannelSetPosition($MusicHandle, $pos+_BASS_ChannelSeconds2Bytes($MusicHandle, 5), $BASS_POS_BYTE)
    endIf
    case $goto
    GUISetState(@sw_hide, $hGUI)
    Opt("GUICloseOnESC", 1)
    $sPosition = Round(_BASS_ChannelBytes2Seconds($MusicHandle, _BASS_ChannelGetPosition($MusicHandle, $BASS_POS_BYTE)))

    $goToDo = _goto($sPosition)

    if $goToDo = $sPosition then
    $GoToDo = false
    $sPosition = false

    else
    _BASS_ChannelSetPosition($MusicHandle, _BASS_ChannelSeconds2Bytes($MusicHandle, $GoToDo), $BASS_POS_BYTE)
    $GoToDo = false
    $sPosition = false

    endIf
    Opt("GUICloseOnESC", 0)
    GUISetState(@sw_show, $hGUI)
    case $my
    MSGBox(0, "about apps", "this app is an small tool which help you to play your audio files" & @crlf & "this app is devloped by nacer baaziz")
    case $next, $next2
    if $file then

    $filePos = $file
    $all = StringReplace(_GUICtrlListBox_GetCount($list), " ", "")
    $pushd = StringReplace(_GUICtrlListBox_GetCurSel($list), " ", "")

    if $pushd = $all-1 then
    $pushd = 0
    $text = _GUICtrlListBox_GetText($list, $pushd)
    _GUICtrlListBox_setCurSel($list, $pushd)
    _BASS_ChannelStop($MusicHandle)
    $MusicHandle = _BASS_StreamCreateFile(False, $Dir & $text, 0, 0, 0)
    _BASS_ChannelSetvolume($MusicHandle, $volume)
    _BASS_ChannelPlay($MusicHandle, 1)
    if @error then
    $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, 0)
    _BASS_ChannelSetvolume($MusicHandle, $volume)
    _BASS_ChannelPlay($MusicHandle, 1)
    else
    $file = $Dir & $text
    GUICtrlSetData($label, @crlf & _GetFileName($file) & @crlf & " in progress")
    winSetTitle($hGUI, "", _t(10) & " : " & _GetFileName($file))
    endIf
    autoEfect()
    else

    $text = _GUICtrlListBox_GetText($list, $pushd+1)
    _GUICtrlListBox_setCurSel($list, $pushd+1)
    _BASS_ChannelStop($MusicHandle)
    $MusicHandle = _BASS_StreamCreateFile(False, $Dir & $text, 0, 0, 0)
    _BASS_ChannelSetvolume($MusicHandle, $volume)
    _BASS_ChannelPlay($MusicHandle, 1)
    if @error then
    $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, 0)
    _BASS_ChannelSetvolume($MusicHandle, $volume)
    _BASS_ChannelPlay($MusicHandle, 1)
    else

    $file = $Dir & $text
    GUICtrlSetData($label, @crlf & _GetFileName($file) & @crlf & " in progress")
    winSetTitle($hGUI, "", _t(10) & " : " & _GetFileName($file))
    endIf
    autoEfect()
    endIf

    endIf
    case $Back, $back2
    if $file then
    $all = _GUICtrlListBox_GetCount($list)
    $pushd = _GUICtrlListBox_GetCurSel($list)
    if $pushd = 0 then
    $pushd = $all
    endIf
    $text = _GUICtrlListBox_GetText($list, $pushd-1)
    _GUICtrlListBox_setCurSel($list, $pushd-1)
    _BASS_ChannelStop($MusicHandle)
    $MusicHandle = _BASS_StreamCreateFile(False, $Dir & $text, 0, 0, 0)
    _BASS_ChannelSetvolume($MusicHandle, $volume)
    _BASS_ChannelPlay($MusicHandle, 1)
    if @error then
    $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, 0)
    _BASS_ChannelSetvolume($MusicHandle, $volume)
    _BASS_ChannelPlay($MusicHandle, 1)
    else

    $file = $Dir & $text
    GUICtrlSetData($label, @crlf & _GetFileName($file) & @crlf & " in progress")
    winSetTitle($hGUI, "", _t(10) & " : " & _GetFileName($file))
    endIf
    autoEfect()
    endIf
    case $rev
                If not $reverb then
                    _BASS_FXSetParameters($ReverbHandle, "0")
                    _BASS_ChannelRemoveFX($MusicHandle, $ReverbHandle)
                    $ReverbHandle = _BASS_ChannelSetFX($MusicHandle, $BASS_FX_DX8_REVERB, 7)

                    _BASS_FXSetParameters($ReverbHandle, "2|-8|3000|0.010")
    $reverb = true
    GUICtrlSetState($rev, $GUI_checked)
                Else
                    _BASS_FXSetParameters($ReverbHandle, "0")
                    _BASS_ChannelRemoveFX($MusicHandle, $ReverbHandle)


    $reverb = false
    GUICtrlSetState($rev, $GUI_unchecked)
                EndIf
    case $ech
                If not $echo Then
                    _BASS_FXSetParameters($EchoHandle, "0")
                    _BASS_ChannelRemoveFX($MusicHandle, $EchoHandle)
                    $EchoHandle = _BASS_ChannelSetFX($MusicHandle, $BASS_FX_BFX_ECHO2, 6)
                    _BASS_FXSetParameters($EchoHandle, "0")
                    _BASS_FXSetParameters($EchoHandle, "1|0.3|0.4|1|" & $BASS_BFX_CHANALL)
    $echo = true
    GUICtrlSetState($ech, $GUI_checked)
                Else
                    _BASS_FXSetParameters($EchoHandle, "0")
                    _BASS_ChannelRemoveFX($MusicHandle, $EchoHandle)
    $echo = false
    GUICtrlSetState($ech, $GUI_unchecked)
                EndIf
    case $Chor
                If not $Chorus then
                    _BASS_FXSetParameters($ChorusHandle, "0")
                    _BASS_ChannelRemoveFX($MusicHandle, $ChorusHandle)
                    $ChorusHandle = _BASS_ChannelSetFX($MusicHandle, $BASS_FX_BFX_CHORUS, 5)
                    $param = _BASS_FXGetParameters($ChorusHandle)

                    _BASS_FXSetParameters($ChorusHandle, "1|0.6|0.2|2|11|4|" & $BASS_BFX_CHANALL)
    $Chorus = true
    GUICtrlSetState($chor, $GUI_checked)
                Else
                    _BASS_FXSetParameters($ChorusHandle, "0")
                    _BASS_ChannelRemoveFX($MusicHandle, $ChorusHandle)
    $Chorus = false
    GUICtrlSetState($chor, $GUI_unchecked)
                EndIf
    case $fast
    local $t = 0



    local $t2 = _BASS_ChannelSetAttribute ($MusicHandle, $BASS_ATTRIB_TEMPO, $t+10)
    $t = $t2
    case $recorderMe
    GUISetState(@sw_hide, $hGUI)
    GUISetState(@sw_show, $HRecorder)
    case $options
    Opt("GUICloseOnESC", 1)
        GUISetState(@SW_hide, $hGUI)
    $return = options()
    if $return = 1 then
    $answer = MSGBox(4, "the settings has been changed", "to apply the new settings you must to restart your application, do you want to restart it now? press yes to restart it now or no to restart it later")
    switch $answer
    case 6
    _scriptRestart()
    case 7
    Opt("GUICloseOnESC", 0)
        GUISetState(@SW_show, $hGUI)
    endSwitch
    else
    Opt("GUICloseOnESC", 0)
        GUISetState(@SW_show, $hGUI)
    endIf

            EndSwitch
    if _BASS_ChannelIsActive($MusicHandle) = 1 and $file then
    GUICtrlSetData($label1, _Sec2Time(Round(_BASS_ChannelBytes2Seconds($MusicHandle, _BASS_ChannelGetPosition($MusicHandle, 0)))) & " / " & _sec2Time(Round(_BASS_ChannelBytes2Seconds($MusicHandle, _BASS_ChannelGetLength($MusicHandle, 0)))) & @crlf & Round((_BASS_ChannelGetPosition($MusicHandle, 0) / _BASS_ChannelGetLength($MusicHandle, 0)) * 100, 0) & "%")
    endIf
    if $file then
    if _BASS_ChannelGetPosition($MusicHandle, $BASS_POS_BYTE) = _BASS_ChannelGetLength($MusicHandle, $BASS_POS_BYTE) then
    Sleep(500)
    $all = StringReplace(_GUICtrlListBox_GetCount($list), " ", "")
    $pushd = StringReplace(_GUICtrlListBox_GetCurSel($list), " ", "")

    if $pushd = $all-1 then
    $pushd = 0
    $text = _GUICtrlListBox_GetText($list, $pushd)
    _GUICtrlListBox_setCurSel($list, $pushd)
    _BASS_ChannelStop($MusicHandle)
    $MusicHandle = _BASS_StreamCreateFile(False, $Dir & $text, 0, 0, 0)
    _BASS_ChannelPlay($MusicHandle, 1)
    if @error then
    _BASS_ChannelStop($MusicHandle)
    $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, 0)
    _BASS_ChannelPlay($MusicHandle, 1)
    else

    $file = $Dir & $text
    GUICtrlSetData($label, @crlf & _GetFileName($file) & @crlf & " in progress")
    winSetTitle($hGUI, "", _t(10) & " : " & _GetFileName($file))
    endIf
    autoEfect()
    elseif $pushd = $all then
    _BASS_ChannelPlay($MusicHandle, 1)
    GUICtrlSetData($label, @crlf & _GetFileName($file) & @crlf & " in progress")
    else
    $text = _GUICtrlListBox_GetText($list, $pushd+1)
    _GUICtrlListBox_setCurSel($list, $pushd+1)
    _BASS_ChannelStop($MusicHandle)
    $MusicHandle = _BASS_StreamCreateFile(False, $Dir & $text, 0, 0, 0)
    _BASS_ChannelPlay($MusicHandle, 1)
    if @error then
    _BASS_ChannelStop($MusicHandle)
    $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, 0)
    _BASS_ChannelPlay($MusicHandle, 1)
    else

    $file = $Dir & $text
    GUICtrlSetData($label, @crlf & _GetFileName($file) & @crlf & " in progress")
    winSetTitle($hGUI, "", _t(10) & " : " & _GetFileName($file))
    endIf
    autoEfect()
    endIf
    endIf
    endIf
    if $file then
    switch _BASS_ChannelIsActive($MusicHandle)
    case 1
    if $state = 1 then
    $state = 1
    else
    GUICtrlSetData($label, @crlf & _GetFileName($file) & @crlf & " in progress")
    $state = 1
    endIf
    case 0
    if $state = 0 then
    $state = 0
    else
    GUICtrlSetData($label, @crlf & _GetFileName($file) & @crlf & " stoped")
    $state = 0
    endIf
    case 3
    if $state = 3 then
    $state =3
    else
    GUICtrlSetData($label, @crlf & _GetFileName($file) & @crlf & " on pause")
    $state =3
    endIf
    endSwitch
    endIf
        WEnd

        ; Delete the previous GUI and all controls.
        GUIDelete($hGUI)
EndFunc; main

Func _FileGetDirPath($sPath)
    Local $sDrive = "", $sDir = "", $sFilename = "", $sExt = ""

    Local $aPath_split = _PathSplit($sPath, $sDrive, $sDir, $sFilename, $sExt)

    Return $sDrive & $sDir & "\"
EndFunc; _FileGetDirPath

Func _GetFileName($sPath)
    Local $sDrive = "", $sDir = "", $sFilename = "", $sExt = ""

    Local $aPath_split = _PathSplit($sPath, $sDrive, $sDir, $sFilename, $sExt)

    Return $sFilename & $sExt
EndFunc; _GetFileName

 

If anyone else tries these scripts.  Start with zip in post one, then if you're having problems replace the contents of easyPlayer.au3 with my revision of script.  

The first GUI that appeared for me was a Green options dialog.  The main dialog doesn't load until you press the 'Okay' button.  The script relaunches it'self too at that stage (before pressing 'Okay') I had to Kill Process Tree.  After pressing 'Okay' at the Green dialog it doesn't happen anymore (script does not relaunch).

Why does it relaunch @nacerbaaziz?

Edited by Xandy
Link to post
Share on other sites

Hello dear
Thank you for your nice post and for your modification of the file and to alerted me about the unintended mistake
My brother so far I have not finished working on the options page
It is Requiring a restart Because I will put some options for the screen readers and these options require restart
and about the  fileOptions.au3 file
I will amend the above publication and will add it to anyone who wants to benefit from it
With my best greetings and best wishesTHE

fileOptions.au3

Link to post
Share on other sites

I am interested in writing the recorder.  I have a lot of work these weeks to come (day job) and I still have lots to learn about your script.  I have written a multi-track recorder already.  I will enjoy integrating our two scripts.

I'll start by saving a recording of stereo mix from computer output, then a microphone, then I'll see if I can output a file with both.

Edit: If that sounds like a reasonable plan.

Edited by Xandy
Link to post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By CYCho
      zPlayer is the name I used when I introduced the early version of this player in my blog back in early 2009 and, therefore, has nothing to do with the mobile media player of the same name which started marketing in 2015.
      After I retired from active duty in 2002 I spent much time listening to music. First I started with CD's and LP's, then quickly moved on to mp3 files. I converted many of my CD's to mp3 and I collected many more from various sources which were freely available at the time. As the number of my mp3 files grew, I put them in folders according to their genres and my favorite classifications. I mainly used Windows Media Player to listen to them and I slowly began to dislike wmp because it had massive user interface while I just wanted to listen to music in the background while I was doing other work in the foreground, hopping between folders from time to time. It was the time I was beginning to learn AutoIt and I thought I should make my own player with AutoIt. Coming from a sales career with no experience in programming, it was not an easy task. Somehow, after about 2 years of learning and trying, I had my own audio player which worked with only hotkeys without any graphical interface. I gave it to some of my friends who were not as computer-savvy as I. They liked it but definitely wanted something to clcik with mouse. So I came up with very rude gui which took a form similar to what it is now.
      The attached source files include one au3 file, one icon file and 14 jpg files. The jpg files are used for drawing a graphical player and are fileinstalled in @DocumentsCommonDir folder. This player uses WMPlayer.OCX as its engine and supports all audio file formats supported by wmp and additional codecs installed. I would like to thank @Bilgus for kind answers to my questions and would appreciate it if anyone could review the code and give me any suggestion. This player works for me, but I don't know whether the code is presentable as an example. I am posting this here with a hope to learn much from AutoIt community.
      PS: Video function was added in August 2020. 


      Please see Downloads section of this forum for the latest version of this player.
    • By CYCho
      This file includes the source code for zPlayer, which is a stand-alone, simple, intuitive and easy-to-use, yet fully functional media player.  I made this to suit my purpose and you can tweak it to your taste. The source code is only about 1600 lines and only standard #include files were used. Also included in the source code file are some image files which are used for drawing the graphical media controls in the main window.
      As of its release date, the compiled exe file of this player, as attached hereto, is not flagged by Windows Defender with latest Security Intelligence Update.
      Hash values for compiled file of the latest version are as follows:
      SHA256: 91625654314ACE71A954C8DA703E68A258E9D7EF0823B261E513A9AB6FB34384
      SHA1: 4E717B293070058EAA4C492D7FF0E0E1B100E4F3

      This player has the following features:
      - Play back all formats of media files which can be played back by the Windows Media Player in your computer
      - Depending on the file types specified by the user in zPlayer.ini file this player can be either audio only, video only or both.
      - Video window is independent of other windows and, when maximized, increases the immersion of the user
      - Graphical media controls similar to embedded Windows Media Player
      - Forward, backward, pause, repeat, shuffle function
      - Increase/decrease/mute sound volume
      - Change folders and create playlist for all media files in that folder and its subfolders, and support for manually-made playlists
      - Save play-back environment when terminating and resume that environment when restarting
      - 'Continue playback' option for a file you left off in the middle of playback
      - With one click, you can see internet search results for the file selected in playlist
      - With a double-click, you can play back an item in the playlist
      - Search strings in the playlist
      - Option to see long file names including folder names
      - Resize the playlist and video windows, and restore them to their default positions
      - Very small footprint: very low CPU and memory usage, with only about 1MB when compiled
      - You can even hide all the windows and manipulate the player with hotkeys only
      Note: zPlayer is the name I used when I introduced the early version of this player in my blog back in early 2009 and, therefore, has nothing to do with the mobile media player of the same name which started marketing in 2015.
       
    • By PeterVerbeek
      In this post I take the opportunity to show the awesome capabilities of AutoIt and its libraries. My open source project Peace is a long running AutoIt based app located on SourceForge. It provides users with a system-wide equalizer and effects machine. It's an interface using the power of Equalizer APO, an audio processing object software. Peace has been download over 2,600,000 times by various kind of users. Amongst others it gives them possibilities like these:
      Hearing impaired - Amplify the gain of frequencies which are impaired. Home Theatre - Create Equalizer presets for watching movies and listening to music. Music lovers & audiophiles - Create presets for listening to music on their high quality speakers and headphones. Gamers - Enhance frequencies to get an edge over other gamers. Headphones - Improve the sound quality of cheap headphones and get the max out of expensive ones. Bass lovers - Boost low frequencies for extra bass. Voice - Make a microphone sound better and improve the voice, for instance for YouTube usage. Low audio - Boost low audio of an input source to a comfortable level. This list covers the main needs of the Peace user. Many people have contacted me over the years asking for new features and telling me how they use Peace for their (sometimes specific) needs.  I was able to use AutoIt and its libraries for all of their needs. So what are the main features of Peace?
      Equalize your computer audio by using up to 31 sliders. Support of equalizing 9 speakers : left/right, center, subwoofer, left/right rear, left/right side. Per slider a filter can be chosen such as peak, low/high pass, shelving. The graph windows shows your equalization so you see exactly what you're doing. Apply an effect such as crossfeed simple/Jan Meier/Chu Moy, stereo balance, bass/treble, upmix/downmix, channel routing. Save presets (called configurations) and activate by mouse click, hotkey, desktop shortcut or Peace system tray. Select a target device to equalize, microphone as input can also be equalized. Automate: you can let Peace automatically activate presets on a switch to another device and another process. Peace is available in these languages: English, Czech, Deutsch, Français, Italiano, Nederlands, Pусский, Українська So who am I? I'm a Dutch programmer who happens the stumble upon AutoIt 5 years ago and created a small Equalizer interface app of less than 400 program lines with it. Nowadays Peace has grown to more than 18,000 lines as many features were added. Although Peace is open source, the program code isn't of the best possible quality. The reason being that I didn't expect it to become so popular. It caught me by supprise. I've created a Library of functions called Pal (link to forum post) which quality is up to the AutoIt community standard as counterpart to the Peace program code.
      I want to state here that AutoIt is a mature program language as Peace obviously shows. I wish it to be used more extensively for professional or semi-professional apps. In my view AutoIt deserves a place amongst the major programming languages for Windows computers.
      Regards,
      Peter Verbeek








    • By roeselpi
      hello again,
      it has been a long time since i have been here and a long time since i last used autoit. ever so often when the time allows me to, then i follow up on an idea that i had a long time ago. i have done all the work on paper but now it is up to writing it in autoit and i keep stumbling over many little issues here and there. sometimes after a few days i will try again and get a step further but sometimes it just will not help no matter how long i try and think about a solution. for most of you it will be the basics but for me it is not all that easy, but at least i give it a try.
      right, down to business:
      here is my code:
      #include <MsgBoxConstants.au3> #include <StringConstants.au3> #include <Array.au3> #include <String.au3> ; ; PART 1: define replacements and check with msgbox ; Global $y, $z $y = "Yes" $z = "No" MsgBox(0,"replacements", $y & @CRLF & $z) ;the replacements in a message box ; ; PART 2: set the texts and check via console and msgbox ; Global $my1string = "abab" ;the first specified text MsgBox(0,"my1string", $my1string) ;the message box to output the first specified text Global $my2string = "icic" ;the second specified text MsgBox(0,"my2string", $my2string) ;the message box to output the second specified text ; ; PART 3: transform the strings to individual arrays ; $my1array = StringSplit($my1string, "") $my1array[0] = "" _ArrayDelete($my1array, 0) _ArrayDisplay($my1array, "my1array") ;the display of the first specified array $my2array = StringSplit($my2string, "") $my2array[0] = "" _ArrayDelete($my2array, 0) _ArrayDisplay($my2array, "my2array") ;the display of the first specified array ; ; PART 4: create an empty array for filling ; Global $OutputArray[4] $OutputArray[0] = "" _ArrayDisplay($OutputArray, "OutputArray") ;the display of the first specified array ; ; PART 5: compare & fill empty OutputArray with data after evaluation ; Global $i, $j, $k For $i = 0 to UBound($my1array) -1 For $j = 0 to UBound($my2array) -1 For $k = 0 to UBound($OutputArray) -1 If $my1array[$i] = "a" And $my2array[$j] = "i" Then $OutputArray[$k] = $y Else $OutputArray[$k] = $z EndIf Next Next Next _ArrayDisplay($OutputArray, "OutputArray") ;the display of the Newly filled Array In "Part 2" i make a string that is converted to an array in "Part 3" ... Now, I know that "a" and "i" are always in the exact same spot in both arrays and so i wanted to compare this and make a further array to document my findings by saying "yes" or "no" ... however my new array keeps saying just "no" allthough i can clearly see and know that it should say:
      yes no yes no my guess is that there is something wrong within my for-loops and that the counting is somehow "off" i guess that when the first for-loop is finished it reaches the second whilst the second for-loop is checking the first which would explain why it always says "no" instead of seeing the obvious.
      so my question would be: what is wrong with my for-loop? or where am i making an error that ultimately gives me the wrong results?
      help is much appreciated.
      kind regards
      roeselpi
       
       
      PS: sorry for my not so great english spelling ... stupid german sitting here trying out intermediate english skills.
    • By ripdad
      This is a project that I have been working on for several months off and on.
      It's a simple "What You Hear" MP3 @ 320Kbps and WAV audio recorder.
      Features:
      - LoudMax, a Gain Controller and Look-Ahead Limiter
      - Auto Shut-Off after one minute of silence
      - Side-by-Side Simulated LED Meter
      - Running Time Counter
      It started off being a large project, but I eventually stripped it down to its
      bare essentials because I came to realize that it would be very difficult to
      deal with every sound card and every way a PC is set up for audio. It would
      have been a nightmare that I was not willing to go through.
      This project contains the most up-to-date BASS.dll v.2.4.15.0 - December 17, 2019.
      All BASS Dll's are 32bit. Those and the needed UDF's are included in the zip file.
      I will try to explain how it works in the next post.

      Download:
      BASS VST Recorder v1.1.zip
       
×
×
  • Create New...