Advertisement
itsallgud

Spatial Audio Switcher for DOLBY with mute check

Jun 9th, 2025
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Autohotkey 18.63 KB | Source Code | 0 0
  1. #Requires AutoHotkey v2.0
  2.  
  3. ; This is a simple AutoHotkey v2.0 tray application to change
  4. ; spatial audio formats, default formats, exclusivity and speaker
  5. ; configurations. It also has links to various connected applications.
  6. ;
  7. ; Modified the original ahk script spatial-audio-switcher-1.0.1
  8. ; with permission to control mute settings while paring down
  9. ; the original code to ONLY control DOLBY ATMOS/DOLBY ACCESS FOR HEADPHONES
  10. ; because that's all I use. (Removed Sonic & DTS). Default settings
  11. ; are basically Spatial Audio On, 7.1 surround, 24 bit, unmuted.
  12. ;
  13. ; Why mute/unmute? Because Windows 11 randomly mutes my sound on
  14. ; a system level that I have to drill down into deep settings to undo.
  15. ;
  16. ; IMPORTANT: To successfully launch this script you have to make or rename
  17. ; an icon file (.ico) you want to use for DOLBY ACCESS FOR HEADPHONES
  18. ; an add it to the spatial-audio-switcher-1.0.1 Icons folder.
  19. ; It must be named dah.ico or look for that in this script and
  20. ; change it to the .ico file of your choice.
  21. ;
  22. ; This very simple tray application wouldn't be possible without
  23. ; awesome applications of Nir Sofer, Chris Mallet and others.  
  24. ; So all thanks should go to them.
  25. ;
  26. ;
  27. ; SoundVolumeCommandLine console application from NirSoft is
  28. ; needed to control audio device. Download it and put it inside
  29. ; Resources directory.
  30. ; https://www.nirsoft.net/utils/sound_volume_command_line.html
  31. ;
  32. ; SoundVolumeView is the GUI version of SoundVolumeCommandLine.
  33. ; The scripts also provides a link to open it. Download it and put
  34. ; it inside Resources directory. But it is not necessary to use the script.
  35. ; https://www.nirsoft.net/utils/sound_volume_view.html
  36. ;
  37.  
  38. ; If the script runs again, skip the dialog box and replace the old instance.
  39. #SingleInstance Force
  40.  
  41. ; Prevents the script from exiting automatically when its last
  42. ; thread completes, allowing it to stay running in an idle state.
  43. Persistent
  44.  
  45. ; Set default audio device to non-spatial sound, default
  46. ; speaker configuration to stereo, default format to 16 Bit 44100 Hz
  47. ; and don't allow applications to take exclusive control of the device.
  48. ; Change the defaults as needed, you can learn about speaker configurations from here:
  49. ; https://learn.microsoft.com/en-us/windows-hardware/drivers/audio/mapping-stream-formats-to-speaker-configurations
  50. Run "Resources\svcl.exe /SetSpatial `"DefaultRenderDevice`" `"Dolby Atmos for Home Theater`"", , "Hide"
  51. Run "Resources\svcl.exe /SetSpeakersConfig `"DefaultRenderDevice`" 0x63f 0x63f 0x63f", , "Hide"
  52. Run "Resources\svcl.exe /SetDefaultFormat `"DefaultRenderDevice`" 24 192000", , "Hide"
  53. Run "Resources\svcl.exe /SetAllowExclusive `"DefaultRenderDevice`" 0", , "Hide"
  54.  
  55. ; We are going to use two main tray menus. One simple and
  56. ; quick one, and one with more options. Let us create them.
  57.  
  58. ; This is the detailed tray menu. This will open with a right click
  59. ; to the tray icon. We are also going to set its default icon and
  60. ; delete AutoHotkey's default tray items.
  61. Tray := A_TrayMenu
  62. TraySetIcon "Icons\icon.ico"
  63. Tray.Delete
  64.  
  65. ; This one is the simple menu to change the spatial audio
  66. ; formats, it will open with a left click to the tray icon.
  67. SpatialMenu := Menu()
  68.  
  69. ; Tooltip text, which is displayed when the mouse hovers over the tray icon.
  70. A_IconTip := "Spatial Audio Switcher"
  71.  
  72. ; Now, we will create the submenus we are going to be using.
  73.  
  74.     ; This one is for the detailed tray menu. It will show a list
  75.     ; of the spatial audio formats that can be selected.
  76.         Select := Menu()
  77.        
  78.     ; This will create a submenu to open sound settings.
  79.     ; This is for the detailed tray menu.
  80.         Settings := Menu()
  81.        
  82.     ; This will create a submenu to control exclusivity.
  83.     ; This is for the detailed tray menu.
  84.         Exclusivity := Menu()
  85.  
  86.     ; This will create a submenu for the detailed tray menu to change default format of the device.
  87.     ; I have only added 16 bit 44100 Hz, 16 bit 48000 Hz, 16 bit 96000 Hz, 16 bit 192000 Hz,
  88.     ; 24 bit 44100 Hz, 24 bit 48000 Hz, 24 bit 96000 Hz, 24 bit 192000 Hz.
  89.         DefaultFormat := Menu()
  90.        
  91.     ; Now we will create a sub-menu to control speaker configurations
  92.     ; between Stereo, 5.1 and 7.1. This will stay in both tray menus.
  93.         Configuration := Menu()
  94.        
  95.     ; Finally we will create a submenu to open spatial audio apps,
  96.     ; Dolby Access and DTS Sound Unbound. This will only stay within
  97.     ; the simple tray menu.
  98.         SpatialApps := Menu()  
  99.  
  100. ; Now, let's define the functions we are going to use.
  101.  
  102.     ; First, an empty function.
  103.         Empty(*)
  104.         {
  105.         }
  106.  
  107.     ; Function to call the simple tray menu. This is going to be the default function.
  108.         Spatial(*)
  109.         {
  110.         SpatialMenu.Show
  111.         }
  112.  
  113.     ; Function to disable spatial audio.
  114.         Disable(*)
  115.         {
  116.         Run "Resources\svcl.exe /SetSpatial `"DefaultRenderDevice`" `"`"", , "Hide"
  117.         TraySetIcon "Icons\icon.ico"
  118.         Tray.Rename "1&", "Disabled"
  119.         Tray.SetIcon "Disabled", ""
  120.         Tray.Add "Disabled", Empty
  121.         Tray.Disable "&Disable Spatial Audio"
  122.         SpatialMenu.Disable "&Disable Spatial Audio"
  123.         }
  124.    
  125.     ; Function to enable Dolby Atmos for Home Theater.
  126.         DolbyAtmosEnable(*)
  127.         {
  128.         Run "Resources\svcl.exe /SetSpatial `"DefaultRenderDevice`" `"Dolby Atmos for Home Theater`"", , "Hide"
  129.         TraySetIcon "Icons\dolby.ico"
  130.         Tray.Enable "&Disable Spatial Audio"
  131.         SpatialMenu.Enable "&Disable Spatial Audio"
  132.         Tray.Enable "1&"
  133.         Tray.Rename "1&", "&Dolby Atmos for Home Theater"
  134.         Tray.SetIcon "&Dolby Atmos for Home Theater", "Icons\dolby.ico"
  135.         Tray.Add "&Dolby Atmos for Home Theater", DolbyAtmos
  136.         }
  137.        
  138.     ; Function to enable Dolby Atmos for Headphones.
  139.         DolbyAccessEnable(*)
  140.         {
  141.         Run "Resources\svcl.exe /SetSpatial `"DefaultRenderDevice`" `"Dolby Atmos`"", , "Hide"
  142.         TraySetIcon "Icons\dah.ico"
  143.         Tray.Enable "&Disable Spatial Audio"
  144.         SpatialMenu.Enable "&Disable Spatial Audio"
  145.         Tray.Enable "1&"
  146.         Tray.Rename "1&", "&Dolby Access for Headphones"
  147.         Tray.SetIcon "&Dolby Access for Headphones", "Icons\dah.ico"
  148.         Tray.Add "&Dolby Access for Headphones", DolbyAccess
  149.         }
  150.        
  151.     ; Function to start Unmuted
  152.         StartUnmuted(*)
  153.         {
  154.         Run "Resources\svcl.exe /Unmute `"DefaultRenderDevice`""
  155.         MuteMenu.Check "Unmuted"
  156.         MuteMenu.Uncheck "Muted"
  157.         MuteMenu2.Check "Unmuted"
  158.         MuteMenu2.Uncheck "Muted"
  159.         }
  160.        
  161.     ; Function to run Dolby Access.
  162.         DolbyAtmos(*)
  163.         {
  164.         Run "explorer.exe shell:appsFolder\DolbyLaboratories.DolbyAccess_rz1tebttyb220!App"
  165.         }
  166.  
  167.     ; Function to run Dolby Access.
  168.         DolbyAccess(*)
  169.         {
  170.         Run "explorer.exe shell:appsFolder\DolbyLaboratories.DolbyAccess_rz1tebttyb220!App"
  171.         }
  172.  
  173.     ; Function to run SoundVolumeView, our advanced sound device manager.
  174.         Advanced(*)
  175.         {
  176.         Run "Resources\SoundVolumeView.exe"
  177.         }
  178.        
  179.     ; Function to open Windows' sound settings.
  180.         Modern(*)
  181.         {
  182.         Run "ms-settings:sound"
  183.         }
  184.  
  185.     ; Function to open Windows' traditional sound settings.
  186.         Traditional(*)
  187.         {
  188.         Run "control mmsys.cpl sounds"
  189.         }
  190.    
  191.     ; Function to open Windows' application volume mixer.      
  192.         Volume(*)
  193.         {
  194.         Run "ms-settings:apps-volume"
  195.         }
  196.        
  197.     ; Function to allow applications to take exclusive control of the default device    .
  198.         Exclusive(*)
  199.         {
  200.         Run "Resources\svcl.exe /SetAllowExclusive `"DefaultRenderDevice`" 1", , "Hide"
  201.         Exclusivity.Check "&Exclusive"
  202.         Exclusivity.Uncheck "&Not Exclusive"
  203.         }
  204.        
  205.     ; Function to not allow applications to take exclusive control of default device    .
  206.         NonExclusive(*)
  207.         {
  208.         Run "Resources\svcl.exe /SetAllowExclusive `"DefaultRenderDevice`" 0", , "Hide"
  209.         Exclusivity.Uncheck "&Exclusive"
  210.         Exclusivity.Check "&Not Exclusive"
  211.         }
  212.        
  213.     ; Function to set the default speaker configuration to stereo.
  214.         Stereo(*)
  215.         {
  216.         Run "Resources\svcl.exe /SetSpeakersConfig `"DefaultRenderDevice`" 0x3 0x3 0x3", , "Hide"
  217.         Configuration.Check "&Stereo"
  218.         Configuration.Uncheck "&Five-point One"
  219.         Configuration.Uncheck "S&even-point One"
  220.         }
  221.        
  222.     ; Function to set the default speaker configuration to 5.1.
  223.         FivePointOne(*)
  224.         {
  225.         Run "Resources\svcl.exe /SetSpeakersConfig `"DefaultRenderDevice`" 0x3f 0x3f 0x3f", , "Hide"
  226.         Configuration.Uncheck "&Stereo"
  227.         Configuration.Check "&Five-point One"
  228.         Configuration.Uncheck "S&even-point One"
  229.         }
  230.    
  231.     ; Function to set the default speaker configuration to 7.1.
  232.         SevenPointOne(*)
  233.         {
  234.         Run "Resources\svcl.exe /SetSpeakersConfig `"DefaultRenderDevice`" 0x63f 0x63f 0x63f", , "Hide"
  235.         Configuration.Uncheck "&Stereo"
  236.         Configuration.Uncheck "&Five-point One"
  237.         Configuration.Check "S&even-point One"
  238.         }
  239.        
  240.     ; Function to set the default format to 16 bit, 44100 Hz.
  241.         df1644(*)
  242.         {
  243.         Run "Resources\svcl.exe /SetDefaultFormat `"DefaultRenderDevice`" 16 44100", , "Hide"
  244.         DefaultFormat.Check "16 Bit, 44100 Hz"
  245.         DefaultFormat.Uncheck "16 Bit, 48000 Hz"
  246.         DefaultFormat.Uncheck "16 Bit, 96000 Hz"
  247.         DefaultFormat.Uncheck "16 Bit, 192000 Hz"
  248.         DefaultFormat.Uncheck "24 Bit, 44100 Hz"
  249.         DefaultFormat.Uncheck "24 Bit, 48000 Hz"
  250.         DefaultFormat.Uncheck "24 Bit, 96000 Hz"
  251.         DefaultFormat.Uncheck "24 Bit, 192000 Hz"
  252.         }
  253.        
  254.     ; Function to set the default format to 16 bit, 48000 Hz.
  255.         df1648(*)
  256.         {
  257.         Run "Resources\svcl.exe /SetDefaultFormat `"DefaultRenderDevice`" 16 48000", , "Hide"
  258.         DefaultFormat.Uncheck "16 Bit, 44100 Hz"
  259.         DefaultFormat.Check "16 Bit, 48000 Hz"
  260.         DefaultFormat.Uncheck "16 Bit, 96000 Hz"
  261.         DefaultFormat.Uncheck "16 Bit, 192000 Hz"
  262.         DefaultFormat.Uncheck "24 Bit, 44100 Hz"
  263.         DefaultFormat.Uncheck "24 Bit, 48000 Hz"
  264.         DefaultFormat.Uncheck "24 Bit, 96000 Hz"
  265.         DefaultFormat.Uncheck "24 Bit, 192000 Hz"
  266.         }
  267.        
  268.     ; Function to set the default format to 16 bit, 96000 Hz.
  269.         df1696(*)
  270.         {
  271.         Run "Resources\svcl.exe /SetDefaultFormat `"DefaultRenderDevice`" 16 96000", , "Hide"
  272.         DefaultFormat.Uncheck "16 Bit, 44100 Hz"
  273.         DefaultFormat.Uncheck "16 Bit, 48000 Hz"
  274.         DefaultFormat.Check "16 Bit, 96000 Hz"
  275.         DefaultFormat.Uncheck "16 Bit, 192000 Hz"
  276.         DefaultFormat.Uncheck "24 Bit, 44100 Hz"
  277.         DefaultFormat.Uncheck "24 Bit, 48000 Hz"
  278.         DefaultFormat.Uncheck "24 Bit, 96000 Hz"
  279.         DefaultFormat.Uncheck "24 Bit, 192000 Hz"
  280.         }
  281.        
  282.     ; Function to set the default format to 16 bit, 192000 Hz.
  283.         df16192(*)
  284.         {
  285.         Run "Resources\svcl.exe /SetDefaultFormat `"DefaultRenderDevice`" 16 192000", , "Hide"
  286.         DefaultFormat.Uncheck "16 Bit, 44100 Hz"
  287.         DefaultFormat.Uncheck "16 Bit, 48000 Hz"
  288.         DefaultFormat.Uncheck "16 Bit, 96000 Hz"
  289.         DefaultFormat.Check "16 Bit, 192000 Hz"
  290.         DefaultFormat.Uncheck "24 Bit, 44100 Hz"
  291.         DefaultFormat.Uncheck "24 Bit, 48000 Hz"
  292.         DefaultFormat.Uncheck "24 Bit, 96000 Hz"
  293.         DefaultFormat.Uncheck "24 Bit, 192000 Hz"
  294.         }
  295.        
  296.     ; Function to set the default format to 24 bit, 44100 Hz.
  297.         df2444(*)
  298.         {
  299.         Run "Resources\svcl.exe /SetDefaultFormat `"DefaultRenderDevice`" 24 44100", , "Hide"
  300.         DefaultFormat.Uncheck "16 Bit, 44100 Hz"
  301.         DefaultFormat.Uncheck "16 Bit, 48000 Hz"
  302.         DefaultFormat.Uncheck "16 Bit, 96000 Hz"
  303.         DefaultFormat.Uncheck "16 Bit, 192000 Hz"
  304.         DefaultFormat.Check "24 Bit, 44100 Hz"
  305.         DefaultFormat.Uncheck "24 Bit, 48000 Hz"
  306.         DefaultFormat.Uncheck "24 Bit, 96000 Hz"
  307.         DefaultFormat.Uncheck "24 Bit, 192000 Hz"
  308.         }
  309.    
  310.     ; Function to set the default format to 24 bit, 48000 Hz.
  311.         df2448(*)
  312.         {
  313.         Run "Resources\svcl.exe /SetDefaultFormat `"DefaultRenderDevice`" 24 48000", , "Hide"
  314.         DefaultFormat.Uncheck "16 Bit, 44100 Hz"
  315.         DefaultFormat.Uncheck "16 Bit, 48000 Hz"
  316.         DefaultFormat.Uncheck "16 Bit, 96000 Hz"
  317.         DefaultFormat.Uncheck "16 Bit, 192000 Hz"
  318.         DefaultFormat.Uncheck "24 Bit, 44100 Hz"
  319.         DefaultFormat.Check "24 Bit, 48000 Hz"
  320.         DefaultFormat.Uncheck "24 Bit, 96000 Hz"
  321.         DefaultFormat.Uncheck "24 Bit, 192000 Hz"
  322.         }
  323.        
  324.     ; Function to set the default format to 24 bit, 96000 Hz.
  325.         df2496(*)
  326.         {
  327.         Run "Resources\svcl.exe /SetDefaultFormat `"DefaultRenderDevice`" 24 96000", , "Hide"
  328.         DefaultFormat.Uncheck "16 Bit, 44100 Hz"
  329.         DefaultFormat.Uncheck "16 Bit, 48000 Hz"
  330.         DefaultFormat.Uncheck "16 Bit, 96000 Hz"
  331.         DefaultFormat.Uncheck "16 Bit, 192000 Hz"
  332.         DefaultFormat.Uncheck "24 Bit, 44100 Hz"
  333.         DefaultFormat.Uncheck "24 Bit, 48000 Hz"
  334.         DefaultFormat.Check "24 Bit, 96000 Hz"
  335.         DefaultFormat.Uncheck "24 Bit, 192000 Hz"
  336.         }
  337.        
  338.     ; Function to set the default format to 24 bit, 192000 Hz.
  339.         df24192(*)
  340.         {
  341.         Run "Resources\svcl.exe /SetDefaultFormat `"DefaultRenderDevice`" 24 192000", , "Hide"
  342.         DefaultFormat.Uncheck "16 Bit, 44100 Hz"
  343.         DefaultFormat.Uncheck "16 Bit, 48000 Hz"
  344.         DefaultFormat.Uncheck "16 Bit, 96000 Hz"
  345.         DefaultFormat.Uncheck "16 Bit, 192000 Hz"
  346.         DefaultFormat.Uncheck "24 Bit, 44100 Hz"
  347.         DefaultFormat.Uncheck "24 Bit, 48000 Hz"
  348.         DefaultFormat.Uncheck "24 Bit, 96000 Hz"
  349.         DefaultFormat.Check "24 Bit, 192000 Hz"
  350.         }
  351.        
  352.     ; Function to reload the Spatial Audio Switcher.
  353.     ; It loads the default settings.
  354.         Restart(*)
  355.         {
  356.         Reload
  357.         }
  358.        
  359.     ; Function to exit the Spatial Audio Switcher.
  360.     ; It loads the default settings first.
  361.         Exit(*)
  362.         {
  363.         Run "Resources\svcl.exe /SetSpatial `"DefaultRenderDevice`" `"Dolby Atmos for Home Theater`"", , "Hide"
  364.         Run "Resources\svcl.exe /SetSpeakersConfig `"DefaultRenderDevice`" 0x63f 0x63f 0x63f", , "Hide"
  365.         Run "Resources\svcl.exe /SetDefaultFormat `"DefaultRenderDevice`" 24 192000", , "Hide"
  366.         Run "Resources\svcl.exe /SetAllowExclusive `"DefaultRenderDevice`" 0", , "Hide"    
  367.         Run "Resources\svcl.exe /Unmute `"DefaultRenderDevice`""
  368.         Sleep 0
  369.         ExitApp
  370.         }
  371.    
  372.         ; Function to mute audio and update checkmark.
  373.         MuteAudio(*)
  374.         {
  375.                 Run "Resources\svcl.exe /Mute `"DefaultRenderDevice`""
  376.                 MuteMenu.Check "Muted"
  377.                 MuteMenu.Uncheck "Unmuted"
  378.                 MuteMenu2.Check "Muted"
  379.                 MuteMenu2.Uncheck "Unmuted"
  380.         }
  381.  
  382.         ; Function to unmute audio and update checkmark.
  383.         UnmuteAudio(*)
  384.         {
  385.                 Run "Resources\svcl.exe /Unmute `"DefaultRenderDevice`""
  386.                 MuteMenu.Uncheck "Muted"
  387.                 MuteMenu.Check "Unmuted"
  388.                 MuteMenu2.Uncheck "Muted"
  389.                 MuteMenu2.Check "Unmuted"
  390.         }
  391.  
  392. ; Now we will populate the menus.
  393.  
  394.     ; First the detailed tray menu. This will open with a right click on the tray icon.
  395.    
  396.         ; First is going to show the current state of spatial audio and change accordingly.
  397.         ; You can open the related app by clicking it.
  398.         Tray.Add "Disabled", Empty
  399.  
  400.         ; Second will be an option to disable spatial audio. Shall be greyed-out
  401.         ; when it is already disabled.
  402.         Tray.Add "&Disable Spatial Audio", Disable
  403.         Tray.SetIcon "&Disable Spatial Audio", "Icons\disable.ico"
  404.         Tray.Disable "&Disable Spatial Audio"
  405.  
  406.         ; A seperator.
  407.         Tray.Add
  408.        
  409.         ; Select submenu.
  410.         Tray.Add "&Spatial Audio", Select
  411.         Select.Add "&Dolby Atmos for Home Theater", DolbyAtmosEnable
  412.         Select.SetIcon "&Dolby Atmos for Home Theater", "Icons\dolby.ico"
  413.         Select.Add "&Dolby Access for Headphones", DolbyAccessEnable
  414.         Select.SetIcon "&Dolby Access for Headphones", "Icons\dah.ico"
  415.  
  416.         ; Settings submenu.
  417.         Tray.Add "&Audio Settings", Settings   
  418.         Settings.Add "&Advanced", Advanced
  419.         Settings.Add "&Modern", Modern
  420.         Settings.Add "&Traditional", Traditional
  421.  
  422.         ; Mute status menu
  423.         MuteMenu := Menu()
  424.         MuteMenu.Add "Muted", MuteAudio
  425.         MuteMenu.Add "Unmuted", UnmuteAudio
  426.         Tray.Add "Muted Status", MuteMenu
  427.  
  428.         ; Configuration submenu.
  429.         Tray.Add "Speaker &Configuration", Configuration
  430.         Configuration.Add "&Stereo", Stereo
  431.         Configuration.Add "&Five-point One", FivePointOne
  432.         Configuration.Add "S&even-point One", SevenPointOne
  433.        
  434.         ; Default Format submenu.
  435.         Tray.Add "Default &Format", DefaultFormat
  436.         DefaultFormat.Add "16 Bit, 44100 Hz", df1644
  437.         DefaultFormat.Add "16 Bit, 48000 Hz", df1648
  438.         DefaultFormat.Add "16 Bit, 96000 Hz", df1696
  439.         DefaultFormat.Add "16 Bit, 192000 Hz", df16192
  440.         DefaultFormat.Add "24 Bit, 44100 Hz", df2444
  441.         DefaultFormat.Add "24 Bit, 48000 Hz", df2448
  442.         DefaultFormat.Add "24 Bit, 96000 Hz", df2496
  443.         DefaultFormat.Add "24 Bit, 192000 Hz", df24192
  444.        
  445.         ; Exclusivity submenu
  446.         Tray.Add "&Exclusivity", Exclusivity
  447.         Exclusivity.Add "&Exclusive", Exclusive
  448.         Exclusivity.Add "&Not Exclusive", NonExclusive
  449.  
  450.         ; Application Volume Mixer.
  451.         Tray.Add "&Volume Mixer", Volume
  452.            
  453.         ; A seperator.
  454.         Tray.Add
  455.        
  456.         ; An item to reload Spatial Audio Switcher
  457.         ; and reset all settings to their default.
  458.         Tray.Add "&Reload", Restart
  459.        
  460.         ; An item to quit Spatial Audio Switcher
  461.         ; and reset all settings to their default.
  462.         Tray.Add "E&xit", Exit
  463.  
  464.     ; Now the simple tray menu. This will open with a left click on the tray icon.
  465.        
  466.         ; First will be an option to disable spatial audio. Shall be greyed-out
  467.         ; when it is already disabled.
  468.         SpatialMenu.Add "&Disable Spatial Audio", Disable
  469.         SpatialMenu.SetIcon "&Disable Spatial Audio", "Icons\disable.ico"
  470.         SpatialMenu.Disable "&Disable Spatial Audio"
  471.    
  472.         ; A seperator.
  473.         SpatialMenu.Add
  474.        
  475.         ; Now the selection between the spatial audio formats.
  476.         SpatialMenu.Add "&Dolby Atmos for Home Theater", DolbyAtmosEnable
  477.         SpatialMenu.SetIcon "&Dolby Atmos for Home Theater", "Icons\dolby.ico"
  478.         SpatialMenu.Add "&Dolby Atmos for Headphones", DolbyAccessEnable
  479.         SpatialMenu.SetIcon "&Dolby Atmos for Headphones", "Icons\dah.ico"
  480.        
  481.         ; A Seperator
  482.         SpatialMenu.Add
  483.        
  484.         ; Speaker configuration. This is important enough to stay
  485.         ; within the simple tray menu.
  486.         SpatialMenu.Add "Speaker &Configuration", Configuration
  487.  
  488.         ; Shortcuts to mute status
  489.         MuteMenu2 := Menu()
  490.         MuteMenu2.Add "Muted", MuteAudio
  491.         MuteMenu2.Add "Unmuted", UnmuteAudio
  492.         SpatialMenu.Add "Muted Status", MuteMenu2
  493.        
  494.         ; Shortcuts to spatial audio applications.
  495.         SpatialMenu.Add "&Applications", SpatialApps
  496.         SpatialApps.Add "&Dolby Access", DolbyAtmosEnable
  497.         SpatialApps.SetIcon "&Dolby Access", "Icons\dolby.ico"
  498.  
  499.         ; Now we will make tray menu show our default settings.
  500.         Exclusivity.Uncheck "&Exclusive"
  501.         Exclusivity.Check "&Not Exclusive"
  502.         Configuration.Uncheck "&Stereo"
  503.         Configuration.Uncheck "&Five-point One"
  504.         Configuration.Check "S&even-point One"
  505.         DefaultFormat.Uncheck "16 Bit, 44100 Hz"
  506.         DefaultFormat.Uncheck "16 Bit, 48000 Hz"
  507.         DefaultFormat.Uncheck "16 Bit, 96000 Hz"
  508.         DefaultFormat.Uncheck "16 Bit, 192000 Hz"
  509.         DefaultFormat.Uncheck "24 Bit, 44100 Hz"
  510.         DefaultFormat.Uncheck "24 Bit, 48000 Hz"
  511.         DefaultFormat.Uncheck "24 Bit, 96000 Hz"
  512.         DefaultFormat.Check "24 Bit, 192000 Hz"
  513.  
  514.         ; Now we will make the simple tray menu the default.
  515.         ; This is needed to open it with one left click to the tray icon.
  516.         Tray.Add
  517.         Tray.Add "Spatial Audio Switcher", Spatial
  518.         Tray.Default := "Spatial Audio Switcher"
  519.         Tray.Disable "Spatial Audio Switcher"
  520.         Tray.ClickCount := 1
  521.                        
  522.         ; Update active state to Dolby Atmos for Home Theater
  523.         DolbyAtmosEnable()
  524.  
  525.         ; Update active state to Unmuted - addresses Windows randomly muting my devices
  526.         StartUnmuted()
  527.  
  528.         ; Windows + Alt + S shortcut can be used to open
  529.         ; the simple tray menu below the mouse pointer.
  530.         #!s::SpatialMenu.Show
  531.  
  532.         ;
  533.         ; END
  534.         ;
  535.        
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement