Advertisement
PoliteMaster

Some (free) tools I use for streaming

Feb 5th, 2016
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.66 KB | None | 0 0
  1. PoliteMaster
  2. Last updated on February 5, 2016
  3.  
  4. Some (free) tools I use for streaming:
  5.  
  6. 1) AutoHotKey, a macro/scripting language for Windows (https://autohotkey.com/)
  7. - I use the installer version (https://autohotkey.com/download/ahk-install.exe), but a portable, standalone .exe is available.
  8. - After installing, you can run (double-click on) .ahk scripts without compiling (an icon will appear in your notification area)
  9. - Use a plain text editor to create and edit scripts. Notepad++ (https://notepad-plus-plus.org/) can be extended to color-code and highlight AHK syntax (https://autohotkey.com/boards/viewtopic.php?f=7&t=50)
  10. - You can change hotkeys in the script to ones you find convenient: https://autohotkey.com/docs/KeyList.htm
  11. - Beginner's scripting guide: https://autohotkey.com/docs/Tutorial.htm
  12. - Tip: If you have a reprogrammable keyboard, you can also assign macro- and useless keys (like CapsLock) to something else
  13.  
  14. Scripts have the following format:
  15. ;Lines that start with a semi-colon are comments to describe what is going on (or are extra code). They will be ignored when a script runs.
  16. HOTKEY:: Lines that end with a double-colon assign a hotkey (left of the double-colon) to the subroutine in the lines that follow.
  17. Functions in subroutines have parameters that might need to be changed per computer. A Google search for a given function (i.e. autohotkey soundset) will yield details about it.
  18. White-space (line breaks, tabs, extra spaces) are generally ignored and can be used to separate parts of a script.
  19.  
  20. 2) Window Layout Manger, a window organizer for Windows (http://www.stefandidak.com/windows-layout-manager/)
  21. - This software allows you to predefine the position, size, and state of all your windowed applications and change layouts on the fly.
  22.  
  23. 3) AquaSnap, for improved alignment, stretching, and tiling of windows
  24. - Unlike Window Layout Manger, AquaSnap lets you (relatively) position windows without a predefined layout.
  25.  
  26. 4) padpyght, a controller input display (https://github.com/lifning/padpyght/releases)
  27. - Although this program only comes with one SNES controller skin, you can modify it or create your own assets in an image editing program (like Adobe Photoshop or GIMP). You can even change the layout and position of buttons via the config file.
  28.  
  29. ----------
  30. How to unmute/mute your microphone with AutoHotKey:
  31. 1) Add the 2 subroutines, Unmute Microphone and Mute Microphone, to your AutoHotKey script (in Notepad or Notepad++).
  32. 2) In the Windows Mixer, change your microphone's volume to an arbitrary value that stands out (e.g. 36).
  33. 3) Copy and paste the Soundcard Analysis.ahk script (below) into your text editor and save. Run Soundcard Analysis.ahk.
  34. 4) Find the Mixer Number (under "Mixer" column) for your microphone. You can easily spot your microphone amongst all the devices by looking for its volume (i.e. 36).
  35. 5) For the "SoundSet" function in both subroutines, replace the "4" (last number) with your own Mixer Number.
  36. 6) Run the script and press your hotkeys.
  37.  
  38. How to add a microphone icon to your Open Broadcaster Software layout:
  39. 1) Find/create two pictures, one for mic unmuted (On.png) and one for mic muted (Off.png)
  40. 2) Copy either one of these pictures and rename the copy (Current.png).
  41. 3) Add Current.png to your OBS scene:
  42. Right-click in the Sources box > Add > Image > Name the source > Browse for Current.png and tick "Check for file changes"
  43. 4) If you haven't already, add the 2 subroutines, Unmute Microphone and Mute Microphone, to your AutoHotKey script (in Notepad or Notepad++).
  44. 5) For both subroutines, uncomment (remove the preceding semi-colon) before the FileCopy function.
  45. 6) For the FileCopy function in both subroutines, change the source locations (C:\Example\On.png and C:\Example\Off.png) and destination location (C:\Example\Current.png) to the actual locations of the pictures on your computer.
  46. 7) Run the script and press your hotkeys.
  47.  
  48. Every time you press the unmute hotkey, AHK will both unmute your microphone and overwrite Current.png with On.png. This will also happen for the mute hotkey, muting your microphone, and Off.png. OBS will independently update your layout with the current version of Current.png.
  49.  
  50.  
  51.  
  52. How to remove/restore the borders from windows:
  53. 1) Add the 2 subroutines, Remove Borders and Restore Borders, to your AutoHotKey script (in Notepad or Notepad++).
  54. 2) Run the script.
  55. 3) Focus the window you'd like to change (left-click on it) and press your hotkeys.
  56.  
  57. Note that not all windows behave well with this function. Applications like Mozilla Firefox, which use a unique shell design, will look very odd without borders. Other applications, like Notepad++, require a bit of adjustment after removing their border. The most notable adjustment is simply dragging the bottom-right corner of the window so that the window recognizes its new size. You may also need to open a new tab (like in Notepad++) to fix the window. While streaming, I only make my emulators, OBS, and Notepad++ borderless.
  58.  
  59. If you make something borderless that you did not intend (or if a window is not working out), you can 1) use Restore Border, 2) re-open the application, 3) reboot your computer. In the case of accidentally clicking on a Windows Explorer element (like the Start menu), Restore Border should fix it. If it doesn't, you can re-open Windows Explorer by first terminating explorer.exe in Task Manger, pressing Win+R, and running "explorer.exe".
  60.  
  61.  
  62.  
  63. ----------
  64. Here is my script. Subroutines are separated into paragraphs.
  65. Copy and paste the entire script (or just paragraphs you like; always keep the first paragraph beginning with #NoEnv...) into a text editor like Notepad or Notepad++. Change hotkeys to your liking (and any parameters mentioned in comments) and save as an .ahk file.
  66.  
  67. #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
  68. ; #Warn ; Enable warnings to assist with detecting common errors.
  69. SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
  70. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
  71.  
  72. ;Unmute Microphone
  73. ;Run Soundcard Analysis.ahk. Determine the Mixer Number for your device and replace the "4" (last number) in "SoundSet" below.
  74. !NumpadDiv::
  75. SoundSet, 0, MASTER, MUTE, 4
  76. ;The line below copies a file from the left location to the right location (and overwrites any exsiting file at the destination).
  77. ;FileCopy, C:\Example\On.png, C:Example\Current.png, 1
  78. return
  79. ;
  80.  
  81. ;Mute Microphone
  82. ;Run Soundcard Analysis.ahk. Determine the Mixer Number for your device and replace the "4" (last number) in "SoundSet" below.
  83. !NumpadMult::
  84. SoundSet, 1, MASTER, MUTE, 4
  85. ;The line below copies a file from the left location to the right location (and overwrites any exsiting file at the destination)
  86. ;FileCopy, C:\Example\Off.png, C:\Example\Current.png, 1
  87. return
  88. ;
  89.  
  90. ;Remove Borders
  91. LWIN & LButton::
  92. WinSet, Style, -0xC00000, A
  93. WinSet, Style, -0x40000, A
  94. return
  95. ;
  96.  
  97. ;Restore Borders
  98. LWIN & RButton::
  99. WinSet, Style, +0xC00000, A
  100. WinSet , Style, +0x40000, A
  101. return
  102. ;
  103.  
  104.  
  105.  
  106. ----------
  107. Soundcard Analysis.ahk
  108.  
  109. SetBatchLines -1
  110. SplashTextOn,,, Gathering Soundcard Info...
  111.  
  112. ; Most of the pure numbers below probably don't exist in any mixer, but they're queried for completeness.
  113. ; The numbers correspond to the following items (in order): CUSTOM, BOOLEANMETER, SIGNEDMETER, PEAKMETER,
  114. ; UNSIGNEDMETER, BOOLEAN, BUTTON, DECIBELS, SIGNED, UNSIGNED, PERCENT, SLIDER, FADER, SINGLESELECT, MUX,
  115. ; MULTIPLESELECT, MIXER, MICROTIME, MILLITIME
  116. ControlTypes = VOLUME,ONOFF,MUTE,MONO,LOUDNESS,STEREOENH,BASSBOOST,PAN,QSOUNDPAN,BASS,TREBLE,EQUALIZER,0x00000000, 0x10010000,0x10020000,0x10020001,0x10030000,0x20010000,0x21010000,0x30040000,0x30020000,0x30030000,0x30050000,0x40020000,0x50030000,0x70010000,0x70010001,0x71010000,0x71010001,0x60030000,0x61030000
  117.  
  118. ComponentTypes = MASTER,HEADPHONES,DIGITAL,LINE,MICROPHONE,SYNTH,CD,TELEPHONE,PCSPEAKER,WAVE,AUX,ANALOG,N/A
  119.  
  120. ; Create a ListView and prepare for the main loop:
  121. Gui, Add, Listview, w400 h400 vMyListView, Component Type|Control Type|Setting|Mixer
  122. LV_ModifyCol(4, "Integer")
  123. SetFormat, Float, 0.2 ; Limit number of decimal places in percentages to two.
  124.  
  125. Loop ; For each mixer number that exists in the system, query its capabilities.
  126. {
  127. CurrMixer := A_Index
  128. SoundGet, Setting,,, %CurrMixer%
  129. if ErrorLevel = Can't Open Specified Mixer ; Any error other than this indicates that the mixer exists.
  130. break
  131.  
  132. ; For each component type that exists in this mixer, query its instances and control types:
  133. Loop, parse, ComponentTypes, `,
  134. {
  135. CurrComponent := A_LoopField
  136. ; First check if this component type even exists in the mixer:
  137. SoundGet, Setting, %CurrComponent%,, %CurrMixer%
  138. if ErrorLevel = Mixer Doesn't Support This Component Type
  139. continue ; Start a new iteration to move on to the next component type.
  140. Loop ; For each instance of this component type, query its control types.
  141. {
  142. CurrInstance := A_Index
  143. ; First check if this instance of this instance even exists in the mixer:
  144. SoundGet, Setting, %CurrComponent%:%CurrInstance%,, %CurrMixer%
  145. ; Checking for both of the following errors allows this script to run on older versions:
  146. if ErrorLevel in Mixer Doesn't Have That Many of That Component Type,Invalid Control Type or Component Type
  147. break ; No more instances of this component type.
  148. ; Get the current setting of each control type that exists in this instance of this component:
  149. Loop, parse, ControlTypes, `,
  150. {
  151. CurrControl := A_LoopField
  152. SoundGet, Setting, %CurrComponent%:%CurrInstance%, %CurrControl%, %CurrMixer%
  153. ; Checking for both of the following errors allows this script to run on older versions:
  154. if ErrorLevel in Component Doesn't Support This Control Type,Invalid Control Type or Component Type
  155. continue
  156. if ErrorLevel ; Some other error, which is unexpected so show it in the results.
  157. Setting := ErrorLevel
  158. ComponentString := CurrComponent
  159. if CurrInstance > 1
  160. ComponentString = %ComponentString%:%CurrInstance%
  161. LV_Add("", ComponentString, CurrControl, Setting, CurrMixer)
  162. } ; For each control type.
  163. } ; For each component instance.
  164. } ; For each component type.
  165. } ; For each mixer.
  166.  
  167. Loop % LV_GetCount("Col") ; Auto-size each column to fit its contents.
  168. LV_ModifyCol(A_Index, "AutoHdr")
  169.  
  170. SplashTextOff
  171. Gui, Show
  172. return
  173.  
  174. GuiClose:
  175. ExitApp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement