Jump to content
LaunchBox Community Forums

jross001

Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by jross001

  1. Hi, 

    I just got LaunchBox, BigBox setup and went the same route for my Arcade Cabinet (change the shell to BigBox).  Ran into the same volume control thing and was just about to give up as well.  After digging around, I found that the Controller Automations in BigBox call the explorer dependent APIs for volume control.  "Volume_Up", "Volume_Down", "Volume_Mute".  You get that nice Volume OSD which indicates the volume level.  These are made possible by the Windows Shell Experience which is part of the explorer shell.  But since we're not launching explorer, this doesn't work at all.  

    However, since all the other required Audio services (AudioSrv) are automatically launched by windows, its just a matter of scripting at this point.  My workaround was to first roll my own AHK script that polls a "Hotkey" and the Joystick XY axes and sends the correct API call.  One of the things I looked at while Googling, was to run the AutoHotKey executable as a service.  You can't run the executable directly as a service, but you could use a commercial program "AlwaysUp"  https://www.coretechnologies.com/products/AlwaysUp/Apps/RunAutoHotkeyAsAWindowsService.html

    I tried it. It works.  But it costs $49 for a 1 user license.  You get a 30 day trial, but I didn't think I needed all the bells and whistles just for some volume control.  Someone might have interest in it, but it was a bit much for my purposes.

    Which led me to Windows Task Scheduler (already comes with Windows 10).  Here is my AHK script (probably could be better, but it works).  You can either launch it with AutoHotKey.exe or if you have AutoHotKey installed, just compile it and run it standalone. 

    #Persistent  ; Keep this script running until the user explicitly exits it.
    SetTimer, WatchAxis, 5
    return
    
    WatchAxis:
    JoyX := GetKeyState("JoyX")  ; Get position of X axis.
    JoyY := GetKeyState("JoyY")  ; Get position of Y axis.
    JoyHoldDownPrev := JoyHoldDown  ; Prev now holds the key that was down before (if any).
    
    if (JoyY > 70 and GetKeyState("Joy10") )
    {
        JoyHoldDown := "Down"
    	SoundSet -1  ; Decrease master volume by 1%
    }
    else if (JoyY < 30 and GetKeyState("Joy10") )
    {
        JoyHoldDown := "Up"
    	SoundSet +1  ; Increase master volume by 1%
    }
    else if (JoyX < 30 and GetKeyState("Joy10") )
    {
        JoyHoldDown := "Left"
    	if (JoyHoldDown = JoyHoldDownPrev)  ; The correct Left Joystick is already down (or no key is needed).
            return  ; Do nothing.
    
    	; Otherwise, the left stick was previously released
    	SoundSet, +1, , mute  ; Toggle the master mute (set it to the opposite state)
    	
    	SoundGet, master_mute, , mute
    	SplashTextOn, , , Master Mute is currently %master_mute%.
    	sleep 2000
        SplashTextOff
    }
    else
        JoyHoldDown := ""
    
    
    return

     

    Then tell Task Scheduler to run it when anyone logs on.

    WindowsKey + r  ; taskschd.msc

    Create a Basic Task (Right Pane).  Give it a name

    image.thumb.png.fc42c432d8327ccdc06ea0716e13d473.pngOn the next screen, select when computer starts or log on. We have to modify it later so either one works for now

    image.thumb.png.16b3a5763ef2e38903ddabe972258adc.pngSelect "Start a Program"

    image.thumb.png.4cccc37b3916a3b4cace8dbabc971d69.pngOn the next screen, simply browse for you executeable

    image.thumb.png.52cf185612adac1b36bd2aeac497aa2e.pngHit next, and be sure to check the checkbox at the bottom before hiting finish

    image.thumb.png.43d3fef4fdbf783e582951692361c6aa.pngIn the next dialog, go over to the "Triggers" tab and click edit at the bottom

    image.thumb.png.06c5ddd2abb0592678f0b522c5e3d266.pngIn the "Begin Task" dropdown, change it to "At Log on".  Set the radio button to "Any User" or to a Specifc User if you'd like. Then hit ok. 

    image.thumb.png.9a37a6e4816d2b9350675cf9549fb5a7.pngGo over to the "Settings" tab, and uncheck the "Stop the task if it runs longer than..." checkbox.

    image.thumb.png.45652d585ac9b4815b0ca81dca5c38e9.pngHit okay, and you should see your new scheduled task in the top pane.

    image.thumb.png.6e649a149530aaa1853fb42654619df3.pngReboot into your BigBox shell and thats it.  Volume control.

     

    • Like 1
×
×
  • Create New...