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

Share this post


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

Share this post


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

Share this post


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

Share this post


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

  • Similar Content

    • By nacerbaaziz
      screen curtain on autoit windows 8 +
      hello autoit forum please i've a question
      on windows 8 and more the micro soft added the Magnification options
      this future can help the blind by turn the screen black to To relax the eyes.
      i searched allot in autoit but i couldn't find any way to do it
      and after then i found an python addon can do that, it's an addon open source to screen reader NVDA
      i hope you can help me to convert it to an autoit script
      note i couldn't do that because I'm very fresh man in dealing with dll files
      inadition to am 0 on python
      please if any one can help me.
      this is the NVDA Python Addon it very small, i need just one future that turn the screen black
      thx in advance
       
      screenCurtain.rarr
       
    • By UEZ
      Hi,
      I created a FMOD UDF (x86 / x64 compatible) whereas the DLL calls are done from memory directly!
      Credits to trancexx for the Subrogation functions!
       
      Supported formats:
      - .MOD (protracker/fasttracker modules) - .S3M (screamtracker 3 modules) - .XM (fasttracker 2 modules) - .IT (impulse tracker modules) - .MID (MIDI files) - .RMI (MIDI files) - .SGT (DirectMusic segment files) - .FSB (FMOD Sample Bank files) - .MP3 - .OGG - .WAV - .MP2 - .RAW  
      Current added function list (sum = 70):
      FMUSICMEM_FreeSong FMUSICMEM_GetBPM FMUSICMEM_GetGlobalVolume FMUSICMEM_GetMasterVolume FMUSICMEM_GetName FMUSICMEM_GetNumChannels FMUSICMEM_GetNumInstruments FMUSICMEM_GetNumOrders FMUSICMEM_GetNumPatterns FMUSICMEM_GetNumSamples FMUSICMEM_GetOrder FMUSICMEM_GetPaused FMUSICMEM_GetRow FMUSICMEM_GetSpeed FMUSICMEM_GetTime FMUSICMEM_GetType FMUSICMEM_IsFinished FMUSICMEM_LoadSong FMUSICMEM_LoadSongEx FMUSICMEM_OptimizeChannels FMUSICMEM_PlaySong FMUSICMEM_SetMasterVolume FMUSICMEM_SetOrder FMUSICMEM_SetPaused FMUSICMEM_StopAllSongs FMUSICMEM_StopSong FSOUNDMEM_Close FSOUNDMEM_DSP_Create FSOUNDMEM_DSP_Free FSOUNDMEM_DSP_GetActive FSOUNDMEM_DSP_GetFFTUnit FSOUNDMEM_DSP_GetSpectrum FSOUNDMEM_DSP_SetActive FSOUNDMEM_DSP_SetPriority FSOUNDMEM_GetAmplitude FSOUNDMEM_GetChannelsPlaying FSOUNDMEM_GetCPUUsage FSOUNDMEM_GetCurrentLevels FSOUNDMEM_GetError FSOUNDMEM_GetFrequency FSOUNDMEM_GetGetSurround FSOUNDMEM_GetMaxChannels FSOUNDMEM_GetPan FSOUNDMEM_GetPaused FSOUNDMEM_GetVolume FSOUNDMEM_Init FSOUNDMEM_SetPaused FSOUNDMEM_SetSpeakerMode FSOUNDMEM_SetSurround FSOUNDMEM_SetVolume FSOUNDMEM_SetVolumeAbsolute FSOUNDMEM_Stream_Close FSOUNDMEM_Stream_FindTagField FSOUNDMEM_Stream_GetLength FSOUNDMEM_Stream_GetLengthMs FSOUNDMEM_Stream_GetNumTagFields FSOUNDMEM_Stream_GetOpenState FSOUNDMEM_Stream_GetPosition FSOUNDMEM_Stream_GetTagField FSOUNDMEM_Stream_GetTime FSOUNDMEM_Stream_Net_GetStatus FSOUNDMEM_Stream_Net_SetMetadataCallback FSOUNDMEM_Stream_Net_SetProxy FSOUNDMEM_Stream_Open FSOUNDMEM_Stream_Play FSOUNDMEM_Stream_PlayEx FSOUNDMEM_Stream_SetLoopCount FSOUNDMEM_Stream_SetPosition FSOUNDMEM_Stream_SetTime FSOUNDMEM_Stream_Stop  
      In the zip archive you can find 6 examples.
       
      Download:  FModMem UDF build 2019-11-24.zip
       
      If you have created additional examples, feel free to post it here.
    • By UEZ
      A FMOD UDF to play music and radio stations whereas the DLL is called directly from memory.
      Supported formats:
      - .MOD (protracker/fasttracker modules) - .S3M (screamtracker 3 modules) - .XM (fasttracker 2 modules) - .IT (impulse tracker modules) - .MID (MIDI files) - .RMI (MIDI files) - .SGT (DirectMusic segment files) - .FSB (FMOD Sample Bank files) - .MP3 - .OGG - .WAV - .MP2 - .RAW  
      Click the forum URL to the right for more information. Execution only in x86 mode as the embedded DLL is x86 only!
       
      Download: FModMem UDF build 2019-11-24.zip
    • By ripdad
      I ran across a topic while researching the BASS UDF...
      https://www.autoitscript.com/forum/topic/155845-carpenter-needs-help-performing-serious-surgery-on-audiometer2/ and then remembered another topic...
      https://www.autoitscript.com/forum/topic/121624-sound-level-sampling/ which got me to thinking as to how I could get the first topic to go LIVE without the need of loading an mp3.
      This will accept any LIVE AUDIO INPUT.
      Be sure to read this post if you have trouble with it...
      https://www.autoitscript.com/forum/topic/121624-sound-level-sampling/?do=findComment&comment=1400178 Also, read the comments I made in the script, so you will know how it will react to LIVE INPUT streams.

      Live FFT Visual Spectrum.zip
       

      LIVE Multiband FFT Visual Spectrum.au3
       
    • By CYCho
      This file includes all the source codes and a compiled .exe version of zPlayer, which is a stand-alone, simple, intuitive and easy-to-use, yet fully functional audio player.  I made this to suit my purpose and you can tweak it to your taste as the source code is only about 1000 lines which are very much readable.  This player has the following functions:
      - Play back all formats of audio files which can be palyed back by the Windows Media Player in your computer
      - Graphical player similar to embedded Windows Media Player
      - Forward, backward, pause, repeat, shuffle funtions
      - Increase/decrease/mute sound volume
      - Change folders and create playlist for all audio 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
      - With one click, you can see DuckDuckGo search results for the file being played back
      - 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 window, and restore it to its default position
      - 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
×
×
  • Create New...