Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PoliteMaster
- Last updated on February 5, 2016
- Some (free) tools I use for streaming:
- 1) AutoHotKey, a macro/scripting language for Windows (https://autohotkey.com/)
- - I use the installer version (https://autohotkey.com/download/ahk-install.exe), but a portable, standalone .exe is available.
- - After installing, you can run (double-click on) .ahk scripts without compiling (an icon will appear in your notification area)
- - 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)
- - You can change hotkeys in the script to ones you find convenient: https://autohotkey.com/docs/KeyList.htm
- - Beginner's scripting guide: https://autohotkey.com/docs/Tutorial.htm
- - Tip: If you have a reprogrammable keyboard, you can also assign macro- and useless keys (like CapsLock) to something else
- Scripts have the following format:
- ;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.
- HOTKEY:: Lines that end with a double-colon assign a hotkey (left of the double-colon) to the subroutine in the lines that follow.
- 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.
- White-space (line breaks, tabs, extra spaces) are generally ignored and can be used to separate parts of a script.
- 2) Window Layout Manger, a window organizer for Windows (http://www.stefandidak.com/windows-layout-manager/)
- - This software allows you to predefine the position, size, and state of all your windowed applications and change layouts on the fly.
- 3) AquaSnap, for improved alignment, stretching, and tiling of windows
- - Unlike Window Layout Manger, AquaSnap lets you (relatively) position windows without a predefined layout.
- 4) padpyght, a controller input display (https://github.com/lifning/padpyght/releases)
- - 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.
- ----------
- How to unmute/mute your microphone with AutoHotKey:
- 1) Add the 2 subroutines, Unmute Microphone and Mute Microphone, to your AutoHotKey script (in Notepad or Notepad++).
- 2) In the Windows Mixer, change your microphone's volume to an arbitrary value that stands out (e.g. 36).
- 3) Copy and paste the Soundcard Analysis.ahk script (below) into your text editor and save. Run Soundcard Analysis.ahk.
- 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).
- 5) For the "SoundSet" function in both subroutines, replace the "4" (last number) with your own Mixer Number.
- 6) Run the script and press your hotkeys.
- How to add a microphone icon to your Open Broadcaster Software layout:
- 1) Find/create two pictures, one for mic unmuted (On.png) and one for mic muted (Off.png)
- 2) Copy either one of these pictures and rename the copy (Current.png).
- 3) Add Current.png to your OBS scene:
- Right-click in the Sources box > Add > Image > Name the source > Browse for Current.png and tick "Check for file changes"
- 4) If you haven't already, add the 2 subroutines, Unmute Microphone and Mute Microphone, to your AutoHotKey script (in Notepad or Notepad++).
- 5) For both subroutines, uncomment (remove the preceding semi-colon) before the FileCopy function.
- 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.
- 7) Run the script and press your hotkeys.
- 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.
- How to remove/restore the borders from windows:
- 1) Add the 2 subroutines, Remove Borders and Restore Borders, to your AutoHotKey script (in Notepad or Notepad++).
- 2) Run the script.
- 3) Focus the window you'd like to change (left-click on it) and press your hotkeys.
- 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.
- 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".
- ----------
- Here is my script. Subroutines are separated into paragraphs.
- 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.
- #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
- ; #Warn ; Enable warnings to assist with detecting common errors.
- SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
- SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
- ;Unmute Microphone
- ;Run Soundcard Analysis.ahk. Determine the Mixer Number for your device and replace the "4" (last number) in "SoundSet" below.
- !NumpadDiv::
- SoundSet, 0, MASTER, MUTE, 4
- ;The line below copies a file from the left location to the right location (and overwrites any exsiting file at the destination).
- ;FileCopy, C:\Example\On.png, C:Example\Current.png, 1
- return
- ;
- ;Mute Microphone
- ;Run Soundcard Analysis.ahk. Determine the Mixer Number for your device and replace the "4" (last number) in "SoundSet" below.
- !NumpadMult::
- SoundSet, 1, MASTER, MUTE, 4
- ;The line below copies a file from the left location to the right location (and overwrites any exsiting file at the destination)
- ;FileCopy, C:\Example\Off.png, C:\Example\Current.png, 1
- return
- ;
- ;Remove Borders
- LWIN & LButton::
- WinSet, Style, -0xC00000, A
- WinSet, Style, -0x40000, A
- return
- ;
- ;Restore Borders
- LWIN & RButton::
- WinSet, Style, +0xC00000, A
- WinSet , Style, +0x40000, A
- return
- ;
- ----------
- Soundcard Analysis.ahk
- SetBatchLines -1
- SplashTextOn,,, Gathering Soundcard Info...
- ; Most of the pure numbers below probably don't exist in any mixer, but they're queried for completeness.
- ; The numbers correspond to the following items (in order): CUSTOM, BOOLEANMETER, SIGNEDMETER, PEAKMETER,
- ; UNSIGNEDMETER, BOOLEAN, BUTTON, DECIBELS, SIGNED, UNSIGNED, PERCENT, SLIDER, FADER, SINGLESELECT, MUX,
- ; MULTIPLESELECT, MIXER, MICROTIME, MILLITIME
- 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
- ComponentTypes = MASTER,HEADPHONES,DIGITAL,LINE,MICROPHONE,SYNTH,CD,TELEPHONE,PCSPEAKER,WAVE,AUX,ANALOG,N/A
- ; Create a ListView and prepare for the main loop:
- Gui, Add, Listview, w400 h400 vMyListView, Component Type|Control Type|Setting|Mixer
- LV_ModifyCol(4, "Integer")
- SetFormat, Float, 0.2 ; Limit number of decimal places in percentages to two.
- Loop ; For each mixer number that exists in the system, query its capabilities.
- {
- CurrMixer := A_Index
- SoundGet, Setting,,, %CurrMixer%
- if ErrorLevel = Can't Open Specified Mixer ; Any error other than this indicates that the mixer exists.
- break
- ; For each component type that exists in this mixer, query its instances and control types:
- Loop, parse, ComponentTypes, `,
- {
- CurrComponent := A_LoopField
- ; First check if this component type even exists in the mixer:
- SoundGet, Setting, %CurrComponent%,, %CurrMixer%
- if ErrorLevel = Mixer Doesn't Support This Component Type
- continue ; Start a new iteration to move on to the next component type.
- Loop ; For each instance of this component type, query its control types.
- {
- CurrInstance := A_Index
- ; First check if this instance of this instance even exists in the mixer:
- SoundGet, Setting, %CurrComponent%:%CurrInstance%,, %CurrMixer%
- ; Checking for both of the following errors allows this script to run on older versions:
- if ErrorLevel in Mixer Doesn't Have That Many of That Component Type,Invalid Control Type or Component Type
- break ; No more instances of this component type.
- ; Get the current setting of each control type that exists in this instance of this component:
- Loop, parse, ControlTypes, `,
- {
- CurrControl := A_LoopField
- SoundGet, Setting, %CurrComponent%:%CurrInstance%, %CurrControl%, %CurrMixer%
- ; Checking for both of the following errors allows this script to run on older versions:
- if ErrorLevel in Component Doesn't Support This Control Type,Invalid Control Type or Component Type
- continue
- if ErrorLevel ; Some other error, which is unexpected so show it in the results.
- Setting := ErrorLevel
- ComponentString := CurrComponent
- if CurrInstance > 1
- ComponentString = %ComponentString%:%CurrInstance%
- LV_Add("", ComponentString, CurrControl, Setting, CurrMixer)
- } ; For each control type.
- } ; For each component instance.
- } ; For each component type.
- } ; For each mixer.
- Loop % LV_GetCount("Col") ; Auto-size each column to fit its contents.
- LV_ModifyCol(A_Index, "AutoHdr")
- SplashTextOff
- Gui, Show
- return
- GuiClose:
- ExitApp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement