MidiToMacro/midi_to_joy_2.ahk
Laurence Dougal Myers a5275e8df8 Code and comments cleanup in main file and MidiRules. Fix display of MIDI port
names (was not converting to UTF-8).
2014-01-19 18:34:27 +11:00

51 lines
2.2 KiB
AutoHotkey

/*
MIDI to joy.
Based on GENERIC MIDI APP V.0.6 by genmce and contributors.
Edit the "VARIBLES TO SET @ STARTUP" section.
MidiRules.ahk contains the logic that maps from MIDI controllers to VJoy.
Sections with !!!!!!!!!!!!!!!!!!!! - don't edit between these, unless you know what you are doing (uykwyad) !
Sections with ++++++++++++++++++++ Edit between these marks. You won't break it, I don't think???
*/
#Include VJoy_lib.ahk
#Persistent
#SingleInstance
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
if A_OSVersion in WIN_NT4,WIN_95,WIN_98,WIN_ME ; if not xp or 2000 quit
{
MsgBox This script requires Windows 2000/XP or later.
ExitApp
}
version = midi_to_joy_2
VJoy_Init()
AxisMax_X := VJoy_GetVJDAxisMax(iInterface, HID_USAGE_X)
readini() ; load values from the ini file, via the readini function - see Midi_under_the_hood.ahk file
gosub, MidiPortRefresh ; used to refresh the input and output port lists - see Midi_under_the_hood.ahk file
port_test(numports,numports2) ; test the ports - check for valid ports? - see Midi_under_the_hood.ahk file
gosub, midiin_go ; opens the midi input port listening routine see Midi_under_the_hood.ahk file
gosub, midiout ; opens the midi out port see Midi_under_the_hood.ahk file
gosub, midiMon ; see below - a monitor gui - see Midi_In_and_GuiMonitor.ahk
;*************************************************
;* VARIBLES TO SET @ STARTUP
;*************************************************
cc_msg = 73,74 ; ++++++++++++++++ you might want to add other vars that load in auto execute section
max_cc_val = 127
return
#Include Midi_In_and_GuiMonitor.ahk ; this file contains: the function to parse midi message into parts we can work with and a midi monitor.
#Include MidiRules.ahk ; this file contains: Rules for manipulating midi input then sending modified midi output.
#Include Midi_under_the_hood.ahk ; this file contains: (DO NOT EDIT THIS FILE) all the dialogs to set up midi ports and midi message handling.