Added NirCmd and Volume Controls
This commit is contained in:
parent
9bb1b526ed
commit
86d4eee402
|
@ -1,2 +1,4 @@
|
||||||
|
/.vs
|
||||||
*.bak
|
*.bak
|
||||||
*.ini
|
MidiToMacro.ini
|
||||||
|
/SOURCE
|
|
@ -0,0 +1,20 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Define the Steam library path (use double backslashes for Windows paths)
|
||||||
|
STEAM_LIBRARY_PATH="D:\\SteamLibrary\\steamapps\\common"
|
||||||
|
|
||||||
|
# Define the output file
|
||||||
|
OUTPUT_FILE="game_exe_list.txt"
|
||||||
|
|
||||||
|
# Clear the output file if it exists
|
||||||
|
> "$OUTPUT_FILE"
|
||||||
|
|
||||||
|
# Loop through each game directory
|
||||||
|
for game_dir in "$STEAM_LIBRARY_PATH"/*; do
|
||||||
|
if [ -d "$game_dir" ]; then
|
||||||
|
# Find all .exe files (case-insensitive) and print only the filenames exactly as they appear
|
||||||
|
find "$game_dir" -type f -iname "*.exe" -exec basename {} \; >> "$OUTPUT_FILE"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Game executable list saved to $OUTPUT_FILE"
|
|
@ -13,36 +13,50 @@ ProcessNote(device, channel, note, velocity, isNoteOn) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ProcessCC(device, channel, cc, value) {
|
ProcessCC(device, channel, cc, value) {
|
||||||
if (cc = 21 or cc = 29) {
|
|
||||||
scaled_value := ConvertCCValueToScale(value, 0, 127)
|
;*************************************************
|
||||||
vol := scaled_value * 100
|
;* Rotary Knob 1 (Master Volume Control) *
|
||||||
SoundSet, vol
|
;*************************************************
|
||||||
|
|
||||||
|
if (cc = 21) {
|
||||||
|
scaled_value := ConvertCCValueToScale(value, 7, 120)
|
||||||
|
vol := Round(scaled_value * 100) ; Scale to percentage
|
||||||
|
SoundSet, vol, MASTER
|
||||||
|
; Minimizing feedback to optimize speed
|
||||||
DisplayOutput("Volume", vol)
|
DisplayOutput("Volume", vol)
|
||||||
} else if (cc = 51) {
|
}
|
||||||
Send {Volume_Mute}
|
|
||||||
DisplayOutput("Volume", "Mute")
|
if (cc = 0 and value = 1) {
|
||||||
} else if (cc = 52 and value != 0) {
|
SoundSet, 1, MASTER, MUTE ; Unmute
|
||||||
Send {Volume_Down}
|
DisplayOutput("Volume Unmuted", "")
|
||||||
DisplayOutput("Volume", "Down")
|
} else if (cc = 0 and value = 0) {
|
||||||
} else if (cc = 53 and value != 0) {
|
SoundSet, 0, MASTER, MUTE ; Mute
|
||||||
Send {Volume_Up}
|
DisplayOutput("Volume Muted", "")
|
||||||
DisplayOutput("Volume", "Up")
|
}
|
||||||
} else if (cc = 54 and value != 0) {
|
|
||||||
Send {Media_Play_Pause}
|
;*************************************************
|
||||||
DisplayOutput("Media", "Play/Pause")
|
;* Rotary Knob 2 (Mozilla Firefox Volume Control)*
|
||||||
} else if (cc = 55 and value != 0) {
|
;*************************************************
|
||||||
Send {Media_Stop}
|
|
||||||
DisplayOutput("Media", "Stop")
|
if (cc = 22) {
|
||||||
} else if (cc = 56 and value != 0) {
|
scaled_value := ConvertCCValueToScale(value, 7, 120)
|
||||||
Send {Media_Prev}
|
vol := Round(scaled_value, 2) ; Scale to the range used by nircmd
|
||||||
DisplayOutput("Media", "Previous")
|
; Adjust Firefox volume using nircmd
|
||||||
} else if (cc = 57 and value != 0) {
|
Run, nircmd setappvolume firefox.exe %vol%
|
||||||
Send {Media_Next}
|
; Minimizing feedback to optimize speed
|
||||||
DisplayOutput("Media", "Next")
|
scaled_value := ConvertCCValueToScale(vol, 0, 127)
|
||||||
} else if (cc = 58 and value != 0) {
|
percentage := Round(vol * 100) ; Scale to percentage
|
||||||
; Place a cue marker in Sound Forge 9
|
DisplayOutput("Firefox Volume", percentage)
|
||||||
ControlSend, , {Alt down}m{Alt up}, ahk_class #32770
|
}
|
||||||
DisplayOutput("Sound Forge", "Place Cue Marker")
|
|
||||||
|
if (cc = 1 and value = 1) {
|
||||||
|
; Mute Mozilla Firefox
|
||||||
|
Run, nircmd muteappvolume firefox.exe 1
|
||||||
|
DisplayOutput("Firefox Muted", "")
|
||||||
|
} else if (cc = 1 and value = 0) {
|
||||||
|
; Unmute Mozilla Firefox
|
||||||
|
Run, nircmd muteappvolume firefox.exe 0
|
||||||
|
DisplayOutput("Firefox Unmuted", "")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -0,0 +1,89 @@
|
||||||
|
# MidiToMacro
|
||||||
|
|
||||||
|
This is an AutoHotKey script for Windows, to map MIDI input values to hotkeys or macros.
|
||||||
|
|
||||||
|
You can use this script to bind CC messages to media keys (play/pause/next), volume sliders, or unusual keyboard combinations (ctrl+shift+alt+F13) which you can assign in programs like StreamLabs OBS.
|
||||||
|
|
||||||
|
It's cobbled together from scripts found on the AHK forums. It originally supported mapping MIDI inputs to a virtual joystick using vJoy, and to MIDI outputs; this functionality has been removed. All credit goes to the original authors.
|
||||||
|
|
||||||
|
## Running
|
||||||
|
|
||||||
|
Double click on `MidiToMacro.ahk`.
|
||||||
|
|
||||||
|
To launch the program when Windows starts, you can add a shortcut to the file in your Start Menu\Startup folder.
|
||||||
|
|
||||||
|
The first time you launch the script, you will be prompted to choose a MIDI input device. If you need to change it later, you can right click on the system tray icon and click `MidiSet`. Or, you can open the `MidiMon`, and change the input in the "Midi Input" dropdown menu; the script will automatically reload.
|
||||||
|
|
||||||
|
To see a log of recent MIDI input messages and any output events, right click on the system tray icon and click `MidiMon`. You can close this window, and the script will keep running in the background.
|
||||||
|
|
||||||
|
## Adding rules
|
||||||
|
|
||||||
|
You can add rules to the file `MidiRules.ahk`.
|
||||||
|
|
||||||
|
There are four handler functions you can modify:
|
||||||
|
|
||||||
|
- `ProcessNote`: handles note on/off events
|
||||||
|
- `ProcessCC`: handles CC (Control Change, or Continuous Control) events
|
||||||
|
- `ProcessPC`: handles patch change events
|
||||||
|
- `ProcessPitchBend`: handle pitch bend events
|
||||||
|
|
||||||
|
Within each function, you can have a series of `if/else` blocks.
|
||||||
|
|
||||||
|
```
|
||||||
|
if (cc = 21) {
|
||||||
|
; ...
|
||||||
|
} else if (cc = 51) {
|
||||||
|
; ...
|
||||||
|
} else if (cc = 52 and value != 0) {
|
||||||
|
; ...
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
A rule to toggle the mute button when receiving CC 51 might look like this:
|
||||||
|
|
||||||
|
```
|
||||||
|
if (cc = 51) {
|
||||||
|
Send {Volume_Mute}
|
||||||
|
DisplayOutput("Volume", "Mute")
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
`Send {Volume_Mute}` simulates pressing the "mute" button on your keyboard. `DisplayOutput("Volume", "Mute")` logs a message to the MidiMon GUI.
|
||||||
|
|
||||||
|
A rule to press the play/pause button might look like this:
|
||||||
|
|
||||||
|
```
|
||||||
|
if (cc = 54 and value != 0) {
|
||||||
|
Send {Media_Play_Pause}
|
||||||
|
DisplayOutput("Media", "Play/Pause")
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
`value != 0` lets us detect button presses, and ignores button releases, on our MIDI controller. (Without this clause, we'd send the keyboard macro twice; once for the button press, and agin for the button release.)
|
||||||
|
|
||||||
|
Here's a rule to map a continuous control from a slider to the main Windows mixer volume:
|
||||||
|
|
||||||
|
```
|
||||||
|
if (cc = 21 or cc = 29) {
|
||||||
|
scaled_value := ConvertCCValueToScale(value, 0, 127)
|
||||||
|
vol := scaled_value * 100
|
||||||
|
SoundSet, vol
|
||||||
|
DisplayOutput("Volume", vol)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
`ConvertCCValueToScale` is a utility function from `CommonFunctions.ahk`. It converts a value within a give range into a floating point number between 0 and 1.
|
||||||
|
|
||||||
|
Here's a rule to trigger a keyboard shortcut in a specific application; in this example, Sound Forge 9:
|
||||||
|
|
||||||
|
```
|
||||||
|
if (cc = 58 and value != 0) {
|
||||||
|
; Place a cue marker in Sound Forge 9
|
||||||
|
ControlSend, , {Alt down}m{Alt up}, ahk_class #32770
|
||||||
|
DisplayOutput("Sound Forge", "Place Cue Marker")
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
You can use AutoHotKey's "WindowSpy" script to identify windows, or controls within an application, for use with `ahk_class`.
|
||||||
|
|
||||||
|
You can find [a list of standard CC messages online](https://www.midi.org/specifications-old/item/table-3-control-change-messages-data-bytes-2). You could use any control number without a specified control function, including numbers between 20-31, 52-63, and 102-119. But, any control number should work fine.
|
Binary file not shown.
After Width: | Height: | Size: 3.3 KiB |
|
@ -0,0 +1,153 @@
|
||||||
|
BatmanAK.exe
|
||||||
|
pbsvc.exe
|
||||||
|
Cities.exe
|
||||||
|
dowser.exe
|
||||||
|
mono.exe
|
||||||
|
al.exe
|
||||||
|
booc.exe
|
||||||
|
csharp.exe
|
||||||
|
gacutil.exe
|
||||||
|
gmcs.exe
|
||||||
|
httpcfg.exe
|
||||||
|
ilasm.exe
|
||||||
|
installutil.exe
|
||||||
|
lc.exe
|
||||||
|
mconfig.exe
|
||||||
|
mdoc.exe
|
||||||
|
mkbundle.exe
|
||||||
|
mono-api-info.exe
|
||||||
|
mono-service.exe
|
||||||
|
mono-shlib-cop.exe
|
||||||
|
mono-xmltool.exe
|
||||||
|
monolinker.exe
|
||||||
|
monop.exe
|
||||||
|
nunit-console.exe
|
||||||
|
pdb2mdb.exe
|
||||||
|
RabbitMQ.Client.Apigen.exe
|
||||||
|
resgen.exe
|
||||||
|
sgen.exe
|
||||||
|
sqlmetal.exe
|
||||||
|
sqlsharp.exe
|
||||||
|
svcutil.exe
|
||||||
|
us.exe
|
||||||
|
wsdl.exe
|
||||||
|
xbuild.exe
|
||||||
|
xsd.exe
|
||||||
|
booc.exe
|
||||||
|
smcs.exe
|
||||||
|
us.exe
|
||||||
|
booc.exe
|
||||||
|
smcs.exe
|
||||||
|
us.exe
|
||||||
|
Dungeon Alchemist.exe
|
||||||
|
ffmpeg.exe
|
||||||
|
UnityCrashHandler64.exe
|
||||||
|
f1_res_Config.exe
|
||||||
|
f1_res_patcher.exe
|
||||||
|
Fallout1_High_Resolution_Patch_4.1.8.exe
|
||||||
|
FalloutLauncher.exe
|
||||||
|
FALLOUTW.EXE
|
||||||
|
falloutwHR.exe
|
||||||
|
f2_res_Config.exe
|
||||||
|
f2_res_patcher.exe
|
||||||
|
fallout2.exe
|
||||||
|
fallout2HR.exe
|
||||||
|
Fallout2Launcher.exe
|
||||||
|
Fallout2_High_Resolution_Patch_4.1.8.exe
|
||||||
|
FalloutClient.exe
|
||||||
|
FalloutNV.exe
|
||||||
|
FalloutNVLauncher.exe
|
||||||
|
FalloutNV_backup.exe
|
||||||
|
FNVpatch.exe
|
||||||
|
nvse_loader.exe
|
||||||
|
DXSETUP.exe
|
||||||
|
vcredist_x86.exe
|
||||||
|
crs-handler.exe
|
||||||
|
helldivers2.exe
|
||||||
|
GGSetup.exe
|
||||||
|
gguninst.exe
|
||||||
|
ffmpeg.exe
|
||||||
|
ffprobe.exe
|
||||||
|
krita.exe
|
||||||
|
kritarunner.exe
|
||||||
|
CrashReportClient.exe
|
||||||
|
EpicWebHelper.exe
|
||||||
|
Palworld-Win64-Shipping.exe
|
||||||
|
Palworld.exe
|
||||||
|
BEService_x64.exe
|
||||||
|
CrashUploader.exe
|
||||||
|
LaunchPad.exe
|
||||||
|
GameLauncherCefChildProcess.exe
|
||||||
|
wws_crashreport_uploader.exe
|
||||||
|
PlanetSide2_x64.exe
|
||||||
|
PlanetSide2_x64_BE.exe
|
||||||
|
Uninstaller.exe
|
||||||
|
wws_crashreport_uploader.exe
|
||||||
|
jabswitch.exe
|
||||||
|
jaccessinspector-32.exe
|
||||||
|
jaccessinspector.exe
|
||||||
|
jaccesswalker-32.exe
|
||||||
|
jaccesswalker.exe
|
||||||
|
java.exe
|
||||||
|
javaw.exe
|
||||||
|
jfr.exe
|
||||||
|
jrunscript.exe
|
||||||
|
keytool.exe
|
||||||
|
kinit.exe
|
||||||
|
klist.exe
|
||||||
|
ktab.exe
|
||||||
|
rmiregistry.exe
|
||||||
|
jabswitch.exe
|
||||||
|
jaccessinspector.exe
|
||||||
|
jaccesswalker.exe
|
||||||
|
java.exe
|
||||||
|
javaw.exe
|
||||||
|
jfr.exe
|
||||||
|
jrunscript.exe
|
||||||
|
keytool.exe
|
||||||
|
kinit.exe
|
||||||
|
klist.exe
|
||||||
|
ktab.exe
|
||||||
|
rmiregistry.exe
|
||||||
|
ProjectZomboid32.exe
|
||||||
|
ProjectZomboid64.exe
|
||||||
|
mist.exe
|
||||||
|
retroarch.exe
|
||||||
|
RCT.EXE
|
||||||
|
Autorun.exe
|
||||||
|
ddhelp.exe
|
||||||
|
dplaysvr.exe
|
||||||
|
dxinfo.exe
|
||||||
|
dxsetup.exe
|
||||||
|
dxtool.exe
|
||||||
|
AcroReader51_ENU.exe
|
||||||
|
setup.exe
|
||||||
|
SkullGirls.exe
|
||||||
|
AutoReporter.exe
|
||||||
|
FlashInstallWrapper.exe
|
||||||
|
flashplayer_10_3r183_90_win.exe
|
||||||
|
ProxyInstallShield.exe
|
||||||
|
SetupPatcherFix.exe
|
||||||
|
UE3Redist_vs2010.exe
|
||||||
|
UE3Redist_vs2012.exe
|
||||||
|
CoherentUI_Host.exe
|
||||||
|
ShippingPC-BattleGame.exe
|
||||||
|
SmiteEAC.exe
|
||||||
|
CoherentUI_Host.exe
|
||||||
|
ShippingPC-BattleGame.exe
|
||||||
|
Smite.exe
|
||||||
|
SmiteEAC.exe
|
||||||
|
EasyAntiCheat_EOS_Setup.exe
|
||||||
|
SmiteBootstrapper.exe
|
||||||
|
SmiteEAC64.exe
|
||||||
|
Launcher.exe
|
||||||
|
DXSETUP.exe
|
||||||
|
sonic2app.exe
|
||||||
|
Typefighters.exe
|
||||||
|
DAEMON.exe
|
||||||
|
UnityCrashHandler64.exe
|
||||||
|
UnityCrashHandler64.exe
|
||||||
|
WhosLila.exe
|
||||||
|
YourOnlyMoveIsHUSTLE.exe
|
||||||
|
masterduel.exe
|
||||||
|
UnityCrashHandler64.exe
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user