Compare commits

...

2 Commits

Author SHA1 Message Date
unknown 86d4eee402 Added NirCmd and Volume Controls 2024-08-03 15:59:56 -04:00
unknown 9bb1b526ed Ignore Timing Clock messages 2024-08-03 15:49:07 -04:00
10 changed files with 339 additions and 55 deletions

4
.gitignore vendored
View File

@ -1,2 +1,4 @@
/.vs
*.bak
*.ini
MidiToMacro.ini
/SOURCE

20
GetSteamGamesList.sh Normal file
View File

@ -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"

View File

@ -42,41 +42,47 @@ Return
;*************************************************
ShowMidiInMessage: ; update the midimonitor gui
Gui,14:default
Gui,14:ListView, In1 ; see the first listview midi in monitor
LV_Add("",stb,statusbyte,chan,byte1,byte2)
LV_ModifyCol(1,"center")
LV_ModifyCol(2,"center")
LV_ModifyCol(3,"center")
LV_ModifyCol(4,"center")
LV_ModifyCol(5,"center")
If (LV_GetCount() > 10)
{
LV_Delete(1)
}
if (statusbyte == 248) ; Ignore Timing Clock messages
return
Gui,14:default
Gui,14:ListView, In1 ; see the first listview midi in monitor
LV_Add("",stb,statusbyte,chan,byte1,byte2)
LV_ModifyCol(1,"center")
LV_ModifyCol(2,"center")
LV_ModifyCol(3,"center")
LV_ModifyCol(4,"center")
LV_ModifyCol(5,"center")
If (LV_GetCount() > 10)
{
LV_Delete(1)
}
return
;*************************************************
;* SHOW MIDI OUTPUT ON GUI MONITOR
;*************************************************
ShowMidiOutMessage: ; update the midimonitor gui
if (statusbyte == 248) ; Ignore Timing Clock messages
return
Gui,14:default
Gui,14:ListView, Out1 ; see the second listview midi out monitor
LV_Add("",stb,statusbyte,chan,byte1,byte2)
LV_ModifyCol(1,"center")
LV_ModifyCol(2,"center")
LV_ModifyCol(3,"center")
LV_ModifyCol(4,"center")
LV_ModifyCol(5,"center")
If (LV_GetCount() > 10)
{
LV_Delete(1)
}
Gui,14:default
Gui,14:ListView, Out1 ; see the second listview midi out monitor
LV_Add("",stb,statusbyte,chan,byte1,byte2)
LV_ModifyCol(1,"center")
LV_ModifyCol(2,"center")
LV_ModifyCol(3,"center")
LV_ModifyCol(4,"center")
LV_ModifyCol(5,"center")
If (LV_GetCount() > 10)
{
LV_Delete(1)
}
return
;*************************************************
;* MIDI MONITOR GUI CODE
;*************************************************

View File

@ -13,36 +13,50 @@ ProcessNote(device, channel, note, velocity, isNoteOn) {
}
ProcessCC(device, channel, cc, value) {
if (cc = 21 or cc = 29) {
scaled_value := ConvertCCValueToScale(value, 0, 127)
vol := scaled_value * 100
SoundSet, vol
;*************************************************
;* Rotary Knob 1 (Master Volume Control) *
;*************************************************
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)
} else if (cc = 51) {
Send {Volume_Mute}
DisplayOutput("Volume", "Mute")
} else if (cc = 52 and value != 0) {
Send {Volume_Down}
DisplayOutput("Volume", "Down")
} else if (cc = 53 and value != 0) {
Send {Volume_Up}
DisplayOutput("Volume", "Up")
} else if (cc = 54 and value != 0) {
Send {Media_Play_Pause}
DisplayOutput("Media", "Play/Pause")
} else if (cc = 55 and value != 0) {
Send {Media_Stop}
DisplayOutput("Media", "Stop")
} else if (cc = 56 and value != 0) {
Send {Media_Prev}
DisplayOutput("Media", "Previous")
} else if (cc = 57 and value != 0) {
Send {Media_Next}
DisplayOutput("Media", "Next")
} else 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")
}
if (cc = 0 and value = 1) {
SoundSet, 1, MASTER, MUTE ; Unmute
DisplayOutput("Volume Unmuted", "")
} else if (cc = 0 and value = 0) {
SoundSet, 0, MASTER, MUTE ; Mute
DisplayOutput("Volume Muted", "")
}
;*************************************************
;* Rotary Knob 2 (Mozilla Firefox Volume Control)*
;*************************************************
if (cc = 22) {
scaled_value := ConvertCCValueToScale(value, 7, 120)
vol := Round(scaled_value, 2) ; Scale to the range used by nircmd
; Adjust Firefox volume using nircmd
Run, nircmd setappvolume firefox.exe %vol%
; Minimizing feedback to optimize speed
scaled_value := ConvertCCValueToScale(vol, 0, 127)
percentage := Round(vol * 100) ; Scale to percentage
DisplayOutput("Firefox Volume", percentage)
}
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", "")
}
}

BIN
NirCmd.chm Normal file

Binary file not shown.

89
Original_README.md Normal file
View File

@ -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.

BIN
Untitled.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

153
game_exe_list.txt Normal file
View File

@ -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

BIN
nircmd.exe Normal file

Binary file not shown.

BIN
nircmdc.exe Normal file

Binary file not shown.